Sha256: 9c56ef054c24d716ac5353e4ad680335690e8a88eea3ddc72bc5fd4b6424b29f
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 KB
Contents
module Para module TagHelper def icon_link_to(name, url_options = nil, options = nil, &block) if block options, url_options = url_options, name name = capture { block.call } end if (icon = options.delete(:icon)) icon_tag = content_tag(:i, '', class: "fa fa-#{ icon }") name = [icon_tag, name].join(' ').html_safe end link_to(name, url_options, options) end def listing_for(resources, options = {}) model = resources.model attributes = model_field_mappings(model).fields relation = options.fetch(:relation, model.name.to_s.underscore.pluralize) allow_adding_resource = options.fetch(:addable, true) partial = :list partial = :tree if model.respond_to? :roots render( partial: find_partial_for(relation, partial), locals: { component: @component, resources: resources, relation: relation, model: model, attributes: attributes, allow_adding_resource: allow_adding_resource } ) end def table_for(options) partial = :table render( partial: find_partial_for( options[:model].name.underscore.pluralize, partial ), locals: options ) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
para-0.4.0 | app/helpers/para/tag_helper.rb |