Commit 73a091b3c738c4407e4cc41cd2522b5b8934b518

Authored by Daniela Feitosa
2 parents 27d41c7f adf0eb09

Merge commit 'refs/merge-requests/155' of git://gitorious.org/noosfero/noosfero …

…into merge-requests/155

(ActionItem2213)
app/views/layouts/_javascript.rhtml
1 1 <%= javascript_include_tag :defaults, 'jquery-latest.js', 'jquery.noconflict.js', 'jquery.cycle.all.min.js', 'thickbox.js', 'lightbox', 'jquery-ui-1.8.2.custom.min', 'jquery.scrollTo', 'jquery.form.js', 'jquery.cookie', 'reflection', 'add-and-join', 'jquery.tokeninput', 'report-abuse','colorbox', 'jquery-validation/jquery.validate', 'catalog', 'manage-products', :cache => 'cache-general' %>
  2 +
2 3 <% language = FastGettext.locale %>
3   -<%= javascript_include_tag 'jquery-validation/localization/messages_'+language, 'jquery-validation/localization/methods_'+language %>
  4 +<% %w{messages methods}.each do |type| %>
  5 + <% require_path = File.join('jquery-validation', 'localization', type+'_'+language) %>
  6 + <% full_path = File.join(Rails.root, 'public', 'javascripts', require_path+'.js')%>
  7 + <%= javascript_include_tag require_path if File.exists?(full_path) %>
  8 +<% end %>
... ...
test/functional/application_controller_test.rb
... ... @@ -438,6 +438,13 @@ class ApplicationControllerTest &lt; ActionController::TestCase
438 438 assert_tag :tag => 'style', :content => 'This is Plugin2 speaking!'
439 439 end
440 440  
  441 + should 'not include jquery-validation language script if they do not exist' do
  442 + Noosfero.stubs(:available_locales).returns(['bli'])
  443 + get :index, :lang => 'bli'
  444 + assert_no_tag :tag => 'script', :attributes => {:src => /messages_bli/}
  445 + assert_no_tag :tag => 'script', :attributes => {:src => /methods_bli/}
  446 + end
  447 +
441 448 if ActiveRecord::Base.connection.adapter_name == 'PostgreSQL'
442 449  
443 450 should 'change postgresql schema' do
... ...