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

32 lines
2.0 KiB
Plaintext

<% 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}','#{User.current.id}','file')") %></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}','#{User.current.id}','file')") %></li>
</ul>
<% end %>
<% end %>