Class: Layout::Step::Cell

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

Constant Summary collapse

@@widths =
VIEW_GRIDCLASS

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(width: 'small-12 medium-12 large-12 xlarge-12', content: '', custom_class: '', prev_name: 'Prev', next_name: 'Next') ⇒ Cell

Returns a new instance of Cell.



8
9
10
11
12
13
14
15
16
17
18
# File 'app/cells/lato_view/layout/step/cell.rb', line 8

def initialize(width: 'small-12 medium-12 large-12 xlarge-12', content: '',
               custom_class: '', prev_name: 'Prev', next_name: 'Next')
  # save params
  @width = width
  @content = content
  @class = custom_class
  @random = SecureRandom.hex
  @prev_name = prev_name
  @next_name = next_name
  # check params
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



6
7
8
# File 'app/cells/lato_view/layout/step/cell.rb', line 6

def content
  @content
end

#custom_classObject

Returns the value of attribute custom_class.



6
7
8
# File 'app/cells/lato_view/layout/step/cell.rb', line 6

def custom_class
  @custom_class
end

#next_nameObject

Returns the value of attribute next_name.



6
7
8
# File 'app/cells/lato_view/layout/step/cell.rb', line 6

def next_name
  @next_name
end

#prev_nameObject

Returns the value of attribute prev_name.



6
7
8
# File 'app/cells/lato_view/layout/step/cell.rb', line 6

def prev_name
  @prev_name
end

#widthObject

Returns the value of attribute width.



6
7
8
# File 'app/cells/lato_view/layout/step/cell.rb', line 6

def width
  @width
end

Instance Method Details

#close(prev_name: @prev_name, next_name: @next_name) ⇒ Object

close step container



40
41
42
# File 'app/cells/lato_view/layout/step/cell.rb', line 40

def close(prev_name: @prev_name, next_name: @next_name)
  "</div><div class='step-navigator' data-step-id='#{@random}'><button class='lato-button step-button step-prev'>#{prev_name}</button><div class='step-paginate-container'><ul class='step-paginate'></ul></div><button class='lato-button step-button step-next'>#{next_name}</button></div></div></div>"
end

#close_stepObject



35
36
37
# File 'app/cells/lato_view/layout/step/cell.rb', line 35

def close_step
  "</div>"
end

#open(width: @width, custom_class: @class) ⇒ Object

open new step container



25
26
27
28
# File 'app/cells/lato_view/layout/step/cell.rb', line 25

def open(width: @width, custom_class: @class)
  "<div class='content-block column #{width} #{custom_class}'><div class='element-step' data-step-id='#{@random}'>
    <div class='step-scroller'>"
end

#open_step(active: false) ⇒ Object



30
31
32
33
# File 'app/cells/lato_view/layout/step/cell.rb', line 30

def open_step(active: false)
  "<div class='step'>" if active 
  "<div class='step active'>"
end

#showObject



20
21
22
# File 'app/cells/lato_view/layout/step/cell.rb', line 20

def show
  open + @content + close
end