move design file field to partial
This commit is contained in:
parent
612ed629bc
commit
e3a50ccf69
|
@ -11,9 +11,9 @@ $(".r_snapshot").hover(
|
|||
$('input.multi_files').change(function(){
|
||||
$(this).prev("ul").append("<li>"+$(this).val()+"</li>");
|
||||
new_node =$(this).clone();
|
||||
new_node.css("display","none");
|
||||
$(this).parent().append(new_node);
|
||||
$(this).val("");
|
||||
$(this).css("display","none");
|
||||
new_node.val("");
|
||||
$(this).after(new_node)
|
||||
});
|
||||
|
||||
$('a.remove_mark').live("click",function(){
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<% fieldname_p = fieldname.pluralize %>
|
||||
<%= f.label "fieldname", t('admin.'+fieldname) %>
|
||||
<ul>
|
||||
<% object.send(fieldname_p).each do |t| %>
|
||||
<li class="r_destroy r_snapshot"> <%= t.file_filename %>
|
||||
<%=fields_for "design["+(fieldname_p)+"][]",t,:index=>nil do |f| %>
|
||||
<%= f.hidden_field :id %>
|
||||
<%= f.hidden_field :to_destroy %>
|
||||
<%end%>
|
||||
<a class="remove_mark" href="#">Del</a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<%= fields_for "design["+(fieldname_p)+"][]", object, :index => nil do |f| %>
|
||||
<%= f.file_field :file ,{:class=>"multi_files",:rtype=>rtype}%>
|
||||
<% end %>
|
|
@ -25,49 +25,13 @@
|
|||
|
||||
|
||||
<p>
|
||||
<%= f.label "stylesheet", t('admin.stylesheet') %>
|
||||
<ul>
|
||||
<% @design.stylesheets.each do |t| %>
|
||||
<li class="r_destroy r_edit" ><%= t.file_filename %>
|
||||
<%= fields_for "design[stylesheets][]", t, :index => nil do |f| %>
|
||||
<%= f.hidden_field :id %>
|
||||
<%= f.hidden_field :to_destroy %>
|
||||
<%end%>
|
||||
<a class="remove_mark" href="#">Del</a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<%= fields_for "design[stylesheets][]", @design, :index => nil do |f| %>
|
||||
<%= f.file_field :file ,{:class=>"multi_files",:rtype=>"stylesheets"}%>
|
||||
<% end %>
|
||||
<%= render :partial => 'design_file' ,:locals => { :fieldname=>"stylesheet",:object=>@design ,:f=>f,:rtype=>'stylesheets' } %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= f.label "javascript", t('admin.javascript') %>
|
||||
<ul>
|
||||
<% @design.javascripts.each do |t| %>
|
||||
<li class="r_destroy r_edit" ><%= t.file_filename %>
|
||||
<%=fields_for "design[javascripts][]",t,:index=>nil do |f| %>
|
||||
<%= f.hidden_field :id %>
|
||||
<%= f.hidden_field :to_destroy %>
|
||||
<%end%>
|
||||
<a class="remove_mark" href="#">Del</a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<%= fields_for "design[javascripts][]", @design, :index => nil do |f| %>
|
||||
<%= f.file_field :file,{:class=>"multi_files",:rtype=>"javascripts"} %>
|
||||
<% end %>
|
||||
<%= render :partial => 'design_file' ,:locals => { :fieldname=>"javascript",:object=>@design ,:f=>f,:rtype=>'javascripts' } %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= f.label "image", t('admin.image') %>
|
||||
<ul>
|
||||
<% @design.images.each do |t| %>
|
||||
<li class="r_destroy r_snapshot" path="<%= t.file %>" item_id="<%=t.id %>"><%= t.file_filename %>
|
||||
<a class="remove_mark" href="#">Del</a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<%= fields_for "design[images][]", @design, :index => nil do |f| %>
|
||||
<%= f.file_field :file ,{:class=>"multi_files",:rtype=>"images"}%>
|
||||
<% end %>
|
||||
<%= render :partial => 'design_file' ,:locals => { :fieldname=>"image",:object=>@design ,:f=>f,:rtype=>'' } %>
|
||||
</p>
|
||||
|
|
Loading…
Reference in New Issue