fix i18n vars in ad_banner

This commit is contained in:
Matthew K. Fu JuYuan 2012-04-17 15:21:43 +08:00
parent 06a3128be5
commit a9a4ca6ede
8 changed files with 24 additions and 19 deletions

View File

@ -40,14 +40,13 @@ class Admin::AdBannersController < ApplicationController
end end
def realtime_preview def realtime_preview
@ad_banner = AdBanner.find(params[:id]).clone @ad_banner = AdBanner.find(params[:id]).preview_clone
debugger #@ad_banner.update_attributes(params[:ad_banner]).update_attributes(params[:ad_images])
@ad_banner.update_attributes(params[:ad_banner])
end end
def index def index
@ad_banners = AdBanner.all @ad_banners = AdBanner.all
@active = @ad_banners.first @active = @ad_banners.first
end end
end end

View File

@ -13,7 +13,11 @@ class AdBanner
FX_TYPES = ["blindX","blindY","blindZ","cover","curtainX","curtainY","fade","fadeZoom","growX","growY","scrollUp","scrollDown","scrollLeft","scrollRight","scrollHorz","scrollVert","shuffle","slideX","slideY","toss","turnUp","turnDown","turnLeft","turnRight","uncover","wipe","zoom"] FX_TYPES = ["blindX","blindY","blindZ","cover","curtainX","curtainY","fade","fadeZoom","growX","growY","scrollUp","scrollDown","scrollLeft","scrollRight","scrollHorz","scrollVert","shuffle","slideX","slideY","toss","turnUp","turnDown","turnLeft","turnRight","uncover","wipe","zoom"]
def preview_clone
preview_banner = self.clone
preview_banner.ad_images = self.ad_images
preview_banner
end
# def new_ad_images(*attrs) # def new_ad_images(*attrs)
# debugger # debugger
# a=1 # a=1

View File

@ -12,8 +12,8 @@
<div> <div>
<%= render :partial => "ad_image_update", :collection => ad_banner_tab.ad_images,:as => :ad_image,:locals=>{:ad_banner => ad_banner_tab} %> <%= render :partial => "ad_image_update", :collection => ad_banner_tab.ad_images,:as => :ad_image,:locals=>{:ad_banner => ad_banner_tab} %>
<%#= render :partial => 'new_add_banner_file', :object => ad_banner_tab.ad_images.build, :locals => { :field_name => "new_ad_images[]", :f => f, :classes => "r_destroy" } %> <%#= render :partial => 'new_add_banner_file', :object => ad_banner_tab.ad_images.build, :locals => { :field_name => "new_ad_images[]", :f => f, :classes => "r_destroy" } %>
<%= link_to 'Add AdImage',new_admin_ad_banner_ad_image_path(ad_banner_tab) %> <%= link_to t("admin.ad.new_image"),new_admin_ad_banner_ad_image_path(ad_banner_tab) ,:class => "btn btn-primary"%>
<%= link_to "NewPreview", realtime_preview_admin_ad_banner_path(ad_banner_tab) , :class=>'preview_trigger'%> <%= link_to t("modal.preview"), realtime_preview_admin_ad_banner_path(ad_banner_tab) , :class=>'preview_trigger btn btn-success'%>
</div> </div>
<% end -%> <% end -%>

View File

@ -5,8 +5,8 @@
<%= "#{ad_image.post_date ||'NeedReset' }~#{ad_image.unpost_date || 'NeedReset'}" %> <%= "#{ad_image.post_date ||'NeedReset' }~#{ad_image.unpost_date || 'NeedReset'}" %>
</p> </p>
<p> <p>
<%= link_to 'Edit',edit_admin_ad_banner_ad_image_path(ad_banner,ad_image),:class => 'btn btn-primary' %> <%= link_to t('edit'),edit_admin_ad_banner_ad_image_path(ad_banner,ad_image),:class => 'btn btn-primary' %>
<%= link_to 'Del',admin_ad_banner_ad_image_path(ad_banner,ad_image),:class => 'btn',:method => :delete,:confirm => t('sure?') %> <%= link_to t('delete'),admin_ad_banner_ad_image_path(ad_banner,ad_image),:class => 'btn',:method => :delete,:confirm => t('sure?') %>
</p> </p>
</li> </li>

