Module: PagesCore::Admin::AdminHelper

Includes:
ContentTabsHelper, DateRangeHelper, ImageUploadsHelper, LabelledFieldHelper, LocalesHelper, PageJsonHelper, TagEditorHelper
Included in:
Admin::AdminHelper
Defined in:
app/helpers/pages_core/admin/admin_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TagEditorHelper

#tag_editor_for

Methods included from LabelledFieldHelper

#image_upload_field, #labelled_field

Methods included from PageJsonHelper

#page_json, #page_permissions

Methods included from LocalesHelper

#locale_direction, #locales_with_dir, #rtl_locale?, #rtl_locales

Methods included from ImageUploadsHelper

#editable_dynamic_image_tag, #image_uploader_tag

Methods included from DateRangeHelper

#date_range, #page_date_range

Methods included from ContentTabsHelper

#content_tab

Instance Attribute Details

#page_description(string = nil, class_name = nil) ⇒ Object



52
53
54
55
56
57
58
59
60
# File 'app/helpers/pages_core/admin/admin_helper.rb', line 52

def page_description(string = nil, class_name = nil)
  deprecate_page_description_args(string, class_name)
  @page_description_class = class_name if class_name
  if string
    @page_description = string
  else
    @page_description
  end
end

#page_description_class=(value) ⇒ Object (writeonly)

Sets the attribute page_description_class

Parameters:

  • value

    the value to set the attribute page_description_class to.



14
15
16
# File 'app/helpers/pages_core/admin/admin_helper.rb', line 14

def page_description_class=(value)
  @page_description_class = value
end


62
63
64
65
66
67
68
69
70
# File 'app/helpers/pages_core/admin/admin_helper.rb', line 62

def page_description_links(links = nil)
  return @page_description_links unless links

  ActiveSupport::Deprecation.warn(
    "Setting page description_links with page_description_links " \
    "is deprecated, use page_description_links="
  )
  @page_description_links = links
end

#page_title(title = nil) ⇒ Object



72
73
74
75
76
77
78
79
# File 'app/helpers/pages_core/admin/admin_helper.rb', line 72

def page_title(title = nil)
  return @page_title unless title

  ActiveSupport::Deprecation.warn(
    "Setting page title with page_title is deprecated, use page_title="
  )
  @page_title = title
end

Instance Method Details

#add_body_class(class_name) ⇒ Object



17
18
19
20
# File 'app/helpers/pages_core/admin/admin_helper.rb', line 17

def add_body_class(class_name)
  @body_classes ||= []
  @body_classes << class_name
end

#body_classesObject



22
23
24
25
26
# File 'app/helpers/pages_core/admin/admin_helper.rb', line 22

def body_classes
  classes = @body_classes || []
  classes << "with_notice" if flash[:notice]
  classes
end

#deprecate_page_description_args(string = nil, class_name = nil) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
# File 'app/helpers/pages_core/admin/admin_helper.rb', line 39

def deprecate_page_description_args(string = nil, class_name = nil)
  if class_name
    ActiveSupport::Deprecation.warn("Setting class through " \
                                    "page_description is deprecated, " \
                                    "use page_description_class=")
  end
  return unless string

  ActiveSupport::Deprecation.warn("Setting description with " \
                                  "page_description is deprecated, " \
                                  "use page_description=")
end


35
36
37
# File 'app/helpers/pages_core/admin/admin_helper.rb', line 35

def link_separator
  safe_join [" ", tag.span("|", class: "separator"), " "]
end

#rich_text_area_tag(name, content = nil, options = {}) ⇒ Object



28
29
30
31
32
33
# File 'app/helpers/pages_core/admin/admin_helper.rb', line 28

def rich_text_area_tag(name, content = nil, options = {})
  react_component("RichTextArea",
                  options.merge(id: sanitize_to_id(name),
                                name: name,
                                value: content))
end