Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Device pages styles and translations #165

Merged
merged 12 commits into from

3 participants

@doitian
Owner

各种翻译和UI

@doitian
Owner

refs #70

@doitian
Owner

The patch for capybara-email can be removed once dockyard/capybara-email#16 is accepted.

@saberma
Owner

@windy please review this PR

@windy
Owner

@doitian 这个修改有哪些意义,没有太明白

Owner
@windy windy merged commit 1c5af4a into 19wu:master

1 check passed

Details default The Travis build passed
@windy
Owner

一个会导致 sign_in 失败的 labels 改动, 已经修复后并入。 @saberma @doitian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 157 additions and 74 deletions.
  1. +3 −0  app/assets/stylesheets/modules/_list.css.scss
  2. +11 −0 app/helpers/application_helper.rb
  3. +6 −2 app/views/application/_signed_out_user_bar.html.slim
  4. +13 −9 app/views/devise/confirmations/new.html.slim
  5. +1 −1  app/views/devise/mailer/confirmation_instructions.html.slim
  6. +5 −0 app/views/devise/mailer/confirmation_instructions.text.erb
  7. +4 −0 app/views/devise/mailer/confirmation_instructions.zh-CN.html.slim
  8. +5 −0 app/views/devise/mailer/confirmation_instructions.zh-CN.text.erb
  9. +1 −1  app/views/devise/mailer/reset_password_instructions.html.slim
  10. +9 −0 app/views/devise/mailer/reset_password_instructions.text.erb
  11. +6 −0 app/views/devise/mailer/reset_password_instructions.zh-CN.html.slim
  12. +9 −0 app/views/devise/mailer/reset_password_instructions.zh-CN.text.erb
  13. +15 −14 app/views/devise/passwords/edit.html.slim
  14. +13 −9 app/views/devise/passwords/new.html.slim
  15. +1 −1  app/views/devise/registrations/new.html.slim
  16. +3 −3 app/views/devise/sessions/new.html.slim
  17. +14 −19 app/views/devise/shared/_links.slim
  18. +2 −2 app/views/events/new.html.slim
  19. +1 −0  config/locales/activerecord.zh-CN.yml
  20. +11 −10 config/locales/zh-CN.yml
  21. +2 −0  config/settings.yml.example
  22. +3 −3 spec/features/user_registration_spec.rb
  23. +9 −0 spec/helpers/application_helper_spec.rb
  24. +10 −0 spec/spec_helper.rb
