socialforge/app/views/files/_file_tools.html.erb

32 lines
1.9 KiB
Plaintext
Raw Normal View History

2016-01-05 10:01:56 +08:00
<% if User.current.logged? %>
<% if (is_project_manager?(User.current, @project) || file.author_id == User.current.id) && project_contains_attachment?(@project,file) %>
<% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @project.id && file.container_type == "Project" %>
<ul class="homepagePostSettiongText">
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %></li>
<li><%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %></li>
<% if @project.is_public? %>
<li>
<span id="is_public_<%= file.id %>">
<%= link_to (file.is_public? ? "设为私有":"设为公开"),
update_file_dense_attachments_path(:attachmentid=>file.id,
:newtype=>(file.is_public? ? 0:1)),
:remote=>true,
:class=>"postOptionLink",
:method => :post %>
</span>
</li>
<%end%>
<li>
<%= link_to( '删除资源', attachment_path(file),
:data => {:confirm => l(:text_are_you_sure)},
:method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @project.id && file.container_type == "Project" && file.destroyable %>
</li>
</ul>
<% end %>
<%else%>
<ul class="resourceSendO">
<li><%= link_to("发&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}')") %></li>
</ul>
<% end %>
<% end %>