Skip to content

Commit

Permalink
Merge 01ae2fb into 380efaf
Browse files Browse the repository at this point in the history
  • Loading branch information
miurahr committed Jul 15, 2015
2 parents 380efaf + 01ae2fb commit fdb4592
Show file tree
Hide file tree
Showing 18 changed files with 124 additions and 68 deletions.
5 changes: 5 additions & 0 deletions app/controllers/application_controller.rb
@@ -1,9 +1,14 @@
class ApplicationController < ActionController::Base
protect_from_forgery

before_filter :set_locale
before_filter :force_approved_account
before_filter :redirect_suspended_account

def set_locale
I18n.locale = params[:locale] || I18n.default_locale
end

def force_approved_account
# We will redirect to the approval page if a user is signed in, is not an admin and is marked as waiting for approval
redirect = user_signed_in? && !current_user.is_admin? && current_user.registration_status.waiting_approval?
Expand Down
14 changes: 7 additions & 7 deletions app/views/admin/admin/index.html.erb
Expand Up @@ -8,19 +8,19 @@

<div class="admin">
<div class="site-settings">
<h3>Site settings</h3>
<h3><%= t('admin.site_settings') %></h3>
<%= form_for @settings, :url => admin_update_path, :method => :post do |f| %>
<%= f.label :max_rooms do %>
Max number of rooms <%= f.number_field :max_rooms, :class => "input-mini pull-right" %>
<%= t('admin.max_number_of_rooms') %><%= f.number_field :max_rooms, :class => "input-mini pull-right" %>
<% end %>
<%= f.label :disable_conn_disconn_activity do %>
<%= f.check_box :disable_conn_disconn_activity, :class => "switch" %> disable connect/disconnect activity
<%= f.check_box :disable_conn_disconn_activity, :class => "switch" %><%= t('admin.disable_connect') %>
<span></span>
<% end %>
<%= f.label :public_site do %>
<%= f.check_box :public_site, :class => "switch" %> Public site
<%= f.check_box :public_site, :class => "switch" %> <%= t('admin.public_site') %>
<span></span>
<% end %>
<p>
Expand All @@ -29,17 +29,17 @@
<% end %>
</div>
<div class="waiting-for-approval-users">
<h3>Users waiting for approval</h3>
<h3><%= t('admin.users_waiting_approval') %></h3>
<ul class="users">
<%= render(:collection => @waiting_for_approval_users, :as => :user, :partial => "user") ||\
content_tag(:li, "There are no users needing approval right now. Invite others to join Kandan!", class: 'no-users') %>
content_tag(:li, t('admin.warn_no_user'), class: 'no-users') %>
</ul>
</div>
<div class="approved-users">
<h3>All users</h3>
<ul class="users">
<%= render(:collection => @approved_users, :as => :user, :partial => "user") ||\
content_tag(:li, "There are no users. Invite others to join Kandan!", class: 'no-users') %>
content_tag(:li, t('admin.warn_no_approved_user'), class: 'no-users') %>
</ul>
</div>
</div>
6 changes: 3 additions & 3 deletions app/views/devise/confirmations/new.html.erb
@@ -1,12 +1,12 @@
<h2>Resend confirmation instructions</h2>
<h2><%= t('devise.confirmations.resend_confirm.head') %></h2>

<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
<%= devise_error_messages! %>

<div><%= f.label :email %><br />
<%= f.email_field :email %></div>

<div><%= f.submit "Resend confirmation instructions" %></div>
<div><%= f.submit t('devise.confirmations.resend_confirm.button') %></div>
<% end %>
<%= render :partial => "devise/shared/links" %>
<%= render :partial => "devise/shared/links" %>
4 changes: 2 additions & 2 deletions app/views/devise/mailer/confirmation_instructions.html.erb
@@ -1,5 +1,5 @@
<p>Welcome <%= @resource.email %>!</p>

<p>You can confirm your account through the link below:</p>
<%= t('devise.mailer.confirmation_instructions.message.html') %>

<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>
<p><%= link_to t('devise.mailer.confirmation_instructions.message.link'), confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>
7 changes: 3 additions & 4 deletions app/views/devise/mailer/reset_password_instructions.html.erb
@@ -1,8 +1,7 @@
<p>Hello <%= @resource.email %>!</p>

<p>Someone has requested a link to change your password, and you can do this through the link below.</p>
<%= t('devise.mailer.reset_password_instructions.message.html') %>

