Class: Uchi::Ui::Index::RecordsTable

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/uchi/ui/index/records_table.rb,
app/components/uchi/ui/index/records_table/search_form.rb

Defined Under Namespace

Classes: SearchForm

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(columns:, records:, repository:, query: nil, scope: nil, sort_order: nil) ⇒ RecordsTable

Returns a new instance of RecordsTable.



13
14
15
16
17
18
19
20
21
# File 'app/components/uchi/ui/index/records_table.rb', line 13

def initialize(columns:, records:, repository:, query: nil, scope: nil, sort_order: nil)
  super()
  @columns = columns
  @query = query
  @sort_order = sort_order
  @records = records
  @repository = repository
  @scope = scope
end

Instance Attribute Details

#columnsObject (readonly)

Returns the columns to be displayed in this table. Each column is a representation of a Field from repository. Defaults to all fields.



9
10
11
# File 'app/components/uchi/ui/index/records_table.rb', line 9

def columns
  @columns
end

#queryObject (readonly)

Returns the value of attribute query.



11
12
13
# File 'app/components/uchi/ui/index/records_table.rb', line 11

def query
  @query
end

#recordsObject (readonly)

Returns the value of attribute records.



11
12
13
# File 'app/components/uchi/ui/index/records_table.rb', line 11

def records
  @records
end

#repositoryObject (readonly)

Returns the value of attribute repository.



11
12
13
# File 'app/components/uchi/ui/index/records_table.rb', line 11

def repository
  @repository
end

#scopeObject (readonly)

Returns the value of attribute scope.



11
12
13
# File 'app/components/uchi/ui/index/records_table.rb', line 11

def scope
  @scope
end

#sort_orderObject (readonly)

Returns the value of attribute sort_order.



11
12
13
# File 'app/components/uchi/ui/index/records_table.rb', line 11

def sort_order
  @sort_order
end

Instance Method Details

#path_for_edit(record) ⇒ Object



23
24
25
# File 'app/components/uchi/ui/index/records_table.rb', line 23

def path_for_edit(record)
  repository.routes.path_for(:edit, id: record.id, scope: scope)
end