Sha256: f0530f4f6c02a882d864e5b49ec8d3771d2fd2eff3782932b2d160e735e8f8df

Contents?: true

Size: 1.62 KB

Versions: 17

Compression:

Stored size: 1.62 KB

Contents

ActiveAdmin.register SystemReceiptTemplate do
  config.batch_actions = false
  
  actions :index, :show, :edit

  menu :parent   => I18n.t('activerecord.models.terminal.other'),
       :priority => 30,
       :if       => proc { can? :index, SystemReceiptTemplate }

  #
  # INDEX
  #
  filter :keyword, :as => 'multiple_select', 
    :collection => proc { I18n.t('smartkiosk.system_receipt_templates').invert },
    :input_html => { :class => 'chosen' }
  filter :updated_at

  index do
    column :keyword do |x|
      x.title
    end
    column :updated_at
    column '' do |resource|
      links = []

      links << link_to(
        I18n.t('active_admin.view'), resource_path(resource),
        :class => 'member_link view_link'
      )

      links << link_to(
        I18n.t('active_admin.edit'), edit_resource_path(resource),
        :class => 'member_link view_link'
      )

      if can?(:destroy, resource)
        links << link_to(
          I18n.t('active_admin.delete'), resource_path(resource),
          :class  => 'member_link view_link',
          :method => :delete
        )
      end

      links.join(' ').html_safe
    end
  end

  #
  # SHOW
  #
  show do |rt|
    attributes_table do
      row :keyword do
        rt.title
      end
      row :template do
        pre rt.template
      end
      row :updated_at
    end

    active_admin_comments
  end

  #
  # FORM
  #
  form do |f|
    f.inputs do
      f.input :template, :input_html => { 
        :style => 'font-family: Consolas, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace' 
      }
    end
    f.actions
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
smartkiosk-server-0.10.13 app/admin/system_receipt_templates.rb
smartkiosk-server-0.10.12 app/admin/system_receipt_templates.rb
smartkiosk-server-0.10.11 app/admin/system_receipt_templates.rb
smartkiosk-server-0.10.10 app/admin/system_receipt_templates.rb
smartkiosk-server-0.10.9 app/admin/system_receipt_templates.rb
smartkiosk-server-0.10.8 app/admin/system_receipt_templates.rb
smartkiosk-server-0.10.7 app/admin/system_receipt_templates.rb
smartkiosk-server-0.10.5 app/admin/system_receipt_templates.rb
smartkiosk-server-0.10.4 app/admin/system_receipt_templates.rb
smartkiosk-server-0.10.3 app/admin/system_receipt_templates.rb
smartkiosk-server-0.10.2 app/admin/system_receipt_templates.rb
smartkiosk-server-0.10.1 app/admin/system_receipt_templates.rb
smartkiosk-server-0.10.0 app/admin/system_receipt_templates.rb
smartkiosk-server-0.9.3 app/admin/system_receipt_templates.rb
smartkiosk-server-0.9.2 app/admin/system_receipt_templates.rb
smartkiosk-server-0.9.1 app/admin/system_receipt_templates.rb
smartkiosk-server-0.9.0 app/admin/system_receipt_templates.rb