Sha256: 55321da73fa660149d3d697e37069a43587adfd6949257f83f566e5236ac3079
Contents?: true
Size: 1.13 KB
Versions: 4
Compression:
Stored size: 1.13 KB
Contents
module Formtastic module Inputs class AssetManagerInput include Formtastic::Inputs::Base def to_html no_items_label = I18n.t('not_available', scope: [object.class.i18n_scope, object.class.name.demodulize.tableize, :show], default: 'N/A') input_wrapping do result = label_html result << template.content_tag(:div, class: 'asset_manager_container') do template.controller.view_context.am_select_link(object, method) << template.content_tag(:div, id: "dinamyc_assets_#{method}", no_items_label: no_items_label) do cr = object.send(method) unless cr.blank? if cr.kind_of?(Array) template.controller.view_context.render(partial: '/admin/asset_manager/assets/assets', locals: { collection: cr }) else template.controller.view_context.render(partial: '/admin/asset_manager/assets/asset', locals: { resource: cr }) end else no_items_label end end end result end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems