Skip to content

Instantly share code, notes, and snippets.

@glideranderson
Created July 17, 2012 19:01
Show Gist options
  • Save glideranderson/3131295 to your computer and use it in GitHub Desktop.
Save glideranderson/3131295 to your computer and use it in GitHub Desktop.
Fat Free CRM Creat Comment js
if @comment.valid?
page.insert_html :after, :comment_new, :partial => "comment", :locals => { :comment => @comment }
page[dom_id(@comment)].visual_effect :highlight, :duration => 1.5
end
page[:shown_notes].value = @comment.commentable.comment_ids.join(',')
page[:comment_comment].clear
page[:comment_comment].focus
id = dom_id(@comment)
if @comment.errors.empty?
page[id].replace :partial => "comment", :collection => [ @comment ]
page[id].visual_effect :highlight, :duration => 1.0
else
page[id].replace_html :partial => "edit"
page[id].visual_effect :shake, :duration => 0.25, :distance => 6
page[:comment_comment].focus
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment