app/views/articles/_form.html.erb
<%= form_for(@article, html: {id: "article-form", role: "form"}) do |f| %>
<% article_errors = @article.errors %>
<% if @article.errors.any? %>
<div id="error_explanation" class="alert alert-danger">
<h2><%= t("errors.template.header.#{article_errors.count == 1 ? 'one' : 'other'}", model: Article.model_name.human, count: article_errors.count) %></h2>
<ul>
<% @article.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="form-group">
<%= f.label :title %><br>
<%= f.text_field :title, class: ["form-control"] %>
</div>
<div class="form-group">
<%= f.label :tag_list %><br>
<%= f.text_field :tag_list, class: ["form-control", "js-tag-names"] %>
</div>
<div class="form-group form-editor">
<%= render partial: "layouts/editor", locals: {form: f} %>
</div>
<div class="preview-area markdown codehilite"></div>
<% if @article.draft? %>
<div class="checkbox">
<label>
<%= f.check_box :published %> <%= tc 'publish' %>
<label>
</div>
<% end %>
<div class="actions">
<% is_edit ||= false %>
<% if is_edit == false || @article.user_id == current_user.id %>
<div>
<%= f.check_box :is_public_editable %>
<%= f.label :is_public_editable %>
</div>
<% end %>
<% unless is_edit %>
<%= f.hidden_field :user_id, :value => current_user.id %>
<% end %>
<%= f.hidden_field :lock_version %>
<%= f.submit class: ["btn", "btn-success"] %>
</div>
<% end %>