Module: Gitter::Helpers

Included in:
Grid, PivotGrid
Defined in:
lib/gitter/helpers.rb

Instance Method Summary collapse

Instance Method Details

#decorate(*args) ⇒ Object



29
30
31
# File 'lib/gitter/helpers.rb', line 29

def decorate *args
  @decorator.decorate
end

#hObject



25
26
27
# File 'lib/gitter/helpers.rb', line 25

def h
  @decorator.h
end

#highlight(text, *keys) ⇒ Object



21
22
23
# File 'lib/gitter/helpers.rb', line 21

def highlight text, *keys
  h.highlight "#{text}", mark(*keys)[:mark] 
end

#input_tag(name) ⇒ Object



43
44
45
# File 'lib/gitter/helpers.rb', line 43

def input_tag name
  input_tags[name]
end

#input_tagsObject



33
34
35
36
37
38
39
40
41
# File 'lib/gitter/helpers.rb', line 33

def input_tags
  @input_tags ||= begin
    res = {}
    filters.each do |filter|
      res[filter.name] = filter.input_tag if filter.input?
    end
    res
  end
end

#keyObject

used to scope params of requests



9
10
11
# File 'lib/gitter/helpers.rb', line 9

def key
  @key ||= :grid#name.intern
end

#mark(*keys) ⇒ Object



17
18
19
# File 'lib/gitter/helpers.rb', line 17

def mark *keys
  { mark: keys.map{|k|filter_value k}.select{|v|v.present?} }
end

#nameObject



4
5
6
# File 'lib/gitter/helpers.rb', line 4

def name
  @name ||= self.class.name.underscore
end

#scoped_params(params) ⇒ Object



13
14
15
# File 'lib/gitter/helpers.rb', line 13

def scoped_params params
  { key => params }
end