Sha256: e09a1db9a9c32fcf9cf556920c1513fea2ba8fbd0ec07faa1f41675c79c1927c

Contents?: true

Size: 847 Bytes

Versions: 3

Compression:

Stored size: 847 Bytes

Contents

class Menu < ActiveRecord::Base
  self.table_name = 'lolita_menus'
  has_many :items, :class_name => "MenuItem", :dependent => :destroy
  validates :name, :presence => true

  include Lolita::Configuration

  lolita do
    list do
      column :name
      column :system_name
      action :edit do 
        title ::I18n.t("lolita.shared.edit")
        url Proc.new{|view,record| view.send(:edit_lolita_resource_path, Lolita.mappings[:menu], :id => record.id)}
      end

      action :destroy do 
        title ::I18n.t("lolita.shared.delete")
        url Proc.new{|view,record| view.send(:lolita_resource_path,Lolita.mappings[:menu],:id => record.id)}
        html :method => :delete, :confirm => ::I18n.t("lolita.list.confirm")
      end
    end
    tab(:content) do
      field :name
      field :system_name, :on => :create
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lolita-menu-0.4.2 app/models/menu.rb
lolita-menu-0.4.1 app/models/menu.rb
lolita-menu-0.4.0 app/models/menu.rb