Skip to content

Commit

Permalink
Fixes bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Xander authored and TomNaessens committed Mar 17, 2024
1 parent dfb655e commit 6d032a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 3 additions & 3 deletions app/assets/javascripts/registrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ $(document).on('turbolinks:load', function() {

const hidePaymentInfoIfNeeded = function(value) {
const val = parseInt(value);
if (window.freeTickets && (window.freeTickets.indexOf(val) !== -1)) {
if (window.freeTickets && window.freeTickets.includes(val)) {
$("#payment-info").hide();
} else {
$("#payment-info").show();
Expand All @@ -50,10 +50,10 @@ $(document).on('turbolinks:load', function() {

$("#registration_access_level").on('change', function() {
hidePaymentInfoIfNeeded($(this).val());
return hideCommentFieldIfNeeded($(this).val());
hideCommentFieldIfNeeded($(this).val());
});

hidePaymentInfoIfNeeded($("#registration_access_level").val());
return hideCommentFieldIfNeeded($("#registration_access_level").val());
hideCommentFieldIfNeeded($("#registration_access_level").val());

});
6 changes: 2 additions & 4 deletions app/views/registrations/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
<%= form_text_area f, :comment %>
<%= javascript_tag do %>
window.ticketsWithComments = <%= @event.access_levels.find_all(&:has_comment).map(&:id).to_json %>
window.freeTickets = <%= @event.access_levels.find_all{|_| :price == 0}.map(&:id).to_json %>
access_levels = <%= @event.access_levels.find_all{|_| true}.to_json %>
console.log("poop")
window.freeTickets = <%= @event.access_levels.where(price: 0).map(&:id).to_json %>
<% end %>
<%= f.submit "Register", class: 'btn btn-group btn-primary' %>
<% end %>
Expand All @@ -24,4 +22,4 @@
Payments can be done by bank transfer, <strong>not by credit card</strong>.
</div>

</div>
</div>

0 comments on commit 6d032a5

Please sign in to comment.