Module: Releaf::Builders::ResourceView

Includes:
Resource, Toolbox, View
Included in:
EditBuilder, ShowBuilder
Defined in:
app/builders/releaf/builders/resource_view.rb

Instance Attribute Summary

Attributes included from Resource

#resource

Attributes included from Template

#template

Instance Method Summary collapse

Methods included from Toolbox

#toolbox, #toolbox_button, #toolbox_menu

Methods included from Resource

#initialize

Methods included from View

#breadcrumb_item, #breadcrumbs, #dialog?, #dialog_name, #flash_item, #flash_notices, #footer_blocks, #footer_primary_block, #footer_primary_tools, #footer_secondary_block, #footer_tools, #header, #header_extras, #output, #section_attributes, #section_blocks, #section_footer, #section_footer_class, #section_header

Methods included from Template

#initialize

Methods included from Base

#default_translation_scope, #html_escape, #icon, #layout_settings, #locale_options, #resource_title, #safe_join, #t, #tag, #template_variable, #translate_locale, #wrapper

Instance Method Details

#back_to_list?Boolean

Returns:

  • (Boolean)

47
48
49
# File 'app/builders/releaf/builders/resource_view.rb', line 47

def back_to_list?
  feature_available?(:index) && params[:index_path].present?
end

#back_to_list_buttonObject


51
52
53
# File 'app/builders/releaf/builders/resource_view.rb', line 51

def back_to_list_button
  button(t("Back to list"), "caret-left", class: "secondary", href: index_path)
end

41
42
43
44
45
# File 'app/builders/releaf/builders/resource_view.rb', line 41

def footer_secondary_tools
  list = []
  list << back_to_list_button if back_to_list?
  list
end

#sectionObject


6
7
8
9
10
# File 'app/builders/releaf/builders/resource_view.rb', line 6

def section
  tag(:section, section_attributes) do
    section_content
  end
end

#section_bodyObject


27
28
29
30
31
# File 'app/builders/releaf/builders/resource_view.rb', line 27

def section_body
  tag(:div, section_body_attributes) do
    section_body_blocks
  end
end

#section_body_attributesObject


33
34
35
# File 'app/builders/releaf/builders/resource_view.rb', line 33

def section_body_attributes
  {class: ["body"]}
end

#section_body_blocksObject


37
38
39
# File 'app/builders/releaf/builders/resource_view.rb', line 37

def section_body_blocks
  []
end

#section_contentObject


12
13
14
# File 'app/builders/releaf/builders/resource_view.rb', line 12

def section_content
  section_blocks
end

#section_header_extrasObject


20
21
22
23
24
25
# File 'app/builders/releaf/builders/resource_view.rb', line 20

def section_header_extras
  return unless feature_available? :toolbox
  tag(:div, class: "extras toolbox-wrap") do
    toolbox(resource, index_path: index_path)
  end
end

#section_header_textObject


16
17
18
# File 'app/builders/releaf/builders/resource_view.rb', line 16

def section_header_text
  resource.new_record? ? t("Create new resource") : resource_title(resource)
end