Class: MerbFootnotes::Notes::AbstractNote
- Inherits:
-
Object
- Object
- MerbFootnotes::Notes::AbstractNote
- Defined in:
- lib/merb_footnotes/notes/abstract_note.rb
Overview
This is the abstrac class for notes.
Direct Known Subclasses
ControllerNote, CookiesNote, EnvNote, FilesNote, FiltersNote, LayoutNote, LogNote, ParamsNote, PartialsNote, QueriesNote, RoutesNote, SessionNote, ViewNote
Class Method Summary collapse
-
.close!(controller = nil) ⇒ Object
Action to be called after the Note was used.
-
.included? ⇒ Boolean
Return true if Note is included in notes array.
-
.start!(controller = nil) ⇒ Object
Action to be called to start the Note.
-
.title ⇒ Object
Returns the title that represents this note.
-
.to_sym ⇒ Object
Returns the symbol that represents this note.
Instance Method Summary collapse
-
#fieldset? ⇒ Boolean
Specifies when should create a fieldset for it, considering it’s valid.
-
#included? ⇒ Boolean
Return if this note is incuded in MerbFootnotes::Filter.notes.
-
#initialize(controller = nil) ⇒ AbstractNote
constructor
Initialize notes.
-
#javascript ⇒ Object
Insert here any additional javascript.
-
#legend ⇒ Object
If fieldset?, create a fieldset with the value returned as legend.
-
#link ⇒ Object
Set href field for Footnotes links.
-
#onclick ⇒ Object
Set onclick field for Footnotes links.
-
#row ⇒ Object
Specifies in which row should appear the title.
-
#stylesheet ⇒ Object
Insert here any additional stylesheet.
-
#title ⇒ Object
If valid?, create a tab on Footnotes Footer with the title returned.
-
#to_sym ⇒ Object
Returns the symbol that represents this note.
-
#valid? ⇒ Boolean
Specifies when should create a note for it.
Constructor Details
#initialize(controller = nil) ⇒ AbstractNote
Initialize notes. Always receives a controller.
48 49 |
# File 'lib/merb_footnotes/notes/abstract_note.rb', line 48 def initialize(controller = nil) end |
Class Method Details
.close!(controller = nil) ⇒ Object
Action to be called after the Note was used. This is applied as an after_filter.
41 42 |
# File 'lib/merb_footnotes/notes/abstract_note.rb', line 41 def close!(controller = nil) end |
.included? ⇒ Boolean
Return true if Note is included in notes array.
28 29 30 |
# File 'lib/merb_footnotes/notes/abstract_note.rb', line 28 def included? MerbFootnotes::Filter.notes.include?(self.to_sym) end |
.start!(controller = nil) ⇒ Object
Action to be called to start the Note. This is applied as a before_filter.
35 36 |
# File 'lib/merb_footnotes/notes/abstract_note.rb', line 35 def start!(controller = nil) end |
.title ⇒ Object
Returns the title that represents this note. It’s the name of the class without Note.
For example, for ControllerNote it will return Controller.
22 23 24 |
# File 'lib/merb_footnotes/notes/abstract_note.rb', line 22 def title @note_title ||= self.name.match(/^MerbFootnotes::Notes::(\w+)Note$/)[1] end |
.to_sym ⇒ Object
Returns the symbol that represents this note. It’s the name of the class, underscored and without _note.
For example, for ControllerNote it will return :controller.
13 14 15 |
# File 'lib/merb_footnotes/notes/abstract_note.rb', line 13 def to_sym @note_sym ||= self.title.to_const_path.to_sym end |
Instance Method Details
#fieldset? ⇒ Boolean
Specifies when should create a fieldset for it, considering it’s valid.
117 118 119 |
# File 'lib/merb_footnotes/notes/abstract_note.rb', line 117 def fieldset? self.respond_to?(:content) end |
#included? ⇒ Boolean
Return if this note is incuded in MerbFootnotes::Filter.notes.
123 124 125 |
# File 'lib/merb_footnotes/notes/abstract_note.rb', line 123 def included? self.class.included? end |
#javascript ⇒ Object
Insert here any additional javascript. This is directly inserted into a <script> tag.
105 106 |
# File 'lib/merb_footnotes/notes/abstract_note.rb', line 105 def javascript end |
#legend ⇒ Object
If fieldset?, create a fieldset with the value returned as legend. By default, returns the title of the class (defined above).
74 75 76 |
# File 'lib/merb_footnotes/notes/abstract_note.rb', line 74 def legend self.class.title end |
#link ⇒ Object
Set href field for Footnotes links. If it’s nil, Footnotes will use ‘#’.
87 88 |
# File 'lib/merb_footnotes/notes/abstract_note.rb', line 87 def link end |
#onclick ⇒ Object
Set onclick field for Footnotes links. If it’s nil, Footnotes will make it open the fieldset.
93 94 |
# File 'lib/merb_footnotes/notes/abstract_note.rb', line 93 def onclick end |
#row ⇒ Object
Specifies in which row should appear the title. The default is :show.
60 61 62 |
# File 'lib/merb_footnotes/notes/abstract_note.rb', line 60 def row :show end |
#stylesheet ⇒ Object
Insert here any additional stylesheet. This is directly inserted into a <style> tag.
99 100 |
# File 'lib/merb_footnotes/notes/abstract_note.rb', line 99 def stylesheet end |
#title ⇒ Object
If valid?, create a tab on Footnotes Footer with the title returned. By default, returns the title of the class (defined above).
67 68 69 |
# File 'lib/merb_footnotes/notes/abstract_note.rb', line 67 def title self.class.title end |
#to_sym ⇒ Object
Returns the symbol that represents this note.
53 54 55 |
# File 'lib/merb_footnotes/notes/abstract_note.rb', line 53 def to_sym self.class.to_sym end |
#valid? ⇒ Boolean
Specifies when should create a note for it. By default, it’s valid.
111 112 113 |
# File 'lib/merb_footnotes/notes/abstract_note.rb', line 111 def valid? true end |