Merge branch 'dai_ao' into 'develop'

项目成员关注列表分页



See merge request !14
This commit is contained in:
黄井泉 2016-11-25 10:52:15 +08:00
commit 253768e73c
11 changed files with 95 additions and 60 deletions

View File

@ -972,6 +972,14 @@ class ProjectsController < ApplicationController
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
#@curse_attachments_all = @all_attachments[@offset, @limit]
@watchers = paginateHelper @watchers,20
end
end
@ -988,5 +996,7 @@ class ProjectsController < ApplicationController
end
return projects
end
#gcmend
end

View File

@ -333,6 +333,7 @@ module WatchersHelper
return '' unless user && user.logged?
objects = Array.wrap(objects)
watched = objects.any? {|object| object.watched_by?(user)}
watched = true if user.id == @project.user_id
@watch_flag = objects.first.instance_of?(Project)
id = watcher_css(objects)
text = @watch_flag ?
@ -340,8 +341,13 @@ module WatchersHelper
url = watch_path(:object_type => objects.first.class.to_s.underscore,
:object_id => (objects.size == 1 ? objects.first.id : objects.map(&:id).sort))
method = watched ? 'delete' : 'post'
link_to text, url, :remote => true, :method => method,
:class => "pro_new_topbtn_left fl" ,:id=>id
if user.id != @project.user_id
link_to text, url, :remote => true, :method => method,
:class => "pro_new_topbtn_left fl" ,:id => id
else
link_to "关注", "javascript:void(0)", :remote => true, :method => method,
:class => "pro_new_grey_topbtn_left fl" , :id => id
end
end
def store_project_link project_id, user_id

View File

@ -12,7 +12,7 @@
<%= link_to "打开<span class='new_roadmap_nav_tagnomal ml5' id='new_roadmap_num_2'>#{@issue_open_count}</span>".html_safe, "", :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_2" %>
</li>
<li id="new_roadmap_nav_3" onclick="HoverLi(3);">
<%= link_to "锁定<span class='new_roadmap_nav_tagnomal ml5' id='new_roadmap_num_3'>#{@issue_close_count}</span>".html_safe, "", :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_3" %>
<%= link_to "关闭<span class='new_roadmap_nav_tagnomal ml5' id='new_roadmap_num_3'>#{@issue_close_count}</span>".html_safe, "", :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_3" %>
</li>
</ul>
</div><!--issues_statistics end-->

View File

@ -3,7 +3,8 @@
<!--关注项目-->
<li class="mr5 fl">
<%= watcher_link_for_project(@project, User.current) %>
<%= link_to "#{@project.watcher_users.count}", {:controller=>"projects", :action=>"watcherlist", :id => @project.id},:id=>"fans_num", :class => 'pro_new_topbtn fl' %>
<%= link_to "#{@project.watcher_users.count}", {:controller => "projects", :action => "watcherlist",
:id => @project.id}, :id => "fans_num", :class => 'pro_new_topbtn fl', :title => "关注成员列表" %>
</li>
<!--加入项目-->
<li class="mr5 fl">
@ -12,15 +13,21 @@
<% else %>
<a style="cursor: default" class="pro_new_topbtn_left fl">等待审批</a>
<% end %>
<%= link_to "#{Member.where(:project_id => @project.id).count}", project_member_path(@project), :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 => "项目成员列表" %>
</li>
<% end %>
<% else %>
<!--项目创建者不能退出项目-->
<% if User.current.id != @project.user_id %>
<% if User.current.login? %>
<li class="mr5 fl">
<%= watcher_link_for_project(@project, User.current) %>
<%= link_to "#{@project.watcher_users.count}", {:controller => "projects", :action => "watcherlist",
:id => @project.id}, :id => "fans_num", :class => 'pro_new_topbtn fl', :title => "关注成员列表" %>
</li>
<li class="mr5 fl">
<a class="pro_new_topbtn_left fl "> 已加入</a>
<a href="<%= project_member_path(@project) %>" class=" pro_new_topbtn fl"><%= Member.where(:project_id => @project.id).count %></a>
<!-- <a href="<%= project_member_path(@project) %>" class=" pro_new_topbtn fl"><%= Member.where(:project_id => @project.id).count %></a>-->
<%= link_to "#{Member.where(:project_id => @project.id).count}", project_member_path(@project), :class => 'pro_new_topbtn fl', :title => "项目成员列表" %>
</li>
<%#= link_to "#{Member.where(:project_id => @project.id).count}", project_member_path(@project), :class => 'pro_new_topbtn fl', :title => "项目成员" %>
<% end %>
@ -35,8 +42,17 @@
<!-- <a href="<%#= {:controller => 'repositories', :action => 'forked'} %>" class="pro_new_topbtn_left fl" target="_blank">Fork</a>-->
<%= link_to "<span class='vl_fork'></span>".html_safe+"Fork", forked_pop_project_path(@project),
:class=>"pro_new_topbtn_left fl", :remote => true %>
<a href="<%= member_forked_project_path(@project) %>" class=" pro_new_topbtn fl"><%= @project.forked_count.to_i %></a>
<a href="<%= member_forked_project_path(@project) %>" class=" pro_new_topbtn fl" title="fork成员列表"><%= @project.forked_count.to_i %></a>
</li>
<% else%>
<li class="mr5 fl">
<%#= link_to "<span class='vl_fork '></span>".html_safe+"Fork","#",
:class=>"pro_new_grey_topbtn_left fl"%>
<a href="javascript:void(0)" class="pro_new_grey_topbtn_left fl" >
<span class='vl_fork'>Fork</span>
</a>
<a href="<%= member_forked_project_path(@project) %>" class=" pro_new_topbtn fl" title="fork成员列表"><%= @project.forked_count.to_i %></a>
<% end %>

