Merge some contributor fixes

This commit is contained in:
Michael Ball 2020-06-30 00:48:47 -07:00
commit 0877aadb2e
72 changed files with 225 additions and 206 deletions

View file

@ -2,10 +2,16 @@ require: rubocop-rspec
inherit_from: .rubocop_todo.yml inherit_from: .rubocop_todo.yml
inherit_mode:
merge:
- Exclude
AllCops: AllCops:
UseCache: true UseCache: true
CacheRootDirectory: tmp/rubocop_cache_rails_dir CacheRootDirectory: tmp/rubocop_cache_rails_dir
MaxFilesInCache: 4000 MaxFilesInCache: 4000
Exclude:
- db/schema.rb
#################### Style ########################### #################### Style ###########################

View file

@ -1156,7 +1156,6 @@ Style/StringLiterals:
- 'config/deploy.rb' - 'config/deploy.rb'
- 'config/environments/production.rb' - 'config/environments/production.rb'
- 'config/puma.rb' - 'config/puma.rb'
- 'db/schema.rb'
- 'lib/tasks/dump_db.rake' - 'lib/tasks/dump_db.rake'
- 'lib/tasks/events_registrations.rake' - 'lib/tasks/events_registrations.rake'
- 'lib/tasks/factory_bot.rake' - 'lib/tasks/factory_bot.rake'

View file

@ -17,7 +17,7 @@ RUN zypper -n install --no-recommends \
# as ruby # as ruby
ruby2.5-devel \ ruby2.5-devel \
# as browser for feature tests # as browser for feature tests
chromium chromium xorg-x11-fonts
# Setup sudo # Setup sudo
RUN echo 'osem ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers RUN echo 'osem ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers

View file

@ -2,7 +2,7 @@
source 'https://rubygems.org' source 'https://rubygems.org'
ruby ENV['OSEM_RUBY_VERSION'] || '2.5.5' ruby '~> 2.5.0'
# rails-assets requires >= 1.8.4 # rails-assets requires >= 1.8.4
if Gem::Version.new(Bundler::VERSION) < Gem::Version.new('1.8.4') if Gem::Version.new(Bundler::VERSION) < Gem::Version.new('1.8.4')
@ -247,7 +247,6 @@ group :test do
gem 'database_cleaner' gem 'database_cleaner'
gem 'geckodriver-helper' gem 'geckodriver-helper'
gem 'rspec-rails' gem 'rspec-rails'
gem 'transactional_capybara'
gem 'webdrivers' gem 'webdrivers'
# for measuring test coverage # for measuring test coverage
gem 'codecov', require: false gem 'codecov', require: false

View file

