Sha256: f78ecfdaf067099bb7216f5e7eb794bb1fc5119e65372d85e233dbb3a82335be
Contents?: true
Size: 1.3 KB
Versions: 2
Compression:
Stored size: 1.3 KB
Contents
-# When rendering inside rails_email_preview hide nav, and hide irrelevant things from the form ruby: prefix = 'email-' if @snippet && @snippet.identifier.try(:start_with?, prefix) && %w(new edit create update).include?(params[:action]) url_params = {part_type: 'text/html'} url_params[:mail_class], url_params[:mail_action] = @snippet.identifier[prefix.length..-1].split('-') url_params[:mail_class] += '_preview' show_url = rails_email_preview.rep_raw_email_url url_params end javascript: jQuery(function($) { if (window.parent && /email/.test(parent.location.href)) { // Hide nav: $('.left-column,.right-column').hide(); $('.center-column').css('margin', 0); $('.page-header h2').html( "Editing email" + " <a href='#{show_url}'>#{t 'rep.view_link'}</a>" ) // Snippet form: var control = function(name) { return $('[name^="snippet[' + name + ']"]').closest('.control-group'); }; // retext labels control('label').find('.control-label').text("Subject"); control('content').find('.control-label').text("Body"); // hide identifier and categories control('identifier').hide(); control('category_ids').hide() // Do not mess with identifier $('[data-slug]').removeAttr('data-slug'); } });
Version data entries
2 entries across 2 versions & 1 rubygems