Module: Gitter::Helpers
Instance Method Summary collapse
- #decorate(*args) ⇒ Object
- #h ⇒ Object
- #highlight(text, *keys) ⇒ Object
- #input_tag(name) ⇒ Object
- #input_tags ⇒ Object
-
#key ⇒ Object
used to scope params of requests.
- #mark(*keys) ⇒ Object
- #name ⇒ Object
- #scoped_params(params) ⇒ Object
Instance Method Details
#decorate(*args) ⇒ Object
29 30 31 |
# File 'lib/gitter/helpers.rb', line 29 def decorate *args @decorator.decorate end |
#h ⇒ Object
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 [name] end |
#input_tags ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/gitter/helpers.rb', line 33 def @input_tags ||= begin res = {} filters.each do |filter| res[filter.name] = filter.input_tag if filter.input? end res end end |
#key ⇒ Object
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 |
#name ⇒ Object
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 |