AlchemyCMS/alchemy_cms

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

Summary

Maintainability
Test Coverage
<li id="page_{{id}}" class="sitemap-item {{page_layout}}" data-slug="{{slug}}" data-restricted="{{restricted}}" data-page-id="{{id}}" data-folded="{{folded}}">
  <div class="sitemap_page{{#if locked}} locked{{/if}}" name="{{name}}">
    <div class="sitemap_left_images">
      <span class="page_folder"></span>
      {{#if definition_missing}}
        <%= page_layout_missing_warning %>
      {{else}}
        {{#if permissions.edit_content}}
          <span class="page-icon {{#unless root}}handle{{/unless}}">
            {{#if locked}}
              <sl-tooltip content="{{locked_notice}}" class="like-hint-tooltip" placement="bottom-start">
                <alchemy-icon name="file-edit" size="xl"></alchemy-icon>
              </sl-tooltip>
            {{else}}
              <alchemy-icon name="file" size="xl"></alchemy-icon>
            {{/if}}
          </span>
        {{else}}
          <sl-tooltip content="<%= Alchemy.t("Your user role does not allow you to edit this page") %>" class="like-hint-tooltip" placement="bottom-start">
            <alchemy-icon name="file-forbid" size="xl"></alchemy-icon>
          </sl-tooltip>
        {{/if}}
      {{/if}}
    </div>
    <div class="sitemap_sitename">
      {{#if permissions.edit_content}}
        <%= link_to(
          "{{name}}",
          alchemy.edit_admin_page_path(id: "__ID__"),
          title: Alchemy.t(:edit_page),
          class: "sitemap_pagename_link"
        ) -%>
      {{else}}
        <%= content_tag("span", "{{name}}", class: "sitemap_pagename_link") %>
      {{/if}}
    </div>
    <div class="sitemap_url" title="{{url_path}}">
      {{ url_path }}
    </div>
    <div class="page_infos">
      {{#if locked}}
      <span class="page_status locked">
        <alchemy-icon name="edit" size="1x"></alchemy-icon>
        {{status_titles.locked}}
      </span>
      {{/if}}
      {{#if restricted}}
      <span class="page_status">
        <alchemy-icon name="lock" size="1x"></alchemy-icon>
        {{status_titles.restricted}}
      </span>
      {{/if}}
      {{#unless public}}
      <span class="page_status">
        <alchemy-icon name="cloud-off" size="1x"></alchemy-icon>
        {{status_titles.public}}
      </span>
      {{/unless}}
    </div>
    <div class="sitemap_right_tools">
      {{#if permissions.info}}
      <sl-tooltip content="<%= Alchemy.t(:page_infos) %>">
        <%= link_to_dialog(
          render_icon("information"),
          alchemy.info_admin_page_path(id: "__ID__"),
          {
            title: Alchemy.t(:page_infos),
            size: "520x290"
          },
          class: "icon_button"
        ) %>
      </sl-tooltip>
      {{else}}
      <div class="sitemap_tool disabled">
        <sl-tooltip content="<%= Alchemy.t("Your user role does not allow you to edit this page") %>" class="like-hint-tooltip" placement="bottom-start">
          <%= render_icon("information") %>
        </sl-tooltip>
      </div>
      {{/if}}
      {{#if permissions.configure}}
      <sl-tooltip content="<%= Alchemy.t(:edit_page_properties) %>">
        <%= link_to_dialog(
          render_icon("settings-3"),
          alchemy.configure_admin_page_path(id: "__ID__"),
          {
            title: Alchemy.t(:edit_page_properties),
            size: "500x680"
          },
          class: "icon_button"
        ) -%>
      </sl-tooltip>
      {{else}}
      <div class="sitemap_tool disabled">
        <sl-tooltip content="<%= Alchemy.t("Your user role does not allow you to edit this page") %>" class="like-hint-tooltip" placement="bottom-start">
          <%= render_icon("settings-3") %>
        </sl-tooltip>
      </div>
      {{/if}}
      {{#if permissions.copy}}
      <sl-tooltip content="<%= Alchemy.t(:copy_page) %>">
        <%= link_to(
          render_icon("file-copy"),
          alchemy.insert_admin_clipboard_path(
            remarkable_type: :pages,
            remarkable_id: "__ID__",
          ),
          remote: true,
          method: :post,
          class: "icon_button"
        ) %>
      </sl-tooltip>
      {{else}}
      <div class="sitemap_tool disabled">
        <sl-tooltip content="<%= Alchemy.t("Your user role does not allow you to edit this page") %>" class="like-hint-tooltip" placement="bottom-start">
          <%= render_icon("file-copy") %>
        </sl-tooltip>
      </div>
      {{/if}}
      {{#if permissions.destroy}}
      <sl-tooltip content="<%= Alchemy.t(:delete_page) %>">
        <%= link_to_confirm_dialog(
          render_icon("delete-bin-2"),
          Alchemy.t(:confirm_to_delete_page),
          url_for(
            controller: "pages",
            action: "destroy",
            id: "__ID__"
          ),
          class: "icon_button"
        ) -%>
      </sl-tooltip>
      {{else}}
      <div class="sitemap_tool disabled">
        <sl-tooltip content="<%= Alchemy.t("Your user role does not allow you to edit this page") %>" class="like-hint-tooltip" placement="bottom-start">
          <%= render_icon("delete-bin-2") %>
        </sl-tooltip>
      </div>
      {{/if}}
      {{#if permissions.create}}
      <sl-tooltip content="<%= Alchemy.t(:create_page) %>">
        <%= link_to_dialog(
          render_icon(:add),
          alchemy.new_admin_page_path(parent_id: "__ID__"),
          {
            title: Alchemy.t(:create_page),
            size: "340x165",
            overflow: true
          },
          class: "icon_button"
        ) -%>
      </sl-tooltip>
      {{else}}
      <div class="sitemap_tool disabled">
        <sl-tooltip content="<%= Alchemy.t("Your user role does not allow you to edit this page") %>" class="like-hint-tooltip" placement="bottom-start">
          <%= render_icon("file-add") %>
        </sl-tooltip>
      </div>
      {{/if}}
    </div>
  </div>
  <ul id="page_{{id}}_children" class="children" data-parent-id="{{id}}">
    {{> list}}
  </ul>
</li>