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

82 lines
3.9 KiB
Plaintext

<% attachmenttypes = @project.attachmenttypes %>
<% sufixtypes = @project.contenttypes %>
<div class="project_r_h">
<h2 class="project_h2"><%= l(:lable_file_sharingarea) %></h2>
</div>
<div class="content-title-top">
<%#= link_to(l(:label_attachment_new), 'javascript:void(0);', :onclick=>"$('#file_buttons').slideToggle();", :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %>
<div class="clearfix"></div>
<div id="file_buttons" class="nhidden">
<%= link_to(l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @project) %>
<%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %>
<p></p>
<div id="upload_file_div" class="relation_file_div <%= !@flag.nil?&&@flag=="true" ? '' : 'hidden'%>">
<%= render :partial => 'new', locals: {project: @project} %>
</div>
<div id="relation_file_div" class="relation_file_div hidden">
<fieldset>
<legend><%= l(:label_search)%></legend>
<%= form_tag(
attachments_autocomplete_path(:format => 'js'),
:remote => true,
:method => :post) do %>
<%= label_tag(:attach_search, l(:label_search_by_keyword)) %>
<%= text_field_tag(:attach_search) %>
<%#= submit_tag("Search") %>
<% end -%>
<%= form_tag attach_relation_path(:format => 'js'),
method: :post,
remote: true,
id: "relation_file_form",
:class => 'hidden' do %>
<%= hidden_field_tag(:class_name, 'Project') %>
<%= hidden_field_tag(:class_id, params[:project_id]) %>
<div id="relation_file">
</div>
<div class="kclearfix" style='margin-top: 10px;'>
<%= submit_tag(l(:button_add)) -%>
</div>
<% end -%>
</fieldset>
<div class="line_under" style="margin:20px 0px;"></div>
</div>
</div>
<div class="box" id="files-box">
<label for="files-box" style="font-weight:bold;">
&nbsp;&nbsp;
<%= l(:label_files_filter) %>
</label>
<% if attachmenttypes.any? %>
&nbsp; &nbsp; &nbsp;
<label for="attachment_browse_label">
<%= l(:attachment_browse) %>
</label>
<%= select_tag "attachment_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_from_collection_for_select(attachmenttypes, "id", "typeName",params[:type]),
:onchange => "attachmenttypes_searchex(this.value)" %>
<% end %>
<% if sufixtypes.any? %>
&nbsp;
<label for="attach_sufix_browse_label">
<%= l(:attachment_sufix_browse) %>
</label>
<%= select_tag "attach_sufix_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_for_select(sufixtypes),
:onchange => "attachment_contenttypes_searchex(this.value)" %>
<% end %>
</div>
</div>
<%= javascript_tag "observeSearchfield('attach_search', null, '#{ escape_javascript attachments_autocomplete_path(:project_id => @project.id, :format => 'js') }')" %>
<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %>
<div id="all_browse_div" class="all_browse_div">
<%#= render :partial => 'show_all_attachment' %>
<% if (@attachtype==0 && @contenttype=='0') || (@attachtype.nil? && @contenttype.nil?) %>
<%= render partial: "show_all_attachment"%>
<%else%>
<%= render partial: "sort_by_attachtypel"%>
<%end%>
</div>
<% html_title(l(:label_attachment_plural)) -%>