diff --git a/.codecov.yml b/.codecov.yml index db247200..9c6a4c0d 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1 +1,6 @@ +coverage: + status: + project: + default: + threshold: 0.5% comment: off diff --git a/.travis.yml b/.travis.yml index a94c68ef..b35784c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,21 +1,8 @@ -language: ruby -cache: bundler -rvm: - - 2.6.6 +os: linux dist: bionic -addons: - apt: - packages: - - chromium-browser -services: - - postgresql branches: except: - /^depfu/.*$/ -before_install: - - "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc" - - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true - - gem install bundler -v $(tail -n 1 Gemfile.lock) notifications: email: on_success: change @@ -25,22 +12,9 @@ notifications: - "chat.freenode.net#osem" on_success: change on_failure: change -before_script: - # install CodeClimate test reporter and tell it we are starting a test run - # - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > $CCTR - # - chmod +x $CCTR - # - $CCTR before-build - - RAILS_ENV=test bundle exec rake db:bootstrap --trace - - RAILS_ENV=test bundle exec bin/rails webdrivers:chromedriver:update -script: - - "bin/travis_script.sh $TEST_SUITE" - # TODO Get this working. - # - $CCTR format-coverage -t simplecov --output coverage/codeclimate.$SUITE.json -# after_script: - # combine coverage from all suites, and upload3 to CodeClimate - # - $CCTR sum-coverage coverage/codeclimate.*.json | $CCTR upload-coverage - # - $CCTR after-build --exit-code $TRAVIS_TEST_RESULT - +stages: + - test + - finalize env: global: - OSEM_DB_ADAPTER=sqlite3 @@ -49,11 +23,90 @@ env: - OSEM_DB_NAME='osem_test' - CC_TEST_REPORTER_ID=$CC_TEST_REPORTER - CCTR=./cc-test-reporter - matrix: - - TEST_SUITE=ability - - TEST_SUITE=features - - TEST_SUITE=models - - TEST_SUITE=controllers - - TEST_SUITE=rest -matrix: - fast_finish: false + - TOTAL_TEST_SUITES=5 +jobs: + include: + - &tests + language: ruby + cache: bundler + rvm: + - 2.6.6 + addons: + apt: + packages: + - chromium-browser + services: + - postgresql + before_install: + - "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc" + - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true + - gem install bundler -v $(tail -n 1 Gemfile.lock) + - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > $CCTR + - chmod +x $CCTR + before_script: + - RAILS_ENV=test bundle exec rake db:bootstrap --trace + - RAILS_ENV=test bundle exec bin/rails webdrivers:chromedriver:update + - $CCTR before-build + script: + - "bin/travis_script.sh $TEST_SUITE && $CCTR format-coverage -t cobertura -o ./coverage/codeclimate.1.json ./coverage/coverage.xml" + env: + - TEST_SUITE=ability + workspaces: + create: + name: ws1 + paths: + - coverage/codeclimate.1.json + - <<: *tests + env: + - TEST_SUITE=features + script: + - "bin/travis_script.sh $TEST_SUITE && $CCTR format-coverage -t cobertura -o ./coverage/codeclimate.2.json ./coverage/coverage.xml" + workspaces: + create: + name: ws2 + paths: + - coverage/codeclimate.2.json + - <<: *tests + env: + - TEST_SUITE=models + script: + - "bin/travis_script.sh $TEST_SUITE && $CCTR format-coverage -t cobertura -o ./coverage/codeclimate.3.json ./coverage/coverage.xml" + workspaces: + create: + name: ws3 + paths: + - coverage/codeclimate.3.json + - <<: *tests + env: + - TEST_SUITE=controllers + script: + - "bin/travis_script.sh $TEST_SUITE && $CCTR format-coverage -t cobertura -o ./coverage/codeclimate.4.json ./coverage/coverage.xml" + workspaces: + create: + name: ws4 + paths: + - coverage/codeclimate.4.json + - <<: *tests + env: + - TEST_SUITE=rest + script: + - "bin/travis_script.sh $TEST_SUITE && $CCTR format-coverage -t cobertura -o ./coverage/codeclimate.5.json ./coverage/coverage.xml" + workspaces: + create: + name: ws5 + paths: + - coverage/codeclimate.5.json + - stage: finalize + if: branch = master + language: minimal + before_install: + - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > $CCTR + - chmod +x $CCTR + workspaces: + use: + - ws1 + - ws2 + - ws3 + - ws4 + - ws5 + script: $CCTR sum-coverage --output - --parts $TOTAL_TEST_SUITES coverage/codeclimate.*.json | $CCTR upload-coverage --input - diff --git a/Gemfile b/Gemfile index 226932f5..87a01972 100644 --- a/Gemfile +++ b/Gemfile @@ -266,7 +266,7 @@ group :test do gem 'pdf-inspector', require: "pdf/inspector" end -group :development, :test do +group :development, :test, :linters do # as debugger gem 'byebug' gem 'pry' @@ -280,6 +280,9 @@ group :development, :test do gem 'rubocop-rspec', require: false gem 'haml-lint', require: false +end + +group :development, :test do # as development/test database gem 'sqlite3' end diff --git a/Gemfile.lock b/Gemfile.lock index c59eb26c..d5815b3f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -127,6 +127,8 @@ GEM aws_cf_signer rest-client cocoon (1.2.15) + codecov (0.5.0) + simplecov (>= 0.15, < 0.22) coderay (1.1.1) concurrent-ruby (1.1.8) countable-rails (0.0.1) diff --git a/README.md b/README.md index 71f3ac37..1a549b45 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ### Spring 2021 Student Project [](https://travis-ci.com/CactusPuppy/snapcon) [](https://codeclimate.com/github/CactusPuppy/snapcon/maintainability) -[](https://codecov.io/gh/CactusPuppy/snapcon) +[](https://codeclimate.com/github/CactusPuppy/snapcon/test_coverage) [](https://hakiri.io/github/CactusPuppy/snapcon/master) [](https://depfu.com/github/CactusPuppy/snapcon?project_id=22682) [](http://dashboard.bluejay.governify.io/dashboard/script/dashboardLoader.js?dashboardURL=https://reporter.bluejay.governify.io/api/v4/dashboards/tpa-CS169L-GH-CactusPuppy_snapcon/main) diff --git a/app/assets/javascripts/osem.js b/app/assets/javascripts/osem.js index 0839f13b..636ed959 100644 --- a/app/assets/javascripts/osem.js +++ b/app/assets/javascripts/osem.js @@ -147,6 +147,15 @@ function word_count(text, divId, maxcount) { }); }; +function fill_if_empty(text_area, filler) { + let area = $('#' + text_area); + + if (!area.val()) { + area.val(filler); + area.trigger('change'); + } +} + /* Wait for the DOM to be ready before attaching events to the elements */ $( document ).ready(function() { /* Set the minimum and maximum proposal abstract and submission text word length */ @@ -155,15 +164,15 @@ $( document ).ready(function() { var max = $selected.data("max-words"); var min = $selected.data("min-words"); + // Set the filler text for the submission text + fill_if_empty('event_submission_text', $selected.data("help")); + $("#abstract-maximum-word-count").text(max); $("#submission-maximum-word-count").text(max); $("#abstract-minimum-word-count").text(min); $("#submission-minimum-word-count").text(min); word_count($('#event_abstract').get(0), 'abstract-count', max); word_count($('#event_submission_text').get(0), 'submission-count', max); - - // Set the placeholder text for the abstract - $('#event_submission_text').attr("placeholder", $selected.data("help")); }) .trigger('change'); @@ -180,6 +189,18 @@ $( document ).ready(function() { var max = $selected.data("max-words"); word_count(this, 'submission-count', max); }); + + /* Listen for reset template button, wait for confirm, and reset. */ + $('#sub_text_reset').click((e) => { + let $selected = $("#event_event_type_id option:selected"); + let $this = $(e.target); + let affirm = confirm($this.data('confirm')); + if (affirm) { + let sub_text = $('#event_submission_text'); + sub_text.val($selected.data('help')); + sub_text.trigger('change'); + } + }); }); /* Commodity function for modal windows */ diff --git a/app/assets/stylesheets/mailbot.css b/app/assets/stylesheets/mailbot.css new file mode 100644 index 00000000..870eb7ef --- /dev/null +++ b/app/assets/stylesheets/mailbot.css @@ -0,0 +1,40 @@ +html { + scroll-behavior: smooth; + } + + body { + background: #fff; + box-shadow: 0 0 2px rgba(0, 0, 0, 0.06); + color: #000; + font-family: 'Montserrat', sans-serif; + font-size: 16px; + line-height: 1.5; + margin: 0 auto; + } + + h1, + h3, + h4, + h5, + h6 { + font-weight: 400; + line-height: 1.3; + } + p { + color: #0B3559; + font-weight: 400; + line-height: 2; + } + + #border { + background-color: #0B3559; + padding: 25px; + color:#fff; + } + + #content { + background-color: #fff; + padding: 100px; + color: #0B3559; + } + \ No newline at end of file diff --git a/app/controllers/payments_controller.rb b/app/controllers/payments_controller.rb index 5dae6d19..ffbfec15 100644 --- a/app/controllers/payments_controller.rb +++ b/app/controllers/payments_controller.rb @@ -16,6 +16,7 @@ class PaymentsController < ApplicationController raise CanCan::AccessDenied.new('Nothing to pay for!', :new, Payment) end + @has_registration_ticket = params[:has_registration_ticket] @unpaid_ticket_purchases = current_user.ticket_purchases.unpaid.by_conference(@conference) end @@ -24,8 +25,15 @@ class PaymentsController < ApplicationController if @payment.purchase && @payment.save update_purchased_ticket_purchases - redirect_to conference_physical_tickets_path, - notice: 'Thanks! Your ticket is booked successfully.' + + has_registration_ticket = params[:has_registration_ticket] + if has_registration_ticket == 'true' + redirect_to new_conference_conference_registration_path(@conference.short_title), + notice: 'Thanks! Your ticket is booked successfully. Please register for the conference.' + else + redirect_to conference_physical_tickets_path, + notice: 'Thanks! Your ticket is booked successfully.' + end else @total_amount_to_pay = Ticket.total_price(@conference, current_user, paid: false) @unpaid_ticket_purchases = current_user.ticket_purchases.unpaid.by_conference(@conference) diff --git a/app/controllers/ticket_purchases_controller.rb b/app/controllers/ticket_purchases_controller.rb index 1a1bc449..3034d742 100644 --- a/app/controllers/ticket_purchases_controller.rb +++ b/app/controllers/ticket_purchases_controller.rb @@ -8,23 +8,42 @@ class TicketPurchasesController < ApplicationController def create current_user.ticket_purchases.by_conference(@conference).unpaid.destroy_all + + # Create a ticket purchase which can be paid or unpaid + count_registration_tickets_before = current_user.count_registration_tickets(@conference) message = TicketPurchase.purchase(@conference, current_user, params[:tickets].try(:first)) - if message.blank? - if current_user.ticket_purchases.by_conference(@conference).unpaid.any? - redirect_to new_conference_payment_path, - notice: 'Please pay here to get tickets.' - elsif current_user.ticket_purchases.by_conference(@conference).paid.any? - redirect_to conference_physical_tickets_path, - notice: 'You already have tickets for the conference.' - elsif @conference.tickets.for_registration.any? - redirect_to conference_tickets_path(@conference.short_title), - error: 'Please get at least one ticket to continue.' - else - redirect_to conference_conference_registration_path(@conference.short_title) - end - else + # The new ticket_purchase has been added to the database. current_user.ticket_purchases contains the new one. + count_registration_tickets_after = current_user.count_registration_tickets(@conference) + + # Failed to create ticket purchase + unless message.blank? redirect_to conference_tickets_path(@conference.short_title), error: "Oops, something went wrong with your purchase! #{message}" + return + end + + # Current user already paid for a registration ticket and the current ticket purchase contains one + if count_registration_tickets_before == 1 && count_registration_tickets_after > 1 + redirect_to conference_physical_tickets_path, + error: 'You already have one registration ticket for the conference.' + return + end + + # User needs to pay for tickets if any of them is not free. + if current_user.ticket_purchases.by_conference(@conference).unpaid.any? + has_registration_ticket = count_registration_tickets_before.zero? && count_registration_tickets_after == 1 + redirect_to new_conference_payment_path(has_registration_ticket: has_registration_ticket), + notice: 'Please pay here to get tickets.' + return + end + + # Redirect to registration page for a user who didn't have a registration ticket and is purchasing one + if count_registration_tickets_before.zero? && count_registration_tickets_after == 1 + redirect_to new_conference_conference_registration_path(@conference.short_title), + notice: 'Thanks! Your ticket is booked successfully. Please register for the conference.' + else + redirect_to conference_physical_tickets_path, + notice: 'Thanks! Your ticket is booked successfully.' end end diff --git a/app/helpers/conference_helper.rb b/app/helpers/conference_helper.rb index 14253b23..417a8d55 100644 --- a/app/helpers/conference_helper.rb +++ b/app/helpers/conference_helper.rb @@ -1,5 +1,8 @@ # frozen_string_literal: true +DEFAULT_LOGO = 'snapcon_logo.png' +DEFAULT_COLOR = '#0B3559' + module ConferenceHelper # Return true if only call_for_papers or call_for_tracks or call_for_booths is open def one_call_open(*calls) @@ -28,6 +31,24 @@ module ConferenceHelper markdown(ticket.description.split("\n").first&.strip) end + def conference_logo_url(conference) + if conference.picture.present? + conference.picture.thumb.url + elsif conference.organization.picture.present? + conference.organization.picture.thumb.url + else + DEFAULT_LOGO + end + end + + def conference_color(conference) + if conference.color.present? + conference.color + else + DEFAULT_COLOR + end + end + # adds events to icalendar for proposals in a conference def icalendar_proposals(calendar, proposals, conference) proposals.each do |proposal| diff --git a/app/mailers/mailbot.rb b/app/mailers/mailbot.rb index c055ec84..07249862 100644 --- a/app/mailers/mailbot.rb +++ b/app/mailers/mailbot.rb @@ -5,21 +5,25 @@ EMAIL_TEMPLATE = 'email_template' YTLF_TICKET_ID = 50 class Mailbot < ActionMailer::Base - def registration_mail(conference, user) - @email_body = conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.registration_body) - @logo = conference.picture.thumb.url + helper ConferenceHelper - mail(to: user.email, - bcc: SNAPCON_BCC_ADDRESS, - from: conference.contact.email, - subject: conference.email_settings.registration_subject, - template_name: EMAIL_TEMPLATE) + default bcc: -> { SNAPCON_BCC_ADDRESS }, + template_name: -> { EMAIL_TEMPLATE }, + to: -> { @user.email }, + from: -> { @conference.contact.email } + + def registration_mail(conference, user) + @user = user + @conference = conference + @email_body = @conference.email_settings.generate_email_on_conf_updates(@conference, @user, @conference.email_settings.registration_body) + + mail(subject: @conference.email_settings.registration_subject) end def ticket_confirmation_mail(ticket_purchase) @ticket_purchase = ticket_purchase - @conference = ticket_purchase.conference @user = ticket_purchase.user + @conference = ticket_purchase.conference PhysicalTicket.last(ticket_purchase.quantity).each do |physical_ticket| pdf = TicketPdf.new(@conference, @user, physical_ticket, @conference.ticket_layout.to_sym, "ticket_for_#{@conference.short_title}_#{physical_ticket.id}") @@ -31,138 +35,100 @@ class Mailbot < ActionMailer::Base template_name = 'young_thinkers_ticket_confirmation_template' end - mail(to: @user.email, - bcc: SNAPCON_BCC_ADDRESS, - from: @conference.contact.email, - template_name: template_name, - subject: "#{@conference.title} | Ticket Confirmation and PDF!") + mail(subject: "#{@conference.title} | Ticket Confirmation and PDF!", + template_name: template_name) end def acceptance_mail(event) - conference = event.program.conference + @user = event.submitter + @conference = event.program.conference + @email_body = @conference.email_settings.generate_event_mail(event, @conference.email_settings.accepted_body) - @logo = conference.picture.thumb.url - @email_body = conference.email_settings.generate_event_mail(event, conference.email_settings.accepted_body) - - mail(to: event.submitter.email, - bcc: SNAPCON_BCC_ADDRESS, - from: conference.contact.email, - subject: conference.email_settings.accepted_subject, - template_name: EMAIL_TEMPLATE) + mail(subject: @conference.email_settings.accepted_subject) end def submitted_proposal_mail(event) - conference = event.program.conference + @user = event.submitter + @conference = event.program.conference + @email_body = @conference.email_settings.generate_event_mail(event, @conference.email_settings.submitted_proposal_body) - @logo = conference.picture.thumb.url - @email_body = conference.email_settings.generate_event_mail(event, conference.email_settings.submitted_proposal_body) - - mail(to: event.submitter.email, - bcc: SNAPCON_BCC_ADDRESS, - from: conference.contact.email, - subject: conference.email_settings.submitted_proposal_subject, - template_name: EMAIL_TEMPLATE) + mail(subject: @conference.email_settings.submitted_proposal_subject) end def rejection_mail(event) - conference = event.program.conference + @user = event.submitter + @conference = event.program.conference + @email_body = @conference.email_settings.generate_event_mail(event, @conference.email_settings.rejected_body) - @logo = conference.picture.thumb.url - @email_body = conference.email_settings.generate_event_mail(event, conference.email_settings.rejected_body) - - mail(to: event.submitter.email, - bcc: SNAPCON_BCC_ADDRESS, - from: conference.contact.email, - subject: conference.email_settings.rejected_subject, - template_name: EMAIL_TEMPLATE) + mail(subject: @conference.email_settings.rejected_subject) end def confirm_reminder_mail(event) - conference = event.program.conference + @user = event.submitter + @conference = event.program.conference + @email_body = @conference.email_settings.generate_event_mail(event, @conference.email_settings.confirmed_without_registration_body) - @logo = conference.picture.thumb.url - @email_body = conference.email_settings.generate_event_mail(event, conference.email_settings.confirmed_without_registration_body) - - mail(to: event.submitter.email, - bcc: SNAPCON_BCC_ADDRESS, - from: conference.contact.email, - subject: conference.email_settings.confirmed_without_registration_subject, - template_name: EMAIL_TEMPLATE) + mail(subject: @conference.email_settings.confirmed_without_registration_subject) end def conference_date_update_mail(conference, user) - @logo = conference.picture.thumb.url - @email_body = conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.conference_dates_updated_body) + @user = user + @conference = conference + @email_body = @conference.email_settings.generate_email_on_conf_updates(@conference, @user, @conference.email_settings.conference_dates_updated_body) - mail(to: user.email, - bcc: SNAPCON_BCC_ADDRESS, - from: conference.contact.email, - subject: conference.email_settings.conference_dates_updated_subject, - template_name: EMAIL_TEMPLATE) + mail(subject: @conference.email_settings.conference_dates_updated_subject) end def conference_registration_date_update_mail(conference, user) - @logo = conference.picture.thumb.url - @email_body = conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.conference_registration_dates_updated_body) + @user = user + @conference = conference + @email_body = @conference.email_settings.generate_email_on_conf_updates(@conference, @user, @conference.email_settings.conference_registration_dates_updated_body) - mail(to: user.email, - bcc: SNAPCON_BCC_ADDRESS, - from: conference.contact.email, - subject: conference.email_settings.conference_registration_dates_updated_subject, - template_name: EMAIL_TEMPLATE) + mail(subject: @conference.email_settings.conference_registration_dates_updated_subject) end def conference_venue_update_mail(conference, user) - @logo = conference.picture.thumb.url - @email_body = conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.venue_updated_body) + @user = user + @conference = conference + @email_body = @conference.email_settings.generate_email_on_conf_updates(@conference, @user, @conference.email_settings.venue_updated_body) - mail(to: user.email, - bcc: SNAPCON_BCC_ADDRESS, - from: conference.contact.email, - subject: conference.email_settings.venue_updated_subject, - template_name: EMAIL_TEMPLATE) + mail(subject: @conference.email_settings.venue_updated_subject) end def conference_schedule_update_mail(conference, user) - @logo = conference.picture.thumb.url - @email_body = conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.program_schedule_public_body) + @user = user + @conference = conference + @email_body = @conference.email_settings.generate_email_on_conf_updates(@conference, @user, @conference.email_settings.program_schedule_public_body) - mail(to: user.email, - from: conference.contact.email, - subject: conference.email_settings.program_schedule_public_subject, - template_name: EMAIL_TEMPLATE) + mail(bcc: nil, + subject: @conference.email_settings.program_schedule_public_subject) end def conference_cfp_update_mail(conference, user) - @logo = conference.picture.thumb.url - @email_body = conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.cfp_dates_updated_body) + @user = user + @conference = conference + @email_body = @conference.email_settings.generate_email_on_conf_updates(@conference, @user, @conference.email_settings.cfp_dates_updated_body) - mail(to: user.email, - from: conference.contact.email, - subject: conference.email_settings.cfp_dates_updated_subject, - template_name: EMAIL_TEMPLATE) + mail(bcc: nil, + subject: @conference.email_settings.cfp_dates_updated_subject) end def conference_booths_acceptance_mail(booth) - conference = booth.conference - @logo = conference.picture.thumb.url - @email_body = conference.email_settings.generate_booth_mail(booth, conference.email_settings.booths_acceptance_body) + @user = booth.submitter + @conference = booth.conference + @email_body = @conference.email_settings.generate_booth_mail(booth, @conference.email_settings.booths_acceptance_body) - mail(to: booth.submitter.email, - from: conference.contact.email, - subject: conference.email_settings.booths_acceptance_subject, - template_name: EMAIL_TEMPLATE) + mail(bcc: nil, + subject: @conference.email_settings.booths_acceptance_subject) end def conference_booths_rejection_mail(booth) - conference = booth.conference - @logo = conference.picture.thumb.url - @email_body = conference.email_settings.generate_booth_mail(booth, conference.email_settings.booths_rejection_body) + @user = booth.submitter + @conference = booth.conference + @email_body = @conference.email_settings.generate_booth_mail(booth, @conference.email_settings.booths_rejection_body) - mail(to: booth.submitter.email, - from: conference.contact.email, - subject: conference.email_settings.booths_rejection_subject, - template_name: EMAIL_TEMPLATE) + mail(bcc: nil, + subject: @conference.email_settings.booths_rejection_subject) end def event_comment_mail(comment, user) @@ -171,8 +137,7 @@ class Mailbot < ActionMailer::Base @conference = @event.program.conference @user = user - mail(to: @user.email, - from: @conference.contact.email, + mail(bcc: nil, template_name: 'comment_template', subject: "New comment has been posted for #{@event.title}") end diff --git a/app/models/event.rb b/app/models/event.rb index d10ae1a1..ba04ba20 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -7,7 +7,6 @@ # id :bigint not null, primary key # abstract :text # comments_count :integer default(0), not null -# committee_review :text # description :text # guid :string not null # is_highlight :boolean default(FALSE) diff --git a/app/models/user.rb b/app/models/user.rb index 9bd1bf80..955c76d1 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -346,6 +346,17 @@ class User < ApplicationRecord events.where(program_id: conference.program.id, 'event_users.event_role': 'volunteer') end + def count_registration_tickets(conference) + count = 0 + ticket_purchases.by_conference(conference).each do |ticket_purchase| + if ticket_purchase.ticket.registration_ticket + count += 1 + end + end + + count + end + def self.empty? User.count == 1 && User.first.email == 'deleted@localhost.osem' end diff --git a/app/serializers/event_serializer.rb b/app/serializers/event_serializer.rb index 9bf196f2..8c30b1a1 100644 --- a/app/serializers/event_serializer.rb +++ b/app/serializers/event_serializer.rb @@ -7,7 +7,6 @@ # id :bigint not null, primary key # abstract :text # comments_count :integer default(0), not null -# committee_review :text # description :text # guid :string not null # is_highlight :boolean default(FALSE) diff --git a/app/views/admin/conferences/show.html.haml b/app/views/admin/conferences/show.html.haml index eaf6a031..b1b07f2c 100644 --- a/app/views/admin/conferences/show.html.haml +++ b/app/views/admin/conferences/show.html.haml @@ -57,6 +57,33 @@ .col-md-4 = render 'donut_chart', title: 'Event types', combined_data: @event_type_distribution + .col-md-4 + -# + = render 'donut_chart', title: 'Difficulty levels', + combined_data: @difficulty_levels_distribution + .col-md-4 + -# + = render 'donut_chart', title: 'Tracks', + combined_data: @tracks_distribution + .tab-pane#distribution_confirmed + .row + .col-md-4 + -# + = render 'donut_chart', title: 'Event types', + combined_data: @event_type_distribution_confirmed + .col-md-4 + -# + = render 'donut_chart', title: 'Difficulty levels', + combined_data: @difficulty_levels_distribution_confirmed + .col-md-4 + -# + = render 'donut_chart', title: 'Tracks', + combined_data: @tracks_distribution_confirmed + .tab-pane#distribution_withdrawn + .row + .col-md-4 + = render 'donut_chart', title: 'Event types', + combined_data: @event_type_distribution_withdrawn .col-md-4 = render 'donut_chart', title: 'Difficulty levels', combined_data: @difficulty_levels_distribution diff --git a/app/views/conference_registrations/_event.html.haml b/app/views/conference_registrations/_event.html.haml index 1a8a3d96..dd389f66 100644 --- a/app/views/conference_registrations/_event.html.haml +++ b/app/views/conference_registrations/_event.html.haml @@ -1,9 +1,9 @@ -.panel.panel-default{c lass: ("panel-success" if event.registrations.include?(@registration)) } +.panel.panel-default{ class: ('panel-success' if event.registrations.include?(registration)) } .panel-heading %label{ for: "registration_event_ids_#{event.id}" } %h3{ style: 'margin: 0 auto;' } = hidden_field_tag 'registration[event_ids][]', nil - = check_box_tag 'registration[event_ids][]', event.id, event.registrations.include?(@registration), id: "registration_event_ids_#{event.id}" + = check_box_tag 'registration[event_ids][]', event.id, event.registrations.include?(registration), id: "registration_event_ids_#{event.id}" = event.title %small = event.subtitle @@ -13,9 +13,10 @@ (Scheduled on: #{event.time.to_date}) .panel-body - %p - = canceled_replacement_event_label(event, event_schedule) - = replacement_event_notice(event_schedule) + -# + %p + = canceled_replacement_event_label(event, event_schedule) + = replacement_event_notice(event_schedule) %p - if event.speakers.any? presented by #{event.speaker_names} @@ -29,10 +30,10 @@ %p = markdown(truncate(event.abstract, length: 250)) -# TODO: More informative text or aria-label. - = link_to 'more', conference_program_proposal_path(@conference.short_title, event.id), target: '_blank' + = link_to 'more', conference_program_proposal_path(conference.short_title, event.id), target: '_blank' - if event.track %span.track %span.fa.fa-road - %span.label{ style: "background-color: #{event.track.color}; color: #{ contrast_color(event.track.color) }" } + %span.label{ style: "background-color: #{event.track.color}; color: #{contrast_color(event.track.color)}" } = event.track.name diff --git a/app/views/conference_registrations/_registration_info.html.haml b/app/views/conference_registrations/_registration_info.html.haml index e8968298..45d6f9fe 100644 --- a/app/views/conference_registrations/_registration_info.html.haml +++ b/app/views/conference_registrations/_registration_info.html.haml @@ -18,6 +18,6 @@ You are registered for #{pluralize(@registration.events.count, 'event')}. They are at the end of this list. - @registration.events_ordered.each do |event| - = render 'conference_registrations/event', event: event, event_schedule: event.event_schedules.first + = render 'conference_registrations/event', event: event, event_schedule: event.event_schedules.first, conference: @conference, registration: @registration = render 'conferences/code_of_conduct', organization: @conference.organization diff --git a/app/views/conferences/_footer.haml b/app/views/conferences/_footer.haml index 6b66478a..0ef3fa56 100644 --- a/app/views/conferences/_footer.haml +++ b/app/views/conferences/_footer.haml @@ -1,14 +1,15 @@ --# .scroll-top-wrapper --# = link_to "#banner", class: "smoothscroll" do --# %i.fa.fa-2x.fa-arrow-circle-up +-# + scroll-top-wrapper + = link_to "#banner", class: "smoothscroll" do + %i.fa.fa-2x.fa-arrow-circle-up --# :javascript --# $(function(){ --# $(document).on( 'scroll', function(){ --# if ($(window).scrollTop() > 100) { --# $('.scroll-top-wrapper').addClass('show'); --# } else { --# $('.scroll-top-wrapper').removeClass('show'); --# } --# }); --# }); + :javascript + $(function(){ + $(document).on( 'scroll', function(){ + if ($(window).scrollTop() > 100) { + $('.scroll-top-wrapper').addClass('show'); + } else { + $('.scroll-top-wrapper').removeClass('show'); + } + }); + }); diff --git a/app/views/conferences/_header.haml b/app/views/conferences/_header.haml index fad8648c..f40fe600 100644 --- a/app/views/conferences/_header.haml +++ b/app/views/conferences/_header.haml @@ -2,13 +2,14 @@ #banner{ style: ("background-image: url(#{conference.picture_url})" if conference.picture_url) } .container .row - .col-md-6.col-md-offset-3{id: (conference.picture? ? "header-image" : "header-no-image")} + .col-md-6.col-md-offset-3{ id: (conference.picture? ? "header-image" : "header-no-image") } .row - -# - if conference.picture? - -# .col-md-4 - -# = image_tag(conference.picture_url, - -# class: 'img-responsive img-center', - -# id: 'splash-logo') + -# + - if conference.picture? + .col-md-4 + = image_tag(conference.picture_url, + class: 'img-responsive img-center', + id: 'splash-logo') .col-md-8 %h1 = conference.title.html_safe diff --git a/app/views/conferences/_program.haml b/app/views/conferences/_program.haml index 18d8a540..de07b475 100644 --- a/app/views/conferences/_program.haml +++ b/app/views/conferences/_program.haml @@ -2,7 +2,7 @@ %li %a.smoothscroll{ href: '#program' } Program %li - = link_to('Schedule', events_conference_schedule_path(@conference)) + = link_to('Schedule', events_conference_schedule_path(conference)) - cache [conference, highlights, tracks, booths, '#splash#program'] do %section#program diff --git a/app/views/conferences/_sponsors.haml b/app/views/conferences/_sponsors.haml index 0bd5edb0..ab9e3638 100644 --- a/app/views/conferences/_sponsors.haml +++ b/app/views/conferences/_sponsors.haml @@ -27,7 +27,7 @@ .row .col-md-12 %h3.text-center - = "Interested in sponsoring #{conference.title}?" + Interested in sponsoring #{conference.title}? = link_to(sponsorship_mailto(conference)) do Please, contact us! .trapezoid diff --git a/app/views/conferences/_tickets.haml b/app/views/conferences/_tickets.haml index b28f705e..940dc1ca 100644 --- a/app/views/conferences/_tickets.haml +++ b/app/views/conferences/_tickets.haml @@ -22,6 +22,6 @@ .word_break = short_ticket_description(ticket) %button.btn-block.btn.btn-lg.btn-success - %i.fa.fa-ticket.fa-fw{"aria-hidden": true} + %i.fa.fa-ticket.fa-fw{ "aria-hidden": true } = humanized_money_with_symbol(ticket.price) .trapezoid diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index f498bf97..c34aa3c1 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -20,24 +20,22 @@ - if @unpaid_tickets .row .col-md-12 - .alert.alert-dismissable.alert-info.text-center#unpaid-tickets{role: 'alert'} - %button.button.close{"data-dismiss" => "alert", "aria-label"=>"close"} + .alert.alert-dismissable.alert-info.text-center#unpaid-tickets{ role: 'alert' } + %button.button.close{ "data-dismiss" => "alert", "aria-label"=>"close" } × %p You have unpaid tickets. Please complete your purchase. = link_to('Purchase Tickets', new_conference_payment_path(@conference), class: 'btn btn-success btn-lg') - - if @user_needs_to_register .row - .col-md-12 - .alert.alert-dismissable.alert-warning.text-center#flash{role: 'alert'} - %button.button.close{"data-dismiss" => "alert", 'aria-label': 'close'} - × - %p - You still need to complete your registration for #{@conference.title}. - = link_to('Complete Registration', new_conference_conference_registration_path(@conference), class: 'btn btn-success btn-lg') - + .col-md-12 + .alert.alert-dismissable.alert-warning.text-center#flash{ role: 'alert' } + %button.button.close{ "data-dismiss" => "alert", 'aria-label': 'close' } + × + %p + You still need to complete your registration for #{@conference.title}. + = link_to('Complete Registration', new_conference_conference_registration_path(@conference), class: 'btn btn-success btn-lg') #splash - if @conference.code_of_conduct.present? @@ -79,29 +77,8 @@ sponsorship_levels: @sponsorship_levels, sponsors: @sponsors - -# footer - if @conference.splashpage.include_social_media - if @conference.contact.has_social_media? = render 'social_media', contact: @conference.contact = render 'footer' - - --# - content_for :script_head do --# :javascript --# var triangle_tcs = tinycolor("#{h(@conference.color)}").monochromatic(); --# var triangle_colors = triangle_tcs.map(function(t) { --# return t.toHexString(); --# }); --# $(function () { --# $(document).ready(function() { --# var triangle_width = document.body.clientWidth; --# var triangle_height = ($( "#banner" ).height() + 200 ); --# var pattern = Trianglify({ width: triangle_width, --# height: triangle_height, --# cell_size: 100, --# x_colors: triangle_colors --# }); --# $('#banner').css('background-image', 'url(' + 0 + ')'); --# }); --# }); diff --git a/app/views/layouts/_mailbot_footer.html.erb b/app/views/layouts/_mailbot_footer.html.erb new file mode 100644 index 00000000..3cc8b3c3 --- /dev/null +++ b/app/views/layouts/_mailbot_footer.html.erb @@ -0,0 +1,12 @@ + +
+ + + + + <%= stylesheet_link_tag "mailbot" %> + + + + + \ No newline at end of file diff --git a/app/views/layouts/_mailbot_header.html.erb b/app/views/layouts/_mailbot_header.html.erb new file mode 100644 index 00000000..12f9d4a5 --- /dev/null +++ b/app/views/layouts/_mailbot_header.html.erb @@ -0,0 +1,25 @@ + + + + +