Made the new deliverable form to submit via Ajax
* Added DeliverablesController#create * Refactored each deliverable row to a partial * Added RJS to update the page after a submission #1135
This commit is contained in:
1 parent
d1418c25d3
commit
b2ecaca21e
6 files changed
+51
-12
No files matched your search
@@ -0,0 +1,19 @@
|
||||
# If there is no deliverable list, refresh the page
|
||||
page << "if ($('deliverable-list') == null) {document.location.reload()}"
|
||||
|
||||
# Add deliverable to list
|
||||
page.insert_html :top, 'deliverable-list', :partial => 'deliverable', :locals => {:deliverable => @deliverable}
|
||||
|
||||
# Remove errors if found
|
||||
page.select('#errorExplanation').each do |value|
|
||||
page.remove value
|
||||
end
|
||||
|
||||
page << "Form.reset($('deliverable-form'))"
|
||||
|
||||
# Add a fading out flash
|
||||
page.insert_html :before, 'new-deliverable', content_tag(:div, @flash, :class => "flash notice", :id => 'rjs-flash')
|
||||
page.delay(3) do
|
||||
page.visual_effect :fade, 'rjs-flash'
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user