Add reroute middleware hack

This commit is contained in:
Wen-Tien Chang committed 2010-01-11 17:09:50 +08:00
1 parent 9f1ba2ae66
commit 314f6d5219
14 files changed
+65 -47

No files matched your search

@@ -1,21 +1,24 @@
class Admin::AnnouncementsController < ApplicationController
before_filter :require_entry_name, :only => [:index, :new]
layout "admin"
def index
@announcements = Announcement.all
@announcements = Announcement.find(:all, :conditions => { :entry_name => params[:entry_name] })
respond_to do |format|
format.html # index.html.erb
format.html
format.xml { render :xml => @announcements }
end
end
def new
@announcement = Announcement.new
@announcement.entry_name = params[:entry_name]
respond_to do |format|
format.html # new.html.erb
format.htm
format.xml { render :xml => @announcement }
end
end
@@ -26,7 +29,7 @@ class Admin::AnnouncementsController < ApplicationController
def create
@announcement = Announcement.new(params[:announcement])
respond_to do |format|
if @announcement.save
flash[:notice] = 'Announcement was successfully created.'
+1 -1
View File
@@ -1,7 +1,7 @@
class AnnouncementsController < ApplicationController
def index
@announcements = Announcement.all
@announcements = Announcement.find(:all, :conditions => { :entry_name => params[:entry_name] })
respond_to do |format|
format.html {
+6 -1
View File
@@ -30,5 +30,10 @@ class ApplicationController < ActionController::Base
# set locale based on session or default
I18n.locale = session[:locale] || I18n.default_locale
end
def require_entry_name
render :text => 'missing entry_name' if params[:entry_name].blank?
return
end
end
+2 -5
View File
@@ -9,14 +9,11 @@ class PagesController < ApplicationController
end
end
def show
def show
@page = Page.find_by_name(params[:page_name])
if @page && !@page.external_link.blank?
# redirect_to @page.external_link
elsif @page && !@page.use_engine.blank?
#model_class = Kernel.const_get( "Announcement" ) # page.use_engine
redirect_to announcements_path
redirect_to @page.external_link
else
render_liquid_page
end