have done multiple file

This commit is contained in:
Rueshyna 2012-11-29 12:13:56 +08:00
parent 349ce37ca4
commit ead3a47243
2 changed files with 7 additions and 23 deletions

View File

@ -244,7 +244,7 @@
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_file', f, :writing_journal_files) %>").replace(old_id, new_id)); $(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_file', f, :writing_journal_files) %>").replace(old_id, new_id));
}); });
$('.add_plugin_files_block a.delete').live('click', function(){ $('.action a.delete').live('click', function(){
$(this).parents('.list_item').remove(); $(this).parents('.list_item').remove();
}); });

View File

@ -1,35 +1,19 @@
<tr id="<%= "plugin_file_#{form_file.id}" if !form_file.new_record? %>" class='list_item'> <tr id="<%= "plugin_file_#{form_file.id}" if !form_file.new_record? %>" class="list_item">
<td> <td>
<div class="control-group"> <div>
<div class="controls"> <%= f.file_field :file, class: "s_grid_1 s_grid" %>
<%= f.file_field :file, class: "s_grid_1 s_grid" %> <%= form_file.file.file ? ( link_to t(:view), form_file.file.url, {:class => 'btn s_grid_1 s_grid', :target => '_blank', :title => t(:view)} ) : '' %>
<%= form_file.file.file ? ( link_to t(:view), form_file.file.url, {:class => 'btn s_grid_1 s_grid', :target => '_blank', :title => t(:view)} ) : '' %>
</div>
</div> </div>
</td> </td>
<td> <td>
<%= f.text_field :title, :class=>'s_grid_1 s_grid' %>
<div class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<%= f.fields_for :file_title_translations do |f| %>
<div class="control-group">
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.from_locale(locale) %></label>
<div class="controls">
<%= f.text_field locale, :class=>'s_grid_1 s_grid', :value => (form_file.file_title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
</div>
<% end %>
</div>
</td> </td>
<td> <td>
<span class="action"> <span class="action">
<% if form_file.new_record? %> <% if form_file.new_record? %>
<a class="delete"><i class="icon-remove"></i></a> <a class="delete"><i class="icon-remove"></i></a>
<% else %> <% else %>
<%= f.hidden_field :id %> <%= f.hidden_field :id %>
<a class="remove_existing_record"><i class="icon-remove"></i></a> <a class="remove_existing_record"><i class="icon-remove"></i></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>