Sha256: 9f980478217cace4b9c3ab19265af3cba3de7b0d22bc22044617e996424dab3e
Contents?: true
Size: 1.38 KB
Versions: 3
Compression:
Stored size: 1.38 KB
Contents
class Layout < ActiveRecord::Base store_templates use_kit_caching before_save :make_path before_save :set_format has_many :page_templates has_many :views belongs_to :user before_save :record_history validates :format, :presence=>true validates :locale, :presence=>true validates :name, :presence=>true validates :handler, :presence=>true def display_name "Layout" end def record_history if self.changed.include?('body') DesignHistory.record(self) end end def history DesignHistory.sys(self.system_id).where(:model=>"Layout").where(:model_id=>self.id).order("id desc") end def make_path self.path = "layouts/" + self.name.urlise end def set_format self.format = 'html' end def locale_enum ['en'] end def handler_enum ['haml', 'erb', 'builder'] end def self.name_exists?(name) Layout.where("name = '#{name}'").count > 0 end def self.create_default(sid, user_id) layout = Layout.new(:stylesheets=>"application", :javascripts=>"", :path=>"layouts/application", :handler=>"haml", :format=>"html", :locale=>"en", :system_id=>sid, :user_id=>user_id, :name=>"application-#{sid}", :body=><<eos !!! %html / Layout: application-#{sid} %head = render :partial=>"layouts/kit_header" %style(type="text/css") div#edit_link { top:30px; } %body = yield eos ) layout.save! end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
kit_cms-2.3.9 | app/models/layout.rb |
kit_cms-2.3.8 | app/models/layout.rb |
kit_cms-2.3.7 | app/models/layout.rb |