Skip to content
This repository has been archived by the owner on Jun 27, 2018. It is now read-only.

Commit

Permalink
fixed the content element types
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Sprenger committed Jan 21, 2010
1 parent 9f751d8 commit 3ef5684
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
14 changes: 2 additions & 12 deletions app/models/content_element_html.rb
Expand Up @@ -11,23 +11,13 @@
#
class ContentElementHtml < ActiveRecord::Base

include ActsAsContentElement
acts_as_content_element :icon => "icons/content_elements/content_element_html.png",
:administration_partial => "admin/content_elements/types/content_element_html/administration"

belongs_to :content_element, :dependent => :destroy

validates_associated :content_element

liquid_methods :html, :created_at, :updated_at, :header, :element_type, :hidden, :created_at, :updated_at, :tags, :page

# returns the icon, that is used for the backend
def icon
"icons/content_elements/content_element_html.png"
end

# defines the path to the partial, that gets rendered in the body part of a content element in the backend
# custom content elements should have a method 'administration_partial' returning the specific partial
def administration_partial
"admin/content_elements/types/content_element_html/administration"
end

end
14 changes: 2 additions & 12 deletions app/models/content_element_text.rb
Expand Up @@ -21,7 +21,8 @@
# * page
class ContentElementText < ActiveRecord::Base

include ActsAsContentElement
acts_as_content_element :icon => "icons/content_elements/content_element_text.png",
:administration_partial => "admin/content_elements/types/content_element_text/administration"

before_save :create_clean_text

Expand All @@ -31,17 +32,6 @@ class ContentElementText < ActiveRecord::Base

liquid_methods :text, :clean_text, :created_at, :updated_at, :header, :element_type, :hidden, :created_at, :updated_at, :tags, :page

# returns the icon, that is used for the backend
def icon
"icons/content_elements/content_element_text.png"
end

# defines the path to the partial, that gets rendered in the body part of a content element in the backend
# custom content elements should have a method 'administration_partial' returning the specific partial
def administration_partial
"admin/content_elements/types/content_element_text/administration"
end

def create_clean_text
self.clean_text = self.text.gsub(/<\/?[^>]*>/, "") if self.text
end
Expand Down

0 comments on commit 3ef5684

Please sign in to comment.