fix js bugs,partial bugs

This commit is contained in:
Matthew Kaito Juyuan Fu 2012-02-04 10:32:24 +08:00
parent 2b2b057583
commit ac0b681779
5 changed files with 25 additions and 18 deletions

View File

@ -1,5 +1,5 @@
$("button.multi_files").live("click", function(){ $("button.multi_files").live("click", function(){
$(this).parent().prev("ul").append("<li>" + $(this).val() +'Time:'+ $(this).siblings('.ad_time').val()+'Link:'+$(this).siblings('.ad_out_link').val()+ "</li>"); $("#new_add_banner_file_holder").append("<li>" + $(this).val() +'Time:'+ $(this).siblings('.ad_time').val()+'Link:'+$(this).siblings('.ad_out_link').val()+ "</li>");
new_node = $(this).parent().clone(); new_node = $(this).parent().clone();
$(this).parent().css("display","none"); $(this).parent().css("display","none");
new_node.children('input.multi_files').val(""); new_node.children('input.multi_files').val("");

View File

@ -0,0 +1,8 @@
<div id="basic_block" class="roles_block">
<%= image_tag ad_image.file %>
<p>
Time to next: <%= ad_image.time_to_next %>
Intro: <%= ad_image.picture_intro %>
Out Link <%= link_to ad_image.out_link %> by <%= ad_image.link_open %>
</p>
</div>

View File

@ -1,8 +1,9 @@
<%= fields_for "ad_banner[existing_ad_images][#{ad_image.id}]", ad_image do |f| %> <%= fields_for "ad_banner[existing_ad_images][#{ad_image.id}]", ad_image do |f| %>
<p class="new_file"> <%= image_tag ad_image.file %>
<div>
Destroy?<%= f.check_box :to_destroy %> Destroy?<%= f.check_box :to_destroy %>
<%= render :partial => "ad_image_form", :locals => { :f => f } %> <%= render :partial => "ad_image_form", :locals => { :f => f } %>
</p> </div>
<% end %> <% end %>

View File

@ -1,8 +1,6 @@
<% content_for :page_specific_css do %> <% content_for :page_specific_css do %>
<%= stylesheet_link_tag "ad_banner" %> <%#= javascript_include_tag "ad_banner" #this line wont work %>
<% end %> <script type="text/javascript" src="<%= asset_path 'ad_banner' %>"></script>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "ad_banner" %>
<% end %> <% end %>
@ -38,12 +36,13 @@
<%= f.select :ad_fx ,AdBanner::FX_TYPES %> <%= f.select :ad_fx ,AdBanner::FX_TYPES %>
</p> </p>
<p> <p>
<%= f.label :ad_images, t('admin.ad_images') %> <%#= f.label :ad_images, t('admin.ad_images') %>
<ul>
<% @ad_banner.ad_images.each do |ad_image| %> <%# @ad_banner.ad_images.each do |ad_image| %>
<%= render :partial => 'ad_image', :object => ad_image, :locals => { :field_name => "ad_images", :f => f, :classes => "r_destroy, r_edit" } %> <%#= render :partial => 'ad_image_update', :object => ad_image, :locals => { :field_name => "ad_images", :f => f, :classes => "r_destroy, r_edit" } %>
<% end %> <%# end %>
</ul> <%= render :partial => "ad_image_update", :collection => @ad_banner.ad_images,:as => :ad_image, %>
<ul id="new_add_banner_file_holder"></ul>
<%= render :partial => 'new_add_banner_file', :object => @ad_banner.ad_images.build, :locals => { :field_name => "new_ad_images[]", :f => f, :classes => "r_destroy" } %> <%= render :partial => 'new_add_banner_file', :object => @ad_banner.ad_images.build, :locals => { :field_name => "new_ad_images[]", :f => f, :classes => "r_destroy" } %>
</p> </p>

View File

@ -10,9 +10,8 @@
<li><%=t('admin.ad_banner.unpost_date') %> <%= @ad_banner.unpost_date %></li> <li><%=t('admin.ad_banner.unpost_date') %> <%= @ad_banner.unpost_date %></li>
<li><%=t('admin.ad_banner.context') %> <%= @ad_banner.context %></li> <li><%=t('admin.ad_banner.context') %> <%= @ad_banner.context %></li>
<li><%=t('admin.ad_banner.direct_to_after_click') %> <%= @ad_banner.direct_to_after_click %></li> <li><%=t('admin.ad_banner.direct_to_after_click') %> <%= @ad_banner.direct_to_after_click %></li>
<li><%=t('admin.ad_banner.ad_style') %> <%= @ad_banner.ad_style %></li> <li><%=t('admin.ad_banner.ad_fx') %> <%= @ad_banner.ad_fx %></li>
</ul> </ul>
<%= render :partial => "admin/ad_banners/ad_image", :collection => @ad_banner.ad_images %> <%= render :partial => "admin/ad_banners/ad_image_show", :collection => @ad_banner.ad_images,:as => :ad_image %>