Merge branch 'master' of github.com:Rulingcom/NCCU

This commit is contained in:
Matthew K. Fu JuYuan 2012-08-01 18:15:28 +08:00
commit 1b29eb5de4
4 changed files with 12 additions and 5 deletions

View File

@ -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

View File

@ -1,10 +1,10 @@
<div class="site-map">
<% @items.each_with_index do |item, i| %>
<div class="map-block">
<h4><%= i+1 %> <%= item.title %></h4>
<h4><%= i+1 %> <a href='<%= item.path %>'><%= item.title %></a></h4>
<ul>
<% item.children.each_with_index do |child, ii| %>
<li class="clear"><%= "#{i+1}-#{ii+1}" %> <%= child.title %></span></li>
<li class="clear"><%= "#{i+1}-#{ii+1}" %> <a href='<%= child.path %>'><%= child.title %></a></span></li>
<% end if item.children %>
</ul>
</div>

View File

@ -13,7 +13,7 @@
<h3 class="h3"><%= t('announcement.tag_cloud') %></h3>
<div class="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 %>
</div>
</div>

View File

@ -13,7 +13,7 @@
<h3 class="h3"><%= t('announcement.tag_cloud') %></h3>
<div class="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 %>
</div>
</div>