docbrown/app/views/html_variants/_form.html.erb
Glenn Carremans bcce614a80 Last general linting sweep (#1947)
* Fixed HTML errors in /app/views/additional_content_boxes

* Fixed indentation

* Fixed linting error in /app/views/comments

* Fixed indentation in /app/views/html_variants

* Fixed HTML errors + Fixed indentation in /app/views/internal

* Fixed HTML errors + Fixed indentation in /app/views/layouts

* Fixed indentation in /app/views/mailers

* Fixed indentation in /app/views/moderations

* Fixed HTML errors + Fixed indentation in /app/views/notifications

* Fixed HTML errors in /app/views/pages

* Fixed HTML errors + Fixed indentation in /app/views/social_previews

* Fixed indentation in /app/views/stories

* Fixed indentation in /app/views/stripe_subscriptions

* Fixed indentation in /app/views/tags

* Fixed indentation in /app/views/users
2019-03-02 07:47:14 -08:00

42 lines
1.5 KiB
Text

<% flash.each do |key, value| %>
<div class="flash flash-<%= key %>"><%= value %></div>
<% end %>
<% if @html_variant.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@html_variant.errors.count, "error") %> prohibited this block from being saved:</h2>
<ul>
<% @html_variant.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
<%= form_for(@html_variant) do |f| %>
<% if @html_variant.new_record? %>
<%= f.label :name %>
<%= f.text_field :name, placeholder: "Unique, descriptive name" %>
<% end %>
<%= f.label :html %>
<%= f.text_area :html, placeholder: "HTML to be shown. Make sure all CSS is properly scoped, and all HTML tags are closed, etc. Manditory field." %>
<div class="form-sub-details">
<%= f.label :published %>
<%= f.check_box :published %>
<%= f.label :group %>
<%= f.select(:group, options_for_select(["article_show_sidebar_cta", "article_show_below_article_cta", "badge_landing_page"], @html_variant.group || "article_show_sidebar_cta")) %>
</div>
<%= f.submit %>
<% end %>
<% if @html_variant.html.present? %>
<h1 style="text-align:center;">Preview:</h1>
<div class="html-variant-wrapper" style="width: 360px;margin:20px auto;">
<%= @html_variant.html.html_safe %>
</div>
<% if @html_variant.group == "article_show_below_article_cta" %>
<div class="html-variant-wrapper" style="width: 880px;margin:20px auto;">
<%= @html_variant.html.html_safe %>
</div>
<% end %>
<% end %>