项目顶端框架搭建及权限判断

This commit is contained in:
huang 2016-11-08 10:23:02 +08:00
parent cceadb02ce
commit a3dfd03e81
4 changed files with 17 additions and 7 deletions

View File

@ -533,7 +533,7 @@ class ProjectsController < ApplicationController
@project.update_attribute(:is_public, 1)
end
end
# by young
# include CoursesHelper
def member
# 消息"同意加入项目"
@ -597,6 +597,10 @@ class ProjectsController < ApplicationController
end
def member_forked
@members_forked = User.find_by_sql("SELECT u.* FROM `projects` p,`users` u where p.user_id = u.id and p.forked_from_project_id = #{@project.id} ;")
end
def update_message_status(user, project)
# 更新加入项目消息
project__messages = ForgeMessage.where("forge_message_type in ('ProjectInvite', 'JoinProject', 'RemoveFromProject') and user_id =? and project_id =? ", user, project)

View File

@ -16,16 +16,18 @@
</li>
<% end %>
<% 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, enshrine_project_path(@project), :class => "pro_new_topbtn fl" %>
</li>
<!--项目创建者不能退出项目-->
<% if User.current.id != @project.user_id %>
<%= exit_project_link(@project) %>
<%= "已加入" %>
<%= link_to "#{Member.where(:project_id => @project.id).count}", project_member_path(@project), :class => 'pro_new_topbtn fl', :title => "项目成员" %>
<% end %>
<% end %>
<!--项目fork-->
<% if @project.gpid && User.current.id != @project.user_id %>
<div class="fr mt5"><%= link_to "<span class='vl_fork'></span>".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn", :target => "_blank", :confirm=>"平台将为您创建一个新的同名项目和版本库,请问是否继续?" %>
<span href="javascript:void(0);" class="vl_btn_2 fb"><%= link_to @project.forked_count.to_i, member_forked_project_path(@project) %></span>
</div>
<% end %>

View File

@ -0,0 +1,3 @@
<% @members_forked.each do |id| %>
<% %>
<% end %>

View File

@ -775,6 +775,7 @@ RedmineApp::Application.routes.draw do
get 'member', :to => 'projects#member', :as => 'member'
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'
get 'file', :action => 'file', :as => 'file'
get 'statistics', :action => 'statistics', :as => 'statistics'
get 'repository_tree_changes', :action => 'repository_tree_changes', :as => 'repository_tree_changes'