Fixed connect_to_model filter extension in wiki_controller (using inheritance here was daft); accelerated tests somewhat
This commit is contained in:
parent
64313ca208
commit
5f3cf38851
5 changed files with 9 additions and 14 deletions
|
@ -2,7 +2,7 @@
|
|||
# Likewise will all the methods added be available for all controllers.
|
||||
class ApplicationController < ActionController::Base
|
||||
|
||||
before_filter :fetch_model_data, :check_authorization, :setup_url_generator, :set_content_type_header, :set_robots_metatag
|
||||
before_filter :connect_to_model, :check_authorization, :setup_url_generator, :set_content_type_header, :set_robots_metatag
|
||||
after_filter :remember_location, :teardown_url_generator
|
||||
|
||||
# For injecting a different wiki model implementation. Intended for use in tests
|
||||
|
@ -27,7 +27,7 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
end
|
||||
|
||||
def fetch_model_data
|
||||
def connect_to_model
|
||||
@action_name = @params['action'] || 'index'
|
||||
@web_name = @params['web']
|
||||
@wiki = wiki
|
||||
|
|
|
@ -9,6 +9,7 @@ class FileController < ApplicationController
|
|||
before_filter :check_allow_uploads
|
||||
|
||||
def file
|
||||
@file_name = params['id']
|
||||
if @params['file']
|
||||
# form supplied
|
||||
new_file = @web.wiki_files.create(@params['file'])
|
||||
|
@ -65,10 +66,6 @@ class FileController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def connect_to_model
|
||||
super and @file_name = @params['id']
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def import_from_archive(archive)
|
||||
|
|
|
@ -5,6 +5,7 @@ require 'zip/zip'
|
|||
|
||||
class WikiController < ApplicationController
|
||||
|
||||
before_filter :load_page
|
||||
caches_action :show, :published, :authors, :recently_revised, :list
|
||||
cache_sweeper :revision_sweeper
|
||||
|
||||
|
@ -284,8 +285,7 @@ class WikiController < ApplicationController
|
|||
|
||||
protected
|
||||
|
||||
def connect_to_model
|
||||
super
|
||||
def load_page
|
||||
@page_name = @params['id']
|
||||
@page = @wiki.read_page(@web_name, @page_name) if @page_name
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue