Skip to content

Commit

Permalink
Merge branch 'snap-cloud:main' into 187460419_Support_delete_event
Browse files Browse the repository at this point in the history
  • Loading branch information
cycomachead authored Aug 1, 2024
2 parents df73c30 + 39fff29 commit 4822214
Show file tree
Hide file tree
Showing 14 changed files with 117 additions and 116 deletions.
128 changes: 64 additions & 64 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,47 @@ GEM
remote: https://rubygems.org/
specs:
Ascii85 (1.1.0)
actioncable (7.0.8.1)
actionpack (= 7.0.8.1)
activesupport (= 7.0.8.1)
actioncable (7.0.8.4)
actionpack (= 7.0.8.4)
activesupport (= 7.0.8.4)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.8.1)
actionpack (= 7.0.8.1)
activejob (= 7.0.8.1)
activerecord (= 7.0.8.1)
activestorage (= 7.0.8.1)
activesupport (= 7.0.8.1)
actionmailbox (7.0.8.4)
actionpack (= 7.0.8.4)
activejob (= 7.0.8.4)
activerecord (= 7.0.8.4)
activestorage (= 7.0.8.4)
activesupport (= 7.0.8.4)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.8.1)
actionpack (= 7.0.8.1)
actionview (= 7.0.8.1)
activejob (= 7.0.8.1)
activesupport (= 7.0.8.1)
actionmailer (7.0.8.4)
actionpack (= 7.0.8.4)
actionview (= 7.0.8.4)
activejob (= 7.0.8.4)
activesupport (= 7.0.8.4)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.8.1)
actionview (= 7.0.8.1)
activesupport (= 7.0.8.1)
actionpack (7.0.8.4)
actionview (= 7.0.8.4)
activesupport (= 7.0.8.4)
rack (~> 2.0, >= 2.2.4)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.8.1)
actionpack (= 7.0.8.1)
activerecord (= 7.0.8.1)
activestorage (= 7.0.8.1)
activesupport (= 7.0.8.1)
actiontext (7.0.8.4)
actionpack (= 7.0.8.4)
activerecord (= 7.0.8.4)
activestorage (= 7.0.8.4)
activesupport (= 7.0.8.4)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.8.1)
activesupport (= 7.0.8.1)
actionview (7.0.8.4)
activesupport (= 7.0.8.4)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
Expand All @@ -61,22 +61,22 @@ GEM
activemodel (>= 4.1, < 7.1)
case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
activejob (7.0.8.1)
activesupport (= 7.0.8.1)
activejob (7.0.8.4)
activesupport (= 7.0.8.4)
globalid (>= 0.3.6)
activemodel (7.0.8.1)
activesupport (= 7.0.8.1)
activerecord (7.0.8.1)
activemodel (= 7.0.8.1)
activesupport (= 7.0.8.1)
activestorage (7.0.8.1)
actionpack (= 7.0.8.1)
activejob (= 7.0.8.1)
activerecord (= 7.0.8.1)
activesupport (= 7.0.8.1)
activemodel (7.0.8.4)
activesupport (= 7.0.8.4)
activerecord (7.0.8.4)
activemodel (= 7.0.8.4)
activesupport (= 7.0.8.4)
activestorage (7.0.8.4)
actionpack (= 7.0.8.4)
activejob (= 7.0.8.4)
activerecord (= 7.0.8.4)
activesupport (= 7.0.8.4)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.8.1)
activesupport (7.0.8.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand Down Expand Up @@ -112,7 +112,7 @@ GEM
bootstrap-switch-rails (3.3.3)
bootstrap3-datetimepicker-rails (4.17.47)
momentjs-rails (>= 2.8.1)
builder (3.2.4)
builder (3.3.0)
bullet (7.0.2)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.11)
Expand Down Expand Up @@ -158,7 +158,7 @@ GEM
rest-client (>= 2.0.0)
cocoon (1.2.15)
colorize (0.8.1)
concurrent-ruby (1.2.3)
concurrent-ruby (1.3.3)
countable-rails (0.0.1)
railties (>= 3.1)
crack (0.4.5)
Expand Down Expand Up @@ -235,7 +235,7 @@ GEM
dotenv-rails (2.8.1)
dotenv (= 2.8.1)
railties (>= 3.2)
erubi (1.12.0)
erubi (1.13.0)
execjs (2.8.1)
factory_bot (6.2.1)
activesupport (>= 5.0.0)
Expand Down Expand Up @@ -290,7 +290,7 @@ GEM
httparty (0.21.0)
mini_mime (>= 1.0.0)
multi_xml (>= 0.5.2)
i18n (1.14.4)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
i18n_data (0.17.1)
simple_po_parser (~> 1.1)
Expand Down Expand Up @@ -350,7 +350,7 @@ GEM
rake
mini_magick (4.12.0)
mini_mime (1.1.5)
minitest (5.22.3)
minitest (5.24.1)
momentjs-rails (2.29.4.1)
railties (>= 3.1)
monetize (1.12.0)
Expand Down Expand Up @@ -378,11 +378,11 @@ GEM
next_rails (1.2.4)
colorize (>= 0.8.1)
nio4r (2.7.0)
nokogiri (1.16.5-arm64-darwin)
nokogiri (1.16.6-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.5-x86_64-darwin)
nokogiri (1.16.6-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.5-x86_64-linux)
nokogiri (1.16.6-x86_64-linux)
racc (~> 1.4)
oauth2 (2.0.9)
faraday (>= 0.17.3, < 3.0)
Expand Down Expand Up @@ -466,7 +466,7 @@ GEM
public_suffix (5.0.4)
puma (6.4.2)
nio4r (~> 2.0)
racc (1.7.3)
racc (1.8.0)
rack (2.2.9)
rack-openid (1.4.2)
rack (>= 1.1.0)
Expand All @@ -475,20 +475,20 @@ GEM
rack
rack-test (2.1.0)
rack (>= 1.3)
rails (7.0.8.1)
actioncable (= 7.0.8.1)
actionmailbox (= 7.0.8.1)
actionmailer (= 7.0.8.1)
actionpack (= 7.0.8.1)
actiontext (= 7.0.8.1)
actionview (= 7.0.8.1)
activejob (= 7.0.8.1)
activemodel (= 7.0.8.1)
activerecord (= 7.0.8.1)
activestorage (= 7.0.8.1)
activesupport (= 7.0.8.1)
rails (7.0.8.4)
actioncable (= 7.0.8.4)
actionmailbox (= 7.0.8.4)
actionmailer (= 7.0.8.4)
actionpack (= 7.0.8.4)
actiontext (= 7.0.8.4)
actionview (= 7.0.8.4)
activejob (= 7.0.8.4)
activemodel (= 7.0.8.4)
activerecord (= 7.0.8.4)
activestorage (= 7.0.8.4)
activesupport (= 7.0.8.4)
bundler (>= 1.15.0)
railties (= 7.0.8.1)
railties (= 7.0.8.4)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -503,9 +503,9 @@ GEM
rails-i18n (7.0.7)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
railties (7.0.8.1)
actionpack (= 7.0.8.1)
activesupport (= 7.0.8.1)
railties (7.0.8.4)
actionpack (= 7.0.8.4)
activesupport (= 7.0.8.4)
method_source
rake (>= 12.2)
thor (~> 1.0)
Expand All @@ -527,8 +527,8 @@ GEM
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.2.7)
strscan (>= 3.0.9)
rexml (3.3.2)
strscan
rolify (6.0.1)
rqrcode (2.2.0)
chunky_png (~> 1.0)
Expand Down
29 changes: 13 additions & 16 deletions app/assets/javascripts/osem-schedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,30 +82,27 @@ $(document).ready( function() {

$('#current-event-btn').on('click', function() {
var now = new Date();
var closestEventId = null;
var closestEvent = null;
var smallestDiff = Infinity;
var i = 0;

$('.event-item').each(function() {
let $event = $(this), eventTimeStr = $event.data('time');

var eventTimeStr = $(this).data('time');
if (!eventTimeStr) { return; }

if (eventTimeStr) {
var eventTime = new Date(eventTimeStr);
var diff = Math.abs(eventTime - now);

if (diff < smallestDiff) {
smallestDiff = diff;
closestEventId = $(this).attr('class').split(' ')[1];
}
}
var eventTime = new Date(eventTimeStr);
var diff = Math.abs(eventTime - now);
if (diff < smallestDiff) {
smallestDiff = diff;
closestEvent = $event;
}
});

if (closestEventId) {
//Instead of relying on hash it's probably better to scroll using javascript
//Since the users and click button->scroll->click again, which won't re-scroll
if (closestEvent) {
// Instead of relying on hash it's probably better to scroll using javascript
// Since the users and click button->scroll->click again, which won't re-scroll
$('.highlighted').removeClass('highlighted');
$('.' + closestEventId).addClass('highlighted').get(0).scrollIntoView({ behavior: 'smooth', block: 'start' });
$(closestEvent).addClass('highlighted').get(0).scrollIntoView({ behavior: 'smooth', block: 'start' });
}
});

Expand Down
3 changes: 2 additions & 1 deletion app/controllers/payments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def create
notice: 'Thanks! Your ticket is booked successfully.'
end
else
@total_amount_to_pay = convert_currency(@conference, Ticket.total_price(@conference, current_user, paid: false), from_currency, selected_currency)
# TODO-SNAPCON: This case is not tested at all
@total_amount_to_pay = CurrencyConversion.convert_currency(@conference, Ticket.total_price(@conference, current_user, paid: false), from_currency, selected_currency)
@unpaid_ticket_purchases = current_user.ticket_purchases.unpaid.by_conference(@conference)
flash.now[:error] = @payment.errors.full_messages.to_sentence + ' Please try again with correct credentials.'
render :new
Expand Down
2 changes: 2 additions & 0 deletions app/views/schedules/_date_event_types.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
The conference timezone is #{timezone_mapping(conference.timezone)}.
- if current_user
Visit your #{link_to('user profile page', edit_user_path(current_user.id))} to set your timezone.
- else
(#{link_to('Log in', new_user_session_path)} to view the schedule in your preferred timezone.)
- if current_user
%p.text-center
Click the star next to each event to add or remove it from
Expand Down
2 changes: 1 addition & 1 deletion app/views/schedules/_event.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

%h3.event-panel-title
= link_to conference_program_proposal_path(@conference.short_title, event.id),
style: color_style do
style: "#{color_style}; line-height: 1.7" do
= event.title
- if event.subtitle.present?
%br
Expand Down
4 changes: 2 additions & 2 deletions app/views/schedules/_event_mini.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
%span= " at #{new_start_time.strftime('%l:%M %P')}"
= join_event_link(event, event_schedule, current_user, small: true)
%p
= truncate(markdown(event.abstract), length: 250, escape: false)
- if event.subevents.present?
= markdown(truncate(event.abstract, length: 256))
- if event.program_subevents.present?
%ul
- event.program_subevents.each do |subevent|
%li= link_to(subevent.title, conference_program_proposal_path(@conference.short_title, subevent.id))
47 changes: 21 additions & 26 deletions app/views/schedules/events.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -40,38 +40,33 @@
.row
/ scheduled events
:ruby
date = nil
time = nil
tz_object = current_user&.timezone ? current_user : @conference
prev_date, prev_time = nil
display_tz = current_user&.timezone.presence || @conference.timezone

/ TODO-SNAPCON: Explore caching this.
- @events_schedules.each do |event_schedule|
- next if event_schedule.event.parent_event.present?
- new_start_time = convert_timezone(event_schedule.start_time, @conference.timezone, tz_object.timezone)
- start_ymd = new_start_time.strftime('%Y-%m-%d')
- unless start_ymd.eql?(date)
.col-xs-12.col-md-12
.date-content
%span.date-title
= inyourtz(event_schedule.start_time, @conference.timezone) do
= date = start_ymd
%a.pull-right{ title: "Go up", href: "#program" }
%i.fa-solid.fa-angles-up.fa-lg{ 'aria-hidden': true }
.col-xs-12.col-md-1
- if !event_schedule.start_time.strftime('%H:%M').eql?(time) || !start_ymd.eql?(date)
- time = new_start_time.strftime('%H:%M')
= inyourtz(event_schedule.start_time, @conference.timezone) do
= time + ' ' + timezone_text(tz_object)
.col-xs-12.col-md-11
- cache [@program, event_schedule, event_schedule.event, current_user, event_schedule.happening_now?, '#scheduled#full#panel'] do
.event-item{ data: { time: event_schedule.start_time.iso8601 }, class: "event-#{event_schedule.event.id}" }
= render 'event', event: event_schedule.event, event_schedule: event_schedule
- @events_schedules.select { |es| es.event.parent_event.nil? }.each do |event_schedule|
- event = event_schedule.event
- start_time = convert_timezone(event_schedule.start_time, @conference.timezone, display_tz)

- unless start_time.to_date.eql?(prev_date)
.date-content
%h2.date-title{ style: "margin: 0;" }
= prev_date = start_time.to_date
%a.pull-right{ title: "Go up", href: "#program" }
%i.fa-solid.fa-angles-up.fa-lg{ 'aria-hidden': true }
- if !start_time.eql?(prev_time)
- prev_time = start_time
%h3= start_time.strftime('%H:%M %p %Z')
.col-12
-# - cache [@program, event_schedule, event, current_user, event_schedule.happening_now?, '#scheduled#full#panel'] do
.event-item{ data: { time: event_schedule.start_time.iso8601 }, id: dom_id(event) }
= render 'event', event: event, event_schedule: event_schedule

/ confirmed events that are not scheduled
- if @unscheduled_events.any?
.col-xs-12.col-md-12
.col-12
.date-content
%span.date-title#unscheduled
%h2.date-title#unscheduled{ style: "margin: 0;" }
Unscheduled events
%a.pull-right{ title: "Go up", href: "#program" }
%i.fa-solid.fa-angles-up.fa-lg{ 'aria-hidden': true }
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20230418211420_create_currency_conversions.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class CreateCurrencyConversions < ActiveRecord::Migration[7.0]
def change
create_table :currency_conversions do |t|
create_table :currency_conversions, if_not_exists: true do |t|
t.decimal :rate
t.string :from_currency
t.string :to_currency
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class SetCurrencyForNullTicketPurchaseCurrency < ActiveRecord::Migration[7.0]
def up
TicketPurchase.where(currency: nil).update_all(currency: 'USD')
end
end
Loading

0 comments on commit 4822214

Please sign in to comment.