Merge branch 'master' of https://github.com/CactusPuppy/snapcon into 176917559-add-brand-elements-to-email

This commit is contained in:
Jimmy 2021-02-24 22:08:12 -08:00
commit e44714b06b
173 changed files with 2673 additions and 254 deletions

View file

@ -9,7 +9,7 @@ module Admin
def index
@events = Event.accessible_by(current_ability).where(program: @program,
state: [:confirmed, :unconfirmed])
state: [:confirmed, :unconfirmed])
@events_commercials = Commercial.where(commercialable_type: 'Event', commercialable_id: @events.pluck(:id))
@events_missing_commercial = @events.where.not(id: @events_commercials.pluck(:commercialable_id))
@events_with_requirements = @events.where.not(description: ['', nil])

View file

@ -10,22 +10,22 @@ class ApplicationController < ActionController::Base
check_authorization unless: :devise_controller?
skip_authorization_check if:
def store_location
# store last url - this is needed for post-login redirect to whatever the user last visited.
return unless request.get?
def store_location
# store last url - this is needed for post-login redirect to whatever the user last visited.
return unless request.get?
if (request.path != '/accounts/sign_in' &&
request.path != '/accounts/sign_up' &&
request.path != '/accounts/password/new' &&
request.path != '/accounts/password/edit' &&
request.path != '/accounts/confirmation' &&
request.path != '/accounts/sign_out' &&
request.path != '/users/ichain_registration/ichain_sign_up' &&
!request.path.starts_with?(Devise.ichain_base_url) &&
!request.xhr?) # don't store ajax calls
session[:return_to] = request.fullpath
end
end
if (request.path != '/accounts/sign_in' &&
request.path != '/accounts/sign_up' &&
request.path != '/accounts/password/new' &&
request.path != '/accounts/password/edit' &&
request.path != '/accounts/confirmation' &&
request.path != '/accounts/sign_out' &&
request.path != '/users/ichain_registration/ichain_sign_up' &&
!request.path.starts_with?(Devise.ichain_base_url) &&
!request.xhr?) # don't store ajax calls
session[:return_to] = request.fullpath
end
end
def after_sign_in_path_for(_resource)
if (can? :view, Conference) &&

View file

@ -64,6 +64,9 @@ class ConferenceRegistrationsController < ApplicationController
redirect_to conference_conference_registration_path(@conference.short_title),
notice: 'You are now registered and will be receiving E-Mail notifications.'
end
elsif @conference.registration_ticket_required? && !current_user.supports?(@conference)
redirect_to conference_tickets_path(@conference.short_title),
error: 'You must buy a registration ticket before registering.'
else
flash.now[:error] = "Could not create your registration for #{@conference.title}: "\
"#{@registration.errors.full_messages.join('. ')}."

View file

@ -27,11 +27,13 @@ class UsersController < ApplicationController
def user_params
params.require(:user).permit(:name, :biography, :nickname, :affiliation,
:picture, :picture_cache)
:picture, :picture_cache)
end
# Somewhat of a hack: users/current/edit
# rubocop:disable Naming/MemoizedInstanceVariableName
def load_user
@user ||= (params[:id] && params[:id] != 'current' && User.find(params[:id]) || current_user)
end
# rubocop:enable Naming/MemoizedInstanceVariableName
end

View file

@ -1,4 +1,3 @@
# frozen_string_literal: true
class UserDatatable < AjaxDatatablesRails::Base

View file

