can add multiple file

This commit is contained in:
Rueshyna 2012-11-29 11:21:05 +08:00
parent 247b2fa76e
commit 349ce37ca4
1 changed files with 7 additions and 13 deletions

View File

@ -185,26 +185,20 @@
<span class="icon-plus input_append"></span>
<ul>
<li class="s_grid_row">
<div> <%= label_tag("", "Full Text", class: "s_grid_2 s_grid") %></div>
<!--
<%= f.fields_for :writing_journal_files, @writing_journal do |wjf| %>
<%= wjf.file_field :file %>
<% end %>
-->
<table class="table table-condensed">
<table>
<thead>
<tr>
<th>File</th>
<th>File Name</th>
<th class="span1"></th>
<th class="s_grid_2 s_grid">File</th>
<th class="s_grid_2 s_grid">File Name</th>
<th><span id='add_plugin_file' class="icon-plus input_append"></span></th>
</tr>
</thead>
<tfoot>
<tr>
<td style="text-align:center" colspan="3">
<td>
<div id='add_plugin_file' class="info_input plugin_files_block">
<%= hidden_field_tag 'plugin_file_field_count', @writing_journal.writing_journal_files.count %>
<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i> add </span></a>
<a class="add"><span><i class="icon-plus icon-white"></i> add </span></a>
</div>
</td>
</tr>
@ -245,7 +239,7 @@
<script>
$('#add_plugin_file a.add').live('click', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_add_plugin_files", "g");
var old_id = new RegExp("new_writing_journal_files", "g");
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_file', f, :writing_journal_files) %>").replace(old_id, new_id));
});