Sha256: 3b23b938cee715a6e05e9aaaa388df00a4c8ad70455d7fc59000b7296db2bbe1

Contents?: true

Size: 1.66 KB

Versions: 26

Compression:

Stored size: 1.66 KB

Contents

# frozen_string_literal: true

module Alchemy
  module Admin
    module PagesHelper
      include Alchemy::Admin::BaseHelper

      # Returns options tags for the screen sizes select in page edit view.
      #
      def preview_sizes_for_select
        options_for_select([
          "auto",
          [Alchemy.t("240", scope: "preview_sizes"), 240],
          [Alchemy.t("320", scope: "preview_sizes"), 320],
          [Alchemy.t("480", scope: "preview_sizes"), 480],
          [Alchemy.t("768", scope: "preview_sizes"), 768],
          [Alchemy.t("1024", scope: "preview_sizes"), 1024],
          [Alchemy.t("1280", scope: "preview_sizes"), 1280]
        ])
      end

      # Renders a label for page's page layout
      #
      # If the page layout definition of the page is missing, it displays a warning.
      #
      def page_layout_label(page)
        if page.persisted? && page.definition.blank?
          [
            page_layout_missing_warning,
            Alchemy.t(:page_type)
          ].join(" ").html_safe
        else
          Alchemy.t(:page_type)
        end
      end

      def page_status_checkbox(page, attribute)
        label = page.class.human_attribute_name(attribute)
        checkbox = if page.attribute_fixed?(attribute)
          content_tag("sl-tooltip", class: "like-hint-tooltip", content: Alchemy.t(:attribute_fixed, attribute: attribute), placement: "bottom-start") do
            check_box_tag("page[#{attribute}]", "1", page.send(attribute), disabled: true)
          end
        else
          check_box(:page, attribute)
        end

        content_tag(:label, class: "checkbox") { "#{checkbox}\n#{label}".html_safe }
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
alchemy_cms-7.2.9 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-7.2.8 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-7.1.13 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-7.2.7 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-7.2.6 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-7.2.5 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-7.1.12 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-7.2.4 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-7.1.11 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-7.2.3 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-7.1.10 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-7.2.2 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-7.1.9 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-7.2.1 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-7.1.8 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-7.1.7 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-7.1.6 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-7.1.5 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-7.1.4 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-7.1.3 app/helpers/alchemy/admin/pages_helper.rb