增加项目关注人列表

This commit is contained in:
huangjingquan 2013-08-27 09:09:34 +08:00
parent 70f7e8423a
commit 92dfea34ad
5 changed files with 68 additions and 11 deletions

View File

@ -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

View File

@ -45,7 +45,7 @@
</table>
</div>
<!--parameter-->
<!--parameter -->
<div class="user_fans">
<table width="240" border="0">
@ -56,12 +56,16 @@
<% end %>
<td class="font_index"><%=link_to "#{@project.members.count}", project_member_path(@project) %></td>
<td class="font_index"><%=link_to @project.watcher_users.count, :controller=>"projects", :action=>"watcherlist" %></td>
<td class="font_index"><%=link_to "#{@project.issues.count}", project_issues_path(@project) %></td>
<td class="font_index"><%=link_to files_count, project_files_path(@project) %></td>
<tr class="font_aram">
<td align="center" width="80px"> <%= l(:label_member) %></td>
<td align="center" width="80px"> <%= l(:label_project_issues) %></td>
<td align="center" width="80px"><%= l(:label_attachment) %></td>
<td align="center" width="60px"> <%= l(:label_member) %></td>
<td align="center" width="60px"><%= l(:label_user_watcher) %></td>
<td align="center" width="60px"> <%= l(:label_project_issues) %></td>
<td align="center" width="60px"><%= l(:label_attachment) %></td>
</tr>
</table>
<div class="user_underline"></div>

View File

@ -0,0 +1,33 @@
<!--add by huang-->
<h3><%= l(:label_user_watcher)%></h3>
<div class="inf_user_image">
<% for user in @project.watcher_users %> <!-- @project.watcher_users.count -->
<ul class="list_watch">
<li>
<table width="660px" border="0" align="center">
<tr>
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :title => "#{user.name}" %></td>
<td><table width="580px" border="0">
<tr>
<td colspan="2" width="580px" ><p><%= content_tag "div", link_to_user(user), :class =>"project_avatar_name" %></p>
</td>
</tr>
<tr>
<td colspan="2" width="580px" ><p class="font_description">
<% 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 %>
</p></td>
</tr>
<tr>
<td width="200" align="right" class="font_lighter"><%= l(:label_user_joinin) %><%= format_date(user.created_on) %>
</td>
</tr>
</table></td>
</tr>
</table></li></ul>
<% end %>
</div>

View File

@ -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

View File

@ -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,7 +51,9 @@ a.bids_user {
margin-top: 10px;
}
ul.list_watch{list-style-type:none;
ul.list_watch{
padding-left: 0px;
list-style-type:none;
height:auto;
border-bottom: 1px dashed rgb(204, 204, 204);
}