Sha256: 3a567c75c2b3038d6acda5773364e43b158ba86375daa1ec5eaf8bae45fe5276

Contents?: true

Size: 886 Bytes

Versions: 10

Compression:

Stored size: 886 Bytes

Contents

class Menu < ActiveRecord::Base
  
  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

  class << self
    def table_name
      "lolita_menus"
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
lolita-menu-0.3.6 app/models/menu.rb
lolita-menu-0.3.5 app/models/menu.rb
lolita-menu-0.3.4 app/models/menu.rb
lolita-menu-0.3.2 app/models/menu.rb
lolita-menu-0.3.1 app/models/menu.rb
lolita-menu-0.3.0 app/models/menu.rb
lolita-menu-0.2.2 app/models/menu.rb
lolita-menu-0.2.1 app/models/menu.rb
lolita-menu-0.2.0 app/models/menu.rb
lolita-menu-0.1.7 app/models/menu.rb