Merge branch 'design_team' of https://github.com/Rulingcom/orbit into design_team

Conflicts:
	vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb
This commit is contained in:
Matthew K. Fu JuYuan 2012-05-18 18:50:10 +08:00
commit 661fcafe70
32 changed files with 53 additions and 36 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

@ -17,7 +17,6 @@ class Admin::AssetCategoriesController < OrbitBackendController
def edit def edit
@asset_category = AssetCategory.find(params[:id]) @asset_category = AssetCategory.find(params[:id])
@i18n_variable = @asset_category.i18n_variable
@url = admin_asset_categories_path(@asset_category) @url = admin_asset_categories_path(@asset_category)
end end

View File

@ -30,7 +30,7 @@ class Admin::DashboardsController < ApplicationController
module_app_class = module_app.classify.constantize module_app_class = module_app.classify.constantize
objects = module_app_class.order_by(:updated_at, :desc).limit(10) objects = module_app_class.order_by(:updated_at, :desc).limit(10)
objects.each do |object| objects.each do |object|
a.merge!(object => object.updated_at) a.merge!(object => object.updated_at) unless (object.archived rescue nil)
end end
end end
sorted_objects = a.sort {|a,b| b[1]<=>a[1]} sorted_objects = a.sort {|a,b| b[1]<=>a[1]}
@ -43,7 +43,7 @@ class Admin::DashboardsController < ApplicationController
module_app_class = module_app.classify.constantize module_app_class = module_app.classify.constantize
objects = module_app_class.order_by(:view_count, :desc).limit(10) objects = module_app_class.order_by(:view_count, :desc).limit(10)
objects.each do |object| objects.each do |object|
a.merge!(object => object.view_count) if object.view_count > 0 a.merge!(object => object.view_count) if object.view_count > 0 && (!object.archived rescue true)
end end
end end
sorted_objects = a.sort {|a,b| b[1]<=>a[1]} sorted_objects = a.sort {|a,b| b[1]<=>a[1]}

View File

@ -21,7 +21,6 @@ class Admin::InfosController < ApplicationController
def edit def edit
@attribute = Info.find(params[:id]) @attribute = Info.find(params[:id])
@i18n_variable = @attribute.i18n_variable
render :template => 'admin/attributes/edit' render :template => 'admin/attributes/edit'
end end

View File

@ -21,7 +21,6 @@ class Admin::RolesController < ApplicationController
def edit def edit
@attribute = Role.find(params[:id]) @attribute = Role.find(params[:id])
@i18n_variable = @attribute.i18n_variable
render :template => 'admin/attributes/edit' render :template => 'admin/attributes/edit'
end end

View File

@ -181,7 +181,7 @@ module ApplicationHelper
end end
def display_visitors(options={}) def display_visitors(options={})
Impression.where(options).distinct(:session_hash).count Impression.where(options).and(:referrer.ne => nil).distinct(:session_hash).count
end end
def display_visitors_today def display_visitors_today

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 %>
<%if at_least_module_manager%>
<i class="icons-pencil"></i> <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) } )%> <%= 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 -%>
<%= 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 ) %> <% 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 ) 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: 新增輪播

View File

@ -55,7 +55,6 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendCo
# GET /bulletins/1/edit # GET /bulletins/1/edit
def edit def edit
@bulletin_category = BulletinCategory.find(params[:id]) @bulletin_category = BulletinCategory.find(params[:id])
@i18n_variable = @bulletin_category.i18n_variable
@url = panel_announcement_back_end_bulletin_category_path(@bulletin_category) @url = panel_announcement_back_end_bulletin_category_path(@bulletin_category)

View File

@ -45,7 +45,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
if(!is_admin? || !is_manager?) if(!is_admin? || !is_manager?)
@bulletins.delete_if{ |bulletin| @bulletins.delete_if{ |bulletin|
bulletin.is_pending == true && (!bulletin.bulletin_category.authed_users('fact_check').include?(current_user) || bulletin.create_user_id!=current_user.id) bulletin.is_pending == true && ((!bulletin.bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) || bulletin.create_user_id!=current_user.id)
} }
end end

View File

