forked from lenorris/rails-int
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Intro to Ajaxifying book reservation:
* Respond with JavaScript view templates * Replace div element with reservation form using jQuery * Show form with jQuery show()
- Loading branch information
Tair Assimov
committed
Mar 2, 2012
1 parent
1e4b714
commit 26ad822
Showing
4 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<h3>Reserve</h3> | ||
|
||
<%= form_for [@book, @reservation] do |f| %> | ||
<% unless @reservation.errors.empty? %> | ||
<h2>Failed create reservation book</h2> | ||
<% @reservation.errors.full_messages.each do |msg| %> | ||
<p><%= msg %></p> | ||
<% end %> | ||
<% end %> | ||
|
||
<div> | ||
Email:<br/> | ||
<%= f.text_field :email %> | ||
</div> | ||
|
||
<%= f.submit "Save" %> | ||
or | ||
<%= link_to "Cancel", book_path(@book) %> | ||
<% end %> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$('#reservation-form').html("<%=j render "new" %>").show(); |