请求分享如果自己在项目的话则不需要申请
This commit is contained in:
parent
82f4c685da
commit
b0e4ed5ab3
|
@ -49,6 +49,21 @@ module ApplicationHelper
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 判断某个资源是否可以申请
|
||||||
|
def attach_show_allow attach_id
|
||||||
|
attachment = Attachment.find(attach_id)
|
||||||
|
case attachment.container_type
|
||||||
|
when "Project"
|
||||||
|
User.current.member_of?(attachment.container) ? true : false
|
||||||
|
when "Course"
|
||||||
|
User.current.member_of_course?(attachment.container) ? true : false
|
||||||
|
when "OrgSubfield"
|
||||||
|
User.current.member_of_org?(attachment.container) ? true : false
|
||||||
|
when "Principal"
|
||||||
|
User.current.id == attachment.author_id ? true : false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Time 2015-03-24 15:27:29
|
# Time 2015-03-24 15:27:29
|
||||||
# Author lizanle
|
# Author lizanle
|
||||||
# Description 从硬盘上删除对应的资源文件
|
# Description 从硬盘上删除对应的资源文件
|
||||||
|
|
|
@ -24,9 +24,9 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<li class="resource-list-apply fr" id="resource_apply_status_<%=attach.id %>">
|
<li class="resource-list-apply fr" id="resource_apply_status_<%=attach.id %>">
|
||||||
<% if attach.is_public == 0 && (@type == "6" || @type == "2") && attach.author != User.current %>
|
<% if attach.is_public == 0 && (@type == "6" || @type == "2") && attach.author != User.current && !attach_show_allow(attach) %>
|
||||||
<% ah = attach.get_status_by_attach(User.current.id) %>
|
<% ah = attach.get_status_by_attach(User.current.id) %>
|
||||||
<% if ah.nil? %>
|
<% if ah.nil? %>
|
||||||
<%= link_to("请求分享", apply_resource_user_path(User.current.id, :attachment_id => attach.id), :class => 'green_btn_share c_white', :remote => true) %>
|
<%= link_to("请求分享", apply_resource_user_path(User.current.id, :attachment_id => attach.id), :class => 'green_btn_share c_white', :remote => true) %>
|
||||||
<% elsif ah == 1 %>
|
<% elsif ah == 1 %>
|
||||||
等待回复
|
等待回复
|
||||||
|
|
Loading…
Reference in New Issue