mirror of
https://github.com/meineerde/redmine.git
synced 2026-03-26 10:41:09 +00:00
Adds AssetTagHelper to ViewListener class and functional test.
git-svn-id: http://redmine.rubyforge.org/svn/branches/work@1724 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
88f3c43170
commit
3a0c29a42e
@ -96,6 +96,7 @@ module Redmine
|
|||||||
include ActionView::Helpers::PrototypeHelper
|
include ActionView::Helpers::PrototypeHelper
|
||||||
include ActionView::Helpers::NumberHelper
|
include ActionView::Helpers::NumberHelper
|
||||||
include ActionView::Helpers::UrlHelper
|
include ActionView::Helpers::UrlHelper
|
||||||
|
include ActionView::Helpers::AssetTagHelper
|
||||||
include ActionController::UrlWriter
|
include ActionController::UrlWriter
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|||||||
@ -316,4 +316,23 @@ class ProjectsControllerTest < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# A hook that is manually registered later
|
||||||
|
class ProjectBasedTemplate < Redmine::Hook::ViewListener
|
||||||
|
def view_layouts_base_html_head(context)
|
||||||
|
# Adds a project stylesheet
|
||||||
|
stylesheet_link_tag(context[:project].identifier) if context[:project]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
# Don't use this hook now
|
||||||
|
Redmine::Hook.clear_listeners
|
||||||
|
|
||||||
|
def test_hook_response
|
||||||
|
Redmine::Hook.add_listener(ProjectBasedTemplate)
|
||||||
|
get :show, :id => 1
|
||||||
|
assert_tag :tag => 'link', :attributes => {:href => '/stylesheets/ecookbook.css'},
|
||||||
|
:parent => {:tag => 'head'}
|
||||||
|
|
||||||
|
Redmine::Hook.clear_listeners
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user