HeavyTechRuby/history

View on GitHub
app/views/comments/_form.html.erb

Summary

Maintainability
Test Coverage
<%= form_with(model: [@story, @comment], local: true) do |form| %>
  <% if @comment.errors.any? %>
    <div class="alert alert-danger" role="alert">
      <div id="error_explanation">
        <h4>
          <%= t('comments.form.prohibited') %>:
        </h4>
        <ul>
          <% @comment.errors.each do |error| %>
            <li><%= error.full_message %></li>
          <% end %>
        </ul>
      </div>
    </div>
  <% end %>
  <div class="w-100">
    <div data-mdb-input-init class="form-outline">
      <%= form.label :body, class: 'form-label', for: 'textAreaExample' %>
      <%= form.text_area :body, class: 'form-control', id: 'textAreaExample', rows: '4' %>
    </div>
    <div class="d-flex justify-content-between mt-3">
      <%= form.submit class: 'btn btn-primary' %>
    </div>
  </div>
<% end %>