From 25a911b4f869cd878ee7c4d081d464191bf36ed5 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Wed, 1 Aug 2012 16:33:46 +0800 Subject: [PATCH 1/8] Change for page: take category and tag at the same time --- app/controllers/pages_controller.rb | 9 ++++++++- .../widget/bulletins/bulletins_side_bar.html.erb | 2 +- .../news_bulletins/news_bulletins_side_bar.html.erb | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 3b0978f9..7a0ffa43 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -62,7 +62,14 @@ class PagesController < ApplicationController def get_item module_app = ModuleApp.first(:conditions => {:key => params[:app_name]}) - @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action]}) + if !params[:category_id].blank? && !params[:tag_id].blank? + @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id], :tag => params[:tag_id]}) + elsif !params[:category_id].blank? + @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id]}) + elsif !params[:tag_id].blank? + @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :tag => params[:tag_id]}) + end + @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action]}) unless @item #TODO 需要做 error handler 處理沒有新增該模組頁面導致錯誤的可能性 end diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/bulletins_side_bar.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/bulletins_side_bar.html.erb index c7b31818..ce06d2e7 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/bulletins_side_bar.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/bulletins_side_bar.html.erb @@ -13,7 +13,7 @@

<%= t('announcement.tag_cloud') %>

<% @tags.each do |tag| %> - <%= link_to tag[I18n.locale], panel_announcement_front_end_bulletins_path(:tag_id => tag.id), :class => "#{tag.cloud_amper} hot#{rand(4) + 1} #{(tag.id.to_s.eql?(params[:tag_id]) || tag.key.eql?(params[:tag_id])) ? 'active' : nil} " %> + <%= link_to tag[I18n.locale], panel_announcement_front_end_bulletins_path(:tag_id => tag.id, :category_id => params[:category_id]), :class => "#{tag.cloud_amper} hot#{rand(4) + 1} #{(tag.id.to_s.eql?(params[:tag_id]) || tag.key.eql?(params[:tag_id])) ? 'active' : nil} " %> <% end %>
diff --git a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/news_bulletins_side_bar.html.erb b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/news_bulletins_side_bar.html.erb index f754b763..bf127ed2 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/news_bulletins_side_bar.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/news_bulletins_side_bar.html.erb @@ -13,7 +13,7 @@

<%= t('announcement.tag_cloud') %>

<% @tags.each do |tag| %> - <%= link_to tag[I18n.locale], panel_news_front_end_news_bulletins_path(:tag_id => tag.id),:class => "#{tag.cloud_amper} hot#{rand(4) + 1} #{(tag.id.to_s.eql?(params[:tag_id]) || tag.key.eql?(params[:tag_id])) ? 'active' : nil} " %> + <%= link_to tag[I18n.locale], panel_news_front_end_news_bulletins_path(:tag_id => tag.id, :category_id => params[:category_id]),:class => "#{tag.cloud_amper} hot#{rand(4) + 1} #{(tag.id.to_s.eql?(params[:tag_id]) || tag.key.eql?(params[:tag_id])) ? 'active' : nil} " %> <% end %>
From 4df4274629be72088649ecc50cdd19b46b8a8792 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Wed, 1 Aug 2012 16:38:07 +0800 Subject: [PATCH 2/8] Add links to frontend_sitemap --- app/views/admin/sites/sitemap_frontend.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/sites/sitemap_frontend.html.erb b/app/views/admin/sites/sitemap_frontend.html.erb index 3656bb2d..171536e7 100644 --- a/app/views/admin/sites/sitemap_frontend.html.erb +++ b/app/views/admin/sites/sitemap_frontend.html.erb @@ -1,10 +1,10 @@
<% @items.each_with_index do |item, i| %>
-

<%= i+1 %> <%= item.title %>

+

<%= i+1 %> <%= "#{item.title}" %>

    <% item.children.each_with_index do |child, ii| %> -
  • <%= "#{i+1}-#{ii+1}" %> <%= child.title %>
  • +
  • <%= "#{i+1}-#{ii+1}" %> <%= "#{child.title}" %>
  • <% end if item.children %>
From 02ade108d07b9f4baa2fe19f20d1cd7bf49031a4 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Wed, 1 Aug 2012 16:59:11 +0800 Subject: [PATCH 3/8] Fix typo --- app/views/admin/sites/sitemap_frontend.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/sites/sitemap_frontend.html.erb b/app/views/admin/sites/sitemap_frontend.html.erb index 171536e7..3a64d3ba 100644 --- a/app/views/admin/sites/sitemap_frontend.html.erb +++ b/app/views/admin/sites/sitemap_frontend.html.erb @@ -4,7 +4,7 @@

