Class: LatoView::Searchbar::Cell

Inherits:
Cell
  • Object
show all
Includes:
Ransack::Helpers::FormHelper
Defined in:
app/concepts/lato_view/searchbar/cell.rb

Overview

Cella Searchbar

Constant Summary collapse

@@styles =

Lista stili possibili per la searchbar

VIEW_CELLSSTYLES

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(elements: nil, filter: nil, url: nil, method: 'get', style: 'normal', remote: false, custom_class: '') ⇒ Cell

Returns a new instance of Cell.



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'app/concepts/lato_view/searchbar/cell.rb', line 42

def initialize(elements: nil, filter: nil, url: nil, method: 'get',
               style: 'normal', remote: false, custom_class: '')
 # eseguo brevi controlli sull'input
 raise 'Searchbar Concept: style value in not correct' unless @@styles.include? style.to_s
 # assegno i valori alle variabili di istanza
  @elements = elements
  @filter = filter
  @url = url
  @method = method
  @style = style
  @remote = remote
  @custom_class = custom_class
end

Instance Attribute Details

#custom_classObject

Stringa contenente classi custom da aggiungere alla searchbar

  • default: nil



40
41
42
# File 'app/concepts/lato_view/searchbar/cell.rb', line 40

def custom_class
  @custom_class
end

#elementsObject

Nome dell’istanza del database da utilizzare nella ricerca

  • default: nil



15
16
17
# File 'app/concepts/lato_view/searchbar/cell.rb', line 15

def elements
  @elements
end

#filterObject

La variabile di filtro ricerca

  • default: nil



19
20
21
# File 'app/concepts/lato_view/searchbar/cell.rb', line 19

def filter
  @filter
end

#methodObject

Metodo con il quale il form deve comunicare con il controller

  • default: ‘get’



27
28
29
# File 'app/concepts/lato_view/searchbar/cell.rb', line 27

def method
  @method
end

#remoteObject

Valore booleano indicante se la serachbar deve utilizzare il remote true o meno nel form

  • default: false



36
37
38
# File 'app/concepts/lato_view/searchbar/cell.rb', line 36

def remote
  @remote
end

#styleObject

Stile della searchbar

  • default: nil



31
32
33
# File 'app/concepts/lato_view/searchbar/cell.rb', line 31

def style
  @style
end

#urlObject

Url custom a cui il form deve inviare la ricerca

  • default: nil



23
24
25
# File 'app/concepts/lato_view/searchbar/cell.rb', line 23

def url
  @url
end

Instance Method Details

#showObject



56
57
58
# File 'app/concepts/lato_view/searchbar/cell.rb', line 56

def show
  render 'show.html'
end