Skip to content

Commit

Permalink
ASPC Rideshare visible for admins
Browse files Browse the repository at this point in the history
  • Loading branch information
thebradbain committed Nov 4, 2019
1 parent 20461d3 commit 870c900
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
6 changes: 3 additions & 3 deletions app/models/ride.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ def is_flighttime_valid

def is_aspc_valid
return unless is_aspc
errors.add(:is_aspc, "ASPC-Funded Ride Booking through this website is currently disabled");

# Change these depending on the program date
aspc_ride_start_date = Date.new(2018, 12, 17)
aspc_ride_end_date = Date.new(2018, 12, 22)
# TODO: set this in admin panel
aspc_ride_start_date = Date.new(2019, 12, 17)
aspc_ride_end_date = Date.new(2019, 12, 22)

if not flighttime.to_date.between? aspc_ride_start_date, aspc_ride_end_date
errors.add(:flighttime, "falls outside the range of the program dates (#{aspc_ride_start_date.strftime("%B %d, %Y") + " - " + aspc_ride_end_date.strftime("%B %d, %Y")})")
Expand Down
6 changes: 2 additions & 4 deletions app/views/rides/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<% hide_aspc_signup = local_assigns.fetch(:hide_aspc_signup, false) %>

<% if @current_user.school == "pomona" && !hide_aspc_signup %>
<% if @current_user.school == "pomona" && @current_user.is_admin %>
<div class="message is-info">
<div class="message-header">
As a Pomona Student, you're eligible for a free ride over winter break!
Expand Down Expand Up @@ -120,7 +118,7 @@
</div>
<% end %>


</div>

<script>
Expand Down
2 changes: 1 addition & 1 deletion app/views/rides/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
<% end %>


<%= render 'form', :hide_aspc_signup => true %>
<%= render 'form' %>
7 changes: 4 additions & 3 deletions app/views/rides/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

.section
.columns
.column.is-12
.column.is-5
.index-notification
%p
%strong ASPC is excited to reintroduce the 5C Rideshare service
Expand All @@ -46,13 +46,14 @@
%br
%p
The aim of this service is to allow students going to and from Ontario or LAX to connect with each other and split the cost of the ride – simply sign in and create or join a ride at a time which works for you!
/

- if current_user && current_user.is_admin
.column.is-2
.column-divider
.column.is-5
.index-notification
%p
%strong Pomona Students: Youx're eligible for a free ride over winter break!
%strong Pomona Students: You're eligible for a free ride over winter break!
%br
%p
For more details, sign in with your Pomona login and
Expand Down
4 changes: 2 additions & 2 deletions app/views/rides/new.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
=content_for :header do
=render 'layouts/page_header', :title => "Create a Ride"

#new-ride
= render 'rides/form', :hide_aspc_signup => true
= render 'rides/form'

0 comments on commit 870c900

Please sign in to comment.