Some updates to translation engine, added dotenv but have not yet set it up.

This commit is contained in:
Godwin
2014-04-29 21:02:02 -06:00
parent 3759910993
commit cc948937bc
35 changed files with 707 additions and 190 deletions
@@ -91,36 +91,31 @@ $info-color: $color-3;
// $shiny-edge-active-color: rgba(#000, .2);
// Media Query Ranges
// $small-range: (0em, 40em);
// $medium-range: (40.063em, 64em);
// $large-range: (64.063em, 90em);
// $xlarge-range: (90.063em, 120em);
// $xxlarge-range: (120.063em);
$small-range: (0em, 45em);
$medium-range: (45.063em, 64em);
$large-range: (64.063em, 90em);
$xlarge-range: (90.063em, 120em);
$xxlarge-range: (120.063em);
// $screen: "only screen";
$screen: "only screen";
// $landscape: "#{$screen} and (orientation: landscape)";
// $portrait: "#{$screen} and (orientation: portrait)";
// $small-up: $screen;
// $small-only: "#{$screen} and (max-width: #{upper-bound($small-range)})";
// $medium-up: "#{$screen} and (min-width:#{lower-bound($medium-range)})";
// $medium-only: "#{$screen} and (min-width:#{lower-bound($medium-range)}) and (max-width:#{upper-bound($medium-range)})";
// $large-up: "#{$screen} and (min-width:#{lower-bound($large-range)})";
// $large-only: "#{$screen} and (min-width:#{lower-bound($large-range)}) and (max-width:#{upper-bound($large-range)})";
// $xlarge-up: "#{$screen} and (min-width:#{lower-bound($xlarge-range)})";
// $xlarge-only: "#{$screen} and (min-width:#{lower-bound($xlarge-range)}) and (max-width:#{upper-bound($xlarge-range)})";
// $xxlarge-up: "#{$screen} and (min-width:#{lower-bound($xxlarge-range)})";
// $xxlarge-only: "#{$screen} and (min-width:#{lower-bound($xxlarge-range)}) and (max-width:#{upper-bound($xxlarge-range)})";
$landscape: "#{$screen} and (orientation: landscape)";
$portrait: "#{$screen} and (orientation: portrait)";
$small-up: $screen;
$small-only: "#{$screen} and (max-width: #{upper-bound($small-range)})";
$medium-up: "#{$screen} and (min-width:#{lower-bound($medium-range)})";
$medium-only: "#{$screen} and (min-width:#{lower-bound($medium-range)}) and (max-width:#{upper-bound($medium-range)})";
$large-up: "#{$screen} and (min-width:#{lower-bound($large-range)})";
$large-only: "#{$screen} and (min-width:#{lower-bound($large-range)}) and (max-width:#{upper-bound($large-range)})";
$xlarge-up: "#{$screen} and (min-width:#{lower-bound($xlarge-range)})";
$xlarge-only: "#{$screen} and (min-width:#{lower-bound($xlarge-range)}) and (max-width:#{upper-bound($xlarge-range)})";
$xxlarge-up: "#{$screen} and (min-width:#{lower-bound($xxlarge-range)})";
$xxlarge-only: "#{$screen} and (min-width:#{lower-bound($xxlarge-range)}) and (max-width:#{upper-bound($xxlarge-range)})";
// Legacy
// $small: $medium-up;
// $medium: $medium-up;
// $large: $large-up;
$small: $medium-up;
$medium: $medium-up;
$large: $large-up;
//We use this as cursors values for enabling the option of having custom cursors in the whole site's stylesheet
// $cursor-crosshair-value: crosshair;
@@ -1036,6 +1031,8 @@ $label-font-sizing: 1em;//rem-calc(11);
// $include-html-top-bar-classes: false;//$include-html-classes;
// Background color for the top bar
$topbar-arrows: false;
$topbar-bg-color: $black;
$topbar-bg: transparent;//$black;
@@ -1050,7 +1047,7 @@ $topbar-title-font-size: 2em;
// Style the top bar dropdown elements
$topbar-dropdown-bg: transparent;
// $topbar-dropdown-link-color: #fff;
$topbar-dropdown-link-bg: transparent;
$topbar-dropdown-link-bg: $black;
// $topbar-dropdown-link-weight: normal;
// $topbar-dropdown-toggle-size: 5px;
// $topbar-dropdown-toggle-color: #fff;
@@ -1063,9 +1060,9 @@ $topbar-link-color-active: $white;
// $topbar-link-weight: normal;
// $topbar-link-font-size: rem-calc(13);
// $topbar-link-hover-lightness: -10%; // Darken by 10%
$topbar-link-bg-hover: transparent;
$topbar-link-bg-active: transparent;
$topbar-link-bg-active-hover: transparent; // scale-color($primary-color, $lightness: -14%);
$topbar-link-bg-hover: lighten($black, 25);
$topbar-link-bg-active: $black;
$topbar-link-bg-active-hover: $topbar-link-bg-hover; // scale-color($primary-color, $lightness: -14%);
$topbar-link-font-family: $header-font-family;
// $topbar-button-font-size: 0.75rem;
@@ -1088,7 +1085,7 @@ $topbar-menu-icon-color: $white;
// Transitions and breakpoint styles
// $topbar-transition-speed: 300ms;
// Using rem-calc for the below breakpoint causes issues with top bar
// $topbar-breakpoint: #{upper-bound($medium-range)}; // Change to 9999px for always mobile layout
$topbar-breakpoint: #{upper-bound($small-range)}; // Change to 9999px for always mobile layout
// $topbar-media-query: "only screen and (min-width: #{upper-bound($medium-range)})";
// Divider Styles
+9 -1
View File
@@ -370,4 +370,12 @@ body.organizations-show {
color: #FFF;
background-color: rgba(#000, 0.5);
}
}
}
.small-text-centered {
text-align: center;
@media #{$medium-up} {
text-align: inherit;
}
}
+9 -3
View File
@@ -1,5 +1,11 @@
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_filter :capture_page_info
def capture_page_info
$page_info = {:path => request.env['PATH_INFO'], :controller => params['controller'], :action => params['action']}
end
end
@@ -1,3 +1,5 @@
include ApplicationHelper
class OrganizationsController < ApplicationController
before_action :set_organization, only: [:show, :edit, :update, :destroy]
@@ -17,6 +19,10 @@ class OrganizationsController < ApplicationController
@organization = Organization.new
#@organization.location = Location.new
@organization.locations.build
@user_location = lookup_ip_location
@organization.locations[0].city = @user_location.city
@organization.locations[0].country = @user_location.country_code
@organization.locations[0].territory = @user_location.state_code
@organization.locations_organization.build
@organization.user_organization_relationships.build
end
+2 -3
View File
@@ -1,13 +1,12 @@
class UserSessionsController < ApplicationController
def new
session[:return_to] ||= request.referer
session[:return_to] ||= request.referer
@user = User.new
end
def create
if @user = login(params[:email], params[:password])
#redirect_back_or_to(:users, notice: 'Login successful')
redirect_to session.delete(:return_to)
redirect_to session.delete(:return_to) || 'pages#home'
else
flash.now[:alert] = "Login failed"
render action: "new"
+32 -7
View File
@@ -178,8 +178,8 @@ module ApplicationHelper
translation['untranslated'] = I18n.translate!(config.i18n.default_locale, key, vars)
translation['lang'] = config.i18n.default_locale.to_s
rescue
puts _lorem_ipsum(behavior, behavior_size)
translation['untranslated'] = behavior ? _lorem_ipsum(behavior, behavior_size) || key.gsub(/^.*\.(.+)?$/, '\1') : key.gsub(/^.*\.(.+)?$/, '\1')
default_translation = I18n::MissingTranslationExceptionHandler.note(key, behavior, behavior_size)
translation['untranslated'] = default_translation
end
end
return translation
@@ -232,7 +232,7 @@ module ApplicationHelper
if /select(_tag)?$/.match(type.to_s)
if !label
select_prompt = placeholder || (form ? 'Select a ' + name.to_s : 'Select one')
select_prompt = placeholder || (form ? 'Select a ' + (_ ('form.select_' + name.to_s)) : 'form.Select_one')
label_html = ''
show_label = false
end
@@ -254,12 +254,12 @@ module ApplicationHelper
if /^password/.match(type.to_s)
placeholder = nil
elsif !placeholder
placeholder = 'Type in a ' + name.to_s
placeholder = (_ 'form.Enter_your_' + name.to_s)
end
end
if show_label
label_html = eval("(" + (form ? 'form.label' : 'label_tag') + " name, '<span>#{label ? CGI.escapeHTML(label) : name}</span>'.html_safe)")
label_html = eval("(" + (form ? 'form.label' : 'label_tag') + " name, '<span>#{CGI.escapeHTML(_ (label || name.to_s))}</span>'.html_safe)")
end
if label === false || !show_label
@@ -370,8 +370,21 @@ module ApplicationHelper
return ("<div class=\"field #{type.to_s.gsub('_', '-').gsub(/\-tag$/, '')} field-#{name.to_s.gsub('_', '-')}#{classes.length > 0 ? ' ' + classes.join(' ') : ''}\">" + (label_after ? '' : label_html) + form_html + (label_after ? label_html : '') + "</div>").html_safe
end
def actions(action)
('<div class="actions"><button name="' + action.to_s + '" type="submit">' + action.to_s + '</button></div>').html_safe
def actions(actions = [])
if !actions.is_a?(Array)
actions = [actions]
end
html = '<div class="actions">'
actions.each { |action|
if action == :facebook_sign_in
html += '<a href="' + url_for(auth_at_provider_path(:provider => :facebook)) + '" class="facebook-sign-in button">' + (_ action.to_s) + '</a>'
else
html += '<button id="' + action.to_s + '" name="' + action.to_s + '" type="submit">' + (_ action.to_s) + '</button>'
end
}
html += '</div>'
html.html_safe
end
def sortable(objects, id = 'id', url: nil, &block)
@@ -521,4 +534,16 @@ module ApplicationHelper
html.html_safe
end
def t(*a)
_(*a)
end
def lookup_ip_location
if request.remote_ip == '127.0.0.1'
Geocoder.search(session['remote_ip'] || (session['remote_ip'] = open("http://checkip.dyndns.org").first.gsub(/^.*\s([\d\.]+).*$/s, '\1').gsub(/[^\.\d]/, ''))).first
else
request.location
end
end
end
+4 -4
View File
@@ -1,7 +1,7 @@
class User < ActiveRecord::Base
authenticates_with_sorcery! do |config|
config.authentications_class = Authentication
end
config.authentications_class = Authentication
end
validates :password, presence: true, confirmation: true, length: { minimum: 3 }, unless: ("id?" || "password_confirmation?")
validates :password_confirmation, presence: true, unless: ("id?" || "password?")
@@ -18,7 +18,7 @@ class User < ActiveRecord::Base
has_many :user_organization_relationships
has_many :organizations, through: :user_organization_relationships
has_many :authentications, :dependent => :destroy
accepts_nested_attributes_for :authentications
has_many :authentications, :dependent => :destroy
accepts_nested_attributes_for :authentications
end
-1
View File
@@ -28,7 +28,6 @@
= javascript_include_tag '//use.typekit.net/iqv7hcg.js'
= javascript_include_tag 'application'
= javascript_include_tag 'nested_form'
= javascript_include_tag '//use.edgefonts.net/abel;amatic-sc.js'
%body{ class: (yield_or_default :page_style) }
= render 'shared/translation_control'
+1 -2
View File
@@ -9,7 +9,7 @@
= field f, :name, :text_field
= field f, :slug, :text_field
.columns.medium-4
.columns.medium-4.small-text-centered
-#%h2=_'organization.create.intro-title', :t
-#%p=_'organization.create.intro', :p
=# field f, :avatar, :image_field
@@ -21,7 +21,6 @@
=# = f.hidden_field :avatar_cache
.columns.medium-8
= field f, :email_address, :email_field
-#= field f, :url, :text_field
= f.fields_for :locations do |b|
= field_set_tag 'Location' do
= field b, :country, :country_select, {help: 'Select a Country'}
+16 -10
View File
@@ -1,5 +1,5 @@
%nav.top-bar.row
%nav.top-bar.row{ data: { :topbar => '' } }
#nav-inner
%ul.title-area
/ Title Area
@@ -10,22 +10,28 @@
%li.toggle-topbar.menu-icon
%a{href: "#"}
%span Menu
.top-bar-section
%section.top-bar-section
/ Left Nav Section
%ul.left
%li.active
%a{href: "/conferences/"} Conferences
= link_to (_'Conferences'), :controller => :conferences
%li
%a{href: "/organizations/"} Organizations
= link_to (_'Organizations'), :controller => :organizations
%li
%a{href: "/resources/"} Resources
= link_to (_'Resources'), '/resources'
/ Right Nav Section
%ul.right
- if current_user
%li.has-form.sign-out
= link_to "Sign Out", :logout, method: :post, :class => 'button'
%li.user-profile
= link_to image_tag(current_user.avatar_url(:icon)), current_user
%li.has-form.sign-out.hide-for-small
= link_to (_"Sign_Out"), :logout, method: :post, :class => 'button'
%li.user-profile.has-dropdown
= link_to current_user do
= image_tag(current_user.avatar_url(:icon))
%span
%span.show-for-small=current_user.username
%ul.dropdown
%li= link_to 'View Profile', current_user
%li= link_to 'Edit Profile', edit_user_path(current_user.id)
- else
%li.has-form.sign-in
= link_to "Sign In", :login, :class => 'button'
= link_to (_"Sign_In"), :login, :class => 'button'
+1 -1
View File
@@ -1,4 +1,4 @@
= form_tag user_sessions_path, :method => :post do
= field :email, :email_field
= field :password, :password_field_tag
= actions :sign_in
= actions [:sign_in, :facebook_sign_in]
+2 -4
View File
@@ -4,10 +4,8 @@
.columns.medium-6
= render 'form'
.columns.medium-6
%h2
Create an Account
%h2 #{_ 'user.Create_Account'}
%p #{_ 'user.why_register', 'paragraph'}
%p
#{_ 'user.why_register', 'paragraph'}
= link_to 'Login with Facebook', auth_at_provider_path(:provider => :facebook)
= render '/users/form'