Fix typo and title in news and announcement frontend

This commit is contained in:
Christophe Vilayphiou 2012-08-05 15:04:52 +08:00
parent 5f88408dcb
commit 73b2cd1035
4 changed files with 14 additions and 16 deletions

View File

@ -9,6 +9,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
# GET /bulletins.xml # GET /bulletins.xml
def index def index
@page = Page.find(params[:page_id])
if !params[:search_query].blank? if !params[:search_query].blank?
search_cond = {:is_checked=>true,:is_hidden=>false,:is_pending => false} search_cond = {:is_checked=>true,:is_hidden=>false,:is_pending => false}
search_cond.merge!({:bulletin_category_id => "#{params[:category_id]}" }) if !params[:category_id].blank? search_cond.merge!({:bulletin_category_id => "#{params[:category_id]}" }) if !params[:category_id].blank?
@ -39,6 +40,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
end end
def show def show
@page = Page.find(params[:page_id])
if params[:preview] == "true" if params[:preview] == "true"
preview_content preview_content
else else

View File

@ -2,11 +2,7 @@
<%= flash_messages %> <%= flash_messages %>
<% if @current_category %> <h1 class="h1"><%= @page.title %></h1>
<h1 class="h1"><%= @current_category.title %></h1>
<% else %>
<h1 class="h1"><%= t('announcement.announcement') %></h1>
<% end %>
<table class="table table-bordered"> <table class="table table-bordered">

View File

@ -9,6 +9,7 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
# GET /news_bulletins.xml # GET /news_bulletins.xml
def index def index
@page = Page.find(params[:page_id])
if !params[:search_query].blank? if !params[:search_query].blank?
search_cond = {:is_checked=>true,:is_hidden=>false,:is_pending=>false,:is_pending=>false} search_cond = {:is_checked=>true,:is_hidden=>false,:is_pending=>false,:is_pending=>false}
search_cond.merge!({:news_bulletin_category_id => "#{params[:category_id]}" }) if !params[:category_id].blank? search_cond.merge!({:news_bulletin_category_id => "#{params[:category_id]}" }) if !params[:category_id].blank?
@ -23,14 +24,14 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
@news_bulletins = @tag.news_bulletins.available_for_lang(I18n.locale).can_display.where(:news_bulletin_category_id => params[:category_id]).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(15) @news_bulletins = @tag.news_bulletins.available_for_lang(I18n.locale).can_display.where(:news_bulletin_category_id => params[:category_id]).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(15)
@current_category = NewsBulletinCategory.from_id(params[:category_id]) rescue nil @current_category = NewsBulletinCategory.from_id(params[:category_id]) rescue nil
elsif !params[:category_id].blank? elsif !params[:category_id].blank?
@news_bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.where(:news_bulletin_category_id => params[:category_id]).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(15) @news_bulletins = NewsBulletin.all.available_for_lang(I18n.locale).can_display.where(:news_bulletin_category_id => params[:category_id]).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(15)
@current_category = NewsBulletinCategory.from_id(params[:category_id]) rescue nil @current_category = NewsBulletinCategory.from_id(params[:category_id]) rescue nil
elsif !params[:tag_id].blank? elsif !params[:tag_id].blank?
@tag = NewsTag.find(params[:tag_id]) rescue nil @tag = NewsTag.find(params[:tag_id]) rescue nil
@tag = NewsTag.where(key: params[:tag_id])[0] unless @tag @tag = NewsTag.where(key: params[:tag_id])[0] unless @tag
@news_bulletins = @tag.news_bulletins.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(15) @news_bulletins = @tag.news_bulletins.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(15)
else else
@news_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(15) @news_bulletins = NewsBulletin.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(15)
end end
impressionist(@tag) if @tag impressionist(@tag) if @tag
end end
@ -40,6 +41,7 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
if params[:preview] == "true" if params[:preview] == "true"
preview_content preview_content
else else
''
@news_bulletin = NewsBulletin.all.available_for_lang(I18n.locale).can_display.where(_id: params[:id]).first @news_bulletin = NewsBulletin.all.available_for_lang(I18n.locale).can_display.where(_id: params[:id]).first
unless @news_bulletin.disable? unless @news_bulletin.disable?
impressionist(@news_bulletin) impressionist(@news_bulletin)

View File

@ -2,16 +2,14 @@
<%= flash_messages %> <%= flash_messages %>
<% if @current_category %> <h1 class="h1"><%= @page.title %></h1>
<h1 class="h1"><%= @current_category.title %></h1>
<% else %> <% if @news_bulletins.blank? and !params[:search_query].blank? %>
<h1 class="h1"><%= t('news.news') %></h1>
<% end %>
<% if @news_bulletins.blank? and !params[:search_query].blank? %>
<%=render :partial => 'shared/search_not_found' %> <%=render :partial => 'shared/search_not_found' %>
<% elsif !params[:search_query].blank? %> <% elsif !params[:search_query].blank? %>
<%= t("search.result_get",:search_word => params[:search_query],:item_num=>@news_bulletins.count) %> <%= t("search.result_get",:search_word => params[:search_query],:item_num=>@news_bulletins.count) %>
<% end %> <% end %>
<table class="table table-bordered"> <table class="table table-bordered">
<tbody> <tbody>
<tr> <tr>