收藏者列表

This commit is contained in:
huang 2016-10-27 12:39:44 +08:00
parent 0272e95eb7
commit 05b206a7cf
4 changed files with 37 additions and 2 deletions

View File

@ -852,12 +852,16 @@ class ProjectsController < ApplicationController
end
end
# 项目收藏
def store_mine
member = Member.where(:project_id => params[:id], :user_id => User.current.id).first
member.try(:is_collect) == 1 ? member.update_column(:is_collect, 0) : member.update_column(:is_collect, 1)
end
# 项目收藏
def enshrine
@stores = Member.where(:project_id => params[:id], :is_collect => 1).includes(:user)
end
#加入私有项目
def join_project
respond_to do |format|

View File

@ -18,7 +18,9 @@
<% else %>
<!--项目收藏-->
<% my_stores = Member.where(:project_id => @project.id, :is_collect => 1).count %>
<li class="mr5 fl"><%= store_project_link(@project.id, User.current.id) %><%= link_to my_stores, store_mine_project_path(@project), :class => "pro_new_topbtn fl" %></li>
<li class="mr5 fl"><%= store_project_link(@project.id, User.current.id) %>
<%= link_to my_stores, enshrine_project_path(@project), :class => "pro_new_topbtn fl" %>
</li>
<!--项目创建者不能退出项目-->
<% if User.current.id != @project.user_id %>
<%= exit_project_link(@project) %>

View File

@ -0,0 +1,28 @@
<div class="container-big mb10">
<div class="project_r_h" style="width:970px;">
<h2 class="project_h2 fl" style="width: 120px;">收藏用户列表</h2>
</div>
<div class="member_content">
<%= error_messages_for 'member' %>
<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-->
<% @stores.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>
<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>
<div class="cl"></div>
<% end%>
<div class="cl"></div>
</div>
</div>
</div>
</div>

View File

@ -751,6 +751,7 @@ RedmineApp::Application.routes.draw do
#by young
get 'member', :to => 'projects#member', :as => 'member'
match 'store_mine', :to => 'projects#store_mine', :as => 'store_mine'
match 'enshrine', :to => 'projects#enshrine', :as => 'enshrine'
get 'file', :action => 'file', :as => 'file'
get 'statistics', :action => 'statistics', :as => 'statistics'
get 'repository_tree_changes', :action => 'repository_tree_changes', :as => 'repository_tree_changes'