forked from comfy/comfortable-mexican-sofa
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Oleg
committed
Aug 23, 2010
1 parent
92be311
commit 87f3641
Showing
11 changed files
with
112 additions
and
299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Comfortable Mexican Sofa (CMS) | ||
============================== | ||
|
||
TODO |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
class CmsPage < ActiveRecord::Base | ||
|
||
has_many :page_contents, :dependent => :destroy | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class CmsPageContent < ActiveRecord::Base | ||
|
||
belongs_to :cms_page | ||
|
||
# -- Class Methods -------------------------------------------------------- | ||
def self.initialize_content_objects(content = '') | ||
raise tag_signature.to_s | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class CmsPageTextContent < CmsPageContent | ||
|
||
# -- Class Methods -------------------------------------------------------- | ||
|
||
# will match tags with this format: | ||
# <cms:page:label:text /> | ||
# <cms:page:label /> | ||
def self.regex_tag_signature(label = nil) | ||
label ||= /\w+/ | ||
/<\s*?cms:page:(#{label}):?(text)?\s*?\/?>/ | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,17 @@ | ||
class CmsSnippet < ActiveRecord::Base | ||
|
||
# -- Validations ---------------------------------------------------------- | ||
# -- Scopes --------------------------------------------------------------- | ||
default_scope :order => 'label' | ||
|
||
# -- Validations ---------------------------------------------------------- | ||
validates :label, | ||
:presence => true, | ||
:presence => true, | ||
:uniqueness => true, | ||
:format => { :with => /^\w[a-z0-9_-]*$/i } | ||
:format => { :with => /^\w[a-z0-9_-]*$/i } | ||
|
||
# -- Class Methods -------------------------------------------------------- | ||
|
||
def self.content_for(label) | ||
(s = find_by_label(label)) ? s.content : '' | ||
end | ||
|
||
# -- Scopes --------------------------------------------------------------- | ||
|
||
default_scope :order => 'label' | ||
|
||
end |
Oops, something went wrong.