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 options tags for the screen sizes 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, #js_filter_field, #link_to_confirm_dialog, #link_to_dialog, #link_url_regexp, #new_asset_path_with_session_information, #page_layout_missing_warning, #render_alchemy_title, #render_hint_for, #sites_for_select, #toolbar_button, #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
#message_icon_class, #page_or_find, #render_flash_notice, #render_icon, #render_message, #shorten, #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.
26 27 28 29 30 31 32 33 34 35 |
# File 'app/helpers/alchemy/admin/pages_helper.rb', line 26 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
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/helpers/alchemy/admin/pages_helper.rb', line 37 def page_status_checkbox(page, attribute) label = page.class.human_attribute_name(attribute) if page.attribute_fixed?(attribute) checkbox = check_box(:page, attribute, disabled: true) hint = content_tag(:span, class: "hint-bubble") do Alchemy.t(:attribute_fixed, attribute: attribute) end content = content_tag(:span, class: "with-hint") do "#{checkbox}\n#{label}\n#{hint}".html_safe end else checkbox = check_box(:page, attribute) content = "#{checkbox}\n#{label}".html_safe end content_tag(:label, class: "checkbox") { content } end |
#preview_sizes_for_select ⇒ Object
Returns options tags for the screen sizes select in page edit view.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/helpers/alchemy/admin/pages_helper.rb', line 10 def preview_sizes_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 |