@ -112,7 +112,7 @@ module ApplicationHelper
concurrent_events << other_event_schedule.event
end
end
concurrent_events.sort_by { |event_schedule| event_schedule.room&.order }
concurrent_events.sort_by { |schedule| schedule.room&.order }
end
def speaker_links(event)
@ -188,11 +188,12 @@ module ApplicationHelper
'hidden' if Date.today > conference.end_date
end
# TODO:Snap!Con: Replace this with a search for a conference logo.
# TODO-SNAPCON: Replace this with a search for a conference logo.
# TODO: If conference is defined, the alt text should be conference name.
def nav_root_link_for(conference = nil)
path = conference&.id.present? ? conference_path(conference) : root_path
link_to(
image_tag('snapcon_logo.png'),
image_tag('snapcon_logo.png', alt: nav_link_text(conference)),
path,
class: 'navbar-brand',
title: nav_link_text(conference)
@ -201,8 +202,8 @@ module ApplicationHelper
def nav_link_text(conference)
conference.try(:organization).try(:name) ||
ENV['OSEM_NAME'] ||
'OSEM'
ENV['OSEM_NAME'] ||
'OSEM'
end
# returns the url to be used for logo on basis of sponsorship level position

View file

@ -24,6 +24,7 @@ module ConferenceHelper
def short_ticket_description(ticket)
return unless ticket.description
markdown(ticket.description.split("\n").first&.strip)
end
end

View file

@ -1,5 +1,7 @@
# frozen_string_literal: true
# TODO: Split this module into smaller modules
# rubocop:disable Metrics/ModuleLength
module EventsHelper
##
# Includes functions related to events
@ -164,7 +166,7 @@ module EventsHelper
conference_id,
event.id,
event.send(attribute),
url: admin_conference_program_event_path(
url: admin_conference_program_event_path(
conference_id,
event,
event: { attribute => nil }
@ -183,7 +185,7 @@ module EventsHelper
if current_user.roles.where(id: conference.roles).any?
# Show Pre-Event links for any memeber of the conference team.
link_to("Join Live Event #{'(Admin link)' unless is_now}",
event.url, target: '_blank')
event.url, target: '_blank')
elsif current_user.registered_to_event?(conference)
if is_now
link_to('Join Live Event', event.url, target: '_blank')
@ -193,7 +195,7 @@ module EventsHelper
end
end
def calendar_timestamp(timestamp, timezone)
def calendar_timestamp(timestamp, _timezone)
timestamp = timestamp.in_time_zone('GMT')
timestamp -= timestamp.utc_offset
timestamp.strftime('%Y%m%dT%H%M%S')
@ -206,12 +208,12 @@ module EventsHelper
start_timestamp = calendar_timestamp(event_schedule.start_time, conference.timezone)
end_timestamp = calendar_timestamp(event_schedule.end_time, conference.timezone)
event_details = {
action: 'TEMPLATE',
text: "#{event.title} at #{conference.title}",
details: calendar_event_text(event, event_schedule, conference),
action: 'TEMPLATE',
text: "#{event.title} at #{conference.title}",
details: calendar_event_text(event, event_schedule, conference),
location: "#{event.room.name} #{event.url}",
dates: "#{start_timestamp}/#{end_timestamp}",
ctz: event_schedule.timezone
dates: "#{start_timestamp}/#{end_timestamp}",
ctz: event_schedule.timezone
}
"#{calendar_base}?#{event_details.to_param}"
end
@ -220,13 +222,13 @@ module EventsHelper
def calendar_event_text(event, event_schedule, conference)
<<~TEXT
#{conference.title} - #{event.title}
#{event_schedule.start_time.strftime("%Y %B %e - %H:%M")} #{event_schedule.timezone}
#{conference.title} - #{event.title}
#{event_schedule.start_time.strftime('%Y %B %e - %H:%M')} #{event_schedule.timezone}
More Info: #{conference_program_proposal_url(conference, event)}
Join: #{event.url}
More Info: #{conference_program_proposal_url(conference, event)}
Join: #{event.url}
#{truncate(event.abstract, length: 200)}
#{truncate(event.abstract, length: 200)}
TEXT
end
@ -256,3 +258,4 @@ module EventsHelper
end
end
end
# rubocop:enable Metrics/ModuleLength

View file

@ -184,12 +184,12 @@ module FormatHelper
return '' if text.nil?
options = {
autolink: true,
autolink: true,
space_after_headers: true,
tables: true,
strikethrough: true,
footnotes: true,
superscript: true
tables: true,
strikethrough: true,
footnotes: true,
superscript: true
}
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML.new(escape_html: escape_html), options)
markdown.render(text).html_safe

View file

@ -68,6 +68,8 @@ class Ability
end
# Abilities for signed in users
# TODO: Refactor into multiple functions
# rubocop:disable Metrics/AbcSize
def signed_in(user)
# Abilities from not_signed_in user are also inherited
not_signed_in
@ -140,6 +142,7 @@ class Ability
user == track.submitter && !(track.accepted? || track.confirmed?)
end
end
# rubocop:enable Metrics/AbcSize
# Abilities for users with roles wandering around in non-admin views.
def common_abilities_for_admins(user)

View file

@ -1,5 +1,14 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: answers
#
# id :bigint not null, primary key
# title :string
# created_at :datetime
# updated_at :datetime
#
class Answer < ApplicationRecord
has_many :qanswers
has_many :questions, through: :qanswers

View file

@ -1,5 +1,21 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: booths
#
# id :bigint not null, primary key
# description :text
# logo_link :string
# reasoning :text
# state :string
# submitter_relationship :text
# title :string
# website_url :string
# created_at :datetime not null
# updated_at :datetime not null
# conference_id :integer
#
class Booth < ApplicationRecord
include ActiveRecord::Transitions
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }

View file

@ -1,5 +1,21 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: booth_requests
#
# id :bigint not null, primary key
# role :string
# created_at :datetime not null
# updated_at :datetime not null
# booth_id :integer
# user_id :integer
#
# Indexes
#
# index_booth_requests_on_booth_id (booth_id)
# index_booth_requests_on_user_id (user_id)
#
class BoothRequest < ApplicationRecord
belongs_to :booth
belongs_to :user

View file

@ -1,5 +1,19 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: cfps
#
# id :bigint not null, primary key
# cfp_type :string
# description :text
# enable_registrations :boolean default(FALSE)
# end_date :date not null
# start_date :date not null
# created_at :datetime
# updated_at :datetime
# program_id :integer
#
# cannot delete program if there are events submitted
class Cfp < ApplicationRecord

View file

@ -1,5 +1,28 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: comments
#
# id :bigint not null, primary key
# body :text
# commentable_type :string
# lft :integer
# rgt :integer
# subject :string
# title :string(50) default("")
# created_at :datetime
# updated_at :datetime
# commentable_id :integer
# parent_id :integer
# user_id :integer
#
# Indexes
#
# index_comments_on_commentable_id (commentable_id)
# index_comments_on_commentable_type (commentable_type)
# index_comments_on_user_id (user_id)
#
class Comment < ApplicationRecord
acts_as_nested_set scope: %i(commentable_id commentable_type)
validates :body, presence: true

