Module: Spark::ApplicationHelper
- Defined in:
- app/helpers/spark/application_helper.rb
Instance Method Summary collapse
- #body_class(classnames = nil) ⇒ Object
- #is_tree_expanded?(item) ⇒ Boolean
- #ng_attrs ⇒ Object
- #tree_cookie ⇒ Object
- #yield_if(symbol) {|content_for(symbol)| ... } ⇒ Object
Instance Method Details
#body_class(classnames = nil) ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'app/helpers/spark/application_helper.rb', line 31 def body_class(classnames=nil) unless classnames.nil? content_for(:body_classes) do [classnames].flatten.join(' ') + ' ' end end if classes = content_for(:body_classes) classes.strip end end |
#is_tree_expanded?(item) ⇒ Boolean
12 13 14 |
# File 'app/helpers/spark/application_helper.rb', line 12 def ( item ) .present? && !!( item ) end |
#ng_attrs ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'app/helpers/spark/application_helper.rb', line 16 def ng_attrs attrs = {} [:ng_init, :ng_controller].each do |sym| attrs[sym] = content_for(sym) if content_for?(sym) end attrs end |
#tree_cookie ⇒ Object
4 5 6 7 8 9 10 |
# File 'app/helpers/spark/application_helper.rb', line 4 def ||= begin JSON.parse([:tree_nav]) if [:tree_nav].present? rescue nil end end |
#yield_if(symbol) {|content_for(symbol)| ... } ⇒ Object
27 28 29 |
# File 'app/helpers/spark/application_helper.rb', line 27 def yield_if(symbol, &block) yield content_for(symbol) if content_for?(symbol) end |