<%= i+1 %> <%= "#{item.title}" %>

    <% item.children.each_with_index do |child, ii| %> -
  • <%= "#{i+1}-#{ii+1}" %> <%= "#{child.title}" %>
  • +
  • <%= "#{i+1}-#{ii+1}" %> <%= "#{child.title}" %>
  • <% end if item.children %>
From 410dfe62e8e334a246afacf4a338168ee5088b8c Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Wed, 1 Aug 2012 17:03:39 +0800 Subject: [PATCH 4/8] Fix typo --- app/views/admin/sites/sitemap_frontend.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/sites/sitemap_frontend.html.erb b/app/views/admin/sites/sitemap_frontend.html.erb index 3a64d3ba..9e6720df 100644 --- a/app/views/admin/sites/sitemap_frontend.html.erb +++ b/app/views/admin/sites/sitemap_frontend.html.erb @@ -1,7 +1,7 @@
<% @items.each_with_index do |item, i| %>
-

<%= i+1 %> <%= "#{item.title}" %>

+

<%= i+1 %> <%= "#{item.title}" %>

    <% item.children.each_with_index do |child, ii| %>
  • <%= "#{i+1}-#{ii+1}" %> <%= "#{child.title}" %>
  • From 83acb78966af8ae883c7af8402eb1365b690eac9 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Wed, 1 Aug 2012 17:05:34 +0800 Subject: [PATCH 5/8] path instead of url --- app/views/admin/sites/sitemap_frontend.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/sites/sitemap_frontend.html.erb b/app/views/admin/sites/sitemap_frontend.html.erb index 9e6720df..78d85b10 100644 --- a/app/views/admin/sites/sitemap_frontend.html.erb +++ b/app/views/admin/sites/sitemap_frontend.html.erb @@ -1,10 +1,10 @@
    <% @items.each_with_index do |item, i| %>
    -

    <%= i+1 %> <%= "#{item.title}" %>

    +

    <%= i+1 %> <%= "#{item.title}" %>

      <% item.children.each_with_index do |child, ii| %> -
    • <%= "#{i+1}-#{ii+1}" %> <%= "#{child.title}" %>
    • +
    • <%= "#{i+1}-#{ii+1}" %> <%= "#{child.title}" %>
    • <% end if item.children %>
    From 0d048de33f3dcd39a6d452bb8c8832bec138d608 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Wed, 1 Aug 2012 17:08:07 +0800 Subject: [PATCH 6/8] Fix link in sitemap --- app/views/admin/sites/sitemap_frontend.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/sites/sitemap_frontend.html.erb b/app/views/admin/sites/sitemap_frontend.html.erb index 78d85b10..5021745a 100644 --- a/app/views/admin/sites/sitemap_frontend.html.erb +++ b/app/views/admin/sites/sitemap_frontend.html.erb @@ -1,10 +1,10 @@
    <% @items.each_with_index do |item, i| %>
    -

    <%= i+1 %> <%= "#{item.title}" %>

    +

    <%= i+1 %><%= item.title %>

      <% item.children.each_with_index do |child, ii| %> -
    • <%= "#{i+1}-#{ii+1}" %> <%= "#{child.title}" %>
    • +
    • <%= "#{i+1}-#{ii+1}" %><%= child.title %>
    • <% end if item.children %>
    From f917adcdf341dd709864a6c903266c37869703a6 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Wed, 1 Aug 2012 17:09:00 +0800 Subject: [PATCH 7/8] Fix typo --- app/views/admin/sites/sitemap_frontend.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/sites/sitemap_frontend.html.erb b/app/views/admin/sites/sitemap_frontend.html.erb index 5021745a..c4aa33fd 100644 --- a/app/views/admin/sites/sitemap_frontend.html.erb +++ b/app/views/admin/sites/sitemap_frontend.html.erb @@ -1,7 +1,7 @@
    <% @items.each_with_index do |item, i| %>
    -

    <%= i+1 %><%= item.title %>

    +

    <%= i+1 %><%= item.title %>

      <% item.children.each_with_index do |child, ii| %>
    • <%= "#{i+1}-#{ii+1}" %><%= child.title %>
    • From df9a1e80575c0503cbe2a30a3ca549b6a8b1a606 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Wed, 1 Aug 2012 17:11:37 +0800 Subject: [PATCH 8/8] Fix typo --- app/views/admin/sites/sitemap_frontend.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/sites/sitemap_frontend.html.erb b/app/views/admin/sites/sitemap_frontend.html.erb index c4aa33fd..cd8372d3 100644 --- a/app/views/admin/sites/sitemap_frontend.html.erb +++ b/app/views/admin/sites/sitemap_frontend.html.erb @@ -1,10 +1,10 @@
      <% @items.each_with_index do |item, i| %>
      -

      <%= i+1 %><%= item.title %>

      +

      <%= i+1 %> <%= item.title %>