fix design index bug when start start from blank DB.

add delay impressionist.
add several i18n vars
This commit is contained in:
Matt K. Fu committed 2013-05-23 12:07:43 +08:00
1 parent 37aa950028
commit 54a35b30be
18 files changed
+83 -96

No files matched your search

@@ -19,10 +19,10 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
with(:frontend_search,true)
with(:available_lang).any_of([I18n.locale.to_s])
end
search_result = @search.results.collect{|result| result.id}
@bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_in(_id:search_result).page( params[:page_main]).per(@page_num)
render 'index'
end
def index
@@ -61,7 +61,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
else
@bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num)
end
impressionist(@tag) if @tag
delayed_impressionist(@tag) if @tag
end
end
@@ -74,7 +74,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
@bulletin = Bulletin.all.can_display.where(_id: params[:id]).first
if @bulletin and !@bulletin.disable? and !@bulletin.is_rejected
if @bulletin.enabled_for_lang(I18n.locale.to_s)
impressionist(@bulletin)
delayed_impressionist(@bulletin)
get_categorys
else
render :text => "<div class='alert alert-error'>#{t('sys.can_not_display_due_to_no_context')}</div>".html_safe
@@ -108,7 +108,7 @@ class Bulletin
end
def enabled_for_lang(lang)
eval("self.available_for_#{lang}")
eval("self.available_for_#{lang}") rescue false
end
def publish_month
@@ -0,0 +1,40 @@
<% # encoding: utf-8 %>
<%= flash_messages %>
<h1 class="h1"><%= @page.title rescue nil %></h1>
<table class="table table-bordered">
<tr>
<%= content_tag (:th) do %>
<%= t('announcement.bulletin.category') %>
<% end if (!params[:search_query].blank? or params[:category_id].blank?)-%>
<th><%= t('announcement.bulletin.title') %></th>
<th><%= t('announcement.bulletin.postdate') %></th>
</tr>
<% if !params[:name].blank?%>
<%= t("search.unit_get",:unit_name => params[:name],:item_num=>@bulletins.count) %>
<% end %>
<% if @bulletins.blank? and !params[:search_query].blank? %>
<%=render :partial => 'shared/search_not_found' %>
<% elsif !params[:search_query].blank? %>
<%= t("search.result_get",:search_word => params[:search_query],:item_num=>@bulletins.count) unless (@bulletins.count == 30) %>
<%= t("search.too_many",:search_word => params[:search_query],:exceed_num=>@bulletins.count) if (@bulletins.count ==30) %>
<% end %>
<% @bulletins.each do |post| %>
<tr>
<td><%= post.bulletin_category.title rescue nil %></td>
<td><%= link_to post.title, panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
<%#= link_to post.title, panel_announcement_back_end_bulletin_path(post) %>
</td>
<td><%= display_date_time(post.postdate) %></td>
</tr>
<% end %>
</table>
@@ -25,6 +25,7 @@ en:
file_name: File Name
frontend:
bulletins: Announcement front-end
search_result: Search result
link_name: Link Name
new_bulletin_category: New Bulletin Category
picture: Cover Picture
@@ -25,6 +25,7 @@ zh_tw:
file_name: 檔案名稱
frontend:
bulletins: 公告前台
search_result: 搜尋結果頁
link_name: 連結名稱
new_bulletin_category: 新增公告類別
picture: 刊頭圖片
+4
View File
@@ -12,6 +12,10 @@ module Announcement
update_info 'some update_info'
front_end do
app_page 'search_result' do
frontend_i18n "announcement.frontend.search_result"
end
app_page 'bulletins' do
frontend_i18n "announcement.frontend.bulletins"
style ["1","2","3"]
@@ -8,7 +8,7 @@ class Panel::PageContent::FrontEnd::PageContextsController < OrbitWidgetControll
def index
# @page_context = PageContext.where("page_id" => params[:page_id], :archived => false)
@page_context = PageContext.first(conditions: { page_id: params[:page_id], :archived => false })
impressionist(@page_context)
delayed_impressionist(@page_context)
respond_to do |format|
format.html # index.html.erb