Created
August 20, 2010 11:38
-
-
Save apotonick/540125 to your computer and use it in GitHub Desktop.
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
module NotesWidget | |
class Form < MyWidget | |
responds_to_event :create, :with => :create_note | |
preserves_attr :display_mode, :from => '..' | |
def form # The form to add notes | |
@note = Notes.new() | |
render | |
end | |
#pragma mark - | |
#pragma mark The triggered actions | |
def create_note | |
@note = Notes.new(param(:note)) | |
if @note.save | |
trigger :content_changed # DISCUSS: Notify the 'content' widget to update | |
#self.invoke(:form) | |
update :text => invoke(:form) | |
else | |
update :view => :form # dunno the difference | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You suck :)