fix view for different_user for ad_banner. add field 'best size' for ad_banner within form

This commit is contained in:
Matthew K. Fu JuYuan 2012-05-18 10:50:53 +08:00 committed by Christophe Vilayphiou
parent 7c6b807170
commit 5f6696a358
8 changed files with 29 additions and 8 deletions

View File

@ -1,7 +1,7 @@
class Admin::AdBannersController < OrbitBackendController class Admin::AdBannersController < OrbitBackendController
layout "new_admin" layout "new_admin"
before_filter :authenticate_user! 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 before_filter :for_app_sub_manager
def rename def rename

View File

@ -1,7 +1,7 @@
class Admin::AdImagesController < ApplicationController class Admin::AdImagesController < OrbitBackendController
layout 'new_admin' layout 'new_admin'
before_filter :authenticate_user! before_filter :authenticate_user!
before_filter :is_admin? before_filter :for_app_sub_manager
def edit def edit
@ad_banner = AdBanner.find params[:ad_banner_id] @ad_banner = AdBanner.find params[:ad_banner_id]

View File

@ -7,6 +7,10 @@
<%= f.select :ad_fx ,AdBanner::FX_TYPES %> <%= f.select :ad_fx ,AdBanner::FX_TYPES %>
<%= f.label :transition_sec, t('admin.ad.transition_sec') %> <%= 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") %> <%= 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 -%>
<br> <br>
<%= f.submit t("admin.ad.update_banner"), :class => 'btn' %> <%= f.submit t("admin.ad.update_banner"), :class => 'btn' %>
<%= f.submit t("cancel"),:type=>'reset', :class => 'btn' %> <%= f.submit t("cancel"),:type=>'reset', :class => 'btn' %>

View File

@ -22,6 +22,13 @@
</div> </div>
</div> </div>
<div class="control-group">
<%= f.label :best_size, t('admin.ad.best_size'),:class => "control-label" %>
<div class="controls">
<%= f.text_field :best_size %> Ex: 500px x 300px
</div>
</div>
<div class="control-group"> <div class="control-group">
<%= f.label :ad_fx, t('admin.ad.ab_fx') %> <%= f.label :ad_fx, t('admin.ad.ab_fx') %>
<div class="controls"> <div class="controls">

View File

@ -13,11 +13,16 @@
<ul id="banner_tab" class="nav nav-tabs"> <ul id="banner_tab" class="nav nav-tabs">
<% @ad_banners.each do |ab| %> <% @ad_banners.each do |ab| %>
<%= content_tag :li ,:class => (ab == @active ? 'active' : nil) do %> <%= content_tag :li ,:class => (ab == @active ? 'active' : nil) do %>
<i class="icons-pencil"></i> <%if at_least_module_manager%>
<%= link_to(ab.title,"##{ab.title.dehumanize}",:contenteditable=>"false",:data=>{:toggle=>"tab" ,'edit-url' =>(admin_rename_ad_banner_path ab) } )%> <i class="icons-pencil"></i>
<%= link_to(ab.title,"##{ab.title.dehumanize}",:contenteditable=>"false",:data=>{:toggle=>"tab" ,'edit-url' =>(admin_rename_ad_banner_path ab) } )%>
<% else %>
<%= link_to(ab.title,"##{ab.title.dehumanize}",:data=>{:toggle=>"tab" } )%>
<% end -%>
<% end -%> <% end -%>
<% end -%> <% end -%>
<%= content_tag :li,link_to(t("admin.ad.new_banner"),"#new-a-banner",:data=>{:toggle=>"modal"}),:id=>'new_ad_banner_tab_but',:class => (@active.nil? ? 'active' : nil ) %>
<%= content_tag :li,link_to(t("admin.ad.new_banner"),"#new-a-banner",:data=>{:toggle=>"modal"}),:id=>'new_ad_banner_tab_but',:class => (@active.nil? ? 'active' : nil ) if at_least_module_manager%>
</ul> </ul>

View File

@ -80,7 +80,10 @@
<!--請程式務必將圖片尺寸加入到行內裡--> <!--請程式務必將圖片尺寸加入到行內裡-->
<%= image_tag @ad_image.file rescue ''%> <%= image_tag @ad_image.file rescue ''%>
</div> </div>
<span class="alert widgetInfo"><%= 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?%></span> <% if !@ad_image.ad_banner.best_size.empty?%>
<span class="alert widgetInfo"><%= t("admin.ad.widget_info_for_ad_image_size",:best_size=> @ad_image.ad_banner.best_size) %>
</span>
<% end -%>
<div class="controls file-upload input-prepend"> <div class="controls file-upload input-prepend">
<label class="control-label add-on btn" for="input-upload"> <label class="control-label add-on btn" for="input-upload">
<%= t(:browse) %> <%= t(:browse) %>

View File

@ -91,6 +91,7 @@ en:
ab_fx: FX ab_fx: FX
all_banners: AdBanner list all_banners: AdBanner list
banner_best_size: Banner Best Size banner_best_size: Banner Best Size
best_size: Best size
new_banner: New banner new_banner: New banner
new_image: New image new_image: New image
showing: Showing showing: Showing

View File

@ -85,6 +85,7 @@ zh_tw:
ab_fx: 轉場特效 ab_fx: 轉場特效
all_banners: 輪播清單 all_banners: 輪播清單
banner_best_size: Banner 尺寸 banner_best_size: Banner 尺寸
best_size: 最佳尺寸
cate_auth: 分類授權 cate_auth: 分類授權
delete_banner: 刪除整組輪播 delete_banner: 刪除整組輪播
new_banner: 新增輪播 new_banner: 新增輪播