From d81ca40f90079c011c876acf70172c8570d0662a Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Fri, 13 Apr 2012 17:24:30 +0800 Subject: [PATCH] AdBanner i18n vars patch --- app/controllers/admin/ad_banners_controller.rb | 6 ++++-- app/views/admin/ad_banners/_ad_banner_tab.html.erb | 6 +++--- config/locales/en.yml | 10 ++++++++++ config/locales/zh_tw.yml | 2 ++ config/routes.rb | 1 + 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/app/controllers/admin/ad_banners_controller.rb b/app/controllers/admin/ad_banners_controller.rb index 95ce7e7c..a6f4fd5f 100644 --- a/app/controllers/admin/ad_banners_controller.rb +++ b/app/controllers/admin/ad_banners_controller.rb @@ -39,8 +39,10 @@ class Admin::AdBannersController < ApplicationController redirect_to admin_ad_banners_url end - def destroy_ad_image - + def realtime_preview + @ad_banner = AdBanner.find(params[:id]) + @ad_banner.update_attributes(params[:ad_banner]) + render end def index diff --git a/app/views/admin/ad_banners/_ad_banner_tab.html.erb b/app/views/admin/ad_banners/_ad_banner_tab.html.erb index d9b1b902..10a98b52 100644 --- a/app/views/admin/ad_banners/_ad_banner_tab.html.erb +++ b/app/views/admin/ad_banners/_ad_banner_tab.html.erb @@ -1,14 +1,14 @@
" id=<%= ad_banner_tab.title %>> -

尺寸:

+

<%= t("admin.ad.banner_best_size") %>:

<%= form_for ad_banner_tab,:url=> admin_ad_banner_path(ad_banner_tab),:method => :put,:class=>"input-medium" do |f| -%> <%= f.label :ad_fx, t('admin.ad.ab_fx') %> <%= f.select :ad_fx ,AdBanner::FX_TYPES %> <%= f.label :transition_sec, t('admin.ad.transition_sec') %> <%= f.text_field :transition_sec,:placeholder=>"3秒請輸入3000",:class=> "span3" %> <%= t("admin.ad.trans_unit_sec") %> - <%= f.submit %> - <%= f.submit 'Cancel',:type=>'reset' %> + <%= f.submit t("admin.ad.update_banner") %> + <%= f.submit t("cancel"),:type=>'reset' %>
<%= 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" } %> diff --git a/config/locales/en.yml b/config/locales/en.yml index da72a4eb..9b586148 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -42,6 +42,16 @@ en: admin: action: Action ad_banner: AD Banner + ad: + ab_fx: FX + all_banners: AdBanner list + banner_best_size: Banner Best Size + new_banner: New banner + new_image: New image + title: Title + transition_sec: Transition time + trans_unit_sec: sec + update_banner: Update Banner add: Add add_item: Add item add_language: Add language diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 491d80e8..ebc6e6b3 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -42,11 +42,13 @@ zh_tw: ad: ab_fx: 轉場特效 all_banners: 輪播清單 + banner_best_size: Banner 尺寸 new_banner: 新增輪播 new_image: 新增橫幅 title: 標題 transition_sec: 轉場單位時間 trans_unit_sec: 秒 + update_banner: 更新輪播 add: 新增 add_item: 新增項目 add_language: 新增語言 diff --git a/config/routes.rb b/config/routes.rb index 99860bb6..cdf3a7f0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -26,6 +26,7 @@ Orbit::Application.routes.draw do resources :ad_banners do + match 'preview/:id' => 'ad_banners#realtime_preview',:as => :realtime_preview,:via => :put collection do 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