@ -13,25 +13,25 @@ GEM
remote: https://rails-assets.org/ remote: https://rails-assets.org/
specs: specs:
Ascii85 (1.0.3) Ascii85 (1.0.3)
actioncable (5.2.3) actioncable (5.2.4.3)
actionpack (= 5.2.3) actionpack (= 5.2.4.3)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
actionmailer (5.2.3) actionmailer (5.2.4.3)
actionpack (= 5.2.3) actionpack (= 5.2.4.3)
actionview (= 5.2.3) actionview (= 5.2.4.3)
activejob (= 5.2.3) activejob (= 5.2.4.3)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (5.2.3) actionpack (5.2.4.3)
actionview (= 5.2.3) actionview (= 5.2.4.3)
activesupport (= 5.2.3) activesupport (= 5.2.4.3)
rack (~> 2.0) rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.3) actionview (5.2.4.3)
activesupport (= 5.2.3) activesupport (= 5.2.4.3)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.4) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
@ -41,20 +41,20 @@ GEM
activemodel (>= 4.1, < 6.1) activemodel (>= 4.1, < 6.1)
case_transform (>= 0.2) case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.3) jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
activejob (5.2.3) activejob (5.2.4.3)
activesupport (= 5.2.3) activesupport (= 5.2.4.3)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (5.2.3) activemodel (5.2.4.3)
activesupport (= 5.2.3) activesupport (= 5.2.4.3)
activerecord (5.2.3) activerecord (5.2.4.3)
activemodel (= 5.2.3) activemodel (= 5.2.4.3)
activesupport (= 5.2.3) activesupport (= 5.2.4.3)
arel (>= 9.0) arel (>= 9.0)
activestorage (5.2.3) activestorage (5.2.4.3)
actionpack (= 5.2.3) actionpack (= 5.2.4.3)
activerecord (= 5.2.3) activerecord (= 5.2.4.3)
marcel (~> 0.3.1) marcel (~> 0.3.1)
activesupport (5.2.3) activesupport (5.2.4.3)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2) i18n (>= 0.7, < 2)
minitest (~> 5.1) minitest (~> 5.1)
@ -76,8 +76,8 @@ GEM
ast (2.4.0) ast (2.4.0)
autoprefixer-rails (9.6.4) autoprefixer-rails (9.6.4)
execjs execjs
awesome_nested_set (3.1.4) awesome_nested_set (3.2.1)
activerecord (>= 4.0.0, < 5.3) activerecord (>= 4.0.0, < 7.0)
aws_cf_signer (0.1.3) aws_cf_signer (0.1.3)
axlsx_rails (0.5.2) axlsx_rails (0.5.2)
actionpack (>= 3.1) actionpack (>= 3.1)
@ -90,7 +90,7 @@ GEM
bootstrap-switch-rails (3.0.2) bootstrap-switch-rails (3.0.2)
bootstrap3-datetimepicker-rails (4.17.47) bootstrap3-datetimepicker-rails (4.17.47)
momentjs-rails (>= 2.8.1) momentjs-rails (>= 2.8.1)
builder (3.2.3) builder (3.2.4)
byebug (11.0.1) byebug (11.0.1)
cancancan (2.3.0) cancancan (2.3.0)
capybara (3.26.0) capybara (3.26.0)
@ -125,7 +125,8 @@ GEM
simplecov simplecov
url url
coderay (1.1.1) coderay (1.1.1)
concurrent-ruby (1.1.5) concurrent-ruby (1.1.6)
connection_pool (2.2.2)
countable-rails (0.0.1) countable-rails (0.0.1)
railties (>= 3.1) railties (>= 3.1)
countries (3.0.0) countries (3.0.0)
@ -137,7 +138,7 @@ GEM
sort_alphabetical (~> 1.0) sort_alphabetical (~> 1.0)
crack (0.4.3) crack (0.4.3)
safe_yaml (~> 1.0.0) safe_yaml (~> 1.0.0)
crass (1.0.5) crass (1.0.6)
daemons (1.3.1) daemons (1.3.1)
dalli (2.7.10) dalli (2.7.10)
dante (0.2.0) dante (0.2.0)
@ -230,7 +231,7 @@ GEM
htmlentities (4.3.4) htmlentities (4.3.4)
http-cookie (1.0.3) http-cookie (1.0.3)
domain_name (~> 0.5) domain_name (~> 0.5)
i18n (1.7.0) i18n (1.8.3)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
i18n_data (0.8.0) i18n_data (0.8.0)
inversion (1.1.1) inversion (1.1.1)
@ -269,7 +270,7 @@ GEM
rb-inotify (~> 0.9, >= 0.9.7) rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2) ruby_dep (~> 1.2)
loggability (0.14.0) loggability (0.14.0)
loofah (2.4.0) loofah (2.6.0)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
lumberjack (1.0.12) lumberjack (1.0.12)
@ -281,14 +282,14 @@ GEM
mime-types (3.2.2) mime-types (3.2.2)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2018.0812) mime-types-data (3.2018.0812)
mimemagic (0.3.3) mimemagic (0.3.5)
mina (1.2.3) mina (1.2.3)
open4 (~> 1.3.4) open4 (~> 1.3.4)
rake rake
mini_magick (4.9.5) mini_magick (4.9.5)
mini_mime (1.0.2) mini_mime (1.0.2)
mini_portile2 (2.4.0) mini_portile2 (2.4.0)
minitest (5.13.0) minitest (5.14.1)
momentjs-rails (2.20.1) momentjs-rails (2.20.1)
railties (>= 3.1) railties (>= 3.1)
monetize (1.9.2) monetize (1.9.2)
@ -306,7 +307,7 @@ GEM
nenv (0.3.0) nenv (0.3.0)
netrc (0.11.0) netrc (0.11.0)
nio4r (2.5.2) nio4r (2.5.2)
nokogiri (1.10.8) nokogiri (1.10.9)
mini_portile2 (~> 2.4.0) mini_portile2 (~> 2.4.0)
notiffany (0.1.1) notiffany (0.1.1)
nenv (~> 0.1) nenv (~> 0.1)
@ -377,24 +378,24 @@ GEM
slop (~> 3.4) slop (~> 3.4)
public_suffix (3.1.1) public_suffix (3.1.1)
puma (3.12.6) puma (3.12.6)
rack (2.1.4) rack (2.2.3)
rack-openid (1.3.1) rack-openid (1.3.1)
rack (>= 1.1.0) rack (>= 1.1.0)
ruby-openid (>= 2.1.8) ruby-openid (>= 2.1.8)
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rails (5.2.3) rails (5.2.4.3)
actioncable (= 5.2.3) actioncable (= 5.2.4.3)
actionmailer (= 5.2.3) actionmailer (= 5.2.4.3)
actionpack (= 5.2.3) actionpack (= 5.2.4.3)
actionview (= 5.2.3) actionview (= 5.2.4.3)
activejob (= 5.2.3) activejob (= 5.2.4.3)
activemodel (= 5.2.3) activemodel (= 5.2.4.3)
activerecord (= 5.2.3) activerecord (= 5.2.4.3)
activestorage (= 5.2.3) activestorage (= 5.2.4.3)
activesupport (= 5.2.3) activesupport (= 5.2.4.3)
bundler (>= 1.3.0) bundler (>= 1.3.0)
railties (= 5.2.3) railties (= 5.2.4.3)
sprockets-rails (>= 2.0.0) sprockets-rails (>= 2.0.0)
rails-assets-bootstrap (3.3.6) rails-assets-bootstrap (3.3.6)
rails-assets-jquery (>= 1.9.1, < 3) rails-assets-jquery (>= 1.9.1, < 3)
@ -428,9 +429,9 @@ GEM
rails-i18n (5.1.3) rails-i18n (5.1.3)
i18n (>= 0.7, < 2) i18n (>= 0.7, < 2)
railties (>= 5.0, < 6) railties (>= 5.0, < 6)
railties (5.2.3) railties (5.2.4.3)
actionpack (= 5.2.3) actionpack (= 5.2.4.3)
activesupport (= 5.2.3) activesupport (= 5.2.4.3)
method_source method_source
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0) thor (>= 0.19.0, < 2.0)
@ -559,18 +560,16 @@ GEM
stripe (> 5, < 6) stripe (> 5, < 6)
sysexits (1.2.0) sysexits (1.2.0)
temple (0.8.0) temple (0.8.0)
thor (0.20.3) thor (1.0.1)
thread_safe (0.3.6) thread_safe (0.3.6)
tilt (2.0.9) tilt (2.0.9)
timecop (0.9.1) timecop (0.9.1)
transactional_capybara (0.2.0)
capybara
transitions (1.2.1) transitions (1.2.1)
ttfunk (1.5.1) ttfunk (1.5.1)
turbolinks (5.2.1) turbolinks (5.2.1)
turbolinks-source (~> 5.2) turbolinks-source (~> 5.2)
turbolinks-source (5.2.0) turbolinks-source (5.2.0)
tzinfo (1.2.5) tzinfo (1.2.7)
thread_safe (~> 0.1) thread_safe (~> 0.1)
uglifier (4.1.20) uglifier (4.1.20)
execjs (>= 0.3.0, < 3) execjs (>= 0.3.0, < 3)
@ -597,7 +596,7 @@ GEM
addressable (>= 2.3.6) addressable (>= 2.3.6)
crack (>= 0.3.2) crack (>= 0.3.2)
hashdiff hashdiff
websocket-driver (0.7.1) websocket-driver (0.7.2)
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5) websocket-extensions (0.1.5)
whenever (0.10.0) whenever (0.10.0)
@ -713,7 +712,6 @@ DEPENDENCIES
stripe stripe
stripe-ruby-mock stripe-ruby-mock
timecop timecop
transactional_capybara
transitions transitions
turbolinks turbolinks
uglifier (>= 1.3.0) uglifier (>= 1.3.0)

View file