View file

@ -1,5 +1,18 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: commercials
#
# id :bigint not null, primary key
# commercial_type :string
# commercialable_type :string
# url :string
# created_at :datetime
# updated_at :datetime
# commercial_id :string
# commercialable_id :integer
#
class Commercial < ApplicationRecord
require 'oembed'
@ -17,7 +30,7 @@ class Commercial < ApplicationRecord
begin
resource = OEmbed::Providers.get(url, maxwidth: 560, maxheight: 315)
{ html: resource.html.html_safe }
rescue StandardError => exception
rescue StandardError
{ html: iframe_fallback(url) }
# { error: exception.message }
end

View file

@ -1,5 +1,41 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: conferences
#
# id :bigint not null, primary key
# booth_limit :integer default(0)
# color :string
# custom_css :text
# custom_domain :string
# description :text
# end_date :date not null
# end_hour :integer default(20)
# events_per_week :text
# guid :string not null
# logo_file_name :string
# picture :string
# registration_limit :integer default(0)
# revision :integer default(0), not null
# short_title :string not null
# start_date :date not null
# start_hour :integer default(9)
# ticket_layout :integer default("portrait")
# timezone :string not null
# title :string not null
# use_vdays :boolean default(FALSE)
# use_volunteers :boolean
# use_vpositions :boolean default(FALSE)
# created_at :datetime
# updated_at :datetime
# organization_id :integer
#
# Indexes
#
# index_conferences_on_organization_id (organization_id)
#
# rubocop:disable Metrics/ClassLength
class Conference < ApplicationRecord
include RevisionCount
require 'uri'
@ -51,7 +87,7 @@ class Conference < ApplicationRecord
has_many :highlighted_events,
-> { where(state: :confirmed, is_highlight: true) },
through: :program,
source: :events
source: :events
has_many :event_types, through: :program
has_many :surveys, as: :surveyable, dependent: :destroy do
@ -1199,3 +1235,4 @@ class Conference < ApplicationRecord
]
end
end
# rubocop:enable Metrics/ClassLength

View file

@ -1,5 +1,24 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: contacts
#
# id :bigint not null, primary key
# blog :string
# email :string
# facebook :string
# googleplus :string
# instagram :string
# mastodon :string
# social_tag :string
# sponsor_email :string
# twitter :string
# youtube :string
# created_at :datetime
# updated_at :datetime
# conference_id :integer
#
class Contact < ApplicationRecord
has_paper_trail on: [:update], ignore: [:updated_at], meta: { conference_id: :conference_id }

View file

@ -1,5 +1,17 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: difficulty_levels
#
# id :bigint not null, primary key
# color :string
# description :text
# title :string
# created_at :datetime
# updated_at :datetime
# program_id :integer
#
class DifficultyLevel < ApplicationRecord
belongs_to :program, touch: true
has_many :events, dependent: :nullify

View file

@ -1,5 +1,50 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: email_settings
#
# id :bigint not null, primary key
# accepted_body :text
# accepted_subject :string
# booths_acceptance_body :text
# booths_acceptance_subject :string
# booths_rejection_body :text
# booths_rejection_subject :string
# cfp_dates_updated_body :text
# cfp_dates_updated_subject :string
# conference_dates_updated_body :text
# conference_dates_updated_subject :string
# conference_registration_dates_updated_body :text
# conference_registration_dates_updated_subject :string
# confirmed_without_registration_body :text
# confirmed_without_registration_subject :string
# program_schedule_public_body :text
# program_schedule_public_subject :string
# registration_body :text
# registration_subject :string
# rejected_body :text
# rejected_subject :string
# send_on_accepted :boolean default(FALSE)
# send_on_booths_acceptance :boolean default(FALSE)
# send_on_booths_rejection :boolean default(FALSE)
# send_on_cfp_dates_updated :boolean default(FALSE)
# send_on_conference_dates_updated :boolean default(FALSE)
# send_on_conference_registration_dates_updated :boolean default(FALSE)
# send_on_confirmed_without_registration :boolean default(FALSE)
# send_on_program_schedule_public :boolean default(FALSE)
# send_on_registration :boolean default(FALSE)
# send_on_rejected :boolean default(FALSE)
# send_on_submitted_proposal :boolean default(FALSE)
# send_on_venue_updated :boolean default(FALSE)
# submitted_proposal_body :text
# submitted_proposal_subject :string
# venue_updated_body :text
# venue_updated_subject :string
# created_at :datetime
# updated_at :datetime
# conference_id :integer
#
class EmailSettings < ApplicationRecord
belongs_to :conference

View file

@ -1,5 +1,34 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: events
#
# id :bigint not null, primary key
# abstract :text
# comments_count :integer default(0), not null
# description :text
# guid :string not null
# is_highlight :boolean default(FALSE)
# language :string
# max_attendees :integer
# progress :string default("new"), not null
# proposal_additional_speakers :text
# public :boolean default(TRUE)
# require_registration :boolean
# start_time :datetime
# state :string default("new"), not null
# subtitle :string
# title :string not null
# week :integer
# created_at :datetime
# updated_at :datetime
# difficulty_level_id :integer
# event_type_id :integer
# program_id :integer
# room_id :integer
# track_id :integer
#
class Event < ApplicationRecord
include ActiveRecord::Transitions
include RevisionCount
@ -281,7 +310,6 @@ class Event < ApplicationRecord
event_schedules.find_by(schedule_id: selected_schedule_id).try(:happening_now?)
end
##
# Returns true or false, if the event is already over or not
#

