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(){
$(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();
$(this).parent().css("display","none");
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| %>
<p class="new_file">
Destroy?<%= f.check_box :to_destroy %>
<%= render :partial => "ad_image_form", :locals => { :f => f } %>
</p>
<%= image_tag ad_image.file %>
<div>
Destroy?<%= f.check_box :to_destroy %>
<%= render :partial => "ad_image_form", :locals => { :f => f } %>
</div>
<% end %>

View File

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

View File

@ -10,9 +10,8 @@
<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.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>
<%= 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 %>