Sha256: afeaed50ca8af16fcf74fc384cf11ea0fa04f9331d0e724e7a85f45125eab3c5

Contents?: true

Size: 1.44 KB

Versions: 7

Compression:

Stored size: 1.44 KB

Contents

-# When rendering inside rails_email_preview hide nav, and hide irrelevant things from the form
ruby:
  snippet = @snippet || @record.is_a?(Cms::Snippet) && @record
  if snippet && (p = ::RailsEmailPreview::Integrations::ComfortableMexicanSofa.rep_email_params_from_snippet(snippet))
    show_url = rails_email_preview.rep_raw_email_url(p.merge part_type: 'text/html')
  end
  customize_form = show_url.present? || snippet && !snippet.persisted?

- if customize_form
  javascript:
    jQuery(function($) {
      if (window.parent && (new RegExp('#{rails_email_preview.rep_root_path}')).test(parent.location.href)) {
        // Hide nav:
        $('.left-column,.right-column').hide();
        $('.center-column').css('margin', 0);

        var showUrl = '#{show_url}';

        if (showUrl) {
          $('.page-header h2').html(
            "#{t '.edit_email'}" + " <a class='btn btn-primary' href='" + showUrl + "'>#{t '.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

7 entries across 7 versions & 1 rubygems

Version Path
rails_email_preview-0.2.20 app/views/integrations/cms/_customize_cms_for_rails_email_preview.html.slim
rails_email_preview-0.2.19 app/views/integrations/cms/_customize_cms_for_rails_email_preview.html.slim
rails_email_preview-0.2.18 app/views/integrations/cms/_customize_cms_for_rails_email_preview.html.slim
rails_email_preview-0.2.17 app/views/integrations/cms/_customize_cms_for_rails_email_preview.html.slim
rails_email_preview-0.2.16 app/views/integrations/cms/_customize_cms_for_rails_email_preview.html.slim
rails_email_preview-0.2.15 app/views/integrations/cms/_customize_cms_for_rails_email_preview.html.slim
rails_email_preview-0.2.14 app/views/integrations/cms/_customize_cms_for_rails_email_preview.html.slim