replace rss format with json in announcement

This commit is contained in:
Rueshyna 2012-11-28 13:43:48 +08:00
parent 452b1525de
commit 114ca5493a
4 changed files with 40 additions and 28 deletions

View File

@ -1,6 +1,7 @@
class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendController
include OrbitControllerLib::DivisionForDisable
before_filter :for_app_manager,:except => [:index,:get_categorys_json,:get_bulletins_json]
# if someone want to use json format replace with rss, please add :get_bulletins_json to below
before_filter :for_app_manager,:except => [:index,:get_categorys_json]
def index
@bulletin_categorys = get_categories_for_index("BulletinCategory")
@ -22,7 +23,15 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendCo
categorys.each do |c|
data << {
category: c.title,
link: "http://#{request.host_with_port}#{panel_announcement_back_end_bulletin_category_get_bulletins_json_path(c)}"
# this is a json format
# link: "http://#{request.host_with_port}#{panel_announcement_back_end_bulletin_category_get_bulletins_json_path(c)}"
# remember to uncommand a rule in route.rb, too
link: "#{url_for( :action => "index",
:controller => "panel/announcement/front_end/bulletins",
:format => :rss,
:only_path => false,
:inner=>true,
:category_id => c )}"
}
end

View File

@ -14,14 +14,15 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
end
def index
@item = Page.find(params[:page_id])
@item = Page.find(params[:page_id]) rescue nil
if @item
if @item.frontend_data_count
@page_num = @item.frontend_data_count
else
@page_num = 15
end
@frontend_style = @item.frontend_style
end
@page = Page.find(params[:page_id]) rescue nil
if !params[:search_query].blank?

View File

@ -6,7 +6,7 @@ Rails.application.routes.draw do
match 'approval_setting' => "approvals#setting" ,:as => :approval_setting,:via => :get
match 'approval_setting' => "approvals#update_setting" ,:as => :approval_setting,:via => :post
match 'approval_setting' => "approvals#user_list" ,:as => :approval_user_list,:via => :put
#match 'get_bulletins_json' => "bulletins#get_bulletins_json" ,:as => :bulletins_json_list,:via => :get
resources :bulletins do
match "approve/:bulletin_id" => "approvals#preview_and_approve",:as => :approval_preview,:via => :put
match "approve/:bulletin_id" => "approvals#approve",:as => :approve,:via => :post
@ -29,7 +29,9 @@ Rails.application.routes.draw do
collection do
get 'get_categorys_json'
end
match "get_bulletins_json/" => "bulletin_categorys#get_bulletins_json", :as => :get_bulletins_json
# if want to use json
# please uncommand below line
# match "get_bulletins_json/" => "bulletin_categorys#get_bulletins_json", :as => :get_bulletins_json
end
resources :bulletin_links, :controller => 'bulletin_links' do