Sha256: 3d383c3d1fa857c4f94a5b3044e5f957d92cee65f7dbbdd31a5618d1ecd31a5b

Contents?: true

Size: 974 Bytes

Versions: 6

Compression:

Stored size: 974 Bytes

Contents

ActiveAdmin::Views::ActiveAdminForm.class_eval do
  def accordion( title, &block )
    @accordion_id = @accordion_id ? ( @accordion_id + 1 ) : 1
    text_node tag :input, type: 'checkbox', id: "accordion-#{@accordion_id}"
    label title, for: "accordion-#{@accordion_id}", class: 'c-card__item c-card__item--brand'
    div class: 'c-card__item' do
      yield block
    end
  end

  def accordion_group( &block )
    div class: 'c-card c-card--accordion u-high' do
      yield block
    end
  end

  def readonly( field, value = nil, options = {} )
    cl = 'readonly-field'
    cl += ' ' + options[:class] if options[:class]
    li class: cl do
      if !field.blank?
        label field, for: nil, class: 'field_label'
      else
        span ' '.html_safe, class: 'field_label'
      end
      div do
        span ( value.nil? ? ( field && object.respond_to?( field ) ? object.send( field ) : '' ) : raw( value ) ), class: 'field_value'
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
activeadmin_blaze_theme-0.5.14 lib/activeadmin/views/activeadmin_form.rb
activeadmin_blaze_theme-0.5.12 lib/activeadmin/views/activeadmin_form.rb
activeadmin_blaze_theme-0.5.10 lib/activeadmin/views/activeadmin_form.rb
activeadmin_blaze_theme-0.5.9 lib/activeadmin/views/activeadmin_form.rb
activeadmin_blaze_theme-0.5.8 lib/activeadmin/views/activeadmin_form.rb
activeadmin_blaze_theme-0.5.6 lib/activeadmin/views/activeadmin_form.rb