From 509bfcc5e2e9ebfe9720051c44ace2d6c05d0872 Mon Sep 17 00:00:00 2001 From: Khanhhd Date: Fri, 25 Oct 2013 09:11:15 +0700 Subject: [PATCH 01/17] Fix bug show page --- app/views/users/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 0733ef8..e87f972 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -6,7 +6,7 @@ <%= gravatar_for @user %> <%= @user.name %>
    - Email: <%= @user.emai%> + Email: <%= @user.email %>

I'm tired

From e0180eda20e1b1c669d206513af094ffdfd897b7 Mon Sep 17 00:00:00 2001 From: tuanlq Date: Mon, 25 Nov 2013 11:56:09 +0700 Subject: [PATCH 02/17] Refs #9349 Translate to Vietnamese in Home page --- app/controllers/application_controller.rb | 7 +++++++ app/views/shared/_micropost_form.html.erb | 4 ++-- app/views/shared/_user_info.html.erb | 2 +- app/views/static_pages/home.html.erb | 10 ++++------ config/locales/en.yml | 7 +++++++ config/locales/vi.yml | 8 ++++++++ 6 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 config/locales/vi.yml diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d8b3d09..8667fca 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,6 +1,13 @@ class ApplicationController < ActionController::Base + + before_action :set_locale + # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception include SessionsHelper + + def set_locale + I18n.locale = params[:locale] || I18n.default_locale + end end diff --git a/app/views/shared/_micropost_form.html.erb b/app/views/shared/_micropost_form.html.erb index e2c2bf8..b1e25b0 100644 --- a/app/views/shared/_micropost_form.html.erb +++ b/app/views/shared/_micropost_form.html.erb @@ -1,7 +1,7 @@ <%= form_for(@micropost) do |f| %> <%= render 'shared/error_messages', object: f.object %>
- <%= f.text_area :content, placeholder: "Compose new micropost..." %> + <%= f.text_area :content, placeholder: t(:compose_new_micropost) << "..." %>
- <%= f.submit "Post", class: "btn btn-large btn-primary" %> + <%= f.submit t(:post), class: "btn btn-large btn-primary" %> <% end %> diff --git a/app/views/shared/_user_info.html.erb b/app/views/shared/_user_info.html.erb index aeda014..75923a4 100644 --- a/app/views/shared/_user_info.html.erb +++ b/app/views/shared/_user_info.html.erb @@ -3,7 +3,7 @@ <%= current_user.name %> - <%= link_to "view my profile", current_user %> + <%= link_to t(:view_my_profile), current_user %> <%= pluralize(current_user.microposts.count, "micropost") %> diff --git a/app/views/static_pages/home.html.erb b/app/views/static_pages/home.html.erb index f83b1d5..9c4590f 100644 --- a/app/views/static_pages/home.html.erb +++ b/app/views/static_pages/home.html.erb @@ -12,21 +12,19 @@
-

Micropost Feed

+

<%=t :micropost_feed %>

<%= render 'shared/feed' %>
<% else %>
-

Welcome to the Sample App

+

<%=t :home_welcom_message %>

- This is the home page for the Ruby on Rails Tutorial sample application. + <%=t :home_description_message %>

-

Test for Git

- - <%= link_to "Dang ky!", signup_path, + <%= link_to t(:home_register_message), signup_path, class: "btn btn-large btn-primary" %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index 0653957..170a7f7 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -21,3 +21,10 @@ en: hello: "Hello world" + home_welcom_message: "Welcome to the Sample App" + home_description_message: "This is the home page for the Ruby on Rails Tutorial sample application." + home_register_message: "Register" + view_my_profile: "View my profile" + post: "Post" + compose_new_micropost: "Compose new micropost" + micropost_feed: "Micropost Feed" diff --git a/config/locales/vi.yml b/config/locales/vi.yml new file mode 100644 index 0000000..82c704a --- /dev/null +++ b/config/locales/vi.yml @@ -0,0 +1,8 @@ +vi: + home_welcom_message: "Chào mừng bạn đến với Sample App" + home_description_message: "Đây là trang chủ cho ứng dụng ví dụ từ Ruby on Rails Tutorial." + home_register_message: "Đăng ký" + view_my_profile: "Xem profile của tôi" + post: "Đăng" + compose_new_micropost: "Soạn một bài mới" + micropost_feed: "Thêm bài viết" \ No newline at end of file From 6396ebf8f01e85aab53d06554e87b17bca4a98ac Mon Sep 17 00:00:00 2001 From: magicime Date: Mon, 25 Nov 2013 13:10:39 +0700 Subject: [PATCH 03/17] refs #9346 change pagination --- app/controllers/static_pages_controller.rb | 2 +- app/controllers/users_controller.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb index c9e0aeb..d5a08aa 100644 --- a/app/controllers/static_pages_controller.rb +++ b/app/controllers/static_pages_controller.rb @@ -2,7 +2,7 @@ class StaticPagesController < ApplicationController def home if signed_in? @micropost = current_user.microposts.build if signed_in? - @feed_items = current_user.feed.paginate(page: params[:page]) + @feed_items = current_user.feed.paginate page: params[:page], per_page: 3 end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index daf5452..1b682bb 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -9,7 +9,7 @@ def index end def show - @microposts = @user.microposts.paginate(page: params[:page]) + @microposts = @user.microposts.paginate page: params[:page], per_page: 3 end def create From 1e82c9287b16e42ed0f2255db32aa73d5fd9a52b Mon Sep 17 00:00:00 2001 From: NghiemThai Date: Mon, 25 Nov 2013 13:34:20 +0700 Subject: [PATCH 04/17] ref #9348 Translate to Vietnamese in User#edit page --- app/views/users/edit.html.erb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 4afe288..9533b21 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -1,23 +1,23 @@ <% provide(:title, "Edit user") %> -

