-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to use AJAX for featuring and unfeaturing products.
- Loading branch information
Kelsey Langlois and LDevinMacKrell
committed
Dec 7, 2017
1 parent
1915e65
commit 34f1fc9
Showing
4 changed files
with
18 additions
and
9 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
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 |
---|---|---|
@@ -1,6 +1,15 @@ | ||
$('#product-details-<%= @product.id %>').after("<%= j render 'show' %>"); | ||
$('#product-details-<%= @product.id %>').remove(); | ||
$('#edit_product_<%= @product.id %>').before("<%= j render 'show' %>"); | ||
$('#edit_product_<%= @product.id %>').remove(); | ||
$('#hide_details_<%= @product.id %>').click(function() { | ||
$('#product-details-<%= @product.id %>').before('<%= j render @product %>') | ||
$('#product-details-<%= @product.id %>').remove(); | ||
}); | ||
|
||
<% if @product.featured %> | ||
$('#feature-<%= @product.id %>').remove(); | ||
$('.featured-products').prepend('<div class="product-feature" id="feature-<%= @product.id %>"><h3><%= link_to @product.name, product_path(@product) %></h3></div>'); | ||
<% else %> | ||
$('#feature-<%= @product.id %>').remove(); | ||
<% end %> |