Sha256: 714ef01b4699034b6cbb45ec5a0acebc11aa19ca8c373acb4fdedfe636bbfe23

Contents?: true

Size: 1.56 KB

Versions: 6

Compression:

Stored size: 1.56 KB

Contents

module Alchemy
  module Admin
    module PagesHelper
      include Alchemy::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

      # Returns the translated explanation of the page status.
      #
      def combined_page_status(page)
        page.status.map do |state, _value|
          next if state == :locked
          val = content_tag(:span, '', class: page.send(state) ? "page_status #{state}" : "page_status not_#{state}")
          val + page.status_title(state)
        end.delete_if(&:blank?).join("<br>").html_safe
      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?
          [
            content_tag(:span, '',
              class: 'inline warning icon',
              title: Alchemy.t(:page_definition_missing)
            ),
            Alchemy.t(:page_type)
          ].join('&nbsp;').html_safe
        else
          Alchemy.t(:page_type)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
alchemy_cms-3.3.3 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-3.3.2 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-3.3.1 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-3.3.0 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-3.3.0.rc2 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-3.3.0.rc1 app/helpers/alchemy/admin/pages_helper.rb