RSS first page
This commit is contained in:
parent
561d510aa8
commit
e256440678
|
@ -101,7 +101,10 @@ class ApplicationController < ActionController::Base
|
|||
# Render the page
|
||||
def render_page
|
||||
if @item
|
||||
render :text => parse_page_noko(@item), :layout => 'page_layout'
|
||||
respond_to do |format|
|
||||
format.html { render :text => parse_page_noko(@item), :layout => 'page_layout' }
|
||||
format.rss { render_main_rss }
|
||||
end
|
||||
else
|
||||
render :text => '404 Not Found'
|
||||
end
|
||||
|
@ -187,4 +190,12 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
end
|
||||
|
||||
def render_main_rss
|
||||
ret = ''
|
||||
ret << "/panel/#{@item.module_app.key}/front_end/#{@item.app_frontend_url}.rss"
|
||||
ret << "/#{params[:id]}" if params[:id] && !params[:id].eql?(@item.id.to_s)
|
||||
ret << "?inner=true&category_id=#{params[:category]}&tag_id=#{params[:tag]}&page_main=#{params[:page_main]}"
|
||||
redirect_to ret
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
xml.instruct! :xml, :version => "1.0"
|
||||
xml.rss :version => "2.0" do
|
||||
xml.channel do
|
||||
if @current_category
|
||||
xml.title @current_category.i18n_variable[I18n.locale]
|
||||
else
|
||||
xml.title t('announcement.announcement')
|
||||
end
|
||||
xml.link panel_announcement_front_end_bulletins_path(:rss)
|
||||
|
||||
for bulletin in @bulletins
|
||||
xml.item do
|
||||
xml.title bulletin.title[I18n.locale]
|
||||
xml.description bulletin.subtitle[I18n.locale]
|
||||
xml.pubDate bulletin.postdate.to_s(:rfc822)
|
||||
xml.link panel_announcement_front_end_bulletin_path(bulletin, :rss)
|
||||
xml.guid panel_announcement_front_end_bulletin_path(bulletin, :rss)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue