%= render "shared/globalize_locales", resource: @banner %>
<%= translatable_form_for [:admin, @banner] do |f| %>
<%= render "errors" %>
<% date_started_at = @banner.post_started_at.present? ? I18n.localize(@banner.post_started_at) : "" %>
<%= f.label :post_started_at, t("admin.banners.banner.post_started_at") %>
<%= f.text_field :post_started_at,
label: false,
placeholder: t("admin.banners.banner.post_started_at"),
value: date_started_at,
class: "js-calendar-full",
id: "post_started_at" %>
<% date_ended_at = @banner.post_ended_at.present? ? I18n.localize(@banner.post_ended_at) : ""%>
<%= f.label :post_ended_at, t("admin.banners.banner.post_ended_at") %>
<%= f.text_field :post_ended_at,
label: false,
placeholder: t("admin.banners.banner.post_ended_at"),
value: date_ended_at,
class: "js-calendar-full",
id: "post_ended_at" %>
<%= f.translatable_fields do |translations_form| %>
<%= translations_form.text_field :title,
placeholder: t("admin.banners.banner.title"),
data: {js_banner_title: "js_banner_title"},
label: t("admin.banners.banner.title") %>
<%= translations_form.text_field :description,
placeholder: t("admin.banners.banner.description"),
data: {js_banner_description: "js_banner_description"},
label: t("admin.banners.banner.description") %>
<% end %>
<%= f.label :target_url, t("admin.banners.banner.target_url") %>
<%= f.text_field :target_url,
label: false,
placeholder: t("admin.banners.banner.target_url") %>
<%= f.label :sections, t("admin.banners.banner.sections_label") %>
<%= f.collection_check_boxes(:web_section_ids, @banner_sections, :id, :name) do |b| %>
<%= b.check_box %> <%= t("admin.banners.banner.sections.#{b.text}") %>
<% end %>
<%= f.label :background_color, nil, for: "background_color_input" %>
<%= t("admin.shared.color_help") %>
<%= f.text_field :background_color, label: false, type: :color,
value: banner_bg_color_or_default %>
<%= f.text_field :background_color, label: false, id: "background_color_input" %>
<%= f.label :font_color, nil, for: "font_color_input" %>
<%= t("admin.shared.color_help") %>
<%= f.text_field :font_color, label: false, type: :color,
value: banner_font_color_or_default %>
<%= f.text_field :font_color, label: false, id: "font_color_input" %>
<%= f.submit(class: "button expanded", value: t("admin.banners.edit.form.submit_button")) %>
<%= link_to @banner.target_url do %>
<%= @banner.title %>
<%= @banner.description %>
<% end %>
<% end %>