From 0306277c3d901fe0a77f37695380aaad39a52bb0 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Fri, 18 May 2012 10:50:53 +0800 Subject: [PATCH] fix view for different_user for ad_banner. add field 'best size' for ad_banner within form --- app/controllers/admin/ad_banners_controller.rb | 2 +- app/controllers/admin/ad_images_controller.rb | 6 +++--- app/views/admin/ad_banners/_ad_banner_tab.html.erb | 4 ++++ .../admin/ad_banners/_modal_ad_banner_form.html.erb | 7 +++++++ app/views/admin/ad_banners/index.html.erb | 11 ++++++++--- app/views/admin/ad_images/_form.html.erb | 5 ++++- config/locales/en.yml | 1 + config/locales/zh_tw.yml | 1 + 8 files changed, 29 insertions(+), 8 deletions(-) diff --git a/app/controllers/admin/ad_banners_controller.rb b/app/controllers/admin/ad_banners_controller.rb index cd436a12..f43c19e5 100644 --- a/app/controllers/admin/ad_banners_controller.rb +++ b/app/controllers/admin/ad_banners_controller.rb @@ -1,7 +1,7 @@ class Admin::AdBannersController < OrbitBackendController layout "new_admin" before_filter :authenticate_user! - before_filter :for_app_manager,:except => [:index,:show] + before_filter :for_app_manager,:except => [:index,:show,:update,:realtime_preview] before_filter :for_app_sub_manager def rename diff --git a/app/controllers/admin/ad_images_controller.rb b/app/controllers/admin/ad_images_controller.rb index 945629ed..e3cef303 100644 --- a/app/controllers/admin/ad_images_controller.rb +++ b/app/controllers/admin/ad_images_controller.rb @@ -1,8 +1,8 @@ -class Admin::AdImagesController < ApplicationController +class Admin::AdImagesController < OrbitBackendController layout 'new_admin' before_filter :authenticate_user! - before_filter :is_admin? - + before_filter :for_app_sub_manager + def edit @ad_banner = AdBanner.find params[:ad_banner_id] @ad_image = @ad_banner.ad_images.find params[:id] 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 ca98e42e..d65a17e0 100644 --- a/app/views/admin/ad_banners/_ad_banner_tab.html.erb +++ b/app/views/admin/ad_banners/_ad_banner_tab.html.erb @@ -7,6 +7,10 @@ <%= f.select :ad_fx ,AdBanner::FX_TYPES %> <%= f.label :transition_sec, t('admin.ad.transition_sec') %> <%= f.text_field :transition_sec,:placeholder=>t('admin.ad.sec_place_holder'),:class=> "span3" %> <%= t("admin.ad.trans_unit_sec") %> + <%if at_least_module_manager%> + <%= f.label :best_size, t('admin.ad.best_size') %> + <%= f.text_field :best_size %> Ex: 500px x 300px + <% end -%>
<%= f.submit t("admin.ad.update_banner"), :class => 'btn' %> <%= f.submit t("cancel"),:type=>'reset', :class => 'btn' %> diff --git a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb b/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb index cbc4de8e..68e0a9c6 100644 --- a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb +++ b/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb @@ -21,6 +21,13 @@ <%= f.text_field :transition_sec %> <%= t("admin.ad.trans_unit_sec") %> + +
+ <%= f.label :best_size, t('admin.ad.best_size'),:class => "control-label" %> +
+ <%= f.text_field :best_size %> Ex: 500px x 300px +
+
<%= f.label :ad_fx, t('admin.ad.ab_fx') %> diff --git a/app/views/admin/ad_banners/index.html.erb b/app/views/admin/ad_banners/index.html.erb index b4be090f..92c78f5b 100644 --- a/app/views/admin/ad_banners/index.html.erb +++ b/app/views/admin/ad_banners/index.html.erb @@ -13,11 +13,16 @@ diff --git a/app/views/admin/ad_images/_form.html.erb b/app/views/admin/ad_images/_form.html.erb index 1513fa05..edbb2563 100644 --- a/app/views/admin/ad_images/_form.html.erb +++ b/app/views/admin/ad_images/_form.html.erb @@ -80,7 +80,10 @@ <%= image_tag @ad_image.file rescue ''%>
- <%= t("admin.ad.widget_info_for_ad_image_size",:best_size=> @ad_image.ad_banner.best_size) if !@ad_image.ad_banner.best_size.empty?%> + <% if !@ad_image.ad_banner.best_size.empty?%> + <%= t("admin.ad.widget_info_for_ad_image_size",:best_size=> @ad_image.ad_banner.best_size) %> + + <% end -%>