<%= simple_form_for([:admin, @article], id: 'article_form') do |f| %>

<%= f.label :hero_image, "Hero Image" %> *

<% if @article.hero_image? %> <%= f.label :hero_image, "Change Image", class: "choose-file" %> <% elsif @article.short_hero_image? %> <%= f.label :hero_image, "Change Image", class: "choose-file" %> <% else %> <%= f.label :hero_image, "Upload Image", class: "choose-file" %> <% end %> <%= f.file_field :hero_image, class: "hero-image-value" %> <%= f.hidden_field :hero_image_file %>

Default images

<% Lines::Article::HERO_IMAGES.each_with_index do |h, i| %>
" width="115" id="hero_<%= i %>" class="select_image <%= 'selected_image' if ('/heroes/' + h) == @article.short_hero_image %>" />
<% end %> <%= f.hidden_field :short_hero_image, class: "short-hero-image-cache" %>

<%= f.label :title, "Title" %> *

<%= f.text_field :title, class: "article-title" %>

<%= f.label :sub_title, "Subtitle" %>

<%= f.text_field :sub_title, class: "article-subtitle" %>

<%= f.label :content, "Content" %> *

<%= f.text_area :content %>

Authors *

<%= hidden_field_tag "article[author_ids][]", nil %> <% @author_count = 1 %> <% Lines::Author.all.each do |author| %> <% if (@author_count <= 2) %>
<% else %>
<% end %> <%= check_box_tag "article[author_ids][]", author.id, @article.author_ids.include?(author.id), id: dom_id(author) %>
<% @author_count += 1 %> <% end %>
<%= link_to "+ Add new author", new_admin_author_path(), class: "add-new-author" %>

<%= f.label :gplus_url, "G+ URL" %>

<%= f.text_field :gplus_url %>

<%= f.label :document, "#{@article.document? ? @article.document.file.filename : 'Choose File' }", class: "choose-files" -%> <%= f.file_field :document, class: "article-document-value" %>
<% if @article.document? %>
<%= f.check_box :remove_document %>
<% end %>

<%= f.label :tag_list, "Tags" %>

<%= f.autocomplete_field :tag_list, autocomplete_tag_name_admin_articles_path, :"data-delimiter" => ', ' %>

Published at *

<%= f.text_field :published_at, value: (@article.published_at || Time.now).strftime("%Y-%m-%d"), 'data-behaviour' => 'datepicker' %>
<%= render_navbar do %> <%= f.submit "Save Article", class: "btn btn-save-publish" %> <%= link_to "Cancel", admin_articles_path, class: "btn btn-cancel" %> <% end %>
<% end %> <%= render 'lines/admin/articles/formatting_guide' %>