From 477e299e2489264a9de24a7150e7d52f36a03a7e Mon Sep 17 00:00:00 2001 From: huangjingquan Date: Thu, 31 Oct 2013 15:18:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=B8=BB=E9=A1=B5=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=20=E5=8E=BB=E6=8E=89=E4=BA=86=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=92=8C=E5=85=B3=E6=B3=A8=E9=9C=80=E6=B1=82=EF=BC=8C=E5=B0=86?= =?UTF-8?q?=E5=85=B3=E6=B3=A8=E9=9C=80=E6=B1=82=E7=BB=9F=E8=AE=A1=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 +- app/models/user.rb | 1 + app/views/layouts/base_users.html.erb | 6 +- app/views/users/_course_form.html.erb | 38 +++++++++++++ app/views/users/_my_course.html.erb | 67 ++--------------------- app/views/users/_my_joinedcourse.html.erb | 65 ++-------------------- app/views/users/user_courses.html.erb | 1 - config/locales/zh.yml | 1 + config/routes.rb | 2 +- lib/redmine.rb | 4 +- 10 files changed, 60 insertions(+), 127 deletions(-) create mode 100644 app/views/users/_course_form.html.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 56a164c0f..cb6b2d677 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -235,7 +235,7 @@ class UsersController < ApplicationController #end def index - + @project_type = params[:project_type] sort_init 'login', 'asc' diff --git a/app/models/user.rb b/app/models/user.rb index 36bcd0d06..4196b3030 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -75,6 +75,7 @@ class User < Principal has_one :rss_token, :class_name => 'Token', :conditions => "action='feeds'" has_one :api_token, :class_name => 'Token', :conditions => "action='api'" belongs_to :auth_source + belongs_to :ucourse, :class_name => 'Course', :foreign_key => :id #huang ## added by xianbo for delete has_many :biding_projects, :dependent => :destroy ##ended by xianbo diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index ca6c4e4bd..f993aa651 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -63,8 +63,10 @@
<%=link_to l(:label_user_watcher)+"("+User.watched_by(@user.id).count.to_s+")" ,:controller=>"users", :action=>"user_watchlist"%>   - <%=link_to l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)+"("+@user.watcher_users(@user.id).count.to_s+")", :controller=>"users", :action=>"user_fanslist" %> - + <%=link_to l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)+"("+@user.watcher_users(@user.id).count.to_s+")", :controller=>"users", :action=>"user_fanslist" %>  + + <%=link_to l(:label_requirement_focus)+"("+Bid.watched_by(@user).where('reward_type = ?', 1).count.to_s+")" ,:controller=>"users", :action=>"watch_bids"%>   + <% if @user.id == User.current.id %>

<%= toggle_link l(:label_brief_introduction), 'introduction', {:focus => 'new_form_user_introduction'} %>

diff --git a/app/views/users/_course_form.html.erb b/app/views/users/_course_form.html.erb new file mode 100644 index 000000000..579f5dbef --- /dev/null +++ b/app/views/users/_course_form.html.erb @@ -0,0 +1,38 @@ + + <%= call_hook :view_account_left_bottom, :user => @user %> \ No newline at end of file diff --git a/app/views/users/_my_course.html.erb b/app/views/users/_my_course.html.erb index d7e4a4cc1..b2c68d3d0 100644 --- a/app/views/users/_my_course.html.erb +++ b/app/views/users/_my_course.html.erb @@ -5,68 +5,13 @@ <%= l(:label_project_course_un) %>

<% else %> -

- <% if @user.user_extensions.identity == 0 %> +

- <%= l(:label_project_course_unadd) %><%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %> - <% else %> - - <%= l(:label_project_cousre_studentun) %><%= link_to"#{l(:label_course_join_student)}",{:controller=>'projects',:action=>'course', :course => 1}, :class => 'icon icon-add' %> - <% end %> + <%= l(:label_project_course_unadd) %><%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %>

<% end %> -<% else %> - <% unless @user != User.current %> - <% if @user.user_extensions.identity == 0 %> -

<%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %>

- <% end %> - <% end %> - - - <% end %> - <%= call_hook :view_account_left_bottom, :user => @user %> +<% else %> +

<%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %>

+ <%= render :partial => 'course_form' %> + <% end %>
diff --git a/app/views/users/_my_joinedcourse.html.erb b/app/views/users/_my_joinedcourse.html.erb index 825fa5a8f..fe96bbf19 100644 --- a/app/views/users/_my_joinedcourse.html.erb +++ b/app/views/users/_my_joinedcourse.html.erb @@ -1,71 +1,18 @@
- <% if @memberships.empty? %> +<% if @memberships.empty? %> <% if @user != User.current %>

<%= l(:label_project_course_un) %>

<% else %>

- <% if @user.user_extensions.identity == 0 %> - <%= l(:label_project_course_unadd) %><%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %> - <% else %> - <%= l(:label_project_cousre_studentun) %><%= link_to"#{l(:label_course_join_student)}",{:controller=>'projects',:action=>'course', :course => 1}, :class => 'icon icon-add' %> - <% end %> + + <%= l(:label_project_cousre_studentun) %><%= link_to"#{l(:label_course_join_student)}",{:controller=>'projects',:action=>'course', :course => 1}, :class => 'icon icon-add' %>

<% end %> - <% else %> - <% unless @user != User.current %> - <% if User.current.user_extensions.identity == 0 %> - <%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %> +<% else %> +

<%= link_to"#{l(:label_course_view_student)}",{:controller=>'projects',:action=>'course', :course => 1}, :class => 'icon icon-add' %>

+ <%= render :partial => 'course_form' %> <% end %> - <% end %> - - <% end %> - <%= call_hook :view_account_left_bottom, :user => @user %>
diff --git a/app/views/users/user_courses.html.erb b/app/views/users/user_courses.html.erb index f056cabe3..a43b8fa86 100644 --- a/app/views/users/user_courses.html.erb +++ b/app/views/users/user_courses.html.erb @@ -1,4 +1,3 @@ - <% if @user.user_extensions.identity == 0 %> <%= render :partial => 'my_course' %> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index e3dfab0d2..d7d345d5e 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1552,6 +1552,7 @@ zh: label_course: 课程 label_course_new: 新建课程 label_course_join_student: 加入课程 + label_course_view_student: 查看其他课程 label_public_info: 若不公开,仅项目成员可见该项目 label_course_student: 学生 label_homework: 课程作业 diff --git a/config/routes.rb b/config/routes.rb index 156bb8fd2..7b6a13ae4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -99,7 +99,7 @@ RedmineApp::Application.routes.draw do end match 'users/:id/user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "feedback" match 'users/:id/user_projects', :controller => 'users', :action => 'user_projects', :via => :get - + #match 'user/:id/watch_calls', :controller => 'users', :action => 'watch_bids', :via => [:get , :post] #end match 'my/account', :controller => 'my', :action => 'account', :via => [:get, :post] diff --git a/lib/redmine.rb b/lib/redmine.rb index e4e639f91..fc51aa3a2 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -330,9 +330,9 @@ end Redmine::MenuManager.map :user_menu do |menu| menu.push :activity, {:controller => 'users', :action => 'show' } menu.push :user_course, {:controller => 'users', :action => 'user_courses'} - menu.push :user_homework, {:controller => 'users', :action => 'user_homeworks'} + #menu.push :user_homework, {:controller => 'users', :action => 'user_homeworks'} by huang menu.push :user_project, {:controller => 'users', :action => 'user_projects'} - menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids'} + # menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids'} by huang menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback'} end