From 2fa6276829eba5d18a366093c267a90bc66c86a4 Mon Sep 17 00:00:00 2001 From: xianbo Date: Thu, 24 Oct 2013 10:13:00 +0800 Subject: [PATCH] fix natural --- app/controllers/users_controller.rb | 26 +++++----- app/views/users/user_projects.html.erb | 12 ++--- app/views/users/watch_projects.html.erb | 65 +++++++++++++------------ config/locales/zh.yml | 6 ++- 4 files changed, 59 insertions(+), 50 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index c4b42c8df..235e28792 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -563,20 +563,20 @@ class UsersController < ApplicationController end def watch_projects - @watch_type = Watcher.visible.where("watchable_type = ? and user_id = ?", 'Project', @user.id) - @watch_projects = [] - unless @watch_type.nil? - @watch_type.each do |obj| - @watch_projects << Project.find(obj.watchable_id) if(Project.find(obj.watchable_id)) - end - end - respond_to do |format| - format.html { - render :layout => 'base_users' - } - format.api + @watch_type = Watcher.visible.where("watchable_type = ? and user_id = ?", 'Project', @user.id) + @watch_projects = [] + unless @watch_type.nil? + @watch_type.each do |obj| + @watch_projects << Project.find(obj.watchable_id) + end + end + respond_to do |format| + format.html { + render :layout => 'base_users' + } + format.api + end end -end def update @user.admin = params[:user][:admin] if params[:user][:admin] diff --git a/app/views/users/user_projects.html.erb b/app/views/users/user_projects.html.erb index 050a3ac35..0996a0002 100644 --- a/app/views/users/user_projects.html.erb +++ b/app/views/users/user_projects.html.erb @@ -1,12 +1,12 @@ - -
-

<%= link_to "关注的项目" , {:controller => 'users', :action => 'watch_projects', :id => @user.id}%> +

+<%= l(:label_project_take)%> + <%= link_to l(:label_has_watched_project) , {:controller => 'users', :action => 'watch_projects', :id => @user.id}%> <% unless @memberships.empty? %> <% if @user == User.current %> -<%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>

- + <%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>

<% end %> +
    <% for membership in @memberships %>
  • @@ -17,7 +17,7 @@ + <%= l(:label_peoject_take_in) %> <%= link_to_project(membership.project) %> + + +
    <%= link_to_user(membership.user) if membership.respond_to?(:user) %> - <%= l(:label_watch_project) %> <%= link_to_project(membership.project) %>
    diff --git a/app/views/users/watch_projects.html.erb b/app/views/users/watch_projects.html.erb index de8f19c20..88aa4515c 100644 --- a/app/views/users/watch_projects.html.erb +++ b/app/views/users/watch_projects.html.erb @@ -1,34 +1,39 @@ -

    <%= link_to "关注的项目" , {:controller => 'users', :action => 'watch_projects', :id => @user.id}%> -<% if @user == User.current %> - <%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>

    -<% end %> + +

    + <%= l(:label_has_watched_project)%> + <%= link_to l(:label_project_take) , {:controller => 'users', :action => 'user_projects', :course => 0, :project_type => @project_type}%> + <% if @user == User.current %> + <%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %> + <% end %> + +

    +
    <% unless @watch_projects.nil?&&watch_projects.project.nil? %> <% for watch_project in @watch_projects %> -
    +
    + + + + + + + + +
    <%= link_to image_tag(url_to_avatar(watch_project.project), :class => 'avatar'), project_path(watch_project.project) %> + - - + - -
    <%= link_to image_tag(url_to_avatar(watch_project.project), :class => 'avatar'), project_path(watch_project.project) %> - - - - - - - - - - -
    <%= link_to_user(@user) if watch_project.respond_to?(:user) %> - <%= @user.name%><%= l(:label_watch_project) %> <%= link_to_project(watch_project.project) %>
    -

    - <%= watch_project.project.description%> -

    <%= format_time(watch_project.created_on) %>
    <%= link_to_user(@user) if watch_project.respond_to?(:user) %> <%= @user.name%><%= l(:label_watch_project) %> <%= link_to_project(watch_project.project) %>
    - - - <% end %> - <% else %> - 还米有关注任何项目 - <% end %> +
    +

    + <%= watch_project.project.description%> +

    <%= format_time(watch_project.created_on) %>
    + +
  • +<% end %> +<% else %> + <%= l(:label_watch_no_projects)%> +<% end %> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 380cbb059..da9756041 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1647,4 +1647,8 @@ zh: label_homework_prompt: 贴心小提示: label_homework_prompt_content: 亲,在这里我们的作业将以项目的形式提交,如果小伙伴们还没有创建项目,请先创建一个项目。项目创建成功后,就可以 label_create_homework: 布置了作业: - label_watch_project: 关注了 \ No newline at end of file + label_watch_project: 关注了 + label_watch_no_projects: 没有关注任何项目 + label_has_watched_project: 关注的项目 + label_project_take: 参与的项目 + label_peoject_take_in: 加入了项目: \ No newline at end of file