cs_app/app/models/link_content.rb
Nicolas Bally 8a08ee35c8 initial
2015-02-22 14:36:30 +01:00

46 lines
672 B
Ruby

# -*- encoding : utf-8 -*-
class LinkContent < ActiveRecord::Base
belongs_to :item
belongs_to :cible, :polymorphic => true
accepts_nested_attributes_for :cible
CIBLE_TYPES = [
{:slug => "MenuItems", :name => "Alias"},
{:slug => "ExternalLink", :name => "Lien externe"},
]
def url
if self.cible
cible.url
else
""
end
end
has_one :portlet, :as => :content, :dependent => :destroy
validates :name, :presence => true
def url
if self.cible
cible.url
else
""
end
end
STYLES = [["Style 1",1], ["Style 2",2]]
def self.picto
"chain"
end
end