Skip to content

Commit

Permalink
Change published options when changing purchase card
Browse files Browse the repository at this point in the history
When user chooses 'default' purchase card, he is offered
only 'unpublished' choice, whereas when he chooses 'other'
purchase card, two options are showed -> 'published' and 'unpublished'
  • Loading branch information
nikolalsvk committed Aug 25, 2016
1 parent ddc025b commit 30f4ad8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//= require d3.v3.min
//= require utility.js
//= require auctionToggle.js
//= require publishedToggle.js
//= require deliveryDueAt.js
//= require selectize
//= require selectizer
14 changes: 14 additions & 0 deletions app/assets/javascripts/publishedToggle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
$(document).ready(function() {
$("#auction_purchase_card").on("change", function(event) {
published_select_element = $("#auction_published")

published_option = "<option value='published'>published</option>"
unpublished_option = "<option value='unpublished'>unpublished</option>"

if(this.value == "default") {
published_select_element.empty().append(unpublished_option)
} else {
published_select_element.empty().append(published_option, unpublished_option)
}
});
});

0 comments on commit 30f4ad8

Please sign in to comment.