diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 09cede45a..b9d61e61e 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -32,7 +32,7 @@ class ProjectsController < ApplicationController before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course] before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches] before_filter :require_admin, :only => [ :copy, :unarchive, :destroy, :calendar] - before_filter :file, :statistics #:watcherlist + before_filter :file # 除非项目内人员,不可查看成员, TODO: 完了写报表里去 # before_filter :memberAccess, only: :member @@ -535,6 +535,23 @@ class ProjectsController < ApplicationController end end + def project_watcherlist + unless @project.nil? + if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin? + render_403 + else + @users -= watched.watcher_users if @watched + end + @watchers = @project.watcher_users + @limit = 20 + @is_remote = true + @watchers_count = @watchers.count + @watcher_pages = Paginator.new @watchers_count, @limit, params['page'] || 1 + @offset ||= @watcher_pages.offset + @watchers = paginateHelper @watchers, 20 + end + end + # include CoursesHelper def member # 消息"同意加入项目" @@ -603,7 +620,7 @@ class ProjectsController < ApplicationController @limit = 20 @is_remote = true - @forked_count = @project.forked_count + @forked_count = @forked_projects.count @forked_pages = Paginator.new @forked_count, @limit, params['page'] || 1 @offset ||= @forked_pages.offset @forked_projects = paginateHelper @forked_projects, @limit @@ -671,13 +688,7 @@ class ProjectsController < ApplicationController end def statistics - @watchers = @project.watcher_users - @limit = 20 - @is_remote = true - @watchers_count = @watchers.count - @watcher_pages = Paginator.new @watchers_count, @limit, params['page'] || 1 - @offset ||= @watcher_pages.offset - @watchers = paginateHelper @watchers, 20 + end #end @@ -978,16 +989,6 @@ class ProjectsController < ApplicationController true end - def watcherlist - unless @project.nil? - if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin? - render_403 - else - @users -= watched.watcher_users if @watched - end - end - end - #gcm def desc_sort_course_by_avtivity(activity_count,projects) return projects if activity_count.size<2 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ad3d2c61d..a1a5ecacb 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2837,6 +2837,12 @@ module ApplicationHelper tag_list end + # 获取项目fork成员数 + def project_fork_count + @forked_projects = Project.where(:forked_from_project_id => @project.id) + @forked_count = @forked_projects.count + end + def get_org_subfield_tag_list org_subfield all_attachments = org_subfield.attachments.select{|attachment| attachment.is_public? || (attachment.container_type == "OrgSubfield" && User.current.member_of_org?(org_subfield.organization))|| diff --git a/app/views/projects/_applied_status.html.erb b/app/views/projects/_applied_status.html.erb index 55190c613..046dc2a0c 100644 --- a/app/views/projects/_applied_status.html.erb +++ b/app/views/projects/_applied_status.html.erb @@ -3,7 +3,7 @@
  • <%= watcher_link_for_project(@project, User.current) %> - <%= link_to "#{@project.watcher_users.count}", {:controller => "projects", :action => "watcherlist", + <%= link_to "#{@project.watcher_users.count}", {:controller => "projects", :action => "project_watcherlist", :id => @project.id}, :id => "fans_num", :class => 'pro_new_topbtn fl', :title => "关注成员列表" %>
  • @@ -21,11 +21,11 @@ <% if User.current.login? %>
  • <%= watcher_link_for_project(@project, User.current) %> - <%= link_to "#{@project.watcher_users.count}", {:controller => "projects", :action => "watcherlist", + <%= link_to "#{@project.watcher_users.count}", {:controller => "projects", :action => "project_watcherlist", :id => @project.id}, :id => "fans_num", :class => 'pro_new_topbtn fl', :title => "关注成员列表" %>
  • - 已加入 + 已加入 <%= link_to "#{Member.where(:project_id => @project.id).count}", project_member_path(@project), :class => 'pro_new_topbtn fl', :title => "项目成员列表" %>
  • @@ -42,7 +42,7 @@ <%= link_to "".html_safe+"Fork", forked_pop_project_path(@project), :class=>"pro_new_topbtn_left fl", :remote => true %> - <%= @project.forked_count.to_i %> + <%= project_fork_count %> <% else%> @@ -52,7 +52,7 @@ Fork - <%= @project.forked_count.to_i %> + <%= project_fork_count %> <% end %> diff --git a/app/views/projects/member.html.erb b/app/views/projects/member.html.erb index 49ab1ac68..83fcf7752 100644 --- a/app/views/projects/member.html.erb +++ b/app/views/projects/member.html.erb @@ -3,7 +3,7 @@

    <%= @subPage_title %> <% if is_project_manager?(User.current, @project) %> - <%=link_to "成员管理", {:controller => 'projects', :action => 'settings'}, :id => @project.id, :tab => 'members', :class => "sy_cblue", :style => "font-weight: normal;" %> + <%=link_to "成员管理", settings_project_url(@project, :tab => 'members'), :id => @project.id, :class => "sy_cblue", :style => "font-weight: normal;" %> <% end %>

    diff --git a/app/views/projects/project_watcherlist.html.erb b/app/views/projects/project_watcherlist.html.erb new file mode 100644 index 000000000..440975e68 --- /dev/null +++ b/app/views/projects/project_watcherlist.html.erb @@ -0,0 +1,29 @@ +
    +

    成员 本页面展示关注了 <%= link_to @project.owner.try(:show_name), user_path(@project.owner) %>/<%= link_to @project.name, project_path(@project) %> 的用户

    + +
    +
    +
      + <%= pagination_links_full @watcher_pages, @watchers_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true %> +
    +
    +
    +
    +
    +
    + + + diff --git a/config/routes.rb b/config/routes.rb index 2ff100196..fc18e6e59 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -780,6 +780,7 @@ RedmineApp::Application.routes.draw do get 'settings(/:tab)', :action => 'settings', :as => 'settings' #by young get 'member', :to => 'projects#member', :as => 'member' + match 'project_watcherlist', :to => 'projects#project_watcherlist', :as => 'project_watcherlist' match 'store_mine', :to => 'projects#store_mine', :as => 'store_mine' match 'enshrine', :to => 'projects#enshrine', :as => 'enshrine' match 'member_forked', :to => 'projects#member_forked', :as => 'member_forked' diff --git a/public/stylesheets/css/project.css b/public/stylesheets/css/project.css index 5af60925c..530287ed4 100644 --- a/public/stylesheets/css/project.css +++ b/public/stylesheets/css/project.css @@ -865,9 +865,9 @@ a.pro_new_username_fork { font-size: 12px; color: #3b94d6; line-height: 24px;} a.pro_new_proname{ overflow: hidden;white-space: nowrap;text-overflow:ellipsis;display: inline-block;} a.pro_new_project_name{ width: 250px; overflow: hidden;white-space: nowrap;text-overflow:ellipsis;display: inline-block;} a.pro_new_topbtn{ padding: 3px 7px; font-size: 12px; line-height: 20px; color: #333;vertical-align: middle;background-color: #fff; border: 1px solid #ddd; border-left: 0; border-top-right-radius: 3px; border-bottom-right-radius: 3px; color: #333;} -a.pro_new_topbtn_left { padding: 3px 10px; font-size: 12px;line-height: 20px; background-image: linear-gradient(#fcfcfc, #eee); border: 1px solid #d5d5d5;border-radius: 3px;border-top-right-radius: 0;border-bottom-right-radius: 0; color: #333; } +a.pro_new_topbtn_left { padding: 3px 10px; font-size: 12px;line-height: 20px; background-image: linear-gradient(#fcfcfc, #eee); border: 1px solid #d5d5d5;border-radius: 3px;border-top-right-radius: 0;border-bottom-right-radius: 0; color: #333;} a:hover.pro_new_topbtn_left{background-image: linear-gradient(#ededed, #dddddd);} -a.pro_new_grey_topbtn_left{padding: 3px 10px; font-size: 12px;line-height: 20px; background: #fff; border: 1px solid #d5d5d5;border-radius: 3px;border-top-right-radius: 0;border-bottom-right-radius: 0; color: #888888; } +a.pro_new_grey_topbtn_left{padding: 3px 10px; font-size: 12px;line-height: 20px; background: #fff; border: 1px solid #d5d5d5;border-radius: 3px;border-top-right-radius: 0;border-bottom-right-radius: 0; color: #888888; cursor:default;} .pro_new_topnav ul{border-bottom: 3px solid #fff; height: 30px; line-height: 30px;} .pro_new_topnav ul li{ float: left;padding:0 15px; height: 30px; line-height: 30px;text-align: center; } .pro_new_topnav_active{border-bottom: 3px solid #3b94d6; }