View
3  app/assets/stylesheets/modules/_list.css.scss
@@ -7,4 +7,7 @@ ul, ol {
padding: 4px;
}
}
+ &.unstyled > li {
+ margin-bottom: $baseLineHeight / 4;
+ }
}
View
11 app/helpers/application_helper.rb
@@ -44,4 +44,15 @@ def render_flashes
render 'flashes'
end
end
+
+ def render_password_label_with_forget_link(object)
+ link = link_to(t('devise.views.links.forget_pass'),
+ new_password_path(resource_name),
+ :tabindex => -1)
+
+ html = object.class.human_attribute_name(:password) +
+ ' (' + content_tag(:small, link) + ')'
+
+ html.html_safe
+ end
end
View
8 app/views/application/_signed_out_user_bar.html.slim
@@ -1,3 +1,7 @@
ul.user-bar.pull-right
- li
- = link_to t('label.sign_in'), new_user_session_path, :class => "btn"
+ - if controller_name != 'registrations'
+ li= link_to t('labels.sign_up'), new_user_registration_path, :class => "btn btn-success"
+ - if controller_name != 'sessions'
+ li= link_to t('labels.sign_in'), new_user_session_path, :class => "btn"
+ - else
+ li= link_to t('devise.views.links.resend_confirmation'), new_confirmation_path(resource_name), :class => "btn btn-link"
View
22 app/views/devise/confirmations/new.html.slim
@@ -1,9 +1,13 @@
-h2 Resend confirmation instructions
-= 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= f.submit "Resend confirmation instructions"
-= render "devise/shared/links"
+.row
+ .span4.offset4.well
+ = simple_form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f|
+ fieldset
+ legend
+ = t('devise.views.confirmations.new.title')
+ small.pull-right
+ = link_to t('devise.views.links.forget_pass'), new_password_path(resource_name)
+
+ .form-inputs
+ = f.input :email
+ .control-group
+ = f.submit t('devise.views.confirmations.new.submit'), :class => 'btn btn-primary'
View
2  app/views/devise/mailer/confirmation_instructions.html.slim
@@ -1,4 +1,4 @@
p
- | Welcome #{@resource.email}!
+ | Welcome #{@resource.login}!
p You can confirm your account email through the link below:
p= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token)
View
5 app/views/devise/mailer/confirmation_instructions.text.erb
@@ -0,0 +1,5 @@
+Welcome <%= @resource.login %>!
+
+You can confirm your account email through the link below:
+
+[Confirm my account]( <%= confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %> )
View
4 app/views/devise/mailer/confirmation_instructions.zh-CN.html.slim
@@ -0,0 +1,4 @@
+p
+ | #{@resource.login},欢迎!
+p 您可以通过下面的链接来激活帐号:
+p= link_to '激活帐号', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token)
View
5 app/views/devise/mailer/confirmation_instructions.zh-CN.text.erb
@@ -0,0 +1,5 @@
+<%= @resource.login %>,欢迎!
+
+您可以通过下面的链接来激活帐号:
+
+[激活帐号]( <%= confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %> )
View
2  app/views/devise/mailer/reset_password_instructions.html.slim
@@ -1,5 +1,5 @@
p
- | Hello #{@resource.email}!
+ | Hello #{@resource.login}!
p Someone has requested a link to change your password, and you can do this through the link below.
p= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token)
p If you didn't request this, please ignore this email.
View
9 app/views/devise/mailer/reset_password_instructions.text.erb
@@ -0,0 +1,9 @@
+Hello <%= @resource.login %>!
+
+Someone has requested a link to change your password, and you can do this through the link below.
+
+[Change my password] ( <%= edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %> )
+
+If you didn't request this, please ignore this email.
+
+Your password won't change until you access the link above and create a new one.
View
6 app/views/devise/mailer/reset_password_instructions.zh-CN.html.slim
@@ -0,0 +1,6 @@
+p
+ | #{@resource.email} 您好,
+p 您可以通过下面的链接修改帐号密码:
+p= link_to '修改密码', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token)
+p 如果您没有提出修改密码的请求,请忽略些邮件。
+p 除非点击上面的链接并设置新的密码,您的密码不会被更改。
View
9 app/views/devise/mailer/reset_password_instructions.zh-CN.text.erb
@@ -0,0 +1,9 @@
+<%= @resource.email %> 您好,
+
+您可以通过下面的链接修改帐号密码:
+
+[修改密码] ( <%= edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %> )
+
+如果您没有提出修改密码的请求,请忽略些邮件。
+
+除非点击上面的链接并设置新的密码,您的密码不会被更改。
View
29 app/views/devise/passwords/edit.html.slim
@@ -1,14 +1,15 @@
-h2 Change your password
-= 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
- = f.label :password, "New password"
- br/
- = f.password_field :password
- div
- = f.label :password_confirmation, "Confirm new password"
- br/
- = f.password_field :password_confirmation
- div= f.submit "Change my password"
-= render "devise/shared/links"
+.row
+ .span4.offset4.well
+ = simple_form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f|
+
+ fieldset
+ legend
+ = t('devise.views.passwords.edit.title')
+
+ .form-inputs
+ = f.hidden_field :reset_password_token
+ = f.input :password
+ = f.input :password_confirmation
+
+ .control-group
+ = f.submit t('devise.views.passwords.edit.submit'), :class => 'btn btn-primary'
View
22 app/views/devise/passwords/new.html.slim
@@ -1,9 +1,13 @@
-h2 Forgot your password?
-= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f|
- = devise_error_messages!
- div
- = f.label :email
- br/
- = f.email_field :email
- div= f.submit "Send me reset password instructions"
-= render "devise/shared/links"
+.row
+ .span4.offset4.well
+ = simple_form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f|
+ fieldset
+ legend
+ = t('devise.views.passwords.new.title')
+ small.pull-right
+ = link_to t('devise.views.links.resend_confirmation'), new_confirmation_path(resource_name)
+
+ .form-inputs
+ = f.input :email
+ .control-group
+ = f.submit t('devise.views.passwords.new.submit'), :class => 'btn btn-primary'
View
2  app/views/devise/registrations/new.html.slim
@@ -12,7 +12,7 @@
= f.input :login, :label => false, :placeholder => resource.class.human_attribute_name(:login)
= f.input :email, :label => false, :placeholder => resource.class.human_attribute_name(:email)
= f.input :password, :label => false, :placeholder => resource.class.human_attribute_name(:password)
- = f.submit t('label.sign_up'), :class => 'btn btn-success'
+ = f.submit t('labels.sign_up_to_launch_event'), :class => 'btn btn-success'
.row-fluid
.span3
View
6 app/views/devise/sessions/new.html.slim
@@ -2,13 +2,13 @@
.span4.offset4.well
= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :class => 'form-full-width' }) do |f|
fieldset
- legend = t('label.sign_in')
+ legend = t('devise.views.sessions.new.title')
= render_flashes
= f.label :email
= f.email_field :email
- = f.label :password, t('label.password_with_forget_link_html', :url => new_password_path(resource_name))
+ = f.label :password, render_password_label_with_forget_link(f.object)
= f.password_field :password
.control-group
- if devise_mapping.rememberable?
= f.hidden_field :remember_me, :value => true
- = f.submit t('label.sign_in'), :class => ['btn', 'btn-info']
+ = f.submit t('devise.views.sessions.new.submit'), :class => ['btn', 'btn-info']
View
33 app/views/devise/shared/_links.slim
@@ -1,19 +1,14 @@
-- if controller_name != 'sessions'
- = link_to "Sign in", new_session_path(resource_name)
- br/
-- if devise_mapping.registerable? && controller_name != 'registrations'
- = link_to "Sign up", new_registration_path(resource_name)
- br/
-- if devise_mapping.recoverable? && controller_name != 'passwords'
- = link_to "Forgot your password?", new_password_path(resource_name)
- br/
-- if devise_mapping.confirmable? && controller_name != 'confirmations'
- = link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name)
- br/
-- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks'
- = link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name)
- br/
-- if devise_mapping.omniauthable?
- - resource_class.omniauth_providers.each do |provider|
- = link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider)
- br/
+ul.unstyled
+ - if controller_name != 'sessions'
+ li= link_to t('devise.views.links.sign_in'), new_session_path(resource_name)
+ - if devise_mapping.registerable? && controller_name != 'registrations'
+ li= link_to t('devise.views.links.sign_up'), new_registration_path(resource_name)
+ - if devise_mapping.recoverable? && controller_name != 'passwords'
+ li= link_to t('devise.views.links.forget_pass'), new_password_path(resource_name)
+ - if devise_mapping.confirmable? && controller_name != 'confirmations'
+ li= link_to t('devise.views.links.resend_confirmation'), new_confirmation_path(resource_name)
+ - if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks'
+ li= link_to t('devise.views.links.resend_unlock'), new_unlock_path(resource_name)
+ - if devise_mapping.omniauthable?
+ - resource_class.omniauth_providers.each do |provider|
+ li= link_to t('devise.views.links.omni_auth', :provider => provider.to_s.titleize), omniauth_authorize_path(resource_name, provider)
View
4 app/views/events/new.html.slim
@@ -1,7 +1,7 @@
.row
.span8.offset2.well
fieldset
- legend = t('label.event_new')
+ legend = t('.title', :scope => 'views')
= simple_form_for @event, :html => { :class => "form-horizontal" } do |f|
= f.error_notification
@@ -13,4 +13,4 @@
= f.input :content, :input_html => { :rows => 12, :class => 'span5' }
.form-actions
= f.button :submit, :class => ['btn', 'btn-info']
- button.btn= t('label.cancel')
+ button.btn= t('labels.cancel')
View
1  config/locales/activerecord.zh-CN.yml
@@ -8,6 +8,7 @@ zh-CN:
login: "登录名"
email: "Email 地址"
password: "密码"
+ password_confirmation: "确认密码"
remember_me: "记住我"
event:
title: "主题"
View
21 config/locales/zh-CN.yml
@@ -13,14 +13,6 @@ zh-CN:
contact_us: "联系我们"
title: "19屋-卖活动票的小屋"
- label:
- sign_in: "登录"
- sign_up: "注册,发动活动"
- password_with_forget_link_html: '密码 <small>(<a href="%{url}">忘记密码</a>)</small>'
- event_new: "新活动"
- event_submit: "发起活动"
- cancel: "取消"
-
slogan:
title: "卖活动票的小屋"
description: "由开源社区研发的活动票务平台,在这个小屋子发动活动、卖票都是免费的。"
@@ -36,8 +28,17 @@ zh-CN:
title: "加入我们"
description: "也许你愿意和我们一起成长,请加入19屋"
+ labels:
+ sign_in: "登录"
+ sign_up: "注册"
+ sign_up_to_launch_event: "注册,发动活动"
+ cancel: "取消"
+
text:
under_construction: "网站建设中"
visit_github_html: '在 Github 上查看19屋的<a href="%{url}">最新进展</a>。'
- index:
- under_construction: test
+
+ views:
+ events:
+ new:
+ title: "发起活动"
View
2  config/settings.yml.example
@@ -31,6 +31,8 @@ development:
test:
<<: *defaults
+ time_zone: 'Beijing'
+ default_locale: 'zh-CN'
email:
<<: *email
View
6 spec/features/user_registration_spec.rb
@@ -3,7 +3,7 @@
feature 'user registration' do
let(:user) { build :user }
- let(:submit) { I18n.t('label.sign_up') }
+ let(:submit) { I18n.t('labels.sign_up') }
before(:each) { visit '/' }
@@ -16,7 +16,7 @@
expect(page).to have_content(I18n.t('devise.registrations.signed_up_but_unconfirmed'))
open_email(user.email)
- current_email.click_link 'Confirm my account'
+ current_email.click_link '激活帐号'
expect(page).to have_content(I18n.t('devise.confirmations.confirmed'))
end
-end
+end
View
9 spec/helpers/application_helper_spec.rb
@@ -81,4 +81,13 @@ def render
end
end
end
+
+ describe '#render_password_label_with_forget_link' do
+ let(:object) { build :user }
+ subject { helper.render_password_label_with_forget_link(object) }
+
+ it { should have_selector('small > a') }
+ it { should have_content(object.class.human_attribute_name(:password)) }
+ it { should have_content(t('devise.views.links.forget_pass')) }
+ end
end
View
10 spec/spec_helper.rb
@@ -5,6 +5,16 @@
require 'rspec/autorun'
require 'capybara/email/rspec'
+class Capybara::Email::Driver
+ def raw
+ if email.mime_type == 'multipart/alternative' && email.html_part
+ email.html_part.body.encoded
+ else
+ email.body.encoded
+ end
+ end
+end
+
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
Something went wrong with that request. Please try again.