View file

@ -1,5 +1,25 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: event_schedules
#
# id :bigint not null, primary key
# enabled :boolean default(TRUE)
# start_time :datetime
# created_at :datetime not null
# updated_at :datetime not null
# event_id :integer
# room_id :integer
# schedule_id :integer
#
# Indexes
#
# index_event_schedules_on_event_id (event_id)
# index_event_schedules_on_event_id_and_schedule_id (event_id,schedule_id) UNIQUE
# index_event_schedules_on_room_id (room_id)
# index_event_schedules_on_schedule_id (schedule_id)
#
class EventSchedule < ApplicationRecord
default_scope { where(enabled: true) }
belongs_to :schedule

View file

@ -1,5 +1,20 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: event_types
#
# id :bigint not null, primary key
# color :string
# description :string
# length :integer default(30)
# maximum_abstract_length :integer default(500)
# minimum_abstract_length :integer default(0)
# title :string not null
# created_at :datetime
# updated_at :datetime
# program_id :integer
#
class EventType < ApplicationRecord
belongs_to :program, touch: true
has_many :events, dependent: :restrict_with_error

View file

@ -1,8 +1,20 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: event_users
#
# id :bigint not null, primary key
# comment :string
# event_role :string default("participant"), not null
# created_at :datetime
# updated_at :datetime
# event_id :integer
# user_id :integer
#
class EventUser < ApplicationRecord
ROLES = [%w[Speaker speaker], %w[Submitter submitter], %w[Moderator moderator],
%w[Volunteer volunteer]]
%w[Volunteer volunteer]]
belongs_to :event, touch: true
belongs_to :user

View file

@ -1,5 +1,15 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: events_registrations
#
# id :bigint not null, primary key
# attended :boolean default(FALSE), not null
# created_at :datetime
# event_id :integer
# registration_id :integer
#
class EventsRegistration < ApplicationRecord
belongs_to :registration
belongs_to :event

View file

@ -1,5 +1,22 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: lodgings
#
# id :bigint not null, primary key
# description :text
# name :string
# photo_content_type :string
# photo_file_name :string
# photo_file_size :integer
# photo_updated_at :datetime
# picture :string
# website_link :string
# created_at :datetime
# updated_at :datetime
# conference_id :integer
#
class Lodging < ApplicationRecord
belongs_to :conference

View file

@ -1,5 +1,17 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: openids
#
# id :bigint not null, primary key
# email :string
# provider :string
# uid :string
# created_at :datetime
# updated_at :datetime
# user_id :integer
#
class Openid < ApplicationRecord
belongs_to :user
validates :provider, :uid, :email, presence: true

View file

@ -1,5 +1,15 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: organizations
#
# id :bigint not null, primary key
# code_of_conduct :text
# description :text
# name :string not null
# picture :string
#
class Organization < ApplicationRecord
resourcify :roles, dependent: :delete_all

View file

@ -1,5 +1,19 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: payments
#
# id :bigint not null, primary key
# amount :integer
# authorization_code :string
# last4 :string
# status :integer default("unpaid"), not null
# created_at :datetime not null
# updated_at :datetime not null
# conference_id :integer not null
# user_id :integer not null
#
class Payment < ApplicationRecord
has_many :ticket_purchases
belongs_to :user
@ -23,7 +37,7 @@ class Payment < ApplicationRecord
end
def stripe_description
#"ticket purchases(#{user.username})"
# "ticket purchases(#{user.username})"
"Tickets for #{conference.title} #{user.name} #{user.email}"
end

View file

@ -1,5 +1,19 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: physical_tickets
#
# id :bigint not null, primary key
# token :string
# created_at :datetime not null
# updated_at :datetime not null
# ticket_purchase_id :integer not null
#
# Indexes
#
# index_physical_tickets_on_token (token) UNIQUE
#
class PhysicalTicket < ApplicationRecord
belongs_to :ticket_purchase
has_one :ticket, through: :ticket_purchase

View file

@ -1,5 +1,27 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: programs
#
# id :bigint not null, primary key
# blind_voting :boolean default(FALSE)
# languages :string
# rating :integer default(0)
# schedule_fluid :boolean default(FALSE)
# schedule_interval :integer default(15), not null
# schedule_public :boolean default(FALSE)
# voting_end_date :datetime
# voting_start_date :datetime
# created_at :datetime
# updated_at :datetime
# conference_id :integer
# selected_schedule_id :integer
#
# Indexes
#
# index_programs_on_selected_schedule_id (selected_schedule_id)
#
# cannot delete program if there are events submitted
class Program < ApplicationRecord

View file

@ -1,5 +1,15 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: qanswers
#
# id :bigint not null, primary key
# created_at :datetime
# updated_at :datetime
# answer_id :integer
# question_id :integer
#
class Qanswer < ApplicationRecord
belongs_to :question
belongs_to :answer, dependent: :delete

View file

@ -1,5 +1,17 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: questions
#
# id :bigint not null, primary key
# global :boolean
# title :string
# created_at :datetime
# updated_at :datetime
# conference_id :integer
# question_type_id :integer
#
class Question < ApplicationRecord
belongs_to :question_type
has_and_belongs_to_many :conferences

