app/views/lines/admin/articles/_form.html.erb in lines-engine-0.6.2 vs app/views/lines/admin/articles/_form.html.erb in lines-engine-0.9.0

- old
+ new

@@ -1,185 +1,87 @@ <%= simple_form_for([:admin, @article], id: 'article_form') do |f| %> - <div class="new-article"> - <div class="row"> - <div class="label"> - <h3><%= f.label :hero_image, "Hero Image" %> <span class="required">*</span></h3> - </div> - <div class="input"> - <div class="hero-image" style="background: url('<%= @article.hero_image? ? @article.hero_image : @article.short_hero_image %>'); background-size: cover;"> - <% 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 %> - <div class="hidden"> - <%= f.hidden_field :hero_image_cache, class: "hero-image-cache" %> - <span id="hero_image_name"><%= (@article.hero_image.filename) if @article.hero_image? %></span> - </div> - </div> - </div> - <div class="additional"> - <div class="short-hero-images-box"> - <h2>Default images</h2> - <div class="short-hero-images"> + <div class="hero-upload"> + <%= f.file_field :hero_image %> + <%= f.hidden_field :remove_hero_image %> + <div class="btn-change-hero">Change</div> + <% if @article.short_hero_image.present? %> + <img src="<%= @article.short_hero_image %>" alt="" /> + <% elsif @article.hero_image? %> + <img src="<%= @article.hero_image %>" alt="" /> + <% end %> + <%= f.hidden_field :hero_image_file %> + <div class="upload-overlay"> + <div class="upload-overlay-close icon-close"></div> + <div class="upload-overlay-inner"> + <h2>Select Hero Image</h2> + <div class="btn-remove-hero<%= " show" if @article.hero_image? || @article.short_hero_image %>">Remove hero image</div> + <%= f.label :hero_image, "Upload an image" %> + <div class="hero-images"> <% Lines::Article::HERO_IMAGES.each_with_index do |h, i| %> - <div class="short-hero-image-box"> - <img src="<%= "/heroes/#{h}" %>" width="115" id="hero_<%= i %>" class="select_image <%= 'selected_image' if ('/heroes/' + h) == @article.short_hero_image %>" /> - </div> + <img src="<%= "/heroes/#{h}" %>" alt="" class="<%= 'selected-hero-image' if ('/heroes/' + h) == @article.short_hero_image %>" /> <% end %> <%= f.hidden_field :short_hero_image, class: "short-hero-image-cache" %> </div> - <br style="clear: both;" /> </div> + <div class="hero-background-overlay"></div> </div> </div> - <div class="row"> - <div class="label"> - <h3><%= f.label :title, "Title" %> <span class="required">*</span></h3> - </div> - <div class="input input-text"> - <%= f.text_field :title, class: "article-title" %> - </div> - <div class="additional"> - - </div> + <div class="input-field required"> + <%= f.text_field :title, placeholder: "Title", class: 'title' %> </div> - <div class="row"> - <div class="label"> - <h3><%= f.label :sub_title, "Subtitle" %></h3> - </div> - <div class="input input-text"> - <%= f.text_field :sub_title, class: "article-subtitle" %> - </div> - <div class="additional"> - - </div> + <div class="input-field"> + <%= f.text_field :sub_title, placeholder: "Subtitle" %> </div> - <div class="row"> - <div class="label"> - <h3><%= f.label :teaser, "Teaser" %></h3> - </div> - <div class="input input-textarea"> - <%= f.text_area :teaser %> - </div> - <div class="additional"></div> + <div class="input-field"> + <%= f.text_area :teaser, placeholder: "Teaser", rows: 1 %> </div> - <div class="row"> - <div class="label"> - <h3><%= f.label :content, "Content" %> <span class="required">*</span></h3> - </div> - <div class="input input-textarea"> - <%= f.text_area :content %> - </div> - <div class="additional"> - <a href="#formatting_guide" data-toggle="modal" class="btn-formatting-help">&lt;/&gt; Formatting Help</a> - </div> + <div class="input-field editor required"> + <%= f.text_area :content, placeholder: "Body copy", rows: 1, data: {editor: "codemirror"} %> </div> - <div class="row"> - <div class="label"> - <h3>Authors <span class="required">*</span></h3> - </div> - <div class="input"> - <%= hidden_field_tag "article[author_ids][]", nil %> - <% @author_count = 1 %> - <% Lines::Author.all.each do |author| %> - <% if (@author_count <= 2) %> - <div class="checkbox first-row"> - <% else %> - <div class="checkbox"> - <% end %> - <%= check_box_tag "article[author_ids][]", author.id, @article.author_ids.include?(author.id), id: dom_id(author) %> - <label for="<%= dom_id(author) %>" class="checkbox"><span></span><%= author.name %></label> - </div> - <% @author_count += 1 %> + <div class="input-field"> + <div class="documents"> + <%= f.label :document, "#{@article.document? ? @article.document.file.filename + ' <span>(' + number_to_human_size(File.size(@article.document.file.file)) + ')</span>' : 'Attach Document' }".html_safe, class: "attachment-label", title: "Change Attachment" -%> + <% if @article.document? %> + <span class="icon-delete btn-delete-attachment" title="Remove Attachment"></span> <% end %> + <%= f.file_field :document, class: "article-document-value" %> + <div class="hidden"> + <%= f.hidden_field :document_cache %> + <%= f.check_box :remove_document %> + </div> </div> - <div class="additional"> - <%= link_to "+ Add new author", new_admin_author_path(), class: "add-new-author" %> - </div> + </div> - <hr /> + <h2>Authors <span style="color: #c10020;">*</span></h2> - <div class="row"> - <div class="label"> - <h3><%= f.label :gplus_url, "G+ URL" %></h3> - </div> - <div class="input input-text"> - <%= f.text_field :gplus_url %> - </div> - <div class="additional"> - - </div> + <div class="input-field"> + <%= f.collection_check_boxes(:author_ids, Lines::Author.all, :id, :name) %> </div> - <div class="row"> - <div class="label"> - <h3><label>Document</label></h3> - </div> - <div class="input"> - <div class="documents"> - <%= f.label :document, "#{@article.document? ? @article.document.file.filename : 'Choose File' }", class: "choose-files" -%> - <%= f.file_field :document, class: "article-document-value" %> - <div class="hidden"> - <%= f.hidden_field :document_cache %> - <%= (@article.hero_image.filename) if @article.document? %> - </div> - </div> + <h2>Additional Info</h2> - <% if @article.document? %> - <div class="checkbox"> - <%= f.check_box :remove_document %> - <label for="article_remove_document" class="checkbox"><span></span>Delete document</label> - </div> - <% end %> - - </div> - <div class="additional"> - - </div> + <div class="input-field"> + <%= f.autocomplete_field :tag_list, autocomplete_tag_name_admin_articles_path, :"data-delimiter" => ', ', placeholder: "Tags" %> </div> - <div class="row"> - <div class="label"> - <h3><%= f.label :tag_list, "Tags" %></h3> - </div> - <div class="input input-text"> - <%= f.autocomplete_field :tag_list, autocomplete_tag_name_admin_articles_path, :"data-delimiter" => ', ' %> - </div> - <div class="additional"> - - </div> + <div class="input-field"> + <%= f.text_field :gplus_url, placeholder: "Google+ link" %> </div> - <div class="row"> - <div class="label"> - <h3>Published at <span class="required">*</span></h3> - </div> - <div class="input input-text"> - <%= f.text_field :published_at, value: (@article.published_at || Time.now).strftime("%Y-%m-%d"), 'data-behaviour' => 'datepicker' %> - </div> - <div class="additional"> - - </div> + <div class="input-field required"> + <%= f.text_field :published_at, value: (@article.published_at || Time.now).strftime("%Y-%m-%d"), 'data-behaviour' => 'datepicker', placeholder: "Published on" %> </div> <%= render_navbar do %> - <%= f.submit "Save Article", class: "btn btn-save-publish" %> + <%= f.submit "Save Article", class: "btn btn-save-publish highlight" %> <%= link_to "Cancel", admin_articles_path, class: "btn btn-cancel" %> <% end %> </div> -<% end %> - -<%= render 'lines/admin/articles/formatting_guide' %> - +<% end %> \ No newline at end of file