Class: Layout::Index::Cell

Inherits:
Cell
  • Object
show all
Defined in:
app/cells/lato_view/layout/index/cell.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(elements: nil, head: nil, attributes: nil, link: nil, show_link: true, edit_link: true, delete_link: true, remote_delete: false, custom_class: nil) ⇒ Cell

Returns a new instance of Cell.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/cells/lato_view/layout/index/cell.rb', line 7

def initialize(elements: nil, head: nil, attributes: nil, link: nil,
               show_link: true, edit_link: true, delete_link: true,
               remote_delete: false, custom_class: nil)
  # save params
  @elements = elements
  @head = head
  @attributes = attributes
  @link = link
  @show_link = show_link
  @edit_link = edit_link
  @delete_link = delete_link
  @remote_delete = remote_delete
  @custom_class = custom_class
  # check params
  check_params
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



4
5
6
# File 'app/cells/lato_view/layout/index/cell.rb', line 4

def attributes
  @attributes
end

#custom_classObject

Returns the value of attribute custom_class.



4
5
6
# File 'app/cells/lato_view/layout/index/cell.rb', line 4

def custom_class
  @custom_class
end

#delete_link=(value) ⇒ Object

Sets the attribute delete_link

Parameters:

  • value

    the value to set the attribute delete_link to.



4
5
6
# File 'app/cells/lato_view/layout/index/cell.rb', line 4

def delete_link=(value)
  @delete_link = value
end

#edit_link=(value) ⇒ Object

Sets the attribute edit_link

Parameters:

  • value

    the value to set the attribute edit_link to.



4
5
6
# File 'app/cells/lato_view/layout/index/cell.rb', line 4

def edit_link=(value)
  @edit_link = value
end

#elementsObject

Returns the value of attribute elements.



4
5
6
# File 'app/cells/lato_view/layout/index/cell.rb', line 4

def elements
  @elements
end

#headObject

return ingex head



34
35
36
# File 'app/cells/lato_view/layout/index/cell.rb', line 34

def head
  @head
end

Returns the value of attribute link.



4
5
6
# File 'app/cells/lato_view/layout/index/cell.rb', line 4

def link
  @link
end

#remote_deleteObject

Returns the value of attribute remote_delete.



4
5
6
# File 'app/cells/lato_view/layout/index/cell.rb', line 4

def remote_delete
  @remote_delete
end

#show_link=(value) ⇒ Object

Sets the attribute show_link

Parameters:

  • value

    the value to set the attribute show_link to.



4
5
6
# File 'app/cells/lato_view/layout/index/cell.rb', line 4

def show_link=(value)
  @show_link = value
end

Instance Method Details

#closeObject

return index end



44
45
46
# File 'app/cells/lato_view/layout/index/cell.rb', line 44

def close
  '</table>'
end

#openObject

open index table



29
30
31
# File 'app/cells/lato_view/layout/index/cell.rb', line 29

def open
  "<table class='table #{@custom_class}'>"
end

#rowsObject

return index rows



39
40
41
# File 'app/cells/lato_view/layout/index/cell.rb', line 39

def rows
  render 'rows.html'
end

#showObject



24
25
26
# File 'app/cells/lato_view/layout/index/cell.rb', line 24

def show
  open + head + rows + close
end