View file

@ -1,5 +1,14 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: question_types
#
# id :bigint not null, primary key
# title :string
# created_at :datetime
# updated_at :datetime
#
class QuestionType < ApplicationRecord
has_many :questions
end

View file

@ -1,5 +1,20 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: registrations
#
# id :bigint not null, primary key
# accepted_code_of_conduct :boolean
# attended :boolean default(FALSE)
# other_special_needs :text
# volunteer :boolean
# week :integer
# created_at :datetime
# updated_at :datetime
# conference_id :integer
# user_id :integer
#
class Registration < ApplicationRecord
require 'csv'
belongs_to :user
@ -69,7 +84,8 @@ class Registration < ApplicationRecord
end
def user_has_registration_ticket
return if TicketPurchase.where(user: user, ticket: conference.registration_tickets).paid.any?
return if conference.registration_ticket_required? &&
TicketPurchase.where(user: user, ticket: conference.registration_tickets).paid.any?
errors.add(:base, 'You must purchase a registration ticket before registering')
if TicketPurchase.where(user: user, ticket: conference.registration_tickets).unpaid.any?

View file

@ -1,5 +1,16 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: registration_periods
#
# id :bigint not null, primary key
# end_date :date
# start_date :date
# created_at :datetime
# updated_at :datetime
# conference_id :integer
#
class RegistrationPeriod < ApplicationRecord
belongs_to :conference

View file

@ -1,5 +1,16 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: resources
#
# id :bigint not null, primary key
# description :text
# name :string
# quantity :integer
# used :integer default(0)
# conference_id :integer
#
class Resource < ApplicationRecord
belongs_to :conference
validates :name, :used, :quantity, presence: true

View file

@ -1,5 +1,22 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: roles
#
# id :bigint not null, primary key
# description :string
# name :string
# resource_type :string
# created_at :datetime
# updated_at :datetime
# resource_id :integer
#
# Indexes
#
# index_roles_on_name (name)
# index_roles_on_name_and_resource_type_and_resource_id (name,resource_type,resource_id)
#
class Role < ApplicationRecord
belongs_to :resource, polymorphic: true
has_many :users_roles

View file

@ -1,5 +1,17 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: rooms
#
# id :bigint not null, primary key
# guid :string not null
# name :string not null
# order :integer
# size :integer
# url :string
# venue_id :integer not null
#
class Room < ApplicationRecord
include RevisionCount
belongs_to :venue

View file

@ -1,5 +1,20 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: schedules
#
# id :bigint not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# program_id :integer
# track_id :integer
#
# Indexes
#
# index_schedules_on_program_id (program_id)
# index_schedules_on_track_id (track_id)
#
class Schedule < ApplicationRecord
belongs_to :program
belongs_to :track

View file

@ -1,5 +1,30 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: splashpages
#
# id :bigint not null, primary key
# banner_photo_content_type :string
# banner_photo_file_name :string
# banner_photo_file_size :integer
# banner_photo_updated_at :datetime
# include_booths :boolean
# include_cfp :boolean default(FALSE)
# include_lodgings :boolean
# include_program :boolean
# include_registrations :boolean
# include_social_media :boolean
# include_sponsors :boolean
# include_tickets :boolean
# include_tracks :boolean
# include_venue :boolean
# public :boolean
# shuffle_highlights :boolean default(FALSE), not null
# created_at :datetime
# updated_at :datetime
# conference_id :integer
#
class Splashpage < ApplicationRecord
belongs_to :conference

View file

@ -1,5 +1,20 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: sponsors
#
# id :bigint not null, primary key
# description :text
# logo_file_name :string
# name :string
# picture :string
# website_url :string
# created_at :datetime
# updated_at :datetime
# conference_id :integer
# sponsorship_level_id :integer
#
class Sponsor < ApplicationRecord
belongs_to :sponsorship_level
belongs_to :conference

View file

@ -1,5 +1,16 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: sponsorship_levels
#
# id :bigint not null, primary key
# position :integer
# title :string
# created_at :datetime
# updated_at :datetime
# conference_id :integer
#
class SponsorshipLevel < ApplicationRecord
validates :title, presence: true
belongs_to :conference

View file

@ -1,5 +1,15 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: subscriptions
#
# id :bigint not null, primary key
# created_at :datetime
# updated_at :datetime
# conference_id :integer
# user_id :integer
#
class Subscription < ApplicationRecord
belongs_to :conference
belongs_to :user

View file

@ -1,5 +1,24 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: surveys
#
# id :bigint not null, primary key
# description :text
# end_date :datetime
# start_date :datetime
# surveyable_type :string
# target :integer default("after_conference")
# title :string
# created_at :datetime not null
# updated_at :datetime not null
# surveyable_id :integer
#
# Indexes
#
# index_surveys_on_surveyable_type_and_surveyable_id (surveyable_type,surveyable_id)
#
class Survey < ActiveRecord::Base
belongs_to :surveyable, polymorphic: true
has_many :survey_questions, dependent: :destroy

View file

