archive/app/views/admin/archive_files/_form_file.html.erb

66 lines
3.0 KiB
Plaintext
Raw Permalink Normal View History

2014-05-14 11:52:06 +00:00
<% if form_file.new_record? %>
<div class="fileupload fileupload-new start-line" data-provides="fileupload">
<% else %>
<div class="fileupload fileupload-exists start-line" data-provides="fileupload">
2016-02-16 10:10:52 +00:00
<i class="icons-list-2 sort-order-icon"></i>
2014-05-14 11:52:06 +00:00
<% if form_file.file.blank? %>
<%= t(:no_file) %>
<% else %>
<%= link_to content_tag(:i) + form_file.file_identifier, form_file.file.url, {:class => 'file-link file-type', :target => '_blank', :title => form_file.file_identifier} %>
<% end %>
<% end %>
<div class="input-prepend input-append">
<label>
<span class="add-on btn btn-file" title="<%= t(:file_) %>">
<i class="icons-paperclip"></i>
<%= f.file_field :file %>
</span>
<div class="uneditable-input input-medium">
<i class="icon-file fileupload-exists"></i>
<span class="fileupload-preview"><%= (form_file.new_record? || form_file.file.blank?) ? t(:select_file) : t(:change_file) %></span>
</div>
</label>
<span class="add-on icons-pencil" title="<%= t('file.name') %>"></span>
<span class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %>
2014-05-14 11:52:06 +00:00
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
<%= f.fields_for :file_title_translations do |f| %>
<%= f.text_field locale, :class => "input-medium", placeholder: t('file.name'), :value => (form_file.file_title_translations[locale] rescue nil) %>
<% end %>
</span>
<% end %>
</span>
<span class="add-on btn-group btn" title="<%= t('archive.show_lang') %>">
<i class="icons-earth"></i> <span class="caret"></span>
<ul class="dropdown-menu">
<% @site_in_use_locales.each do |locale| %>
2014-05-14 11:52:06 +00:00
<li>
<label class="checkbox">
2015-05-01 08:48:49 +00:00
<%= check_box_tag "archive_file[archive_file_multiples_attributes][#{( form_file.new_record? ? 'new_archive_file_multiples' : "#{i}" )}][choose_lang][]", locale, form_file.choose_lang.include?(locale.to_s) %>
2014-05-14 11:52:06 +00:00
<%= t(locale.to_s) %>
</label>
</li>
<% end %>
</ul>
<%= hidden_field_tag 'archive_file[archive_file_multiples_attributes][0][choose_lang][]', '' %>
</span>
<% if form_file.new_record? %>
<span class="delete_file add-on btn" title="<%= t(:delete_) %>">
<a class="icon-trash"></a>
2016-02-16 10:10:52 +00:00
<%= f.hidden_field :sort_number, :value => "new_archive_file_sort_order_XXX", :class => "input-mini" %>
2014-05-14 11:52:06 +00:00
</span>
<% else %>
<span class="remove_existing_record add-on btn" title="<%= t(:remove) %>">
<%= f.hidden_field :id %>
2016-02-16 10:10:52 +00:00
<%= f.hidden_field :sort_number , :class => "file-sort-number-field" %>
2014-05-14 11:52:06 +00:00
<a class=" icon-remove"></a>
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
</span>
2015-03-18 09:59:03 +00:00
<span class="downloaded_times">Downloaded <b><%= form_file.download_count %></b> time<%= form_file.download_count > 1 ? "s" : "" %>.</span>
2014-05-14 11:52:06 +00:00
<% end %>
</div>
</div>