@ -37,7 +37,7 @@ There is a rudimentary docker-compose configuration for production usage (`docke
1. Configure OSEM 1. Configure OSEM
You have at least to set `SECRET_KEY_BASE` You have at least to set `OSEM_DB_PASSWORD` and `SECRET_KEY_BASE`
``` ```
cp dotenv.example .env.production cp dotenv.example .env.production
vim .env.production vim .env.production

View file

@ -99,6 +99,8 @@ class AdminAbility
can :manage, Conference, organization_id: org_ids_for_organization_admin can :manage, Conference, organization_id: org_ids_for_organization_admin
can [:index, :show], Role can [:index, :show], Role
can [:index, :revert_object, :revert_attribute], PaperTrail::Version, organization_id: org_ids_for_organization_admin
signed_in_with_organizer_role(user, conf_ids_for_organization_admin) signed_in_with_organizer_role(user, conf_ids_for_organization_admin)
end end

View file

@ -5,7 +5,9 @@ class Role < ApplicationRecord
has_many :users_roles has_many :users_roles
has_many :users, through: :users_roles has_many :users, through: :users_roles
has_paper_trail on: [:create, :update], only: [:name, :description], meta: { conference_id: :resource_id } has_paper_trail on: [:create, :update],
only: [:name, :description],
meta: { conference_id: :conference_id, organization_id: :organization_id }
before_destroy :cancel before_destroy :cancel
scopify scopify
@ -14,6 +16,14 @@ class Role < ApplicationRecord
validates :name, uniqueness: { scope: :resource } validates :name, uniqueness: { scope: :resource }
def conference_id
resource_type == 'Conference' ? resource_id : nil
end
def organization_id
resource_type == 'Organization' ? resource_id : nil
end
private private
# Needed to ensure that removing all user from role doesn't remove role. # Needed to ensure that removing all user from role doesn't remove role.

View file

@ -4,11 +4,8 @@ class UsersRole < ApplicationRecord
belongs_to :role belongs_to :role
belongs_to :user belongs_to :user
has_paper_trail on: [:create, :destroy], meta: { conference_id: :conference_id } delegate :conference_id, :organization_id, to: :role
private has_paper_trail on: [:create, :destroy],
meta: { conference_id: :conference_id, organization_id: :organization_id }
def conference_id
role.resource_id
end
end end

View file

@ -17,7 +17,7 @@
input_html: { class: 'form-control', input_html: { class: 'form-control',
id: 'registration-period-end-datepicker' } id: 'registration-period-end-datepicker' }
= f.input :description, hint: markdown_hint, = f.input :description, hint: markdown_hint,
input_html: { rows: 2, data: { provide: 'markdown-editable' } } input_html: { rows: 2, data: { provide: 'markdown' } }
- if cfp.cfp_type == 'events' - if cfp.cfp_type == 'events'
= f.input :enable_registrations, as: :boolean, = f.input :enable_registrations, as: :boolean,
hint: 'Allow submitters to request registration?' hint: 'Allow submitters to request registration?'

View file

@ -9,7 +9,7 @@
= semantic_form_for(@conference, url: admin_conference_path(@conference.short_title), html: {multipart: true}) do |f| = semantic_form_for(@conference, url: admin_conference_path(@conference.short_title), html: {multipart: true}) do |f|
= f.input :title, hint: "The full title of the conference, e.g. 'openSUSE Conference 2014'" = f.input :title, hint: "The full title of the conference, e.g. 'openSUSE Conference 2014'"
= f.input :short_title, hint: "A short title, e.g. 'oSC14', to be used in URLs" = f.input :short_title, hint: "A short title, e.g. 'oSC14', to be used in URLs"
= f.input :description, hint: markdown_hint('A description of the conference.'), input_html: { rows: 5, data: { provide: 'markdown-editable' } } = f.input :description, hint: markdown_hint('A description of the conference.'), input_html: { rows: 5, data: { provide: 'markdown' } }
= f.input :color, hint: 'The color will be used eg for the dashboard.', input_html: {size: 6, type: 'color'} = f.input :color, hint: 'The color will be used eg for the dashboard.', input_html: {size: 6, type: 'color'}
= f.label 'Conference Logo' = f.label 'Conference Logo'
%br %br

View file

@ -11,7 +11,7 @@
= semantic_form_for(@lodging, url: (@lodging.new_record? ? admin_conference_lodgings_path : admin_conference_lodging_path(@conference.short_title, @lodging))) do |f| = semantic_form_for(@lodging, url: (@lodging.new_record? ? admin_conference_lodgings_path : admin_conference_lodging_path(@conference.short_title, @lodging))) do |f|
= f.input :name, input_html: { autofocus: true} = f.input :name, input_html: { autofocus: true}
= f.input :website_link, input_html: { type: :url } = f.input :website_link, input_html: { type: :url }
= f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown-editable' } }, hint: markdown_hint = f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown' } }, hint: markdown_hint
- if @lodging.picture? - if @lodging.picture?
= image_tag @lodging.picture.thumb.url = image_tag @lodging.picture.thumb.url
= f.input :picture = f.input :picture

View file

@ -2,11 +2,11 @@
= f.inputs name: 'Organization details' do = f.inputs name: 'Organization details' do
= f.input :name, as: :string, required: true = f.input :name, as: :string, required: true
= f.input :description, as: :text, = f.input :description, as: :text,
input_html: { rows: 10, data: { provide: 'markdown-editable' } }, input_html: { rows: 10, data: { provide: 'markdown' } },
hint: markdown_hint, hint: markdown_hint,
placeholder: 'Decribe about your organization...' placeholder: 'Decribe about your organization...'
= f.input :code_of_conduct, as: :text, = f.input :code_of_conduct, as: :text,
input_html: { rows: 10, data: { provide: 'markdown-editable' } }, input_html: { rows: 10, data: { provide: 'markdown' } },
hint: markdown_hint, hint: markdown_hint,
placeholder: 'Rules governing behavior and dispute resolution...' placeholder: 'Rules governing behavior and dispute resolution...'
= image_tag f.object.picture.thumb.url if f.object.picture? = image_tag f.object.picture.thumb.url if f.object.picture?

View file

@ -9,7 +9,7 @@
.col-md-8 .col-md-8
= semantic_form_for(@resource, :url => (@resource.new_record? ? admin_conference_resources_path : admin_conference_resource_path(@conference.short_title, @resource))) do |f| = semantic_form_for(@resource, :url => (@resource.new_record? ? admin_conference_resources_path : admin_conference_resource_path(@conference.short_title, @resource))) do |f|
= f.input :name, input_html: { autofocus: true } = f.input :name, input_html: { autofocus: true }
= f.input :description, input_html: { rows: 5, data: { provide: 'markdown-editable' } } = f.input :description, input_html: { rows: 5, data: { provide: 'markdown' } }
= f.input :used = f.input :used
= f.input :quantity = f.input :quantity
%p.text-right %p.text-right

View file

@ -10,7 +10,7 @@
.col-md-8 .col-md-8
= semantic_form_for(@sponsor, url: (@sponsor.new_record? ? admin_conference_sponsors_path : admin_conference_sponsor_path(@conference.short_title, @sponsor))) do |f| = semantic_form_for(@sponsor, url: (@sponsor.new_record? ? admin_conference_sponsors_path : admin_conference_sponsor_path(@conference.short_title, @sponsor))) do |f|
= f.input :name, input_html: { autofocus: true } = f.input :name, input_html: { autofocus: true }
= f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown-editable' } }, hint: markdown_hint = f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown' } }, hint: markdown_hint
= image_tag f.object.picture.thumb.url if f.object.picture? = image_tag f.object.picture.thumb.url if f.object.picture?
= f.input :picture = f.input :picture
= f.input :website_url = f.input :website_url

View file

@ -10,7 +10,7 @@
.col-md-8 .col-md-8
= semantic_form_for(@ticket, url: (@ticket.new_record? ? admin_conference_tickets_path : admin_conference_ticket_path(@conference.short_title, @ticket))) do |f| = semantic_form_for(@ticket, url: (@ticket.new_record? ? admin_conference_tickets_path : admin_conference_ticket_path(@conference.short_title, @ticket))) do |f|
= f.input :title, input_html: { autofocus: true } = f.input :title, input_html: { autofocus: true }
= f.input :description, input_html: { rows: 5, data: { provide: 'markdown-editable' } } = f.input :description, input_html: { rows: 5, data: { provide: 'markdown' } }
= f.input :price = f.input :price
= f.input :price_currency, as: :select, class: 'form-control', collection: ['USD', 'EUR', 'GBP', 'INR', 'CNY', 'CHF'], include_blank: false = f.input :price_currency, as: :select, class: 'form-control', collection: ['USD', 'EUR', 'GBP', 'INR', 'CNY', 'CHF'], include_blank: false
= f.input :registration_ticket, hint: 'A registration ticket is with which user register for the conference.' = f.input :registration_ticket, hint: 'A registration ticket is with which user register for the conference.'

View file

@ -23,6 +23,6 @@
with with
= link_to 'rooms', admin_conference_venue_rooms_path(@conference.short_title) = link_to 'rooms', admin_conference_venue_rooms_path(@conference.short_title)
, if you want to select a room for the track. , if you want to select a room for the track.
= f.input :description, input_html: {rows: 2, data: { provide: 'markdown-editable' } }, hint: markdown_hint = f.input :description, input_html: {rows: 2, data: { provide: 'markdown' } }, hint: markdown_hint
= f.input :cfp_active, label: 'Allow event submitters to select this track for their proposal' = f.input :cfp_active, label: 'Allow event submitters to select this track for their proposal'
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }

View file

@ -20,7 +20,7 @@
= f.input :email = f.input :email
= f.input :password if @user.new_record? = f.input :password if @user.new_record?
= f.input :affiliation, as: :string = f.input :affiliation, as: :string
= f.input :biography, input_html: { rows: 10, data: { provide: 'markdown-editable' } }, = f.input :biography, input_html: { rows: 10, data: { provide: 'markdown' } },
hint: markdown_hint hint: markdown_hint
= f.actions do = f.actions do
= f.action :submit, button_html: {class: 'btn btn-primary'} = f.action :submit, button_html: {class: 'btn btn-primary'}

View file

@ -14,7 +14,7 @@
.col-md-8 .col-md-8
= semantic_form_for(@venue, url: admin_conference_venue_path(@conference.short_title)) do |f| = semantic_form_for(@venue, url: admin_conference_venue_path(@conference.short_title)) do |f|
= f.inputs :name, :website = f.inputs :name, :website
= f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown-editable' } }, hint: markdown_hint = f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown' } }, hint: markdown_hint
= f.label 'Venue Logo' = f.label 'Venue Logo'
%br %br
- if @venue.picture? - if @venue.picture?

View file

@ -15,18 +15,14 @@
- role = current_or_last_object_state('Role', object.role_id) - role = current_or_last_object_state('Role', object.role_id)
- role_name = role.try(:name) || PaperTrail::Version.where(item_type: 'Role', item_id: object.role_id).last.changeset[:name].second - role_name = role.try(:name) || PaperTrail::Version.where(item_type: 'Role', item_id: object.role_id).last.changeset[:name].second
role role
- if role_name == 'organization_admin' - if version.conference_id
- if Organization.find_by(id: version.conference_id)
-# organization_admin belongs to organization and not conferences
- organization = Organization.find_by(id: version.conference_id)
= link_if_alive version, role_name,
admins_admin_organization_path(organization), organization
- else
(Deleted Organization)
- else
- conference = Conference.find_by(id: version.conference_id) - conference = Conference.find_by(id: version.conference_id)
- conference_short_title = conference.try(:short_title) || current_or_last_object_state('Conference', version.conference_id).try(:short_title) || ' ' - conference_short_title = conference.try(:short_title) || current_or_last_object_state('Conference', version.conference_id).try(:short_title) || ' '
= link_if_alive version, role.try(:name), admin_conference_role_path(conference_short_title,role.try(:name) || ' '), conference = link_if_alive version, role.try(:name), admin_conference_role_path(conference_short_title,role.try(:name) || ' '), conference
- elsif version.organization_id
- organization = Organization.find(version.organization_id)
= link_if_alive version, role_name,
admins_admin_organization_path(organization), organization
= version.event == 'create' ? 'to' : 'from' = version.event == 'create' ? 'to' : 'from'
user user
@ -133,19 +129,15 @@
- when 'Role' - when 'Role'
role role
- role_name = object.try(:name) || PaperTrail::Version.where(item_type: 'Role', item_id: version.item_id).last.changeset[:name].second - role_name = object.try(:name) || PaperTrail::Version.where(item_type: 'Role', item_id: version.item_id).last.changeset[:name].second
- if role_name == 'organization_admin' - if version.conference_id
- if Organization.find_by(id: version.conference_id)
-# organization_admin belongs to organization and not conferences
- organization = Organization.find_by(id: version.conference_id)
= link_if_alive version, role_name,
admins_admin_organization_path(organization), organization
- else
(Role Deleted)
- else
- conference = Conference.find_by(id: version.conference_id) - conference = Conference.find_by(id: version.conference_id)
- conference_short_title = conference.try(:short_title) || current_or_last_object_state('Conference', version.conference_id).try(:short_title) || ' ' - conference_short_title = conference.try(:short_title) || current_or_last_object_state('Conference', version.conference_id).try(:short_title) || ' '
= link_if_alive version, role_name, = link_if_alive version, role_name,
admin_conference_role_path(conference_short_title, role_name), conference admin_conference_role_path(conference_short_title, role_name), conference
- elsif version.organization_id
- organization = Organization.find(version.organization_id)
= link_if_alive version, role_name,
admins_admin_organization_path(organization), organization
- when 'Venue' - when 'Venue'
venue venue
@ -203,20 +195,16 @@
= link_to_user(version.item_id) = link_to_user(version.item_id)
- unless %w(Conference Subscription Registration User Organization).include?(version.item_type) - unless %w(Conference Subscription Registration User Organization).include?(version.item_type)
- if (version.item_type == 'Role' && role_name == 'organization_admin') || (version.item_type == 'UsersRole' && role_name == 'organization_admin') - if version.item_type == 'Commercial'
in organization
- if Organization.find_by(id: version.conference_id)
-# organization_admin belongs to organization and not conferences
- organization = Organization.find_by(id: version.conference_id)
= link_to_organization(version.conference_id)
- else
(Organization Deleted)
- elsif version.item_type == 'Commercial'
- commercial = current_or_last_object_state(version.item_type, version.item_id) - commercial = current_or_last_object_state(version.item_type, version.item_id)
- commercialable = current_or_last_object_state(commercial.commercialable_type, commercial.commercialable_id) - commercialable = current_or_last_object_state(commercial.commercialable_type, commercial.commercialable_id)
- unless commercial.commercialable_type == 'Conference' - unless commercial.commercialable_type == 'Conference'
in conference in conference
= link_to_conference(version.conference_id) = link_to_conference(version.conference_id)
- elsif version.organization_id
- organization = Organization.find(version.organization_id)
in organization
= link_to_organization(version.organization_id)
- else - else
in conference in conference
= link_to_conference(version.conference_id) = link_to_conference(version.conference_id)

View file

@ -3,11 +3,11 @@
.col-md-8 .col-md-8
= semantic_form_for(@booth, url: @url, html: { multipart: true }) do |f| = semantic_form_for(@booth, url: @url, html: { multipart: true }) do |f|
= f.input :title, as: :string, input_html: { autofocus: true }, required: true = f.input :title, as: :string, input_html: { autofocus: true }, required: true
= f.input :description, input_html: { rows: 5, data: { provide: 'markdown-editable' } }, required: true, = f.input :description, input_html: { rows: 5, data: { provide: 'markdown' } }, required: true,
hint: 'This field becomes public upon request acceptance' hint: 'This field becomes public upon request acceptance'
= f.input :reasoning, input_html: { rows: 5, data: { provide: 'markdown-editable' } }, required: true, = f.input :reasoning, input_html: { rows: 5, data: { provide: 'markdown' } }, required: true,
label: 'How it fits the conference' label: 'How it fits the conference'
= f.input :submitter_relationship, input_html: { rows: 5, data: { provide: 'markdown-editable' } }, required: true, = f.input :submitter_relationship, input_html: { rows: 5, data: { provide: 'markdown' } }, required: true,
label: 'Submitter\'s relation', label: 'Submitter\'s relation',
hint: 'e.g. employee, comunity manager, etc' hint: 'e.g. employee, comunity manager, etc'
= f.input :website_url = f.input :website_url

View file

@ -29,7 +29,7 @@
%span{ class: 'help-block select-help-text collapse event_difficulty_level_id', id: "#{difficulty_level.id}-help" } %span{ class: 'help-block select-help-text collapse event_difficulty_level_id', id: "#{difficulty_level.id}-help" }
= difficulty_level.description = difficulty_level.description
= f.input :abstract, required: true, input_html: { rows: 5, data: { provide: 'markdown-editable' } }, = f.input :abstract, required: true, input_html: { rows: 5, data: { provide: 'markdown' } },
hint: markdown_hint('[Tips to improve your presentations.](http://blog.hubspot.com/blog/tabid/6307/bid/5975/10-Rules-to-Instantly-Improve-Your-Presentations.aspx)') hint: markdown_hint('[Tips to improve your presentations.](http://blog.hubspot.com/blog/tabid/6307/bid/5975/10-Rules-to-Instantly-Improve-Your-Presentations.aspx)')
%p %p

View file

@ -47,7 +47,7 @@
collection: @languages, collection: @languages,
include_blank: false, label: 'Language', input_html: { class: 'select-help-toggle' } include_blank: false, label: 'Language', input_html: { class: 'select-help-toggle' }
= f.input :abstract, required: true, input_html: { rows: 5, data: { provide: 'markdown-editable' } }, = f.input :abstract, required: true, input_html: { rows: 5, data: { provide: 'markdown' } },
hint: markdown_hint hint: markdown_hint
%p %p

View file

@ -15,6 +15,6 @@
= f.input :color, input_html: {size: 6, type: 'color'}, required: true = f.input :color, input_html: {size: 6, type: 'color'}, required: true
= f.input :start_date, as: :string, input_html: { id: 'registration-period-start-datepicker', start_date: @conference.start_date, end_date: @conference.end_date, readonly: 'readonly' } = f.input :start_date, as: :string, input_html: { id: 'registration-period-start-datepicker', start_date: @conference.start_date, end_date: @conference.end_date, readonly: 'readonly' }
= f.input :end_date, as: :string, input_html: { id: 'registration-period-end-datepicker', readonly: 'readonly' } = f.input :end_date, as: :string, input_html: { id: 'registration-period-end-datepicker', readonly: 'readonly' }
= f.input :description, input_html: {rows: 2, data: { provide: 'markdown-editable' } }, required: true, hint: "This will be public #{markdown_hint}".html_safe = f.input :description, input_html: {rows: 2, data: { provide: 'markdown' } }, required: true, hint: "This will be public #{markdown_hint}".html_safe
= f.input :relevance, input_html: {rows: 5, data: { provide: 'markdown-editable' } }, required: true, hint: "Please explain here how this track relates to the conference, how you are related to its content and why we should accept it. #{markdown_hint}".html_safe = f.input :relevance, input_html: {rows: 5, data: { provide: 'markdown' } }, required: true, hint: "Please explain here how this track relates to the conference, how you are related to its content and why we should accept it. #{markdown_hint}".html_safe
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }

View file

@ -14,7 +14,7 @@
= link_to 'Change your avatar here', 'https://gravatar.com' = link_to 'Change your avatar here', 'https://gravatar.com'
= f.input :affiliation, as: :string, = f.input :affiliation, as: :string,
hint: 'This could be a company, a user group, or nothing at all.' hint: 'This could be a company, a user group, or nothing at all.'
= f.input :biography, input_html: { rows: 5, data: { provide: 'markdown-editable' } }, = f.input :biography, input_html: { rows: 5, data: { provide: 'markdown' } },
hint: markdown_hint hint: markdown_hint
You have used You have used
%span#bio_length %span#bio_length

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class CreateSurveys < ActiveRecord::Migration class CreateSurveys < ActiveRecord::Migration[5.0]
def change def change
create_table :surveys do |t| create_table :surveys do |t|
t.datetime :start_date t.datetime :start_date

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class CreateSurveyQuestions < ActiveRecord::Migration class CreateSurveyQuestions < ActiveRecord::Migration[5.0]
def change def change
create_table :survey_questions do |t| create_table :survey_questions do |t|
t.references :survey t.references :survey

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AddTargetToSurveys < ActiveRecord::Migration class AddTargetToSurveys < ActiveRecord::Migration[5.0]
def change def change
add_column :surveys, :target, :integer, default: 0 add_column :surveys, :target, :integer, default: 0
end end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class CreateSurveyReplies < ActiveRecord::Migration class CreateSurveyReplies < ActiveRecord::Migration[5.0]
def change def change
create_table :survey_replies do |t| create_table :survey_replies do |t|
t.integer :survey_question_id t.integer :survey_question_id

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class CreateSurveySubmissions < ActiveRecord::Migration class CreateSurveySubmissions < ActiveRecord::Migration[5.0]
def change def change
create_table :survey_submissions do |t| create_table :survey_submissions do |t|
t.integer :user_id t.integer :user_id

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AddCommentsCountToEvents < ActiveRecord::Migration class AddCommentsCountToEvents < ActiveRecord::Migration[4.2]
def change def change
add_column :events, :comments_count, :integer, default: 0, null: false add_column :events, :comments_count, :integer, default: 0, null: false

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AddDefaultToRevisionInConference < ActiveRecord::Migration class AddDefaultToRevisionInConference < ActiveRecord::Migration[4.2]
def change def change
change_column :conferences, :revision, :integer, default: 0, null: false change_column :conferences, :revision, :integer, default: 0, null: false
end end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AddEnabledToEventSchedules < ActiveRecord::Migration class AddEnabledToEventSchedules < ActiveRecord::Migration[5.0]
def change def change
add_column :event_schedules, :enabled, :boolean, default: true add_column :event_schedules, :enabled, :boolean, default: true
end end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class CreateBooths < ActiveRecord::Migration class CreateBooths < ActiveRecord::Migration[4.2]
def change def change
create_table :booths do |t| create_table :booths do |t|
t.string :title t.string :title

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AddTypeToCfps < ActiveRecord::Migration class AddTypeToCfps < ActiveRecord::Migration[4.2]
class TmpCfp < ActiveRecord::Base class TmpCfp < ActiveRecord::Base
self.table_name = 'cfps' self.table_name = 'cfps'
end end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class CreateBoothRequests < ActiveRecord::Migration class CreateBoothRequests < ActiveRecord::Migration[4.2]
def change def change
create_table :booth_requests do |t| create_table :booth_requests do |t|
t.references :booth, index: true, foreign_key: true t.references :booth, index: true, foreign_key: true

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class CreatePhysicalTickets < ActiveRecord::Migration class CreatePhysicalTickets < ActiveRecord::Migration[4.2]
def change def change
create_table :physical_tickets do |t| create_table :physical_tickets do |t|
t.integer :ticket_purchase_id, null: false t.integer :ticket_purchase_id, null: false

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AddShortNameToTracks < ActiveRecord::Migration class AddShortNameToTracks < ActiveRecord::Migration[4.2]
class TmpProgram < ActiveRecord::Base class TmpProgram < ActiveRecord::Base
self.table_name = 'programs' self.table_name = 'programs'
end end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AddTicketLayoutToConferences < ActiveRecord::Migration class AddTicketLayoutToConferences < ActiveRecord::Migration[4.2]
def change def change
add_column :conferences, :ticket_layout, :integer, default: 0 add_column :conferences, :ticket_layout, :integer, default: 0
end end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AddStateCfpActiveAndSubmitterReferenceToTracks < ActiveRecord::Migration class AddStateCfpActiveAndSubmitterReferenceToTracks < ActiveRecord::Migration[4.2]
def change def change
add_column :tracks, :state, :string add_column :tracks, :state, :string
add_column :tracks, :cfp_active, :boolean add_column :tracks, :cfp_active, :boolean

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class CreateTicketScannings < ActiveRecord::Migration class CreateTicketScannings < ActiveRecord::Migration[4.2]
def change def change
create_table :ticket_scannings do |t| create_table :ticket_scannings do |t|
t.integer :physical_ticket_id, null: false t.integer :physical_ticket_id, null: false

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AddRoomAndDatesToTracks < ActiveRecord::Migration class AddRoomAndDatesToTracks < ActiveRecord::Migration[4.2]
def change def change
add_reference :tracks, :room, index: true, foreign_key: true add_reference :tracks, :room, index: true, foreign_key: true
add_column :tracks, :start_date, :date add_column :tracks, :start_date, :date

View file

@ -1,11 +1,13 @@
# frozen_string_literal: true # frozen_string_literal: true
class MakeTrackStateNotNullAndAddDefaultValue < ActiveRecord::Migration class MakeTrackStateNotNullAndAddDefaultValue < ActiveRecord::Migration[4.2]
class TmpTrack < ActiveRecord::Base class TmpTrack < ActiveRecord::Base
self.table_name = 'tracks' self.table_name = 'tracks'
end end
def change def change
TmpTrack.reset_column_information
TmpTrack.where(state: nil).each do |track| TmpTrack.where(state: nil).each do |track|
track.state = 'confirmed' track.state = 'confirmed'
track.save! track.save!

View file

@ -1,16 +1,18 @@
# frozen_string_literal: true # frozen_string_literal: true
class MakeTrackCfpActiveNotNull < ActiveRecord::Migration class MakeTrackCfpActiveNotNull < ActiveRecord::Migration[4.2]
class TmpTrack < ActiveRecord::Base class TmpTrack < ActiveRecord::Base
self.table_name = 'tracks' self.table_name = 'tracks'
end end
def change def change
TmpTrack.reset_column_information
TmpTrack.where(cfp_active: nil).each do |track| TmpTrack.where(cfp_active: nil).each do |track|
track.cfp_active = true track.cfp_active = true
track.save! track.save!
end end
change_column_null :tracks, :cfp_active, false change_column :tracks, :cfp_active, :boolean, null: false, default: false
end end
end end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AddIndexToPhysicalTickets < ActiveRecord::Migration class AddIndexToPhysicalTickets < ActiveRecord::Migration[4.2]
def change def change
add_column :physical_tickets, :token, :string add_column :physical_tickets, :token, :string
add_index :physical_tickets, :token, unique: true add_index :physical_tickets, :token, unique: true

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AddCustomDomainToConferences < ActiveRecord::Migration class AddCustomDomainToConferences < ActiveRecord::Migration[4.2]
def change def change
add_column :conferences, :custom_domain, :string add_column :conferences, :custom_domain, :string
end end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AddRelevanceToTracks < ActiveRecord::Migration class AddRelevanceToTracks < ActiveRecord::Migration[4.2]
def change def change
add_column :tracks, :relevance, :text add_column :tracks, :relevance, :text
end end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AddIncludeBoothsToSplashpages < ActiveRecord::Migration class AddIncludeBoothsToSplashpages < ActiveRecord::Migration[4.2]
def change def change
add_column :splashpages, :include_booths, :boolean add_column :splashpages, :include_booths, :boolean
end end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AddBoothLimitToConferences < ActiveRecord::Migration class AddBoothLimitToConferences < ActiveRecord::Migration[4.2]
def change def change
add_column :conferences, :booth_limit, :integer, default: 0 add_column :conferences, :booth_limit, :integer, default: 0
end end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AddBoothsToEmailSettings < ActiveRecord::Migration class AddBoothsToEmailSettings < ActiveRecord::Migration[4.2]
def change def change
add_column :email_settings, :send_on_booths_acceptance, :boolean, default: false add_column :email_settings, :send_on_booths_acceptance, :boolean, default: false
add_column :email_settings, :booths_acceptance_subject, :string add_column :email_settings, :booths_acceptance_subject, :string

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AddRegistrationTicketToTickets < ActiveRecord::Migration class AddRegistrationTicketToTickets < ActiveRecord::Migration[4.2]
def change def change
add_column :tickets, :registration_ticket, :boolean, default: false add_column :tickets, :registration_ticket, :boolean, default: false
end end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AddTrackReferenceToSchedule < ActiveRecord::Migration class AddTrackReferenceToSchedule < ActiveRecord::Migration[4.2]
def change def change
add_reference :schedules, :track, index: true, foreign_key: true add_reference :schedules, :track, index: true, foreign_key: true
end end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AddSelectedScheduleToTracks < ActiveRecord::Migration class AddSelectedScheduleToTracks < ActiveRecord::Migration[4.2]
def change def change
add_column :tracks, :selected_schedule_id, :integer add_column :tracks, :selected_schedule_id, :integer
add_index :tracks, :selected_schedule_id add_index :tracks, :selected_schedule_id

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AddDescriptionToCfps < ActiveRecord::Migration class AddDescriptionToCfps < ActiveRecord::Migration[4.2]
def change def change
add_column :cfps, :description, :text add_column :cfps, :description, :text
end end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AddAmountPaidToTicketPurchases < ActiveRecord::Migration class AddAmountPaidToTicketPurchases < ActiveRecord::Migration[4.2]
def change def change
add_column :ticket_purchases, :amount_paid, :float, default: 0 add_column :ticket_purchases, :amount_paid, :float, default: 0
end end

View file

@ -1,8 +1,8 @@
# frozen_string_literal: true # frozen_string_literal: true
class RebuildConferencePictures < ActiveRecord::Migration class RebuildConferencePictures < ActiveRecord::Migration[5.0]
def up def up
Conference.all.each do |conference| Conference.where.not(picture: nil).each do |conference|
conference.picture.recreate_versions! conference.picture.recreate_versions!
end end
end end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AddMastodonToContact < ActiveRecord::Migration class AddMastodonToContact < ActiveRecord::Migration[5.0]
def change def change
add_column :contacts, :mastodon, :string add_column :contacts, :mastodon, :string
end end

View file

@ -0,0 +1,35 @@
class AddOrganizationToVersions < ActiveRecord::Migration[5.2]
def up
add_reference :versions, :organization
deconflate
end
def down
conflate
remove_reference :versions, :organization
end
private
def conflate
say 'conflate'
PaperTrail::Version.where.not(organization_id: nil).each do |version|
version.update_attributes conference_id: version.organization_id
end
end
def deconflate
say 'deconflate'
PaperTrail::Version.where.not(conference_id: nil).where(item_type: %[Role UsersRole]).each do |version|
id = version.conference_id
if Organization.exists?(id)
raise "version #{version.id} conflates organization #{id} with conference #{id}" if Conference.exists?(id)
version.update_attributes conference_id: nil, organization_id: id
end
end
end
end

View file

@ -10,10 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2018_12_29_233811) do ActiveRecord::Schema.define(version: 2020_03_31_214534) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "answers", force: :cascade do |t| create_table "answers", force: :cascade do |t|
t.string "title" t.string "title"
@ -641,7 +638,9 @@ ActiveRecord::Schema.define(version: 2018_12_29_233811) do
t.text "object_changes" t.text "object_changes"
t.datetime "created_at" t.datetime "created_at"
t.integer "conference_id" t.integer "conference_id"
t.integer "organization_id"
t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id" t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id"
t.index ["organization_id"], name: "index_versions_on_organization_id"
end end
create_table "votes", force: :cascade do |t| create_table "votes", force: :cascade do |t|

View file

@ -1,4 +1,5 @@
version: '2' version: "2.4"
services: services:
osem: osem:
build: build:

View file

@ -1,10 +1,11 @@
version: "2" version: "2.4"
services: services:
database: database:
image: postgres image: postgres
environment: environment:
PGDATA: /var/lib/postgresql/data/pgdata PGDATA: /var/lib/postgresql/data/pgdata
POSTGRES_PASSWORD: $OSEM_DB_PASSWORD
osem: osem:
build: build:
context: . context: .

View file

@ -1,10 +1,11 @@
version: "2" version: "2.4"
services: services:
production_database: production_database:
image: postgres image: postgres
environment: environment:
PGDATA: /var/lib/postgresql/data/pgdata PGDATA: /var/lib/postgresql/data/pgdata
POSTGRES_PASSWORD: $OSEM_DB_PASSWORD
volumes: volumes:
- osem_production_database:/var/lib/postgresql/data/pgdata - osem_production_database:/var/lib/postgresql/data/pgdata
production_web: production_web:
@ -18,6 +19,7 @@ services:
env_file: .env.production # see dotenv.example file env_file: .env.production # see dotenv.example file
environment: environment:
OSEM_DB_HOST: production_database OSEM_DB_HOST: production_database
RAILS_SERVE_STATIC_FILES: 'true'
command: /osem/bin/osem-init.sh command: /osem/bin/osem-init.sh
volumes: volumes:
- osem_production_web_data:/osem/public/system - osem_production_web_data:/osem/public/system

View file

@ -32,9 +32,6 @@
# OSEM_MEMCACHED_USERNAME='root' # OSEM_MEMCACHED_USERNAME='root'
# OSEM_MEMCACHED_PASSWORD='1234' # OSEM_MEMCACHED_PASSWORD='1234'
# The ruby version to use
# OSEM_RUBY_VERSION=2.5.0
# What time is it? # What time is it?
# OSEM_TIME_ZONE="UTC" # OSEM_TIME_ZONE="UTC"

View file

@ -59,6 +59,17 @@ FactoryBot.define do
biography { '<div id="divInjectedElement"></div>' } biography { '<div id="divInjectedElement"></div>' }
end end
factory :organization_admin, parent: :user do
transient do
organization { create(:organization) }
end
after(:create) do |user, evaluator|
user.roles << Role.find_or_create_by(name: 'organization_admin', resource: evaluator.organization)
user.save!
end
end
factory :organizer, parent: :user do factory :organizer, parent: :user do
transient do transient do
resource { create(:resource) } resource { create(:resource) }

View file

@ -75,7 +75,7 @@ feature Commercial do
expect(page).to have_css("button[type='submit']:disabled", text: 'Save Materials') expect(page).to have_css("button[type='submit']:disabled", text: 'Save Materials')
end end
scenario 'updates a commercial of an event', feature: true, js: true do scenario 'updates materials of an event', feature: true, js: true do
commercial = create(:commercial, commercial = create(:commercial,
commercialable_id: event.id, commercialable_id: event.id,
commercialable_type: 'Event') commercialable_type: 'Event')
@ -85,7 +85,6 @@ feature Commercial do
click_button 'Update' click_button 'Update'
page.find('#flash') page.find('#flash')
expect(flash).to eq('Materials were successfully updated.') expect(flash).to eq('Materials were successfully updated.')
TransactionalCapybara::AjaxHelpers.wait_for_ajax(page)
expect(event.commercials.count).to eq(1) expect(event.commercials.count).to eq(1)
commercial.reload commercial.reload
expect(commercial.url).to eq('https://www.youtube.com/watch?v=M9bq_alk-sw') expect(commercial.url).to eq('https://www.youtube.com/watch?v=M9bq_alk-sw')
@ -117,8 +116,7 @@ feature Commercial do
click_link 'Delete' click_link 'Delete'
end end
page.find('#flash') page.find('#flash')
expect(flash).to eq('Materials were successfully destroyed.') expect(flash).to eq('Materials successfully destroyed.')
TransactionalCapybara::AjaxHelpers.wait_for_ajax(page)
expect(event.commercials.count).to eq(0) expect(event.commercials.count).to eq(0)
end end
end end

View file

@ -114,9 +114,12 @@ feature Event do
visit conference_program_proposals_path(conference.short_title) visit conference_program_proposals_path(conference.short_title)
click_link 'New Proposal' click_link 'New Proposal'
expect(page).to have_selector(".in[id='#{find_field('event[event_type_id]').value}-help']") # End of animation
fill_in 'event_title', with: 'Example Proposal' fill_in 'event_title', with: 'Example Proposal'
select('Example Event Type', from: 'event[event_type_id]') select('Example Event Type', from: 'event[event_type_id]')
expect(page).to have_selector(".in[id='#{find_field('event[event_type_id]').value}-help']") # End of animation
fill_in 'event_abstract', with: 'Lorem ipsum abstract' fill_in 'event_abstract', with: 'Lorem ipsum abstract'
expect(page).to have_text('You have used 3 words') expect(page).to have_text('You have used 3 words')
@ -127,7 +130,6 @@ feature Event do
page.find('#flash') page.find('#flash')
expect(page).to have_content 'Proposal was successfully submitted.' expect(page).to have_content 'Proposal was successfully submitted.'
TransactionalCapybara::AjaxHelpers.wait_for_ajax(page)
expect(current_path).to eq(conference_program_proposals_path(conference.short_title)) expect(current_path).to eq(conference_program_proposals_path(conference.short_title))
expect(Event.count).to eq(expected_count) expect(Event.count).to eq(expected_count)
end end

View file

@ -318,17 +318,14 @@ feature 'Version' do
end end
context 'organization role', feature: true, versioning: true, js: true do context 'organization role', feature: true, versioning: true, js: true do
let!(:organization_admin) { create(:organization_admin, organization: conference.organization) }
let!(:user) { create(:user) } let!(:user) { create(:user) }
let!(:role) do
Role.find_by(
resource_id: conference.organization.id,
resource_type: 'Organization'
)
end
setup do setup do
user.add_role :organization_admin, conference.organization user.add_role :organization_admin, conference.organization
user.remove_role :organization_admin, conference.organization user.remove_role :organization_admin, conference.organization
sign_in organization_admin
visit admin_revision_history_path visit admin_revision_history_path
end end
@ -392,7 +389,7 @@ feature 'Version' do
click_link 'Comments (0)' click_link 'Comments (0)'
fill_in 'comment_body', with: 'Sample comment' fill_in 'comment_body', with: 'Sample comment'
click_button 'Add Comment' click_button 'Add Comment'
TransactionalCapybara::AjaxHelpers.wait_for_ajax(page) expect(page).to have_text('Comments (1)')
Comment.last.destroy Comment.last.destroy
PaperTrail::Version.last.reify.save PaperTrail::Version.last.reify.save

View file

@ -20,9 +20,6 @@ require 'webdrivers'
# all migrations applied # all migrations applied
ActiveRecord::Migration.maintain_test_schema! ActiveRecord::Migration.maintain_test_schema!
# Keep capybara and the database on the same page
require 'transactional_capybara/rspec'
# Adds rspec helper provided by paper_trail # Adds rspec helper provided by paper_trail
# makes it easier to control when PaperTrail is enabled during testing. # makes it easier to control when PaperTrail is enabled during testing.
require 'paper_trail/frameworks/rspec' require 'paper_trail/frameworks/rspec'
@ -49,10 +46,8 @@ RSpec.configure do |config|
# config.mock_with :flexmock # config.mock_with :flexmock
# config.mock_with :rr # config.mock_with :rr
# If you're not using ActiveRecord, or you'd prefer not to run each of your # Test within database transactions
# examples within a transaction, remove the following line or assign false config.use_transactional_examples = true
# instead of true.
config.use_transactional_fixtures = false
# Run specs in random order to surface order dependencies. If you find an # Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing # order dependency and want to debug it, you can fix the order by providing
@ -78,12 +73,10 @@ RSpec.configure do |config|
end end
Capybara.register_driver :chrome_headless do |app| Capybara.register_driver :chrome_headless do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome( options = Selenium::WebDriver::Chrome::Options.new(
chromeOptions: { args: %w(headless disable-gpu window-size=1920x1080 no-sandbox) } args: %w(headless disable-gpu window-size=1920x1080 no-sandbox)
)
Capybara::Selenium::Driver.new(
app, browser: :chrome, desired_capabilities: capabilities
) )
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
end end
Capybara.default_max_wait_time = 10 # seconds Capybara.default_max_wait_time = 10 # seconds

View file

@ -2,16 +2,7 @@
RSpec.configure do |config| RSpec.configure do |config|
config.before(:suite) do config.before(:suite) do
DatabaseCleaner.clean_with(:transaction) DatabaseCleaner.clean_with(:truncation)
Rails.application.load_seed Rails.application.load_seed
end end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do |example|
TransactionalCapybara::AjaxHelpers.wait_for_ajax(page) if example.metadata[:js]
DatabaseCleaner.clean
end
end end

View file

@ -2,7 +2,10 @@
# Mock external requests to youtube # Mock external requests to youtube
require 'webmock/rspec' require 'webmock/rspec'
WebMock.disable_net_connect!(allow_localhost: true, allow: /stripe.com/) driver_urls = Webdrivers::Common.subclasses.map do |driver|
Addressable::URI.parse(driver.base_url).host
end
WebMock.disable_net_connect!(allow_localhost: true, allow: [*driver_urls, /stripe.com/])
RSpec.configure do |config| RSpec.configure do |config|
config.before(:each) do config.before(:each) do

View file

@ -1,14 +0,0 @@
# frozen_string_literal: true
module ActiveRecord
class Base
mattr_accessor :shared_connection
@@shared_connection = nil
def self.connection
@@shared_connection || retrieve_connection
end
end
end
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection

View file

@ -9,7 +9,7 @@ RSpec.configure do |config|
example_filename += '.html' example_filename += '.html'
if RSpec.current_example.exception.present? if RSpec.current_example.exception.present?
save_page(example_filename) save_page(example_filename)
save_page(example_screenshotname) save_screenshot(example_screenshotname) # rubocop:disable Lint/Debugger
# remove the file if the test starts working again # remove the file if the test starts working again
else else
File.unlink(example_filename) if File.exist?(example_filename) File.unlink(example_filename) if File.exist?(example_filename)