faq/app/views/admin/faqs/_form_qa_file.html.erb

69 lines
3.2 KiB
Plaintext
Raw Normal View History

2014-05-08 07:33:39 +00:00
<% if form_qa_file.new_record? %>
<div class="fileupload fileupload-new start-line" data-provides="fileupload">
<% else %>
2020-02-29 06:27:06 +00:00
<div class="fileupload fileupload-exists start-line" data-provides="fileupload">
2014-05-08 07:33:39 +00:00
<% if form_qa_file.file.blank? %>
<%= t(:no_file) %>
<% else %>
<%= link_to content_tag(:i) + form_qa_file.file_identifier, form_qa_file.file.url, {:class => 'file-link file-type', :target => '_blank', :title => form_qa_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_qa_file.new_record? || form_qa_file.file.blank?) ? t(:select_file) : t(:change_file) %></span>
</div>
</label>
<span class="add-on icons-pencil" title='<%= t(:alternative) %>'></span>
<span class="tab-content">
2014-05-16 09:22:13 +00:00
<% @site_in_use_locales.each_with_index do |locale, i| %>
2014-05-08 07:33:39 +00:00
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale.to_s %>">
<%= f.fields_for :title_translations do |f| %>
<%= f.text_field locale, :class => "input-medium", placeholder: t(:alternative), :value => (form_qa_file.title_translations[locale] rescue nil) %>
<% end %>
</span>
<% end %>
</span>
<span class="add-on icons-pencil" title='<%= t(:description) %>'></span>
<span class="tab-content">
2014-05-16 09:22:13 +00:00
<% @site_in_use_locales.each_with_index do |locale, i| %>
2014-05-08 07:33:39 +00:00
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale.to_s %>">
<%= f.fields_for :description_translations do |f| %>
<%= f.text_field locale, :class => "input-medium", placeholder: t(:description), :value => (form_qa_file.description_translations[locale] rescue nil) %>
<% end %>
</span>
<% end %>
</span>
</span>
2021-11-15 04:35:23 +00:00
<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| %>
<li>
<label class="checkbox">
2021-11-15 05:15:57 +00:00
<%= check_box_tag "qa[qa_files_attributes][#{( form_qa_file.new_record? ? 'new_bulletin_files' : "#{i}" )}][choose_lang][]", locale, form_qa_file.choose_lang.include?(locale.to_s) %>
2021-11-15 04:35:23 +00:00
<%= t(locale.to_s) %>
</label>
</li>
<% end %>
</ul>
2021-11-15 05:15:57 +00:00
<%= hidden_field_tag "qa[qa_files_attributes][#{( form_qa_file.new_record? ? 'new_bulletin_files' : "#{i}" )}][choose_lang][]", '' %>
2021-11-15 04:35:23 +00:00
</span>
2014-05-08 07:33:39 +00:00
<% if form_qa_file.new_record? %>
<span class="delete_file add-on btn" title="<%= t(:delete_) %>">
<a class="icon-trash"></a>
</span>
<% else %>
<span class="remove_existing_record add-on btn" title="<%= t(:remove) %>">
<%= f.hidden_field :id %>
<a class="icon-remove"></a>
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
</span>
<% end %>
</div>
</div>