View File

@ -1,30 +1,31 @@
<div class="st_list2" style="width:970px;">
<div class="st_box">
<a href="#" class="fr fb mb5" >加入时间</a>
<div class="cl"></div><!--st_box_top end-->
<ul class="clear pro_new_users_box">
<% members.each do |member| %>
<div class="st_boxlist">
<a href="javascript:" class="st_img">
<%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 32, :height => 32)) %>
</a>
<span class="fr ml10 c_grey"><%= l(:label_user_for_project_grade) %><span class="c_orange"><%= format("%.2f" ,read_user_project_scores(member.user,@project)).to_i %></span></span>
<li class="clear">
<%= link_to image_tag(url_to_avatar(member.user), :width => "50", :height => "50"), user_path(member.user), :alt => "用户头像", :class => "pro_new_users fl mr5" %>
<div class="fl mt5 clear">
<%= link_to member.user.try(:show_name), user_path(member.user), :class => "pro_new_users mt5 fl" %>
<!--<span class="ml5 mr5 mt5 fl"> / </span>
<%#= link_to project.name, user_path(member.user), :class => "pro_new_users mt5 fl" %>-->
<br/>
<span class=" c_grey mt3 fl"><%= h time_tag(member.created_on) %></span>
</div>
</li>
<% end %>
</ul>
<span class="fl ml10 c_grey"><%= l(:label_username)%></span>
<%= link_to(member.user.name, user_path(member.user),:class => "ml10 c_blue02") %><%= rolesToLanguage(member.roles.sort.collect(&:to_s)).join(', ') %><br/>
</div>
<span class="fr c_grey"><%= format_date(member.created_on)%></span>
</div>
<div class="cl"></div>
<% end%>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
<div style="text-align:center;">
<div class="pages" style="width:auto; display:inline-block;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
<div class="cl"></div>

View File

@ -1,11 +1,12 @@
<div class="container-big mb10">
<div class="project_r_h" style="width:970px;">
<h2 class="project_h2 fl"><%= @subPage_title %></h2>
<div class="pro_new_info mb10">
<div class="project_r_h">
<h2 class="clear"><%= @subPage_title %>
<% if is_project_manager?(User.current, @project) %>
<span class="fr f14 fontGrey2" style="height: 40px; line-height: 40px; margin-right: 15px;">
<%=link_to "成员管理", :controller => 'projects', :action => 'settings', :id => @project.id, :tab => 'members' %>
<%=link_to "成员管理", {:controller => 'projects', :action => 'settings'}, :id => @project.id, :tab => 'members', :class => "sy_cblue", :style => "font-weight: normal;" %>
</span>
<% end %>
</h2>
</div>
<div class="member_content">
<%= error_messages_for 'member' %>