View File

@ -23,7 +23,7 @@
<script type='text/javascript' src='/static/kernel.js'></script> <script type='text/javascript' src='/static/kernel.js'></script>
<script type='text/javascript'> <script type='text/javascript'>
$('#slideshow-<%=ad_banner.title.dehumanize%>').on('show', function () { $('#slideshow-<%=ad_banner.title.dehumanize%>').on('show', function () {
$('#slideshow-banner_1').find(".ad_banner_slideshow").cycle({delay: -1000, fx: '<%= ad_banner.ad_fx.nil?? 'fade': ad_banner.ad_fx %>', timeoutFn: getTimeout }); $('#slideshow-<%=ad_banner.title.dehumanize%>').find(".ad_banner_slideshow").cycle({delay: -1000, fx: '<%= ad_banner.ad_fx.nil?? 'fade': ad_banner.ad_fx %>', timeoutFn: getTimeout });
}); });
</script> </script>

View File

@ -4,6 +4,8 @@
<% content_for :page_specific_javascript do %> <% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/datepicker" %> <%= javascript_include_tag "lib/datepicker" %>
<%= javascript_include_tag "lib/date.format" %> <%= javascript_include_tag "lib/date.format" %>
<%= javascript_include_tag "inc/modal-preview" %>
<% end %> <% end %>
@ -180,9 +182,9 @@
</div> </div>
<!--Post End--> <!--Post End-->
<div class="form-actions"> <div class="form-actions">
<button class="btn btn-success" type="submit">Preview/預覽</button> <%= link_to t("modal.preview"), realtime_preview_admin_ad_banner_path(@ad_image.ad_banner) ,:class=>"preview_trigger btn btn-success" rescue nil%>
<button class="btn btn-primary" type="submit">Submit/送出</button> <button class="btn btn-primary" type="submit"><%= t("submit")%></button>
<button class="btn" type="reset">Cancel/取消</button> <button class="btn" type="reset"><%= t("cancel")%></button>
</div> </div>
</form> </form>
</div> </div>

View File

@ -32,9 +32,9 @@
<%= content_tag :li, :class => active_for_controllers('ad_banners', 'ad_images') do -%> <%= content_tag :li, :class => active_for_controllers('ad_banners', 'ad_images') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.ad_banner'), admin_ad_banners_path %> <%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.ad_banner'), admin_ad_banners_path %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('ad_banners', 'ad_images')) do -%> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('ad_banners', 'ad_images')) do -%>
<%= content_tag :li, link_to(t('admin.all_ad_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %> <%= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %>
<%= content_tag :li, link_to(t('admin.new_ad_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %> <%= content_tag :li, link_to(t('admin.ad.new_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %>
<%= content_tag :li, link_to(t('admin.new_ad_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %> <%= content_tag :li, link_to(t('admin.ad.new_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %>
<% end %> <% end %>
<% end %> <% end %>

View File

@ -26,13 +26,13 @@ Orbit::Application.routes.draw do
resources :ad_banners do resources :ad_banners do
member do
match 'preivew' => 'ad_banners#realtime_preview',:as => :realtime_preview,:via => :put
end
collection do collection do
match 'new_ad_image' => 'ad_images#new',:as => :new_ad_image,:via => :get match 'new_ad_image' => 'ad_images#new',:as => :new_ad_image,:via => :get
match 'new_ad_image' => 'ad_images#create',:as => :create_ad_image,:via => :post match 'new_ad_image' => 'ad_images#create',:as => :create_ad_image,:via => :post
end end
member do
match 'preivew' => 'ad_banners#realtime_preview',:as => :realtime_preview,:via => :put
end
resources :ad_images ,:except => [:show,:index] resources :ad_images ,:except => [:show,:index]
end end
resources :dashboards resources :dashboards