@ -1,5 +1,18 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: survey_questions
#
# id :bigint not null, primary key
# kind :integer default("boolean")
# mandatory :boolean default(FALSE)
# max_choices :integer
# min_choices :integer
# possible_answers :text
# title :string
# survey_id :integer
#
class SurveyQuestion < ActiveRecord::Base
belongs_to :survey
has_many :survey_replies, dependent: :destroy

View file

@ -1,5 +1,16 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: survey_replies
#
# id :bigint not null, primary key
# text :text
# created_at :datetime not null
# updated_at :datetime not null
# survey_question_id :integer
# user_id :integer
#
class SurveyReply < ActiveRecord::Base
belongs_to :user
belongs_to :survey_question

View file

@ -1,5 +1,15 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: survey_submissions
#
# id :bigint not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# survey_id :integer
# user_id :integer
#
class SurveySubmission < ActiveRecord::Base
belongs_to :user
belongs_to :survey

View file

@ -1,5 +1,20 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: tickets
#
# id :bigint not null, primary key
# description :text
# price_cents :integer default(0), not null
# price_currency :string default("USD"), not null
# registration_ticket :boolean default(FALSE)
# title :string not null
# visible :boolean default(TRUE)
# created_at :datetime
# updated_at :datetime
# conference_id :integer
#
class Ticket < ApplicationRecord
belongs_to :conference
has_many :ticket_purchases, dependent: :destroy

View file

@ -1,5 +1,20 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: ticket_purchases
#
# id :bigint not null, primary key
# amount_paid :float default(0.0)
# paid :boolean default(FALSE)
# quantity :integer default(1)
# week :integer
# created_at :datetime
# conference_id :integer
# payment_id :integer
# ticket_id :integer
# user_id :integer
#
class TicketPurchase < ApplicationRecord
belongs_to :ticket
belongs_to :user
@ -107,6 +122,7 @@ end
def count_purchased_registration_tickets(conference, purchases)
# TODO: WHAT CAUSED THIS???
return 0 unless purchases
conference.tickets.for_registration.inject(0) do |sum, registration_ticket|
sum + purchases[registration_ticket.id.to_s].to_i
end

View file

@ -1,5 +1,14 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: ticket_scannings
#
# id :bigint not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# physical_ticket_id :integer not null
#
class TicketScanning < ApplicationRecord
belongs_to :physical_ticket

View file

@ -1,5 +1,33 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: tracks
#
# id :bigint not null, primary key
# cfp_active :boolean not null
# color :string
# description :text
# end_date :date
# guid :string not null
# name :string not null
# relevance :text
# short_name :string not null
# start_date :date
# state :string default("new"), not null
# created_at :datetime
# updated_at :datetime
# program_id :integer
# room_id :integer
# selected_schedule_id :integer
# submitter_id :integer
#
# Indexes
#
# index_tracks_on_room_id (room_id)
# index_tracks_on_selected_schedule_id (selected_schedule_id)
# index_tracks_on_submitter_id (submitter_id)
#
class Track < ApplicationRecord
include ActiveRecord::Transitions
include RevisionCount

View file

@ -1,5 +1,51 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: users
#
# id :bigint not null, primary key
# affiliation :string
# avatar_content_type :string
# avatar_file_name :string
# avatar_file_size :integer
# avatar_updated_at :datetime
# biography :text
# confirmation_sent_at :datetime
# confirmation_token :string
# confirmed_at :datetime
# current_sign_in_at :datetime
# current_sign_in_ip :string
# email :string default(""), not null
# email_public :boolean default(FALSE)
# encrypted_password :string default(""), not null
# is_admin :boolean default(FALSE)
# is_disabled :boolean default(FALSE)
# languages :string
# last_sign_in_at :datetime
# last_sign_in_ip :string
# mobile :string
# name :string
# nickname :string
# picture :string
# remember_created_at :datetime
# reset_password_sent_at :datetime
# reset_password_token :string
# sign_in_count :integer default(0)
# tshirt :string
# unconfirmed_email :string
# username :string
# volunteer_experience :text
# created_at :datetime
# updated_at :datetime
#
# Indexes
#
# index_users_on_confirmation_token (confirmation_token) UNIQUE
# index_users_on_email (email) UNIQUE
# index_users_on_reset_password_token (reset_password_token) UNIQUE
# index_users_on_username (username) UNIQUE
#
class IChainRecordNotFound < StandardError
end
@ -55,9 +101,8 @@ class User < ApplicationRecord
[:database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable, :confirmable,
:omniauthable,
# omniauth_providers: [:suse, :google, :facebook, :github, :discourse]
omniauth_providers: [:google, :discourse]
]
omniauth_providers: [:suse, :google, :facebook, :github, :discourse]]
# omniauth_providers: [:google, :discourse]
end
devise(*devise_modules)
@ -160,6 +205,7 @@ class User < ApplicationRecord
# Partials should *not* directly call `gravatar_url`
def profile_picture(opts = {})
return gravatar_url(opts) unless picture.present?
size = (opts[:size] || 0).to_i
if size < 50
picture.tiny.url
@ -259,7 +305,7 @@ class User < ApplicationRecord
# TODO: Use a real authorization in the right place....
def manages_volunteers?(conference)
organizer_roles = get_roles['organizer']
organizer_roles&.include?(conference.short_title) # TODO or Volunteer Coorinator.
organizer_roles&.include?(conference.short_title) # TODO: or Volunteer Coorinator.
end
def registered
@ -300,7 +346,6 @@ class User < ApplicationRecord
events.where(program_id: conference.program.id, 'event_users.event_role': 'volunteer')
end
def self.empty?
User.count == 1 && User.first.email == 'deleted@localhost.osem'
end

