Module: Alchemy::Admin::PagesHelper
- Includes:
- BaseHelper
- Defined in:
- app/helpers/alchemy/admin/pages_helper.rb
Instance Method Summary collapse
-
#page_layout_label(page) ⇒ Object
Renders a label for page’s page layout.
- #page_status_checkbox(page, attribute) ⇒ Object
-
#preview_sizes_for_select ⇒ Object
Returns screen sizes for the preview size select in page edit view.
Methods included from BaseHelper
#alchemy_body_class, #alchemy_datepicker, #button_with_confirm, #clipboard_select_tag_options, #current_alchemy_user_name, #delete_button, #hint_with_tooltip, #link_to_confirm_dialog, #link_to_dialog, #link_url_regexp, #page_layout_missing_warning, #render_alchemy_title, #render_hint_for, #sites_for_select, #translations_for_select
Methods included from NavigationHelper
#alchemy_main_navigation_entry, #entry_active?, #main_navigation_css_classes, #navigate_module, #sorted_alchemy_modules, #url_for_module, #url_for_module_sub_navigation
Methods included from BaseHelper
#render_icon, #render_message, #warning
Instance Method Details
#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.
22 23 24 25 26 27 28 29 30 31 |
# File 'app/helpers/alchemy/admin/pages_helper.rb', line 22 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 |
#page_status_checkbox(page, attribute) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/helpers/alchemy/admin/pages_helper.rb', line 33 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 |
#preview_sizes_for_select ⇒ Object
Returns screen sizes for the preview size select in page edit view.
You can configure the screen sizes in your config/alchemy/config.yml
.
12 13 14 15 16 |
# File 'app/helpers/alchemy/admin/pages_helper.rb', line 12 def preview_sizes_for_select Alchemy::Config.get(:page_preview_sizes).map do |size| [Alchemy.t(size, scope: "preview_sizes"), size] end end |