<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @token) %></p>
<p><%= link_to t(devise.mailer.reset_password_instructions.link'), edit_password_url(@resource, :reset_password_token => @token) %></p>
<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>
<%= t('devise.mailer.reset_password_instructions.note.html') %>
6 changes: 2 additions & 4 deletions app/views/devise/mailer/unlock_instructions.html.erb
@@ -1,7 +1,5 @@
<p>Hello <%= @resource.email %>!</p>

<p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
<%= t('devise.mailer.unlock_instructions.message.html') %>

<p>Click the link below to unlock your account:</p>

<p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>
<p><%= link_to t('devise.mailer.unlock_instructions.message.link'), unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>
10 changes: 5 additions & 5 deletions app/views/devise/passwords/edit.html.erb
@@ -1,20 +1,20 @@
<div class="devise">

<h2>Change your password</h2>
<h2><%= t('devise.passwords.edit.head')</h2>
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
<%= devise_error_messages! %>
<%= f.hidden_field :reset_password_token %>
<div class="form-group">
<%= f.label :password, "New password", :class => "control-label" %>
<%= f.label :password, t('devise.passwords.edit.new'), :class => "control-label" %>
<%= f.password_field :password, :class => "form-control" %>
</div>
<div class="form-group">
<%= f.label :password_confirmation, "Confirm new password", :class => "control-label" %>
<%= f.label :password_confirmation, t('devise.passwords.edit.confirm'), :class => "control-label" %>
<%= f.password_field :password_confirmation, :class => "form-control" %>
</div>
<p><%= f.submit "Change my password", :class => "btn btn-primary" %></p>
<p><%= f.submit t('devise.passwords.edit.submit'), :class => "btn btn-primary" %></p>
<% end %>
<p><%= render :partial => "devise/shared/links" %></p>
<p><%= render :partial => "devise/shared/links" %></p>
6 changes: 3 additions & 3 deletions app/views/devise/passwords/new.html.erb
@@ -1,12 +1,12 @@
<div class="devise">
<h3 class="heading">Forgot Password?</h3>
<h3 class="heading"><%= t('devise.passwords.new.head')</h3>
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
<%= devise_error_messages! %>
<div class="form-group">
<%= label_tag :email, "Email", :class => "control-label" %>
<%= label_tag :email, t('devise.passwords.new.email'), :class => "control-label" %>
<%= f.text_field :email, :autofocus => true, :placeholder => 'jsmith@example.com', :class => "form-control" %>
</div>
<p><%= f.submit "Submit", :class => "btn btn-primary" %></p>
<p><%= f.submit t('devise.passwords.new.submit'), :class => "btn btn-primary" %></p>
<% end %>
<p><%= render :partial => "devise/shared/links" %></p>
</div>
22 changes: 11 additions & 11 deletions app/views/devise/registrations/edit.html.erb
Expand Up @@ -4,45 +4,45 @@
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put , :role => "form"}) do |f| %>
<div class="devise">
<h3 class="heading">Edit <%= resource_name.to_s.humanize %></h3>
<h3 class="heading"><%= t('devise.registrations.edit') %><%= resource_name.to_s.humanize %></h3>
<%= devise_error_messages! %>
<div class="form-group">
<%= label_tag :first_name, "First Name", :class => "control-label" %>
<%= label_tag :first_name, t('devise.registrations.first_name'), :class => "control-label" %>
<%= f.text_field :first_name, :class => "form-control", :placeholder => "John" %>
</div>
<div class="form-group">
<%= label_tag :last_name, "Last Name", :class => "control-label" %>
<%= label_tag :last_name, t('devise.registrations.last_name'), :class => "control-label" %>
<%= f.text_field :last_name, :class => "form-control", :placeholder => "Smith" %>
</div>
<div class="form-group">
<%= label_tag :email, "Email", :class => "control-label" %>
<%= label_tag :email, t('devise.registrations.email'), :class => "control-label" %>
<%= f.email_field :email, :class => "form-control", :placeholder => "jsmith@example.com" %>
</div>
<div class="form-group">
<%= label_tag :password, "Password", :class => "control-label" %>
<%= label_tag :password, t('devise.registrations.password'), :class => "control-label" %>
<%= f.password_field :password , :placeholder => 'New Password', :class => "form-control" %>
<div class="note"><i>(leave blank if you don't want to change it)</i></div>
</div>
<div class="form-group">
<%= label_tag :password_confirmation, "Password Confirmation", :class => "control-label" %>
<%= label_tag :password_confirmation, t('devise.registrations.password_confirmation'), :class => "control-label" %>
<%= f.password_field :password_confirmation, :class => "form-control", :placeholder => 'New Password Confirmation' %>
</div>
<div class="form-group">
<%= label_tag :avatar_url, "Avatar URL", :class => "control-label" %>
<%= label_tag :avatar_url, t('devise.registrations.avatar_url'), :class => "control-label" %>
<%= f.url_field :avatar_url, :class => "form-control", :placeholder => 'http://www.gravatar.com/avatar/XXXXXXXXX' %>
<div class="note"><i>(Avatar URL replaces your gravatar image)</i></div>
</div>
<div class="form-group">
<%= label_tag :current_password, "Current Password", :class => "control-label" %>
<%= label_tag :current_password, t('devise.registrations.current_password'), :class => "control-label" %>
<%= f.password_field :current_password, :class => "form-control", :placeholder => 'Current Password' %>
<div class="note"><i>(Enter your current password to confirm your changes)</i></div>
</div>
<p><%= link_to "Back", :back, :class => "btn btn-info" %>&nbsp;<%= f.submit "Update" , :class => "btn btn-primary" %></p>
</div>
<div class="devise">
<h3 class="heading">Cancel My Account.</h3>
<p>Unhappy with your service? We hate to see you go!<p>
<p><%= link_to "Cancel my account", registration_path(resource_name), :class => "btn btn-danger", :confirm => "Are you sure you want to delete your account?", :method => :delete %></p>
<h3 class="heading"><%= t('devise.registrations.cancel_account.head') %></h3>
<%= t('devise.registrations.cancel_account.html') %>
<p><%= link_to t('devise.registrations.cancel_account.link'), registration_path(resource_name), :class => "btn btn-danger", :confirm => "Are you sure you want to delete your account?", :method => :delete %></p>
<% end %>


Expand Down
16 changes: 8 additions & 8 deletions app/views/devise/registrations/new.html.erb
@@ -1,32 +1,32 @@
<div class="devise">
<h3 class="heading">Register an Account</h3>
<h3 class="heading"><%= t('devise.registrations.register_account') %></h3>
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>
<div class="form-group">
<%= label_tag :first_name, "First Name", :class => "control-label" %>
<%= label_tag :first_name, t('devise.registrations.first_name'), :class => "control-label" %>
<%= f.text_field :first_name, :class => "form-control", :placeholder => 'John' %>
</div>
<div class="form-group">
<%= label_tag :last_name, "Last Name", :class => "control-label" %>
<%= label_tag :last_name, t('devise.registrations.last_name'), :class => "control-label" %>
<%= f.text_field :last_name, :class => "form-control", :placeholder => 'Smith' %>
</div>
<div class="form-group">
<%= label_tag :email, "Email", :class => "control-label" %>
<%= label_tag :email, t('devise.registrations.email'), :class => "control-label" %>
<%= f.email_field :email, :class => "form-control", :placeholder => 'jsmith@example.com' %>
</div>
<div class="form-group">
<%= label_tag :password, "Username", :class => "control-label" %>
<%= label_tag :password, t('devise.registrations.username'), :class => "control-label" %>
<%= f.text_field :username, :class => "form-control", :placeholder => 'jsmith' %>
</div>
<div class="form-group">
<%= label_tag :password, "Password", :class => "control-label" %>
<%= label_tag :password, t('devise.registrations.password'), :class => "control-label" %>
<%= f.password_field :password, :class => "form-control", :placeholder => 'Something Memorable!' %>
</div>
<div class="form-group">
<%= label_tag :password, "Password Confirmation", :class => "control-label" %>
<%= label_tag :password, t('devise.registrations.password_confirmation'), :class => "control-label" %>
<%= f.password_field :password_confirmation, :class => "form-control", :placeholder => 'Something Memorable!' %>
</div>
<p><%= f.submit "Register", :class => "btn btn-primary" %></p>
<p><%= f.submit t('devise.registrations.register'), :class => "btn btn-primary" %></p>
<% end %>
<p><%= render :partial => "devise/shared/links" %></p>
</div>
8 changes: 4 additions & 4 deletions app/views/main/_sidebar.html.erb
Expand Up @@ -5,10 +5,10 @@
<%= current_user.full_name_or_username %>
</a>
<ul class="user-menu">
<li><%= link_to 'Admin console', admin_root_path if current_user.is_admin? %></li>
<li><%= link_to 'Edit Account', users_edit_path %></li>
<li><%= link_to 'Logout', destroy_user_session_path, :method => :delete %></li>
<li><%= link_to 'About Kandan', about_path %></li>
<li><%= link_to t('main.admin_console'), admin_root_path if current_user.is_admin? %></li>
<li><%= link_to t('main.edit_account'), users_edit_path %></li>
<li><%= link_to t('main.logout'), destroy_user_session_path, :method => :delete %></li>
<li><%= link_to t('main.about_kandan'), about_path %></li>
</ul>
</div>
<div class="widgets"></div>
10 changes: 5 additions & 5 deletions app/views/sessions/new.html.erb
@@ -1,18 +1,18 @@
<div class="devise">
<h3 class="heading">Sign In</h3>
<h3 class="heading"><%= t('sessions.title') %></h3>
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :role => :form) do |f| %>
<div class="form-group">
<%= label_tag :username, "Username", :class => "control-label" %>
<%= label_tag :username, t('sessions.username'), :class => "control-label" %>
<%= f.text_field :username, :autofocus => true, :placeholder => 'jsmith', :class => "form-control" %>
</div>
<div class="form-group">
<%= label_tag :password, "Password", :class => "control-label" %>
<%= label_tag :password, t('sessions.password'), :class => "control-label" %>
<%= f.password_field :password, :class => "form-control"%>
</div>
<label class="checkbox">
<input type="checkbox" value="remember-me"> Remember me
<input type="checkbox" value="remember-me"><%= t('sessions.rememberme') %>
</label>
<%= f.submit "Sign in", :class => "btn btn-primary" %>
<%= f.submit t('sessions.submit'), :class => "btn btn-primary" %>
<% end %>
<%= render :partial => "devise/shared/links" %>
</div>
3 changes: 3 additions & 0 deletions config/application.rb
Expand Up @@ -43,6 +43,9 @@ class Application < Rails::Application
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]
config.i18n.default_locale = :en
config.i18n.enforce_available_locales = true

# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
Expand Down
12 changes: 0 additions & 12 deletions config/locales/en.yml

This file was deleted.

9 changes: 9 additions & 0 deletions config/locales/en/admin.en.yml
@@ -0,0 +1,9 @@
en:
admin:
site_settings: "Site settings"
max_number_of_rooms: "Max number of rooms"
public_site: "Public site"
disable_connect: "disable connect/disconnect activity"
users_waiting_approval: "Users waiting for approval"
warn_no_user: "There are no users needing approval right now. Invite others to join Kandan!"
warn_no_approved_user: "There are no users. Invite others to join Kandan!"
41 changes: 41 additions & 0 deletions config/locales/devise.en.yml → config/locales/en/devise.en.yml
Expand Up @@ -25,15 +25,42 @@ en:
signed_in: 'Signed in successfully.'
signed_out: 'Signed out successfully.'
passwords:
new:
head: "Forgot Password?"
email: "Email"
submit: "Submit"
edit:
head: "Change your password"
new: "New password"
confirm: "Confirm new password"
submit: "Change my password"
send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
updated: 'Your password was changed successfully. You are now signed in.'
updated_not_active: 'Your password was changed successfully.'
send_paranoid_instructions: "If your e-mail exists on our database, you will receive a password recovery link on your e-mail"
confirmations:
resend_confirm:
head: "Resend confirmation instructions"
button: "Resend confirmation instructions"
send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
send_paranoid_instructions: 'If your e-mail exists on our database, you will receive an email with instructions about how to confirm your account in a few minutes.'
confirmed: 'Your account was successfully confirmed. You are now signed in.'
registrations:
register_account: "Register an Account"
first_name: "First Name"
last_name: "Last Name"
email: "Email"
username: "Username"
password: "Password"
password_confirmation: "Password Confirmation"
register: "Register"
edit: "Edit"
avatar_url: "Avatar URL"
current_password: "Current Password"
cancel_account:
head: "Cancel My Account."
html: "<p>Unhappy with your service? We hate to see you go!<p>"
link: "Cancel my account"
signed_up: 'Welcome! You have signed up successfully.'
updated: 'You updated your account successfully.'
destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
Expand All @@ -50,7 +77,21 @@ en:
mailer:
confirmation_instructions:
subject: 'Confirmation instructions'
message:
html: "<p>You can confirm your account through the link below:</p>"
link: "Confirm my account"
reset_password_instructions:
subject: 'Reset password instructions'
message:
html: "<p>Someone has requested a link to change your password, and you can do this through the link below.</p>"
note:
html: "<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>"
link: "Change my password"
unlock_instructions:
subject: 'Unlock Instructions'
message:
html: "<p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
<p>Click the link below to unlock your account:</p>"
link: "Unlock my account"
6 changes: 6 additions & 0 deletions config/locales/en/main.en.yml
@@ -0,0 +1,6 @@
en:
main:
admin_console: "Admin console"
edit_account: "Edit Account"
logout: "Logout"
about_kandan: "About Kandan"
7 changes: 7 additions & 0 deletions config/locales/en/sessions.en.yml
@@ -0,0 +1,7 @@
en:
sessions:
title: "Sign In"
username: "Username"
password: "Password"
rememberme: "Remember me"
submit: "Sign in"

0 comments on commit fdb4592

Please sign in to comment.