orbit-personalbook/app/views/panel/personal_book/desktop/personal_books/_form_file.html.erb

51 lines
2.2 KiB
Plaintext

<tr id="<%= "plugin_file_#{form_file.id}" if !form_file.new_record? %>" class="list_item">
<td>
<div>
<% if form_file.new_record? %>
<%= f.file_field :file, class: "s_grid_2", onchange:"var temp = o.filepathSplitter(this.value);temp=temp[temp.length - 1];this.parentNode.getElementsByTagName('label')[0].innerHTML = temp;var inputs = this.parentNode.parentNode.parentNode.getElementsByClassName('title_field');inputs[0].value = temp;inputs[1].value = temp;" %>
<label></label>
<% else %>
<%= link_to(image_tag(check_file_type(form_file.file.url)),
form_file.file.url,
:class => "file",
"target" => "_blank",
"title" => form_file.title) %>
<% end %>
</div>
</td>
<% @site_in_use_locales.each_with_index do |locale, i| %>
<% style = locale != I18n.locale.to_s ? 'style=display:none;' : "" %>
<% data = "data-language=" + locale %>
<td <%= style %> <%= data %>>
<%= f.fields_for :file_title_translations do |f| %>
<%= f.text_field locale,
class: 's_grid_4 title_field',
placeholder: I18nVariable.from_locale(locale),
value: (form_file.file_title_translations[locale] rescue nil) %>
<% end %>
</td>
<td <%= style %> <%= data %>>
<%= f.fields_for :file_description_translations do |f| %>
<%= f.text_field locale,
class: 's_grid_4',
placeholder: I18nVariable.from_locale(locale),
value: (form_file.file_description_translations[locale] rescue nil) %>
<% end %>
</td>
<% end %>
<td>
<span class="action">
<% if form_file.new_record? %>
<a class="delete"><i class="icon-remove" style="cursor:pointer;"></i></a>
<% else %>
<%= f.hidden_field :id %>
<a class="remove_existing_record" style="cursor:pointer;"><i class="icon-remove"></i></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
<% end %>
<%= form_file.file.file ? ( link_to '', form_file.file.url, {:class => 'icon-eye-open', :target => '_blank', :title => t(:view)} ) : '' %>
</span>
</td>
</tr>