Cap nhat thong tin ca nhan

+

Cập nhật thông tin cá nhân

<%= form_for(@user) do |f| %> <%= render 'shared/error_messages', object: f.object %> - <%= f.label :name %> + <%= f.label :name, "Tên" %> <%= f.text_field :name %> - <%= f.label :email %> + <%= f.label :email, "Địa chỉ email" %> <%= f.text_field :email %> - <%= f.label :password %> + <%= f.label :password, "Mật Khẩu" %> <%= f.password_field :password %> - <%= f.label :password_confirmation, "Confirm Password" %> + <%= f.label :password_confirmation, "Xác nhận mật Khẩu" %> <%= f.password_field :password_confirmation %> - <%= f.submit "Thay doi", class: "btn btn-large btn-primary" %> + <%= f.submit "Thay đổi", class: "btn btn-large btn-primary" %> <% end %> <%= gravatar_for @user %> From 27c079de42c8864ddba58f8bd4bc7da2eda9e863 Mon Sep 17 00:00:00 2001 From: tuanlq Date: Mon, 25 Nov 2013 14:17:31 +0700 Subject: [PATCH 05/17] Refs #9367 remove delete user link in User#index --- app/views/users/_user.html.erb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/views/users/_user.html.erb b/app/views/users/_user.html.erb index 2a599c8..399a195 100644 --- a/app/views/users/_user.html.erb +++ b/app/views/users/_user.html.erb @@ -1,8 +1,4 @@
  • -<%= gravatar_for user %> -<%= link_to user.name, user %> -<% if current_user.admin? && !current_user?(user) %> - | <%= link_to "delete", user, method: :delete, - data: { confirm: "You sure?" } %> - <% end %> -
  • + <%= gravatar_for user %> + <%= link_to user.name, user %> + From 197ae683dfe968506e460e4f268ec581d639058b Mon Sep 17 00:00:00 2001 From: magicime Date: Mon, 25 Nov 2013 14:14:09 +0700 Subject: [PATCH 06/17] refs #9364 Delete Help page --- app/controllers/static_pages_controller.rb | 3 --- app/views/static_pages/help.html.erb | 18 ------------------ config/routes.rb | 1 - 3 files changed, 22 deletions(-) delete mode 100644 app/views/static_pages/help.html.erb diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb index d5a08aa..b499f31 100644 --- a/app/controllers/static_pages_controller.rb +++ b/app/controllers/static_pages_controller.rb @@ -5,7 +5,4 @@ def home @feed_items = current_user.feed.paginate page: params[:page], per_page: 3 end end - - def help - end end diff --git a/app/views/static_pages/help.html.erb b/app/views/static_pages/help.html.erb deleted file mode 100644 index 96bd129..0000000 --- a/app/views/static_pages/help.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -<% provide(:title, "Help") %> - - - - Ruby on Rails Tutorial Sample App | <%= yield(:title) %> - - -

    Help

    -

    - Get help on the Ruby on Rails Tutorial at the - Rails Tutorial help page. - To get help on this sample app, see the - Rails Tutorial book. -

    - - - -

    Find me in app/views/static_pages/help.html.erb

    diff --git a/config/routes.rb b/config/routes.rb index cc790e6..88c9178 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -8,7 +8,6 @@ resources :microposts, only: [:create, :destroy] resources :relationships, only: [:create, :destroy] root 'static_pages#home' - match '/help', to: 'static_pages#help', via: 'get' match '/about', to: 'static_pages#about', via: 'get' match '/signup', to: 'users#new', via: 'get' match '/signin', to: 'sessions#new', via: 'get' From a2f40786604d11dbe474feb0b9b51a5dee62f0a3 Mon Sep 17 00:00:00 2001 From: NghiemThai Date: Mon, 25 Nov 2013 14:29:22 +0700 Subject: [PATCH 07/17] ref 9366 Add user email in User#index --- app/views/users/_user.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/users/_user.html.erb b/app/views/users/_user.html.erb index 399a195..d48a1ae 100644 --- a/app/views/users/_user.html.erb +++ b/app/views/users/_user.html.erb @@ -1,4 +1,5 @@
  • <%= gravatar_for user %> <%= link_to user.name, user %> -
  • + <%= user.email %> + \ No newline at end of file From 80944e656e05474e15f4cfc455599f873454ddd3 Mon Sep 17 00:00:00 2001 From: VanYen Date: Tue, 24 Dec 2013 15:31:12 +0700 Subject: [PATCH 08/17] refs #task10099 fix bug when can not access localhost:3000 --- app/views/layouts/_head.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb index 73f6a0c..1a018a1 100644 --- a/app/views/layouts/_head.html.erb +++ b/app/views/layouts/_head.html.erb @@ -5,7 +5,7 @@