diff --git a/.rubocop.yml b/.rubocop.yml index 3c1b0b43..d2e59faf 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -22,6 +22,9 @@ Metrics/ClassLength: Metrics/ModuleLength: Enabled: false +Metrics/AbcSize: + Enabled: false + Layout/HashAlignment: Enabled: true EnforcedColonStyle: table diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index f2767cca..30b23651 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2024-05-20 17:20:36 UTC using RuboCop version 1.63.5. +# on 2024-05-20 21:02:26 UTC using RuboCop version 1.63.5. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -16,11 +16,6 @@ Lint/UnmodifiedReduceAccumulator: Exclude: - 'app/helpers/shifts_helper.rb' -# Offense count: 36 -# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. -Metrics/AbcSize: - Max: 65 - # Offense count: 6 # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode. # AllowedMethods: refine @@ -35,7 +30,7 @@ Metrics/CyclomaticComplexity: # Offense count: 50 # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. Metrics/MethodLength: - Max: 58 + Max: 60 # Offense count: 10 # Configuration parameters: AllowedMethods, AllowedPatterns. @@ -217,9 +212,9 @@ Style/GuardClause: - 'app/controllers/ticket_requests_controller.rb' - 'app/models/event.rb' -# Offense count: 25 +# Offense count: 27 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https Layout/LineLength: - Max: 154 + Max: 252 diff --git a/app/assets/stylesheets/site/global.css.scss b/app/assets/stylesheets/site/global.css.scss index 2620d7e1..ea946f90 100644 --- a/app/assets/stylesheets/site/global.css.scss +++ b/app/assets/stylesheets/site/global.css.scss @@ -71,7 +71,11 @@ legend { } label.strong { - font-weight: 800; + font-weight: 500; +} + +strong { + font-weight: 600; } .event-row { diff --git a/app/controllers/ticket_requests_controller.rb b/app/controllers/ticket_requests_controller.rb index 790fc9b4..400f5ad1 100644 --- a/app/controllers/ticket_requests_controller.rb +++ b/app/controllers/ticket_requests_controller.rb @@ -106,7 +106,7 @@ def create end tr_params = permitted_params[:ticket_request].to_h || {} - + tr_params[:donation] = 0 unless tr_params[:donation].present? && tr_params[:donation] =~ /^[\d.]+$/ if tr_params.empty? flash.now[:error] = 'Please fill out the form below to request tickets.' return render_flash(flash) @@ -158,6 +158,8 @@ def update .flatten.map(&:presence) .compact + ticket_request_params[:donation] = 0 unless ticket_request_params[:donation].present? && ticket_request_params[:donation] =~ /^[\d.]+$/ + ticket_request_params.delete(:guest_list) ticket_request_params[:guests] = guests diff --git a/app/views/ticket_requests/_form.html.haml b/app/views/ticket_requests/_form.html.haml index 3c64e46f..79f38793 100644 --- a/app/views/ticket_requests/_form.html.haml +++ b/app/views/ticket_requests/_form.html.haml @@ -201,6 +201,7 @@ %br = f.label :donation, 'Your Donation' = f.number_field :donation, class: 'input-mini', min: 0, required: false + = tooltip_box "Your donation is optional, but would be greatly appreciated!" .control-group diff --git a/app/views/ticket_requests/_ticket_request_show.html.haml b/app/views/ticket_requests/_ticket_request_show.html.haml index 2a59e875..9c92b65c 100644 --- a/app/views/ticket_requests/_ticket_request_show.html.haml +++ b/app/views/ticket_requests/_ticket_request_show.html.haml @@ -16,13 +16,19 @@ %span.p-2.rounded{ class: text_class_for_status(ticket_request) } = ticket_request.status_name - - if ticket_request.can_purchase? + %tr + %td.text-end.small.p-2.px-4.text-nowrap= "Total Tickets Price:" + %td + %strong + %span{ class: ('label label-info' if ticket_request.special_price) } + = number_to_currency(ticket_request.price, precision: 0) + + - if ticket_request.donation&.positive? %tr - %td.text-end.small.p-2.px-4.text-nowrap= "Total Tickets Price:" + %td.text-end.small.p-2.px-4.text-nowrap= "Extra Donation:" %td %strong - %span{ class: ('label label-info' if ticket_request.special_price) } - = number_to_currency(ticket_request.price, precision: 0) + = number_to_currency(ticket_request.donation, precision: 0) %tr %td.text-end.small.p-2.px-4.text-nowrap= "Payment:" diff --git a/app/views/ticket_requests/show.html.haml b/app/views/ticket_requests/show.html.haml index 7791d029..e7d34934 100644 --- a/app/views/ticket_requests/show.html.haml +++ b/app/views/ticket_requests/show.html.haml @@ -51,9 +51,9 @@ = succeed '!' do = 'ticket'.pluralize(@ticket_request.total_tickets) + - if @ticket_request.user == current_user || @event.admin?(current_user) %hr - - = render partial: 'ticket_request_show', locals: { event: @event, ticket_request: @ticket_request, payment: @payment } + = render partial: 'ticket_request_show', locals: { event: @event, ticket_request: @ticket_request, payment: @payment, current_user: } .card-footer.bg-body-secondary.border-dark-subtle .row