Commit c363363438401550efb3e0893655f6e92d3cb663

Authored by AntonioTerceiro
1 parent ad69b0ad

r244@sede: terceiro | 2007-07-29 17:00:48 -0300

ActionItem0: adding utility method to include all needed headers
 


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@248 3f533792-8f58-4932-b0fe-aaf55b0a4547
vendor/plugins/design/lib/design/helper.rb
... ... @@ -150,6 +150,17 @@ module Design
150 150 image_tag('/' + File.join(Design.design_root, 'icons', design.icon_theme, filename), options)
151 151 end
152 152  
  153 + ###############################################
  154 + # GENERAL UTILITIES
  155 + ###############################################
  156 +
  157 + # generates all header tags needed to use the design. The same as calling +design_template_javascript_include_tags+, +design_template_stylesheet_link_tags+ and 'design_theme_stylesheet_link_tags
  158 + def design_all_header_tags
  159 + design_template_javascript_include_tags +
  160 + design_template_stylesheet_link_tags +
  161 + design_theme_stylesheet_link_tags
  162 + end
  163 +
153 164 end # END OF module Helper
154 165  
155 166 end #END OF module Design
... ...
vendor/plugins/design/test/design_helper_test.rb
... ... @@ -59,6 +59,10 @@ class DesignHelperTestController < ActionController::Base
59 59 '
60 60 end
61 61  
  62 + def all_header_tags
  63 + render :inline => '<%= design_all_header_tags %>'
  64 + end
  65 +
62 66 end
63 67  
64 68 class DesignHelperTest < Test::Unit::TestCase
... ... @@ -147,4 +151,35 @@ class DesignHelperTest &lt; Test::Unit::TestCase
147 151 }
148 152 end
149 153  
  154 + def test_should_provide_full_header_tags
  155 + get :all_header_tags
  156 +
  157 + # template JS
  158 + assert_tag :tag => 'script', :attributes => {
  159 + :type => 'text/javascript',
  160 + :src => '/designs/templates/default/javascripts/one.js'
  161 + }
  162 + assert_tag :tag => 'script', :attributes => {
  163 + :type => 'text/javascript',
  164 + :src => '/designs/templates/default/javascripts/two.js'
  165 + }
  166 +
  167 + # template CSS
  168 + assert_tag :tag => 'link', :attributes => {
  169 + :type => 'text/css',
  170 + :href => '/designs/templates/default/stylesheets/one.css'
  171 + }
  172 + assert_tag :tag => 'link', :attributes => {
  173 + :type => 'text/css',
  174 + :href => '/designs/templates/default/stylesheets/two.css'
  175 + }
  176 +
  177 + # theme CSS
  178 + assert_tag :tag => 'link', :attributes => {
  179 + :type => 'text/css',
  180 + :href => '/designs/themes/default/one.css'
  181 + }
  182 +
  183 + end
  184 +
150 185 end
... ...