@ -2,7 +2,7 @@ module Panel::Announcement::BackEnd::BulletinsHelper
def show_approval_link(bulletin) def show_approval_link(bulletin)
by_bulletin = (!bulletin.is_expired? and !bulletin.is_checked?) by_bulletin = (!bulletin.is_expired? and !bulletin.is_checked?)
by_user = (bulletin.bulletin_category.authed_users('fact_check').include?(current_user) or is_manager? or is_admin?) by_user = ((bulletin.bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) or is_manager? or is_admin?)
by_bulletin and by_user by_bulletin and by_user
end end

View File

@ -28,7 +28,7 @@
</div> </div>
</div> </div>
</td> </td>
<td><%= bulletin.bulletin_category.i18n_variable[I18n.locale] %></td> <td><%= bulletin.bulletin_category.i18n_variable[I18n.locale] rescue nil %></td>
<td> <td>
<%= link_to bulletin.title[I18n.locale], panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category.id) rescue ''%> <%= link_to bulletin.title[I18n.locale], panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category.id) rescue ''%>

View File

@ -1,7 +1,7 @@
<ul> <ul>
<li> <li>
<b><%= t('announcement.category') %></b> <b><%= t('announcement.category') %></b>
<%= @bulletin.bulletin_category.i18n_variable[I18n.locale] %> <%= @bulletin.bulletin_category.i18n_variable[I18n.locale] rescue nil %>
</li> </li>
<li> <li>
<b><%= t('announcement.postdate') %></b> <b><%= t('announcement.postdate') %></b>

View File

@ -18,7 +18,7 @@
<% @bulletins.each do |post| %> <% @bulletins.each do |post| %>
<tr> <tr>
<td><%= post.bulletin_category.i18n_variable[I18n.locale] %></td> <td><%= post.bulletin_category.i18n_variable[I18n.locale] rescue nil %></td>
<td><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %> <td><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
<%#= link_to post.title, panel_announcement_back_end_bulletin_path(post) %> <%#= link_to post.title, panel_announcement_back_end_bulletin_path(post) %>
</td> </td>

View File

@ -12,7 +12,7 @@
<% @bulletins.each do |post| %> <% @bulletins.each do |post| %>
<tr> <tr>
<td><%= post.bulletin_category.i18n_variable[I18n.locale] %></td> <td><%= post.bulletin_category.i18n_variable[I18n.locale] rescue nil %></td>
<td><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %> <td><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
</td> </td>
<td><%= post.postdate %></td> <td><%= post.postdate %></td>

View File

@ -56,7 +56,6 @@ class Panel::News::BackEnd::NewsBulletinCategorysController < OrbitBackendContro
# GET /news_bulletins/1/edit # GET /news_bulletins/1/edit
def edit def edit
@news_bulletin_category = NewsBulletinCategory.find(params[:id]) @news_bulletin_category = NewsBulletinCategory.find(params[:id])
@i18n_variable = @news_bulletin_category.i18n_variable
@url = panel_news_back_end_news_bulletin_category_path(@news_bulletin_category) @url = panel_news_back_end_news_bulletin_category_path(@news_bulletin_category)

View File

@ -43,7 +43,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
@link_url = panel_news_back_end_news_bulletins_path @link_url = panel_news_back_end_news_bulletins_path
@news_bulletins.delete_if{ |news_bulletin| @news_bulletins.delete_if{ |news_bulletin|
news_bulletin.is_pending == true && (!news_bulletin.bulletin_category.authed_users('fact_check').include?(current_user) || news_bulletin.create_user_id!=current_user.id) news_bulletin.is_pending == true && ((!news_bulletin.bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) || news_bulletin.create_user_id!=current_user.id)
} }
@news_bulletin_file = NewsBulletinFile.new @news_bulletin_file = NewsBulletinFile.new

View File

@ -28,7 +28,7 @@
</div> </div>
</div> </div>
</td> </td>
<td><%= news_bulletin.news_bulletin_category.i18n_variable[I18n.locale] %></td> <td><%= news_bulletin.news_bulletin_category.i18n_variable[I18n.locale] rescue nil %></td>
<td> <td>
<%= link_to news_bulletin.title[I18n.locale], panel_news_front_end_news_bulletin_path(news_bulletin, :category_id => news_bulletin.news_bulletin_category.id) rescue ''%> <%= link_to news_bulletin.title[I18n.locale], panel_news_front_end_news_bulletin_path(news_bulletin, :category_id => news_bulletin.news_bulletin_category.id) rescue ''%>

View File

@ -1,7 +1,7 @@
<ul> <ul>
<li> <li>
<b><%= t('news.category') %></b> <b><%= t('news.category') %></b>
<%= @news_bulletin.news_bulletin_category.i18n_variable[I18n.locale] %> <%= @news_bulletin.news_bulletin_category.i18n_variable[I18n.locale] rescue nil %>
</li> </li>
<li> <li>
<b><%= t('news.postdate') %></b> <b><%= t('news.postdate') %></b>

View File

@ -38,7 +38,6 @@ class Panel::WebResource::BackEnd::WebLinkCategorysController < OrbitBackendCont
# GET /web_links/1/edit # GET /web_links/1/edit
def edit def edit
@web_link_category = WebLinkCategory.find(params[:id]) @web_link_category = WebLinkCategory.find(params[:id])
@i18n_variable = @web_link_category.i18n_variable
@url = panel_web_resource_back_end_web_link_category_path(@web_link_category) @url = panel_web_resource_back_end_web_link_category_path(@web_link_category)

View File

@ -19,7 +19,7 @@
</div> </div>
</div> </div>
</td> </td>
<td><%= web_link.web_link_category.i18n_variable[I18n.locale] %></td> <td><%= web_link.web_link_category.i18n_variable[I18n.locale] rescue nil %></td>
<td> <td>
<%= link_to web_link.name[I18n.locale], panel_web_resource_back_end_web_link_path(web_link) %> <%= link_to web_link.name[I18n.locale], panel_web_resource_back_end_web_link_path(web_link) %>
<div class="quick-edit"> <div class="quick-edit">

View File

@ -9,7 +9,7 @@
<ul> <ul>
<li> <li>
<b><%= t('announcement.category') %></b> <b><%= t('announcement.category') %></b>
<%= @bulletin.bulletin_category.i18n_variable[I18n.locale] %> <%= @bulletin.bulletin_category.i18n_variable[I18n.locale] rescue nil %>
</li> </li>
<li> <li>
<b><%= t('announcement.postdate') %></b> <b><%= t('announcement.postdate') %></b>

View File

@ -15,7 +15,7 @@
<% @web_links.each do |post| %> <% @web_links.each do |post| %>
<tr> <tr>
<td><%= post.web_link_category.i18n_variable[I18n.locale] %></td> <td><%= post.web_link_category.i18n_variable[I18n.locale] rescue nil %></td>
<td> <td>
<%#= link_to post.name[I18n.locale], panel_web_resource_front_end_web_link_path(post) %> <%#= link_to post.name[I18n.locale], panel_web_resource_front_end_web_link_path(post) %>
<%= link_to post.name[I18n.locale], post.url, {:target => '_blank', :title => post.name[I18n.locale]} %> <%= link_to post.name[I18n.locale], post.url, {:target => '_blank', :title => post.name[I18n.locale]} %>

View File

@ -9,7 +9,7 @@
<ul> <ul>
<li> <li>
<b><%= t('announcement.category') %></b> <b><%= t('announcement.category') %></b>
<%= @bulletin.bulletin_category.i18n_variable[I18n.locale] %> <%= @bulletin.bulletin_category.i18n_variable[I18n.locale] rescue nil %>
</li> </li>
<li> <li>
<b><%= t('announcement.postdate') %></b> <b><%= t('announcement.postdate') %></b>

View File

@ -14,7 +14,7 @@
</tr> </tr>
<% @web_links.each do |post| %> <% @web_links.each do |post| %>
<tr> <tr>
<td><%= post.web_link_category.i18n_variable[I18n.locale] %></td> <td><%= post.web_link_category.i18n_variable[I18n.locale] rescue nil %></td>
<td> <td>
<%= link_to post.name[I18n.locale], post.url, {:target => '_blank', :title => post.name[I18n.locale]} %> <%= link_to post.name[I18n.locale], post.url, {:target => '_blank', :title => post.name[I18n.locale]} %>
</td> </td>

View File

@ -27,6 +27,7 @@ class Impression
private private
def update_impressions_counter_cache def update_impressions_counter_cache
if self.referrer
impressionable_class = self.impressionable_type.constantize impressionable_class = self.impressionable_type.constantize
if impressionable_class.impressionist_counter_cache_options if impressionable_class.impressionist_counter_cache_options
@ -34,4 +35,5 @@ class Impression
resouce.try(:update_impressionist_counter_cache) resouce.try(:update_impressionist_counter_cache)
end end
end end
end
end end