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

45 lines
3.5 KiB
Plaintext

<ul>
<li class="homepagePostSettingIcon">
<% if User.current.admin? || (User.current.logged? ) %>
<% if User.current.admin? || ((is_project_manager?(User.current, project) || file.author_id == User.current.id) && project_contains_attachment?(project, file)) %>
<% if User.current.admin? || ((delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project") %>
<ul class="homepagePostSettiongText">
<% if hidden_unproject_infos %>
<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>
<% else %>
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send_hidden('#{file.id}','#{User.current.id}','file')") %></li>
<% end %>
<% if params[:tag_name].blank? %>
<li><%= link_to '更新版本',attachments_versions_path(file, :project_id => project.id), :class => "postOptionLink", :remote => true %></li>
<% else %>
<li><%= link_to '更新版本',attachments_versions_path(file, :tag_name => params[:tag_name].force_encoding("UTF-8"), :project_id => project.id, :other => params[:other]),:class => "postOptionLink",:remote=>true %></li>
<% end %>
<% if project.is_public? %>
<li>
<span id="is_public_<%= file.id %>">
<% if params[:tag_name].blank? %>
<%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid => file.id, :newtype=>(file.is_public? ? 0:1), :project_id => project.id), :remote=>true,:class=>"postOptionLink",:method => :post %>
<% else %>
<%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid => file.id, :newtype=>(file.is_public? ? 0:1), :tag_name => params[:tag_name].force_encoding("UTF-8"), :project_id => project.id, :other => params[:other]), :remote=>true,:class=>"postOptionLink",:method => :post %>
<% end %>
</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">
<% if hidden_unproject_infos %>
<li><%= link_to("发&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
<% else %>
<li><%= link_to("发&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send_hidden('#{file.id}','#{User.current.id}','file')") %></li>
<% end %>
</ul>
<% end %>
<% end %>
</li>
</ul>