Module: Alchemy::Admin::PagesHelper

Includes:
BaseHelper
Defined in:
app/helpers/alchemy/admin/pages_helper.rb

Instance Method Summary collapse

Methods included from BaseHelper

#_t, #page_or_find, #render_flash_notice, #render_icon, #render_message, #shorten, #warning

Instance Method Details

#combined_page_status(page) ⇒ Object

Returns the translated explanation of the page status.



22
23
24
25
26
27
28
29
# File 'app/helpers/alchemy/admin/pages_helper.rb', line 22

def combined_page_status(page)
  page.status.map do |state, _value|
    next if state == :locked
    css_class = page.send("#{state}?") ? "page_status #{state}" : "page_status not_#{state}"
    val = (:span, '', class: css_class)
    val + page.status_title(state)
  end.delete_if(&:blank?).join("<br>").html_safe
end

#page_layout_label(page) ⇒ Object

Renders a label for page’s page layout

If the page layout definition of the page is missing, it displays a warning.



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'app/helpers/alchemy/admin/pages_helper.rb', line 35

def page_layout_label(page)
  if page.persisted? && page.definition.blank?
    [
      (: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

#preview_sizes_for_selectObject

Returns options tags for the screen sizes select in page edit view.



8
9
10
11
12
13
14
15
16
17
18
# File 'app/helpers/alchemy/admin/pages_helper.rb', line 8

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