2010-07-23 20:09:54 +00:00
|
|
|
module Models
|
|
|
|
module Extensions
|
|
|
|
module Page
|
|
|
|
module Templatized
|
2010-07-16 20:36:07 +00:00
|
|
|
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
included do
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-07-31 02:15:24 +00:00
|
|
|
referenced_in :content_type
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-07-16 20:36:07 +00:00
|
|
|
field :templatized, :type => Boolean, :default => false
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-07-16 20:36:07 +00:00
|
|
|
field :content_type_visible_column
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-07-20 10:15:53 +00:00
|
|
|
before_validation :set_slug_if_templatized
|
2010-07-16 20:36:07 +00:00
|
|
|
end
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-07-16 20:36:07 +00:00
|
|
|
module InstanceMethods
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-07-16 20:36:07 +00:00
|
|
|
def set_slug_if_templatized
|
|
|
|
self.slug = 'content_type_template' if self.templatized?
|
|
|
|
end
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-07-16 20:36:07 +00:00
|
|
|
end
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-07-16 20:36:07 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2010-07-23 20:09:54 +00:00
|
|
|
|
|
|
|
|