View file

@ -1,5 +1,17 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: users_roles
#
# id :bigint not null, primary key
# role_id :integer
# user_id :integer
#
# Indexes
#
# index_users_roles_on_user_id_and_role_id (user_id,role_id)
#
class UsersRole < ApplicationRecord
belongs_to :role
belongs_to :user

View file

@ -1,5 +1,13 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: vchoices
#
# id :bigint not null, primary key
# vday_id :integer
# vposition_id :integer
#
class Vchoice < ApplicationRecord
belongs_to :vday
belongs_to :vposition

View file

@ -1,5 +1,16 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: vdays
#
# id :bigint not null, primary key
# day :date
# description :text
# created_at :datetime
# updated_at :datetime
# conference_id :integer
#
class Vday < ApplicationRecord
belongs_to :conference

View file

@ -1,5 +1,26 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: venues
#
# id :bigint not null, primary key
# city :string
# country :string
# description :text
# guid :string
# latitude :string
# longitude :string
# name :string
# photo_file_name :string
# picture :string
# postalcode :string
# street :string
# website :string
# created_at :datetime
# updated_at :datetime
# conference_id :integer
#
class Venue < ApplicationRecord
belongs_to :conference
has_one :commercial, as: :commercialable, dependent: :destroy

View file

@ -1,5 +1,16 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: votes
#
# id :bigint not null, primary key
# rating :integer
# created_at :datetime
# updated_at :datetime
# event_id :integer
# user_id :integer
#
class Vote < ApplicationRecord
belongs_to :user
belongs_to :event

View file

@ -1,5 +1,16 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: vpositions
#
# id :bigint not null, primary key
# description :text
# title :string not null
# created_at :datetime
# updated_at :datetime
# conference_id :integer
#
class Vposition < ApplicationRecord
belongs_to :conference

View file

@ -1,5 +1,40 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: conferences
#
# id :bigint not null, primary key
# booth_limit :integer default(0)
# color :string
# custom_css :text
# custom_domain :string
# description :text
# end_date :date not null
# end_hour :integer default(20)
# events_per_week :text
# guid :string not null
# logo_file_name :string
# picture :string
# registration_limit :integer default(0)
# revision :integer default(0), not null
# short_title :string not null
# start_date :date not null
# start_hour :integer default(9)
# ticket_layout :integer default("portrait")
# timezone :string not null
# title :string not null
# use_vdays :boolean default(FALSE)
# use_volunteers :boolean
# use_vpositions :boolean default(FALSE)
# created_at :datetime
# updated_at :datetime
# organization_id :integer
#
# Indexes
#
# index_conferences_on_organization_id (organization_id)
#
class ConferenceSerializer < ActiveModel::Serializer
include ApplicationHelper
attributes :short_title, :title, :description, :start_date, :end_date, :picture_url,

View file

@ -1,5 +1,25 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: event_schedules
#
# id :bigint not null, primary key
# enabled :boolean default(TRUE)
# start_time :datetime
# created_at :datetime not null
# updated_at :datetime not null
# event_id :integer
# room_id :integer
# schedule_id :integer
#
# Indexes
#
# index_event_schedules_on_event_id (event_id)
# index_event_schedules_on_event_id_and_schedule_id (event_id,schedule_id) UNIQUE
# index_event_schedules_on_room_id (room_id)
# index_event_schedules_on_schedule_id (schedule_id)
#
class EventScheduleSerializer < ActiveModel::Serializer
include ActionView::Helpers::TextHelper

View file

@ -1,5 +1,34 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: events
#
# id :bigint not null, primary key
# abstract :text
# comments_count :integer default(0), not null
# description :text
# guid :string not null
# is_highlight :boolean default(FALSE)
# language :string
# max_attendees :integer
# progress :string default("new"), not null
# proposal_additional_speakers :text
# public :boolean default(TRUE)
# require_registration :boolean
# start_time :datetime
# state :string default("new"), not null
# subtitle :string
# title :string not null
# week :integer
# created_at :datetime
# updated_at :datetime
# difficulty_level_id :integer
# event_type_id :integer
# program_id :integer
# room_id :integer
# track_id :integer
#
class EventSerializer < ActiveModel::Serializer
include ActionView::Helpers::TextHelper

View file

@ -1,5 +1,17 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: rooms
#
# id :bigint not null, primary key
# guid :string not null
# name :string not null
# order :integer
# size :integer
# url :string
# venue_id :integer not null
#
class RoomSerializer < ActiveModel::Serializer
attributes :guid, :name, :description

View file

@ -1,5 +1,33 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: tracks
#
# id :bigint not null, primary key
# cfp_active :boolean not null
# color :string
# description :text
# end_date :date
# guid :string not null
# name :string not null
# relevance :text
# short_name :string not null
# start_date :date
# state :string default("new"), not null
# created_at :datetime
# updated_at :datetime
# program_id :integer
# room_id :integer
# selected_schedule_id :integer
# submitter_id :integer
#
# Indexes
#
# index_tracks_on_room_id (room_id)
# index_tracks_on_selected_schedule_id (selected_schedule_id)
# index_tracks_on_submitter_id (submitter_id)
#
class TrackSerializer < ActiveModel::Serializer
attributes :guid, :name, :color
end

