extract function for toggling email footer and header

pull/41/head
Martin Linkhorst 13 years ago
parent 5080b9019b
commit 0cbf9b7340
  1. 2
      app/helpers/application_helper.rb
  2. 8
      public/javascripts/application.js

@ -923,7 +923,7 @@ module ApplicationHelper
def switch_emails_decorators_language(lang)
localized_language_name = l(:general_lang_name, :locale => lang)
# make that better
link_to_function(localized_language_name, "jQuery('#emails_decorators a').css('text-decoration', 'none'); jQuery(this).css('text-decoration', 'underline'); jQuery('.emails_decorators').hide(); jQuery('#emails_decorators_#{lang}').show();")
link_to_function(localized_language_name, "toggleEmailDecoratorFields(this, '#{lang}')")
end
def progress_bar(pcts, options={})

@ -459,6 +459,14 @@ function addClickEventToAllErrorMessages() {
});
});
}
function toggleEmailDecoratorFields(sender, lang) {
jQuery("#emails_decorators a").css("text-decoration", "none");
jQuery(".emails_decorators").hide();
jQuery(sender).css("text-decoration", "underline");
jQuery("#emails_decorators_" + lang).show();
}
$(document).observe('dom:loaded', function() {
// Set focus on first error message
var error_focus = $$('a.afocus').first();

Loading…
Cancel
Save