AlchemyCMS/alchemy_cms

View on GitHub
app/views/alchemy/admin/clipboard/index.html.erb

Summary

Maintainability
Test Coverage
<% if @clipboard_items.blank? %>
  <%= render_message do %>
    <%= Alchemy.t('No items in your clipboard') %>
  <% end %>
<% else %>
  <%= render_message do %>
    <%= Alchemy.t('Add items from clipboard via "Add Element" button') %>
  <% end %>

  <div id="clipboard_items">
    <ul>
      <% @clipboard_items.each do |item| %>
        <% item_class = item.class.name.demodulize.underscore.pluralize %>
        <li id="clipboard_item_<%= item.id %>" class="<%= item_class %>">
          <% if item_class == 'pages' %>
            <%= render_icon(:file) %>
            <%= truncate(item.name, length: 50) %>
          <% else %>
            <%= render_icon(:draggable, style: false) %>
            <%= truncate(item.display_name_with_preview_text(50), length: 50) %>
          <% end %>
          <sl-tooltip content="<%= Alchemy.t('Remove item from clipboard') %>">
            <%= link_to render_icon(:close, size: '1x'),
              alchemy.remove_admin_clipboard_path(remarkable_type: item_class, remarkable_id: item.id),
              remote: true, method: 'delete',
              class: "icon_button small"
            %>
          </sl-tooltip>
        </li>
      <% end %>
    </ul>
    <p>
      <%= link_to_confirm_dialog Alchemy.t('clear clipboard'),
        Alchemy.t('Do you really want to clear the clipboard?'),
        alchemy.clear_admin_clipboard_path(remarkable_type: params[:remarkable_type]),
        class: 'button' %>
    </p>
  </div>
<% end %>