View file

@ -16,7 +16,7 @@
= semantic_form_for(@commercial, url: admin_conference_commercials_path(conference_id: @conference.short_title)) do |f|
= f.input :url, label: 'URL', as: :string, input_html: { required: 'required', autofocus: true },
hint: 'Just paste the url of your video/photo provider. YouTube, Vimeo, SpeakerDeck, SlideShare, Instagram, Flickr.'
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary pull-right', disabled: true }
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary pull-right', disabled: true }, label: 'Save Materials'
%hr
- @commercials.each_slice(3) do |slice|
@ -24,10 +24,10 @@
- slice.each do |commercial|
- if commercial.persisted?
.col-md-4
.thumbnail
.flexvideo{ id: "resource-content-#{commercial.id}" }
.panel
%div{ id: "resource-content-#{commercial.id}" }
= render partial: 'shared/media_item', locals: { commercial: commercial }
.caption
.caption.panel-footer
- if can? :update, commercial
= semantic_form_for commercial, url: admin_conference_commercial_path(conference_id: @conference.short_title, id: commercial) do |f|
= f.input :url, label: 'URL', as: :string, input_html: { id: "commercial_url_#{commercial.id}", required: 'required' }, hint: 'Just paste the url of your video/photo provider'

View file

@ -22,17 +22,17 @@
= semantic_form_for(@event.commercials.build, url: conference_program_proposal_commercials_path(conference_id: @conference.short_title, proposal_id: @event)) do |f|
= f.input :url, label: 'URL', as: :string, input_html: { required: 'required', type: 'url' },
hint: 'Just paste the url of your video/photo provider. Currently supported: YouTube, Vimeo, SpeakerDeck, SlideShare, Instagram, Flickr.'
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary pull-right', disabled: true }
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary pull-right', disabled: true }, label: 'Save Materials'
%hr
- @event.commercials.each_slice(3) do |slice|
.row
- slice.each do |commercial|
- if commercial.persisted?
.col-md-4
.thumbnail
.flexvideo{ id: "resource-content-#{commercial.id}"}
.panel.panel-default
%div{ id: "resource-content-#{commercial.id}"}
= render partial: 'shared/media_item', locals: { commercial: commercial }
.caption
.caption.panel-footer
- if can? :update, commercial
= semantic_form_for commercial, url: conference_program_proposal_commercial_path(conference_id: @conference.short_title, proposal_id: @event, id: commercial) do |f|
= f.input :url, label: 'URL', as: :string, input_html: { id: "commercial_url_#{commercial.id}", required: 'required', type: 'url' }

View file

@ -64,7 +64,7 @@
%p.text-right
- if @event.new_record?
= f.submit 'Create Proposal', class: 'btn btn-success'
= f.submit 'Submit Proposal', class: 'btn btn-success'
- else
= f.submit 'Update Proposal', class: 'btn btn-success'

View file

@ -1,19 +1,18 @@
.flexvideo
- if commercial.url
- if commercial.commercial_type == 'SlideShare'
%iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', src: "https://www.slideshare.net/slideshow/embed_code/#{commercial.commercial_id}"}
- elsif commercial.commercial_type == 'Flickr'
%iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', src: "https://flic.kr/p/#{commercial.commercial_id}/player/268a054da2"}
- elsif commercial.commercial_type == 'Vimeo'
%iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', src: "//player.vimeo.com/video/#{commercial.commercial_id}"}
- elsif commercial.commercial_type == 'Speakerdeck'
%iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', src: "https://speakerdeck.com/player/#{commercial.commercial_id}?"}
- elsif commercial.commercial_type == 'Instagram'
%iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', scrolling: 'no', allowtransparency: 'true', src: "//instagram.com/p/#{commercial.commercial_id}/embed/"}
- elsif commercial.commercial_type == 'YouTube'
%iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', src: "https://www.youtube.com/embed/#{commercial.commercial_id}?rel=0"}
- elsif commercial.url
= Commercial.render_from_url(commercial.url)[:html]
- else
- if commercial.commercial_type == 'SlideShare'
%iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', src: "https://www.slideshare.net/slideshow/embed_code/#{commercial.commercial_id}"}
- elsif commercial.commercial_type == 'Flickr'
%iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', src: "https://flic.kr/p/#{commercial.commercial_id}/player/268a054da2"}
- elsif commercial.commercial_type == 'Vimeo'
%iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', src: "//player.vimeo.com/video/#{commercial.commercial_id}"}
- elsif commercial.commercial_type == 'Speakerdeck'
%iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', src: "https://speakerdeck.com/player/#{commercial.commercial_id}?"}
- elsif commercial.commercial_type == 'Instagram'
%iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', scrolling: 'no', allowtransparency: 'true', src: "//instagram.com/p/#{commercial.commercial_id}/embed/"}
- else
%iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', src: "https://www.youtube.com/embed/#{commercial.commercial_id}?rel=0"}
- if commercial.url
%br
= link_to('Open in a new tab', commercial.url, target: '_blank')
= link_to('Open in a new tab', commercial.url, target: '_blank', class: 'btn btn-info')