Class: Ticker
- Inherits:
-
Content
- Object
- ActiveRecord::Base
- Content
- Ticker
- Defined in:
- app/models/ticker.rb
Constant Summary
- DISPLAY_NAME =
'Ticker Text'
Class Method Summary (collapse)
-
+ (Object) clean_html(html)
clear out the unapproved html tags.
-
+ (Object) preview(data)
return the cleaned input data.
Instance Method Summary (collapse)
-
- (Object) sanitize_html
make sure the data only contains authorized html tags.
-
- (Object) set_kind
Automatically set the kind for the content if it is new.
Methods inherited from Content
#action_allowed?, active, #after_add_callback, all_subclasses, display_name, #end_time=, expired, form_attributes, future, #has_children?, #is_active?, #is_approved?, #is_denied?, #is_expired?, #is_orphan?, #is_pending?, #parent_id_cannot_be_this_content, #perform_action, #pre_render, #render_details, #start_time=
Class Method Details
+ (Object) clean_html(html)
clear out the unapproved html tags
24 25 26 27 |
# File 'app/models/ticker.rb', line 24 def self.clean_html(html) # sanitize gem erased '<<<'' whereas ActionView's was more discerning ActionController::Base.helpers.sanitize(html, :tags => %w(b br i em li ol u ul p q small strong), :attributes => %w(style class)) unless html.nil? end |
+ (Object) preview(data)
return the cleaned input data
30 31 32 |
# File 'app/models/ticker.rb', line 30 def self.preview(data) clean_html(data.to_s) end |
Instance Method Details
- (Object) sanitize_html
make sure the data only contains authorized html tags
19 20 21 |
# File 'app/models/ticker.rb', line 19 def sanitize_html self.data = self.class.clean_html(self.data) unless self.data.nil? end |
- (Object) set_kind
Automatically set the kind for the content if it is new.
13 14 15 16 |
# File 'app/models/ticker.rb', line 13 def set_kind return unless new_record? self.kind = Kind.where(:name => 'Ticker').first end |