noesya/osuny

View on GitHub
app/views/admin/communication/websites/posts/index.html.erb

Summary

Maintainability
Test Coverage
<% content_for :title, "#{Communication::Website::Post.model_name.human(count: 2)}" %>

<div class="d-flex justify-content-between mb-4">
  <p>
    <%= @posts.total_count %>
    <%= Communication::Website::Post.model_name.human(count: @posts.total_count).downcase %>
  </p>
  <%= render 'filters', current_path: admin_communication_website_posts_path, website: @website %>
</div>

<div data-batch-selectable class="mb-5">
  <%= form_tag publish_batch_admin_communication_website_posts_path do %>
    <%= render 'admin/communication/websites/posts/list', posts: @posts, selectable: true %>
    <%= paginate @posts %>
    <div>
      <div data-batch-selectable-role="actions-container">
        <div class="d-flex align-items-center">
          <div class="col-auto me-3">
            <%= t('batch_selectable.title') %>
          </div>
          <div class="col-auto me-3">
            <select name="published" class="form-select">
              <option value="false"><%= t('communication.website.post.localizations.unpublished') %></option>
              <option value="true"><%= t('communication.website.post.localizations.published') %></option>
            </select>
          </div>
          <div class="col-auto me-3">
            <%= submit_tag t("save"), class: "btn btn-primary" %>
          </div>
        </div>
      </div>
    </div>
  <% end %>
</div>

<% content_for :action_bar_left do %>
  <%= link_to t('communication.website.posts.new_curation'),
              new_admin_communication_website_post_curation_path(website_id: @website.id),
              class: button_classes('btn-light') if can?(:create, Communication::Website::Post) %>
<% end %>

<% content_for :action_bar_right do %>
  <%= create_link Communication::Website::Post %>
<% end %>