From eb91322e1fd2eac82650891d5584ab9e0b489024 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Wed, 8 Aug 2012 17:35:29 +0800 Subject: [PATCH 1/3] rss branch end --- .../news_bulletins/index.rss.builder | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.rss.builder diff --git a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.rss.builder b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.rss.builder new file mode 100644 index 00000000..b4901f70 --- /dev/null +++ b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.rss.builder @@ -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('news.campus_news') + end + xml.link panel_news_front_end_news_bulletins_path(:rss) + + for news_bulletin in @news_bulletins + xml.item do + xml.title news_bulletin.title[I18n.locale] + xml.description news_bulletin.text[I18n.locale] + xml.pubDate news_bulletin.postdate.to_s(:rfc822) + xml.link panel_news_front_end_news_bulletin_path(news_bulletin, :rss) + xml.guid panel_news_front_end_news_bulletin_path(news_bulletin, :rss) + end + end + end +end \ No newline at end of file From 41930eb69330444df163adee1e2c58e7a3c9807e Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Tue, 19 Jun 2012 10:49:45 +0800 Subject: [PATCH 2/3] RSS first page --- app/controllers/application_controller.rb | 13 +++++++++++- .../front_end/bulletins/index.rss.builder | 21 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.rss.builder diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 109d4742..74274eeb 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.rss.builder b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.rss.builder new file mode 100644 index 00000000..c0dd32e0 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.rss.builder @@ -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 \ No newline at end of file From 987e6fff2b264678d6b9b6b7bbb1f27718bd5f73 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Thu, 9 Aug 2012 02:20:10 +0800 Subject: [PATCH 3/3] 1.Rss feed but no entry for clicking now. wait for design. 2.Unit link is now fixed. --- Gemfile.lock | 2 -- .../front_end/bulletins/show.html.erb | 5 +++-- .../front_end/bulletins/show.rss.builder | 20 ++++++++++++++++++ .../news/app/models/news_bulletin.rb | 1 + .../front_end/news_bulletins/show.html.erb | 2 +- .../front_end/news_bulletins/show.rss.builder | 21 +++++++++++++++++++ 6 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.rss.builder create mode 100644 vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.rss.builder diff --git a/Gemfile.lock b/Gemfile.lock index 463946c3..96f07221 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -186,7 +186,6 @@ GEM chinese_pinyin (>= 0.3.0) redis (>= 2.1.1) redis-namespace (~> 1.0.2) - remotipart (1.0.2) resque (1.20.0) multi_json (~> 1.0) redis-namespace (~> 1.0.2) @@ -333,7 +332,6 @@ DEPENDENCIES redis (>= 2.1.1) redis-namespace (~> 1.0.2) redis-search (= 0.7.1) - remotipart resque resque-restriction resque-scheduler diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb index a26f9200..0f60d98e 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb @@ -3,8 +3,9 @@
<%= dislpay_view_count(@bulletin) %> - <%= display_date_time(@bulletin.postdate) %> - <%= link_to @bulletin.cache_dept[I18n.locale.to_s],panel_announcement_front_end_index_bulletins_by_unit_path(:name=>@bulletin.cache_dept[I18n.locale.to_s]) rescue nil %> + <%= display_date_time(@bulletin.postdate) %> + <% unit = @bulletin.cache_dept[I18n.locale.to_s] rescue nil %> + <%= link_to unit,panel_announcement_front_end_index_bulletins_by_unit_path(:name=>unit) unless unit.blank? %>
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.rss.builder b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.rss.builder new file mode 100644 index 00000000..8fb929f5 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.rss.builder @@ -0,0 +1,20 @@ +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) + + xml.item do + xml.title @bulletin.title + xml.description @bulletin.text + 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 \ No newline at end of file diff --git a/vendor/built_in_modules/news/app/models/news_bulletin.rb b/vendor/built_in_modules/news/app/models/news_bulletin.rb index 4cb139be..578714c6 100644 --- a/vendor/built_in_modules/news/app/models/news_bulletin.rb +++ b/vendor/built_in_modules/news/app/models/news_bulletin.rb @@ -166,6 +166,7 @@ class NewsBulletin end end + def enabled_for_lang(lang) eval("self.available_for_#{lang}") end diff --git a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb index 7366127a..eac3fec8 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb @@ -6,7 +6,7 @@ <%= display_date(@news_bulletin.postdate) %> <% unit = @news_bulletin.unit_list_for_anc.title rescue nil %> <%= " | " if unit %> - <%= link_to unit, panel_news_front_end_index_news_bulletins_by_unit_path(:name=>@news_bulletin.unit_list_for_anc_id)%> + <%= link_to unit, panel_news_front_end_index_news_bulletins_by_unit_path(:name=>@news_bulletin.unit_list_for_anc_id) unless unit.blank?%>
diff --git a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.rss.builder b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.rss.builder new file mode 100644 index 00000000..ba01a48e --- /dev/null +++ b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.rss.builder @@ -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('news.campus_news') + end + xml.link panel_news_front_end_news_bulletins_path(:rss) + +# for news_bulletin in @news_bulletins + xml.item do + xml.title @news_bulletin.title + xml.description @news_bulletin.text + xml.pubDate @news_bulletin.postdate.to_s(:rfc822) + xml.link panel_news_front_end_news_bulletin_path(@news_bulletin, :rss) + xml.guid panel_news_front_end_news_bulletin_path(@news_bulletin, :rss) + end +# end + end +end \ No newline at end of file