AlchemyCMS/alchemy_cms

View on GitHub
app/views/alchemy/admin/pages/_toolbar.html.erb

Summary

Maintainability
Test Coverage
<div class="toolbar_buttons">
  <%= render "alchemy/admin/partials/site_select" %>
  <%= render "alchemy/admin/partials/language_tree_select" %>
  <%= render Alchemy::Admin::ToolbarButton.new(
    icon: "file-add",
    url: alchemy.new_admin_page_path(language: @current_language),
    hotkey: 'alt+n',
    tooltip_placement: "top-start",
    dialog_options: {
      title: Alchemy.t('Add a page'),
      size: '340x215',
      overflow: true
    },
    label: Alchemy.t('Add a page'),
    if_permitted_to: [:create, Alchemy::Page]
  ) %>
  <div class="toolbar_spacer"></div>
  <% if can?(:flush, Alchemy::Page) %>
    <div class="toolbar_button">
      <sl-tooltip content="<%= Alchemy.t("Flush page cache") %>">
        <%= link_to(
          render_icon(:eraser),
          alchemy.flush_admin_pages_path,
          remote: true,
          method: :post,
          class: "icon_button please_wait",
          title: Alchemy.t("Flush page cache")
        ) %>
      </sl-tooltip>
    </div>
  <% end %>
  <div class="toolbar_button">
    <sl-tooltip content="<%= Alchemy.t("Show clipboard") %>">
      <%= link_to_dialog(
        render_icon(:clipboard, style: clipboard_empty?("pages") ? "line" : "fill"),
        alchemy.admin_clipboard_path(remarkable_type: "pages"),
        {
          title: Alchemy.t("Clipboard"),
          size: "380x305"
        },
        class: "icon_button",
        title: Alchemy.t("Show clipboard"),
        id: "clipboard_button"
      ) %>
    </sl-tooltip>
  </div>
  <div class="toolbar_spacer"></div>
  <div class="toolbar_button">
    <sl-tooltip content="<%= Alchemy.t("Hierarchical") %>">
      <%= link_to(
        render_icon(:"menu-2"),
        alchemy.admin_pages_path(view: "tree"),
        class: ["icon_button", @view != "list" && "active"].compact
      ) %>
    </sl-tooltip>
  </div>
  <div class="toolbar_button">
    <sl-tooltip content="<%= Alchemy.t("Sortable List") %>">
      <%= link_to(
        render_icon("sort-desc", style: false),
        alchemy.admin_pages_path(view: "list"),
        class: ["icon_button", @view == "list" && "active"].compact
      ) %>
    </sl-tooltip>
  </div>
</div>
<% search_filter_params[:view] = "list" %>
<%= render "alchemy/admin/partials/search_form",
  url: alchemy.admin_pages_path(search_filter_params.except(:q, :page)),
  additional_params: [:view] %>