View File

@ -9,7 +9,7 @@
<span class="ml5 mr5 mt5 fl"> / </span>
<%= link_to project.name, project_path(project), :class => "pro_new_users mt5 fl" %>
<br/>
<span class=" c_grey mt3"><%=h time_tag(project.created_on) %></span>
<span class=" c_grey mt3"><%=h time_tag(project.created_on) %></span>
</div>
</li>
<% end %>

View File

@ -1,28 +1,28 @@
<div class="container-big mb10">
<div class="project_r_h" style="width:970px;">
<h2 class="project_h2"><%= l(:label_user_watcher)%></h2>
</div>
<div class="st_list2" style="width:970px;">
<div class="st_box">
<a href="#" class="fr fb mb5" >加入时间</a>
<div class="cl"></div><!--st_box_top end-->
<% for user in @project.watcher_users %>
<div class="st_boxlist">
<a href="javascript:" class="st_img">
<%= user.nil? ? '' : (image_tag(url_to_avatar(user), :width => 32, :height => 32)) %>
</a>
<span class="fl ml10 c_grey"><%= l(:label_username)%></span>
<%= link_to(user.name, user_path(user),:class => "ml10 c_blue02") %>
<span class="fr c_grey"><%= format_date(user.created_on) %></span>
</div>
<div class="cl"></div>
<% end%>
<div class="cl"></div>
</div>
</div>
<% html_title(l(:label_followers)) -%>
<div class="pro_new_info mb10">
<h2 class="clear">成员<span class="fr pro_new_font mr15" > 本页面展示关注了 <%= link_to @project.owner.try(:show_name), user_path(@project.owner) %>/<%= link_to @project.name, project_path(@project) %> 的用户</span></h2>
<ul class="clear pro_new_users_box">
<% @watchers.each do |user| %>
<li class="clear">
<%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_path(user), :alt => "用户头像", :class => "pro_new_users fl mr5" %>
<div class="fl mt5 clear">
<%= link_to user.try(:show_name), user_path(user), :class => "pro_new_users mt5 fl" %>
<!-- <span class="ml5 mr5 mt5 fl"> / </span>
<%#= link_to project.name, project_path(project), :class => "pro_new_users mt5 fl" %>-->
<br/>
<span class=" c_grey mt3 fl"><%=h time_tag(user.created_on) %></span>
</div>
</li>
<% end %>
</ul>
</div>
<div style="text-align:center;">
<div class="pages" style="width:auto; display:inline-block;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @watcher_pages, @watchers_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
<div class="cl"></div>

View File

@ -226,7 +226,7 @@ zh:
button_download: 下载
button_more: "更多"
button_delete: 删除
button_unfollow: 取消关注
button_unfollow: 关注
button_follow: 关注
button_watch: 跟踪
button_unwatch: 取消跟踪

View File

@ -52,7 +52,7 @@ zh:
label_agree_join_project: 同意加入
label_apply_project: "加入"
label_button_following: "添加关注"
label_button_following: "关注"
label_project_collect: 收藏
label_project_collect_cancel: 取消收藏
label_exit_project: 退出项目

View File

@ -867,6 +867,7 @@ a.pro_new_project_name{ width: 250px; overflow: hidden;white-space: nowrap;text-
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: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; }
.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; }
@ -1028,7 +1029,7 @@ textarea.muban_textarea{ width: 98.5%;border:1px solid #ddd; background:#fff; co
.pro_new_users_box{ margin:0 10px;}
.pro_new_users_box li{ width:25%; float: left; margin:10px 0;}
.pro_new_users{ }
a.pro_new_users { max-width:80px; overflow:hidden;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; word-break:break-all; display: inline-block; font-weight: bold; color: #666;}
a.pro_new_users { max-width:130px; overflow:hidden;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; word-break:break-all; display: inline-block; font-weight: bold; color: #666;}
a:hover.pro_new_users {color: #3b94d6}
.pro_new_users img{ width:40px;height:40px; border: 3px solid #fff;-webkit-border-radius:50px;-moz-border-radius:50px;-o-border-radius:50px;border-radius:50px;}
.pro_new_users img:hover{border: 3px solid #e6e6e6;}