Class: TinyAdmin::Views::Actions::Index

Inherits:
DefaultLayout show all
Defined in:
lib/tiny_admin/views/actions/index.rb

Instance Attribute Summary collapse

Attributes inherited from DefaultLayout

#flash_component, #head_component, #messages, #navbar_component, #options, #title

Attributes inherited from BasicLayout

#content, #params, #widgets

Instance Method Summary collapse

Methods inherited from BasicLayout

#label_for, #update_attributes

Methods included from Utils

#humanize, #params_to_s, #prepare_page, #to_class

Instance Attribute Details

#actionsObject

Returns the value of attribute actions.



7
8
9
# File 'lib/tiny_admin/views/actions/index.rb', line 7

def actions
  @actions
end

#fieldsObject

Returns the value of attribute fields.



7
8
9
# File 'lib/tiny_admin/views/actions/index.rb', line 7

def fields
  @fields
end

#filtersObject

Returns the value of attribute filters.



7
8
9
# File 'lib/tiny_admin/views/actions/index.rb', line 7

def filters
  @filters
end

Returns the value of attribute links.



7
8
9
# File 'lib/tiny_admin/views/actions/index.rb', line 7

def links
  @links
end

#pagination_componentObject

Returns the value of attribute pagination_component.



7
8
9
# File 'lib/tiny_admin/views/actions/index.rb', line 7

def pagination_component
  @pagination_component
end

#prepare_recordObject

Returns the value of attribute prepare_record.



7
8
9
# File 'lib/tiny_admin/views/actions/index.rb', line 7

def prepare_record
  @prepare_record
end

#recordsObject

Returns the value of attribute records.



7
8
9
# File 'lib/tiny_admin/views/actions/index.rb', line 7

def records
  @records
end

#slugObject

Returns the value of attribute slug.



7
8
9
# File 'lib/tiny_admin/views/actions/index.rb', line 7

def slug
  @slug
end

Instance Method Details

#view_templateObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/tiny_admin/views/actions/index.rb', line 16

def view_template
  super do
    div(class: 'index') {
      div(class: 'row') {
        div(class: 'col-4') {
          h1(class: 'title') {
            title
          }
        }
        div(class: 'col-8') {
          actions_buttons
        }
      }

      div(class: 'row') {
        div_class = filters&.any? ? 'col-9' : 'col-12'
        div(class: div_class) {
          table(class: 'table') {
            table_header if fields.any?

            table_body
          }

          render pagination_component if pagination_component
        }

        if filters&.any?
          div(class: 'col-3') {
            filters_form = TinyAdmin::Views::Components::FiltersForm.new
            filters_form.update_attributes(section_path: TinyAdmin.route_for(slug), filters: filters)
            render filters_form
          }
        end
      }

      render TinyAdmin::Views::Components::Widgets.new(widgets)
    }
  end
end