From 92dfea34ad73ee7fd2fbaa9bc20572a4e25b2b60 Mon Sep 17 00:00:00 2001 From: huangjingquan Date: Tue, 27 Aug 2013 09:09:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=A1=B9=E7=9B=AE=E5=85=B3?= =?UTF-8?q?=E6=B3=A8=E4=BA=BA=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 16 +++++++++--- app/views/layouts/base_projects.html.erb | 12 ++++++--- app/views/projects/watcherlist.html.erb | 33 ++++++++++++++++++++++++ config/routes.rb | 4 ++- public/stylesheets/application.css | 14 +++++++--- 5 files changed, 68 insertions(+), 11 deletions(-) create mode 100644 app/views/projects/watcherlist.html.erb diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 9a3e2d70f..a31fd18aa 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -19,14 +19,14 @@ class ProjectsController < ApplicationController layout 'base_projects'# by young menu_item :overview menu_item :roadmap, :only => :roadmap -# menu_item :settings, :only => :settings + menu_item :settings, :only => :settings before_filter :find_project, :except => [ :index, :list, :new, :create, :copy ] - before_filter :authorize, :except => [ :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file, :statistics, :feedback] + before_filter :authorize, :except => [:watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file, :statistics, :feedback] before_filter :authorize_global, :only => [:new, :create] before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ] #by young - before_filter :member, :file, :statistics + before_filter :member, :file, :statistics, :watcherlist # accept_rss_auth :index accept_api_auth :index, :show, :create, :update, :destroy @@ -51,6 +51,7 @@ class ProjectsController < ApplicationController helper :activities helper :documents helper :watchers +# helper :watcherlist ### added by william include ActsAsTaggableOn::TagsHelper @@ -392,3 +393,12 @@ class ProjectsController < ApplicationController true end end + +# added by huang +def watcherlist + if @watched + @users -= watched.watcher_users + end + +end +# end diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index c0cd755a8..f4165bdba 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -45,7 +45,7 @@ - +
@@ -56,12 +56,16 @@ <% end %> + + - - - + + + + +
<%=link_to "#{@project.members.count}", project_member_path(@project) %><%=link_to @project.watcher_users.count, :controller=>"projects", :action=>"watcherlist" %> <%=link_to "#{@project.issues.count}", project_issues_path(@project) %> <%=link_to files_count, project_files_path(@project) %>
<%= l(:label_member) %> <%= l(:label_project_issues) %><%= l(:label_attachment) %> <%= l(:label_member) %><%= l(:label_user_watcher) %> <%= l(:label_project_issues) %><%= l(:label_attachment) %>
diff --git a/app/views/projects/watcherlist.html.erb b/app/views/projects/watcherlist.html.erb new file mode 100644 index 000000000..491dd7205 --- /dev/null +++ b/app/views/projects/watcherlist.html.erb @@ -0,0 +1,33 @@ + +

<%= l(:label_user_watcher)%>

+
+ <% for user in @project.watcher_users %> +
    +
  • + + + + + +
    <%= link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :title => "#{user.name}" %> + + + + + + + + + +

    <%= content_tag "div", link_to_user(user), :class =>"project_avatar_name" %>

    +

    + <% unless user.memberships.empty? %> + <%= l(:label_contribute_to, :project_count => "#{user.memberships.count}") %> + <% for member in user.memberships %> + <%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %> + <% end %> + <% end %> +

    <%= l(:label_user_joinin) %><%= format_date(user.created_on) %> +
+<% end %> +
\ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index c95489187..c8594e27c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -138,6 +138,8 @@ RedmineApp::Application.routes.draw do get 'file', :action => 'file', :as => 'file' get 'statistics', :action => 'statistics', :as => 'statistics' get 'feedback', :action => 'feedback' + get 'watcherlist', :action=> 'watcherlist' + match 'user_watcherlist', :to => 'projects#watcherlist', :via => :get, :as => "watcherlist" #add by huang #end post 'modules' @@ -166,7 +168,7 @@ RedmineApp::Application.routes.draw do # get 'projects/:project_id/repository', :to => 'repositories#show', :as => 'project_repository' # match '/show', :controller => 'projects', :action => 'show', :as => 'project_show', :via => :get - + match '/watcherlist', :controller=>'projects', :action=> 'watcherlist', :as => 'watcherlist', :via => :get #add by huang #end resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 25a2940ad..de4cbb192 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -11,6 +11,12 @@ h4 {border-bottom: 1px dotted #bbb;} /*new by huang*/ /**/ +.project_avatar_name { + position: relative; + font-size: 16px; + display:block; +} + a.bids_user { font-family:微软雅黑; color:#15bccf; @@ -45,9 +51,11 @@ a.bids_user { margin-top: 10px; } -ul.list_watch{list-style-type:none; - height:auto; - border-bottom: 1px dashed rgb(204, 204, 204); +ul.list_watch{ + padding-left: 0px; + list-style-type:none; + height:auto; + border-bottom: 1px dashed rgb(204, 204, 204); } .new_creat{