Module: SexyLi::RecordTagHelper
- Defined in:
- lib/sexy_li/record_tag_helper.rb
Instance Method Summary collapse
- #li_for(records, prefix = nil, options = {}, &block) ⇒ Object
- #render_content_for(tag, records, prefix = nil, options = {}) ⇒ Object
- #render_li_for(records, prefix = nil, options = {}) ⇒ Object
- #render_tr_for(records, prefix = nil, options = {}) ⇒ Object
- #tr_for(records, prefix = nil, options = {}, &block) ⇒ Object
Instance Method Details
#li_for(records, prefix = nil, options = {}, &block) ⇒ Object
3 4 5 |
# File 'lib/sexy_li/record_tag_helper.rb', line 3 def li_for(records, prefix = nil, = {}, &block) content_tag_for(:li, records, prefix, , &block) end |
#render_content_for(tag, records, prefix = nil, options = {}) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/sexy_li/record_tag_helper.rb', line 11 def render_content_for(tag, records, prefix = nil, = {}) key = records.first.class.name.tableize.singularize partial = prefix && prefix[:partial] ? prefix[:partial] : key content_tag_for(tag, records, prefix, ) do |record| render partial, key.to_sym => record end end |
#render_li_for(records, prefix = nil, options = {}) ⇒ Object
19 20 21 |
# File 'lib/sexy_li/record_tag_helper.rb', line 19 def render_li_for(records, prefix = nil, = {}) render_content_for(:li, records, prefix, ) end |
#render_tr_for(records, prefix = nil, options = {}) ⇒ Object
23 24 25 |
# File 'lib/sexy_li/record_tag_helper.rb', line 23 def render_tr_for(records, prefix = nil, = {}) render_content_for(:tr, records, prefix, ) end |
#tr_for(records, prefix = nil, options = {}, &block) ⇒ Object
7 8 9 |
# File 'lib/sexy_li/record_tag_helper.rb', line 7 def tr_for(records, prefix = nil, = {}, &block) content_tag_for(:li, records, prefix, , &block) end |