Rebuild rubocop TODOs after auto-correcting
This commit is contained in:
parent
31c50255e9
commit
84dbb52d11
580 changed files with 3689 additions and 3133 deletions
|
|
@ -1,257 +1,31 @@
|
||||||
# This configuration was generated by
|
# This configuration was generated by
|
||||||
# `rubocop --auto-gen-config`
|
# `rubocop --auto-gen-config`
|
||||||
# on 2017-11-27 22:40:12 +0530 using RuboCop version 0.51.0.
|
# on 2018-04-04 10:16:39 -0700 using RuboCop version 0.54.0.
|
||||||
# The point is for the user to remove these configuration records
|
# The point is for the user to remove these configuration records
|
||||||
# one by one as the offenses are removed from the code base.
|
# one by one as the offenses are removed from the code base.
|
||||||
# Note that changes in the inspected code, or installation of new
|
# Note that changes in the inspected code, or installation of new
|
||||||
# versions of RuboCop, may require this file to be generated again.
|
# versions of RuboCop, may require this file to be generated again.
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 8
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
||||||
# SupportedStyles: with_first_parameter, with_fixed_indentation
|
# SupportedHashRocketStyles: key, separator, table
|
||||||
Layout/AlignParameters:
|
# SupportedColonStyles: key, separator, table
|
||||||
Exclude:
|
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
||||||
- 'Vagrantfile'
|
Layout/AlignHash:
|
||||||
|
|
||||||
# Offense count: 9
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Layout/ClosingParenthesisIndentation:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/conference_registrations_controller.rb'
|
|
||||||
- 'spec/support/omniauth_macros.rb'
|
|
||||||
|
|
||||||
# Offense count: 14
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Layout/CommentIndentation:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/admin/comments_controller.rb'
|
|
||||||
- 'app/controllers/admin/difficulty_levels_controller.rb'
|
|
||||||
- 'app/models/conference.rb'
|
|
||||||
- 'app/models/program.rb'
|
|
||||||
- 'app/models/track.rb'
|
|
||||||
- 'spec/features/volunteers_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Layout/EmptyLineAfterMagicComment:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/models/conference_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 109
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
||||||
# SupportedStyles: empty_lines, no_empty_lines
|
|
||||||
Layout/EmptyLinesAroundBlockBody:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Layout/EmptyLinesAroundExceptionHandlingKeywords:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/payment.rb'
|
|
||||||
|
|
||||||
# Offense count: 9
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
|
|
||||||
Layout/ExtraSpacing:
|
|
||||||
Exclude:
|
|
||||||
- 'Guardfile'
|
|
||||||
- 'app/controllers/application_controller.rb'
|
|
||||||
- 'config.ru'
|
|
||||||
- 'db/migrate/20140623101032_create_ahoy_events.rb'
|
|
||||||
- 'db/migrate/20140701123203_add_events_per_week_to_conference.rb'
|
|
||||||
- 'db/migrate/20140719160903_create_delayed_jobs.rb'
|
|
||||||
- 'spec/models/conference_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 42
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
|
||||||
# SupportedStyles: consistent, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
|
|
||||||
Layout/FirstParameterIndentation:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
|
||||||
# SupportedStyles: special_inside_parentheses, consistent, align_brackets
|
|
||||||
Layout/IndentArray:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/conference.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: IndentationWidth.
|
|
||||||
Layout/IndentAssignment:
|
|
||||||
Exclude:
|
|
||||||
- 'app/helpers/format_helper.rb'
|
|
||||||
- 'app/models/conference.rb'
|
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
|
||||||
# SupportedStyles: special_inside_parentheses, consistent, align_braces
|
|
||||||
Layout/IndentHash:
|
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/models/user.rb'
|
- 'app/models/user.rb'
|
||||||
- 'db/migrate/20140701123203_add_events_per_week_to_conference.rb'
|
- 'spec/mailers/mailbot_spec.rb'
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
||||||
# SupportedStyles: normal, rails
|
|
||||||
Layout/IndentationConsistency:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/users_controller.rb'
|
|
||||||
- 'app/models/event.rb'
|
|
||||||
- 'spec/controllers/subscriptions_controller_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 4
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Layout/LeadingCommentSpace:
|
|
||||||
Exclude:
|
|
||||||
- 'Guardfile'
|
|
||||||
- 'app/models/comment.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
||||||
# SupportedStyles: symmetrical, new_line, same_line
|
|
||||||
Layout/MultilineArrayBraceLayout:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/conference_registrations_controller.rb'
|
|
||||||
|
|
||||||
# Offense count: 5
|
# Offense count: 5
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
Layout/MultilineBlockLayout:
|
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||||
|
# SupportedStyles: with_first_parameter, with_fixed_indentation
|
||||||
|
Layout/AlignParameters:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/serializers/conference_serializer.rb'
|
- 'spec/controllers/admin/conferences_controller_spec.rb'
|
||||||
|
- 'spec/controllers/admin/registration_periods_controller_spec.rb'
|
||||||
# Offense count: 6
|
- 'spec/models/email_settings_spec.rb'
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
||||||
# SupportedStyles: symmetrical, new_line, same_line
|
|
||||||
Layout/MultilineHashBraceLayout:
|
|
||||||
Exclude:
|
|
||||||
- 'app/serializers/conference_serializer.rb'
|
|
||||||
- 'spec/models/event_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 40
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
||||||
# SupportedStyles: symmetrical, new_line, same_line
|
|
||||||
Layout/MultilineMethodCallBraceLayout:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 53
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
|
||||||
# SupportedStyles: aligned, indented, indented_relative_to_receiver
|
|
||||||
Layout/MultilineMethodCallIndentation:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 23
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
|
||||||
# SupportedStyles: aligned, indented
|
|
||||||
Layout/MultilineOperationIndentation:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/application_controller.rb'
|
|
||||||
- 'app/models/conference.rb'
|
|
||||||
- 'app/models/event.rb'
|
|
||||||
- 'db/migrate/20140701123203_add_events_per_week_to_conference.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Layout/SpaceAfterComma:
|
|
||||||
Exclude:
|
|
||||||
- 'lib/tasks/data_demo.rake'
|
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
||||||
# SupportedStyles: space, no_space
|
|
||||||
Layout/SpaceAroundEqualsInParameterDefault:
|
|
||||||
Exclude:
|
|
||||||
- 'app/helpers/format_helper.rb'
|
|
||||||
- 'app/models/event.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: AllowForAlignment.
|
|
||||||
Layout/SpaceAroundOperators:
|
|
||||||
Exclude:
|
|
||||||
- 'lib/tasks/data.rake'
|
|
||||||
|
|
||||||
# Offense count: 463
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles, SupportedStylesForEmptyBraces.
|
|
||||||
# SupportedStyles: space, no_space
|
|
||||||
# SupportedStylesForEmptyBraces: space, no_space
|
|
||||||
Layout/SpaceBeforeBlockBraces:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Layout/SpaceBeforeComma:
|
|
||||||
Exclude:
|
|
||||||
- 'lib/tasks/data_demo.rake'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Layout/SpaceBeforeSemicolon:
|
|
||||||
Exclude:
|
|
||||||
- 'Guardfile'
|
|
||||||
|
|
||||||
# Offense count: 54
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SupportedStylesForEmptyBraces, SpaceBeforeBlockParameters.
|
|
||||||
# SupportedStyles: space, no_space
|
|
||||||
# SupportedStylesForEmptyBraces: space, no_space
|
|
||||||
Layout/SpaceInsideBlockBraces:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/admin/comments_controller.rb'
|
|
||||||
- 'app/controllers/admin/questions_controller.rb'
|
|
||||||
- 'app/helpers/application_helper.rb'
|
|
||||||
- 'app/models/program.rb'
|
|
||||||
- 'app/models/ticket.rb'
|
|
||||||
- 'app/models/user.rb'
|
|
||||||
- 'lib/tasks/events_registrations.rake'
|
|
||||||
- 'spec/controllers/admin/event_schedules_controller_spec.rb'
|
|
||||||
- 'spec/controllers/admin/schedules_controller_spec.rb'
|
|
||||||
- 'spec/features/splashpage_spec.rb'
|
|
||||||
- 'spec/models/ability_spec.rb'
|
|
||||||
- 'spec/models/user_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 19
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SupportedStylesForEmptyBraces.
|
|
||||||
# SupportedStyles: space, no_space, compact
|
|
||||||
# SupportedStylesForEmptyBraces: space, no_space
|
|
||||||
Layout/SpaceInsideHashLiteralBraces:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/admin/conferences_controller.rb'
|
|
||||||
- 'app/controllers/api/v1/speakers_controller.rb'
|
|
||||||
- 'app/models/conference.rb'
|
|
||||||
- 'app/models/event_type.rb'
|
|
||||||
- 'app/models/user.rb'
|
|
||||||
- 'spec/models/event_spec.rb'
|
|
||||||
- 'spec/models/payment_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Layout/SpaceInsidePercentLiteralDelimiters:
|
|
||||||
Exclude:
|
|
||||||
- 'Gemfile'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
||||||
# SupportedStyles: final_newline, final_blank_line
|
|
||||||
Layout/TrailingBlankLines:
|
|
||||||
Exclude:
|
|
||||||
- 'lib/tasks/event_attatchments.rake'
|
|
||||||
- 'lib/tasks/roles.rake'
|
|
||||||
|
|
||||||
# Offense count: 13
|
# Offense count: 13
|
||||||
Lint/AmbiguousBlockAssociation:
|
Lint/AmbiguousBlockAssociation:
|
||||||
|
|
@ -276,60 +50,34 @@ Lint/IneffectiveAccessModifier:
|
||||||
- 'app/models/commercial.rb'
|
- 'app/models/commercial.rb'
|
||||||
- 'app/models/conference.rb'
|
- 'app/models/conference.rb'
|
||||||
|
|
||||||
# Offense count: 2
|
# Offense count: 140
|
||||||
Lint/RescueWithoutErrorClass:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/users/omniauth_callbacks_controller.rb'
|
|
||||||
- 'lib/tasks/migrate_config.rake'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Lint/ScriptPermission:
|
|
||||||
Exclude:
|
|
||||||
- 'Guardfile'
|
|
||||||
- 'Rakefile'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
|
|
||||||
Lint/UnusedBlockArgument:
|
|
||||||
Exclude:
|
|
||||||
- 'lib/tasks/user.rake'
|
|
||||||
|
|
||||||
# Offense count: 136
|
|
||||||
Metrics/AbcSize:
|
Metrics/AbcSize:
|
||||||
Max: 98
|
Max: 94
|
||||||
|
|
||||||
# Offense count: 258
|
# Offense count: 310
|
||||||
# Configuration parameters: CountComments, ExcludedMethods.
|
# Configuration parameters: CountComments, ExcludedMethods.
|
||||||
Metrics/BlockLength:
|
Metrics/BlockLength:
|
||||||
Max: 471
|
Max: 1420
|
||||||
|
|
||||||
# Offense count: 28
|
# Offense count: 32
|
||||||
Metrics/CyclomaticComplexity:
|
Metrics/CyclomaticComplexity:
|
||||||
Max: 14
|
Max: 14
|
||||||
|
|
||||||
# Offense count: 2774
|
# Offense count: 136
|
||||||
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
|
||||||
# URISchemes: http, https
|
|
||||||
Metrics/LineLength:
|
|
||||||
Max: 619
|
|
||||||
|
|
||||||
# Offense count: 133
|
|
||||||
# Configuration parameters: CountComments.
|
# Configuration parameters: CountComments.
|
||||||
Metrics/MethodLength:
|
Metrics/MethodLength:
|
||||||
Max: 63
|
Max: 60
|
||||||
|
|
||||||
# Offense count: 4
|
# Offense count: 5
|
||||||
# Configuration parameters: CountComments.
|
# Configuration parameters: CountComments.
|
||||||
Metrics/ModuleLength:
|
Metrics/ModuleLength:
|
||||||
Max: 200
|
Max: 180
|
||||||
|
|
||||||
# Offense count: 20
|
# Offense count: 22
|
||||||
Metrics/PerceivedComplexity:
|
Metrics/PerceivedComplexity:
|
||||||
Max: 16
|
Max: 16
|
||||||
|
|
||||||
# Offense count: 20
|
# Offense count: 18
|
||||||
Naming/AccessorMethodName:
|
Naming/AccessorMethodName:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/application_controller.rb'
|
- 'app/controllers/application_controller.rb'
|
||||||
|
|
@ -367,44 +115,268 @@ Naming/PredicateName:
|
||||||
- 'app/models/contact.rb'
|
- 'app/models/contact.rb'
|
||||||
|
|
||||||
# Offense count: 2
|
# Offense count: 2
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
||||||
|
# AllowedNames: io, id, to
|
||||||
|
Naming/UncommunicativeMethodParamName:
|
||||||
|
Exclude:
|
||||||
|
- 'app/models/conference.rb'
|
||||||
|
|
||||||
|
# Offense count: 2
|
||||||
|
# Configuration parameters: EnforcedStyle.
|
||||||
# SupportedStyles: snake_case, normalcase, non_integer
|
# SupportedStyles: snake_case, normalcase, non_integer
|
||||||
Naming/VariableNumber:
|
Naming/VariableNumber:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/models/ticket_purchase_spec.rb'
|
- 'spec/models/ticket_purchase_spec.rb'
|
||||||
|
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
# Configuration parameters: EnforcedStyle, Include.
|
||||||
# SupportedStyles: is_a?, kind_of?
|
# SupportedStyles: action, filter
|
||||||
Style/ClassCheck:
|
# Include: app/controllers/**/*.rb
|
||||||
|
Rails/ActionFilter:
|
||||||
Exclude:
|
Exclude:
|
||||||
|
- 'app/controllers/users/omniauth_callbacks_controller.rb'
|
||||||
|
|
||||||
|
# Offense count: 103
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
Rails/ActiveRecordAliases:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# Offense count: 124
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
Rails/ApplicationRecord:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# Offense count: 11
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
# Configuration parameters: NilOrEmpty, NotPresent, UnlessPresent.
|
||||||
|
Rails/Blank:
|
||||||
|
Exclude:
|
||||||
|
- 'app/controllers/conferences_controller.rb'
|
||||||
|
- 'app/controllers/users/omniauth_callbacks_controller.rb'
|
||||||
|
- 'app/models/program.rb'
|
||||||
|
- 'app/models/user.rb'
|
||||||
|
- 'db/migrate/20160309182655_remove_dietary_choices_table.rb'
|
||||||
|
- 'spec/factories/event_schedule.rb'
|
||||||
|
|
||||||
|
# Offense count: 19
|
||||||
|
# Configuration parameters: Include.
|
||||||
|
# Include: db/migrate/*.rb
|
||||||
|
Rails/CreateTableWithTimestamps:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# Offense count: 126
|
||||||
|
# Configuration parameters: EnforcedStyle.
|
||||||
|
# SupportedStyles: strict, flexible
|
||||||
|
Rails/Date:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# Offense count: 3
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
# Configuration parameters: EnforceForPrefixed.
|
||||||
|
Rails/Delegate:
|
||||||
|
Exclude:
|
||||||
|
- 'app/models/event.rb'
|
||||||
|
- 'app/models/room.rb'
|
||||||
|
- 'app/models/track.rb'
|
||||||
|
|
||||||
|
# Offense count: 3
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
# Configuration parameters: Whitelist.
|
||||||
|
# Whitelist: find_by_sql
|
||||||
|
Rails/DynamicFindBy:
|
||||||
|
Exclude:
|
||||||
|
- 'app/controllers/admin/events_controller.rb'
|
||||||
|
- 'db/migrate/20140701123203_add_events_per_week_to_conference.rb'
|
||||||
|
|
||||||
|
# Offense count: 5
|
||||||
|
Rails/FilePath:
|
||||||
|
Exclude:
|
||||||
|
- 'app/pdfs/ticket_pdf.rb'
|
||||||
|
- 'spec/features/lodgings_spec.rb'
|
||||||
|
- 'spec/features/sponsor_spec.rb'
|
||||||
|
- 'spec/spec_helper.rb'
|
||||||
|
|
||||||
|
# Offense count: 7
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
# Configuration parameters: Include.
|
||||||
|
# Include: app/models/**/*.rb
|
||||||
|
Rails/FindBy:
|
||||||
|
Exclude:
|
||||||
|
- 'app/models/event.rb'
|
||||||
|
- 'app/models/openid.rb'
|
||||||
|
- 'app/models/ticket_purchase.rb'
|
||||||
|
- 'app/models/user.rb'
|
||||||
|
|
||||||
|
# Offense count: 6
|
||||||
|
# Configuration parameters: Include.
|
||||||
|
# Include: app/models/**/*.rb
|
||||||
|
Rails/HasAndBelongsToMany:
|
||||||
|
Exclude:
|
||||||
|
- 'app/models/conference.rb'
|
||||||
|
- 'app/models/qanswer.rb'
|
||||||
|
- 'app/models/question.rb'
|
||||||
|
- 'app/models/registration.rb'
|
||||||
|
- 'app/models/vchoice.rb'
|
||||||
|
|
||||||
|
# Offense count: 18
|
||||||
|
# Configuration parameters: Include.
|
||||||
|
# Include: app/models/**/*.rb
|
||||||
|
Rails/HasManyOrHasOneDependent:
|
||||||
|
Exclude:
|
||||||
|
- 'app/models/answer.rb'
|
||||||
|
- 'app/models/event.rb'
|
||||||
|
- 'app/models/payment.rb'
|
||||||
|
- 'app/models/physical_ticket.rb'
|
||||||
|
- 'app/models/question_type.rb'
|
||||||
|
- 'app/models/registration.rb'
|
||||||
|
- 'app/models/role.rb'
|
||||||
|
- 'app/models/room.rb'
|
||||||
|
- 'app/models/sponsorship_level.rb'
|
||||||
|
- 'app/models/ticket_purchase.rb'
|
||||||
|
- 'app/models/track.rb'
|
||||||
|
- 'app/models/user.rb'
|
||||||
|
- 'app/models/vday.rb'
|
||||||
|
- 'app/models/visit.rb'
|
||||||
|
- 'app/models/vposition.rb'
|
||||||
|
|
||||||
|
# Offense count: 254
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
# Configuration parameters: Include.
|
||||||
|
# Include: spec/**/*, test/**/*
|
||||||
|
Rails/HttpPositionalArguments:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# Offense count: 8
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
# Configuration parameters: EnforcedStyle.
|
||||||
|
# SupportedStyles: numeric, symbolic
|
||||||
|
Rails/HttpStatus:
|
||||||
|
Exclude:
|
||||||
|
- 'app/controllers/admin/commercials_controller.rb'
|
||||||
|
- 'app/controllers/admin/event_schedules_controller.rb'
|
||||||
|
- 'app/controllers/admin/programs_controller.rb'
|
||||||
|
- 'app/controllers/admin/tracks_controller.rb'
|
||||||
|
- 'app/controllers/admin/venue_commercials_controller.rb'
|
||||||
|
- 'app/controllers/commercials_controller.rb'
|
||||||
|
|
||||||
|
# Offense count: 14
|
||||||
|
# Configuration parameters: Include.
|
||||||
|
# Include: app/models/**/*.rb
|
||||||
|
Rails/InverseOf:
|
||||||
|
Exclude:
|
||||||
|
- 'app/models/booth.rb'
|
||||||
|
- 'app/models/conference.rb'
|
||||||
|
- 'app/models/event.rb'
|
||||||
|
- 'app/models/program.rb'
|
||||||
|
- 'app/models/track.rb'
|
||||||
|
- 'app/models/user.rb'
|
||||||
|
- 'app/models/venue.rb'
|
||||||
|
- 'app/models/visit.rb'
|
||||||
|
|
||||||
|
# Offense count: 1
|
||||||
|
# Configuration parameters: Include.
|
||||||
|
# Include: app/controllers/**/*.rb
|
||||||
|
Rails/LexicallyScopedActionFilter:
|
||||||
|
Exclude:
|
||||||
|
- 'app/controllers/registrations_controller.rb'
|
||||||
|
|
||||||
|
# Offense count: 4
|
||||||
|
Rails/OutputSafety:
|
||||||
|
Exclude:
|
||||||
|
- 'app/helpers/events_helper.rb'
|
||||||
|
- 'app/helpers/format_helper.rb'
|
||||||
|
- 'app/models/commercial.rb'
|
||||||
|
|
||||||
|
# Offense count: 15
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
Rails/PluralizationGrammar:
|
||||||
|
Exclude:
|
||||||
|
- 'spec/models/conference_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 5
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
Rails/Presence:
|
||||||
|
Exclude:
|
||||||
|
- 'app/controllers/schedules_controller.rb'
|
||||||
|
- 'app/helpers/application_helper.rb'
|
||||||
|
- 'app/models/user.rb'
|
||||||
|
- 'db/migrate/20140820124117_undo_wrong_migration20140801080705_add_users_to_events.rb'
|
||||||
|
|
||||||
|
# Offense count: 23
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
# Configuration parameters: NotNilAndNotEmpty, NotBlank, UnlessBlank.
|
||||||
|
Rails/Present:
|
||||||
|
Exclude:
|
||||||
|
- 'app/helpers/users_helper.rb'
|
||||||
|
- 'app/models/campaign.rb'
|
||||||
|
- 'app/models/cfp.rb'
|
||||||
- 'app/models/email_settings.rb'
|
- 'app/models/email_settings.rb'
|
||||||
|
- 'app/models/event.rb'
|
||||||
|
- 'app/models/program.rb'
|
||||||
|
- 'app/models/venue.rb'
|
||||||
|
- 'db/migrate/20141104131625_generate_username.rb'
|
||||||
|
|
||||||
|
# Offense count: 52
|
||||||
|
# Configuration parameters: Include.
|
||||||
|
# Include: db/migrate/*.rb
|
||||||
|
Rails/ReversibleMigration:
|
||||||
|
Exclude:
|
||||||
|
- 'db/migrate/20140530082708_remove_color_defaults.rb'
|
||||||
|
- 'db/migrate/20140605125153_update_event_states.rb'
|
||||||
|
- 'db/migrate/20140610173021_change_person_id_to_user_id_in_registrations.rb'
|
||||||
|
- 'db/migrate/20140611123926_change_person_id_to_user_id_in_votes.rb'
|
||||||
|
- 'db/migrate/20140623150541_drop_person_and_event_person_tables.rb'
|
||||||
|
- 'db/migrate/20140731165107_move_conference_contact_details_to_contact.rb'
|
||||||
|
- 'db/migrate/20140801164901_move_conference_media_to_commercial.rb'
|
||||||
|
- 'db/migrate/20140801170430_move_event_media_to_commercial.rb'
|
||||||
|
- 'db/migrate/20140820093735_migrating_supporter_registrations_to_ticket_users.rb'
|
||||||
|
- 'db/migrate/20140821103643_split_ticket_price_in_price_and_currency.rb'
|
||||||
|
- 'db/migrate/20140825093132_move_splashpage_attributes_from_conference_to_splashpage.rb'
|
||||||
|
- 'db/migrate/20140930092923_move_sponsor_email_to_contact.rb'
|
||||||
|
- 'db/migrate/20141117222919_drop_splash_descriptions_and_photo.rb'
|
||||||
|
- 'db/migrate/20141130182139_drop_table_event_attachments.rb'
|
||||||
|
|
||||||
|
# Offense count: 8
|
||||||
|
# Configuration parameters: Blacklist.
|
||||||
|
# Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters
|
||||||
|
Rails/SkipsModelValidations:
|
||||||
|
Exclude:
|
||||||
|
- 'app/models/concerns/revision_count.rb'
|
||||||
|
- 'db/migrate/20140730104658_migrate_roles_for_cancancan.rb'
|
||||||
|
- 'db/migrate/20161229080315_add_comments_count_to_events.rb'
|
||||||
|
- 'db/migrate/20180226032958_add_created_at_and_updated_at_to_event_types.rb'
|
||||||
|
- 'db/migrate/20180313012253_add_timestamps_to_tickets.rb'
|
||||||
|
- 'lib/tasks/user.rake'
|
||||||
|
- 'spec/controllers/conferences_controller_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 50
|
||||||
|
# Configuration parameters: EnforcedStyle.
|
||||||
|
# SupportedStyles: strict, flexible
|
||||||
|
Rails/TimeZone:
|
||||||
|
Exclude:
|
||||||
|
- 'app/models/comment.rb'
|
||||||
|
- 'app/models/conference.rb'
|
||||||
|
- 'db/migrate/20180226032958_add_created_at_and_updated_at_to_event_types.rb'
|
||||||
|
- 'db/migrate/20180313012253_add_timestamps_to_tickets.rb'
|
||||||
|
- 'lib/tasks/dump_db.rake'
|
||||||
|
- 'spec/controllers/admin/comments_controller_spec.rb'
|
||||||
|
- 'spec/controllers/admin/programs_controller_spec.rb'
|
||||||
|
- 'spec/factories/users.rb'
|
||||||
|
- 'spec/models/campaign_spec.rb'
|
||||||
|
- 'spec/models/conference_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 2
|
||||||
|
Security/Open:
|
||||||
|
Exclude:
|
||||||
|
- 'app/pdfs/ticket_pdf.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
Style/ClassVars:
|
Style/ClassVars:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/support/kneet_connections.rb'
|
- 'spec/support/kneet_connections.rb'
|
||||||
|
|
||||||
# Offense count: 2
|
# Offense count: 11
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Style/ColonMethodCall:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/commercial.rb'
|
|
||||||
- 'app/models/contact.rb'
|
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles, SingleLineConditionsOnly, IncludeTernaryExpressions.
|
|
||||||
# SupportedStyles: assign_to_condition, assign_inside_condition
|
|
||||||
Style/ConditionalAssignment:
|
|
||||||
Exclude:
|
|
||||||
- 'app/helpers/format_helper.rb'
|
|
||||||
- 'db/migrate/20140610165551_migrate_data_person_to_user.rb'
|
|
||||||
- 'db/migrate/20140820124117_undo_wrong_migration20140801080705_add_users_to_events.rb'
|
|
||||||
|
|
||||||
# Offense count: 9
|
|
||||||
Style/DateTime:
|
Style/DateTime:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/models/conference.rb'
|
- 'app/models/conference.rb'
|
||||||
|
|
@ -412,301 +384,66 @@ Style/DateTime:
|
||||||
- 'spec/models/conference_spec.rb'
|
- 'spec/models/conference_spec.rb'
|
||||||
- 'spec/models/program_spec.rb'
|
- 'spec/models/program_spec.rb'
|
||||||
|
|
||||||
# Offense count: 488
|
# Offense count: 495
|
||||||
Style/Documentation:
|
Style/Documentation:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# Offense count: 2
|
# Offense count: 20
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Style/EmptyCaseCondition:
|
|
||||||
Exclude:
|
|
||||||
- 'app/helpers/format_helper.rb'
|
|
||||||
- 'app/helpers/versions_helper.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Style/EmptyLiteral:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/models/conference_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 9
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
||||||
# SupportedStyles: compact, expanded
|
|
||||||
Style/EmptyMethod:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/admin/lodgings_controller.rb'
|
|
||||||
- 'app/controllers/admin/registration_periods_controller.rb'
|
|
||||||
- 'app/controllers/users_controller.rb'
|
|
||||||
- 'db/migrate/20121223115125_create_tracks_table.rb'
|
|
||||||
- 'db/migrate/20121223115135_create_events_table.rb'
|
|
||||||
- 'db/migrate/20130103134212_create_registrations_table.rb'
|
|
||||||
- 'db/migrate/20130206192339_rename_attending_social_events_with_partner.rb'
|
|
||||||
- 'db/migrate/20130216122155_set_registration_defaults_to_false.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Style/Encoding:
|
|
||||||
Exclude:
|
|
||||||
- 'app/uploaders/picture_uploader.rb'
|
|
||||||
- 'spec/models/conference_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 32
|
|
||||||
# Configuration parameters: MinBodyLength.
|
# Configuration parameters: MinBodyLength.
|
||||||
Style/GuardClause:
|
Style/GuardClause:
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 4
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
|
||||||
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
|
||||||
Style/HashSyntax:
|
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'Gemfile'
|
- 'app/controllers/admin/organizations_controller.rb'
|
||||||
- 'lib/tasks/user.rake'
|
|
||||||
|
|
||||||
# Offense count: 22
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: MaxLineLength.
|
|
||||||
Style/IfUnlessModifier:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/api/v1/events_controller.rb'
|
|
||||||
- 'app/controllers/conference_registrations_controller.rb'
|
- 'app/controllers/conference_registrations_controller.rb'
|
||||||
- 'app/controllers/users/omniauth_callbacks_controller.rb'
|
|
||||||
- 'app/helpers/application_helper.rb'
|
|
||||||
- 'app/models/commercial.rb'
|
|
||||||
- 'app/models/conference.rb'
|
|
||||||
- 'app/models/email_settings.rb'
|
|
||||||
- 'app/models/user.rb'
|
|
||||||
- 'db/migrate/20151031092713_change_conference_id_to_venue_id_in_rooms.rb'
|
|
||||||
- 'lib/tasks/events_registrations.rake'
|
|
||||||
- 'spec/controllers/admin/conferences_controller_spec.rb'
|
|
||||||
- 'spec/support/flash.rb'
|
|
||||||
|
|
||||||
# Offense count: 8
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Style/LineEndConcatenation:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/features/cfp_spec.rb'
|
|
||||||
- 'spec/features/conference_spec.rb'
|
|
||||||
- 'spec/features/registration_periods_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 9
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
||||||
# SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline
|
|
||||||
Style/MethodDefParentheses:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/conference.rb'
|
|
||||||
- 'app/models/user.rb'
|
|
||||||
- 'lib/tasks/demo_data_for_development.rake'
|
|
||||||
|
|
||||||
# Offense count: 7
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Style/MultilineIfModifier:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/conferences_controller.rb'
|
- 'app/controllers/conferences_controller.rb'
|
||||||
|
- 'app/controllers/registrations_controller.rb'
|
||||||
- 'app/controllers/schedules_controller.rb'
|
- 'app/controllers/schedules_controller.rb'
|
||||||
|
- 'app/helpers/events_helper.rb'
|
||||||
|
- 'app/models/ability.rb'
|
||||||
- 'app/models/cfp.rb'
|
- 'app/models/cfp.rb'
|
||||||
- 'app/models/event.rb'
|
- 'app/models/conference.rb'
|
||||||
|
- 'app/models/registration.rb'
|
||||||
- 'app/models/registration_period.rb'
|
- 'app/models/registration_period.rb'
|
||||||
|
- 'app/models/user.rb'
|
||||||
|
- 'db/migrate/20140820124117_undo_wrong_migration20140801080705_add_users_to_events.rb'
|
||||||
|
- 'lib/tasks/data.rake'
|
||||||
|
|
||||||
# Offense count: 2
|
# Offense count: 37
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
Style/MutableConstant:
|
Style/IfUnlessModifier:
|
||||||
Exclude:
|
|
||||||
- 'app/models/event_user.rb'
|
|
||||||
- 'lib/tasks/migrate_config.rake'
|
|
||||||
|
|
||||||
# Offense count: 4
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: Whitelist.
|
|
||||||
# Whitelist: be, be_a, be_an, be_between, be_falsey, be_kind_of, be_instance_of, be_truthy, be_within, eq, eql, end_with, include, match, raise_error, respond_to, start_with
|
|
||||||
Style/NestedParenthesizedCalls:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/features/conference_spec.rb'
|
|
||||||
- 'spec/models/conference_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 27
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
|
|
||||||
# SupportedStyles: skip_modifier_ifs, always
|
|
||||||
Style/Next:
|
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# Offense count: 117
|
# Offense count: 1
|
||||||
# Cop supports --auto-correct.
|
Style/MixinUsage:
|
||||||
# Configuration parameters: EnforcedOctalStyle, SupportedOctalStyles.
|
|
||||||
# SupportedOctalStyles: zero_with_o, zero_only
|
|
||||||
Style/NumericLiteralPrefix:
|
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/controllers/admin/conferences_controller_spec.rb'
|
- 'spec/spec_helper.rb'
|
||||||
- 'spec/controllers/conference_registration_controller_spec.rb'
|
|
||||||
- 'spec/helpers/date_time_helper_spec.rb'
|
|
||||||
- 'spec/models/conference_spec.rb'
|
|
||||||
- 'spec/models/email_settings_spec.rb'
|
|
||||||
- 'spec/models/registration_spec.rb'
|
|
||||||
- 'spec/serializers/conference_serializer_spec.rb'
|
|
||||||
- 'spec/serializers/event_serializer_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 7
|
# Offense count: 41
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: Strict.
|
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
||||||
Style/NumericLiterals:
|
|
||||||
MinDigits: 15
|
|
||||||
|
|
||||||
# Offense count: 7
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: AutoCorrect, EnforcedStyle, SupportedStyles.
|
|
||||||
# SupportedStyles: predicate, comparison
|
# SupportedStyles: predicate, comparison
|
||||||
Style/NumericPredicate:
|
Style/NumericPredicate:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/**/*'
|
- 'spec/**/*'
|
||||||
- 'app/controllers/admin/conferences_controller.rb'
|
- 'app/controllers/admin/conferences_controller.rb'
|
||||||
|
- 'app/helpers/application_helper.rb'
|
||||||
- 'app/helpers/date_time_helper.rb'
|
- 'app/helpers/date_time_helper.rb'
|
||||||
- 'app/helpers/format_helper.rb'
|
- 'app/helpers/format_helper.rb'
|
||||||
|
- 'app/models/cfp.rb'
|
||||||
|
- 'app/models/conference.rb'
|
||||||
|
- 'app/models/event.rb'
|
||||||
|
- 'app/models/program.rb'
|
||||||
|
- 'app/models/registration.rb'
|
||||||
|
- 'app/models/ticket_purchase.rb'
|
||||||
- 'app/models/user.rb'
|
- 'app/models/user.rb'
|
||||||
|
- 'lib/tasks/events_registrations.rake'
|
||||||
|
|
||||||
# Offense count: 3
|
# Offense count: 3
|
||||||
Style/OptionalArguments:
|
Style/OptionalArguments:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/models/event.rb'
|
- 'app/models/event.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 2835
|
||||||
# Cop supports --auto-correct.
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
||||||
Style/OrAssignment:
|
# URISchemes: http, https
|
||||||
Exclude:
|
Metrics/LineLength:
|
||||||
- 'app/controllers/schedules_controller.rb'
|
Max: 619
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: AllowSafeAssignment.
|
|
||||||
Style/ParenthesesAroundCondition:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/admin/base_controller.rb'
|
|
||||||
- 'app/controllers/application_controller.rb'
|
|
||||||
- 'app/helpers/format_helper.rb'
|
|
||||||
|
|
||||||
# Offense count: 15
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: PreferredDelimiters.
|
|
||||||
Style/PercentLiteralDelimiters:
|
|
||||||
Exclude:
|
|
||||||
- 'Gemfile'
|
|
||||||
- 'app/controllers/admin/users_controller.rb'
|
|
||||||
- 'app/models/cfp.rb'
|
|
||||||
- 'app/models/comment.rb'
|
|
||||||
- 'app/models/commercial.rb'
|
|
||||||
- 'app/models/conference.rb'
|
|
||||||
- 'app/models/contact.rb'
|
|
||||||
- 'app/models/registration.rb'
|
|
||||||
- 'app/models/subscription.rb'
|
|
||||||
- 'app/models/track.rb'
|
|
||||||
- 'app/uploaders/picture_uploader.rb'
|
|
||||||
- 'spec/models/program_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
||||||
# SupportedStyles: short, verbose
|
|
||||||
Style/PreferredHashMethods:
|
|
||||||
Exclude:
|
|
||||||
- 'lib/tasks/migrate_config.rake'
|
|
||||||
|
|
||||||
# Offense count: 6
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: SupportedStyles.
|
|
||||||
# SupportedStyles: compact, exploded
|
|
||||||
Style/RaiseArgs:
|
|
||||||
EnforcedStyle: compact
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Style/RedundantParentheses:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/admin/base_controller.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
|
|
||||||
# SupportedStyles: slashes, percent_r, mixed
|
|
||||||
Style/RegexpLiteral:
|
|
||||||
Exclude:
|
|
||||||
- 'Guardfile'
|
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
||||||
# SupportedStyles: only_raise, only_fail, semantic
|
|
||||||
Style/SignalException:
|
|
||||||
Exclude:
|
|
||||||
- 'lib/tasks/user.rake'
|
|
||||||
- 'spec/support/flash.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: AllowIfMethodIsEmpty.
|
|
||||||
Style/SingleLineMethods:
|
|
||||||
Exclude:
|
|
||||||
- 'Guardfile'
|
|
||||||
|
|
||||||
# Offense count: 16
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
|
|
||||||
# SupportedStyles: single_quotes, double_quotes
|
|
||||||
Style/StringLiterals:
|
|
||||||
Exclude:
|
|
||||||
- 'Gemfile'
|
|
||||||
- 'Vagrantfile'
|
|
||||||
- 'lib/tasks/dump_db.rake'
|
|
||||||
- 'lib/tasks/events_registrations.rake'
|
|
||||||
- 'lib/tasks/factory_girl.rake'
|
|
||||||
- 'lib/tasks/user.rake'
|
|
||||||
|
|
||||||
# Offense count: 6
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
||||||
# SupportedStyles: single_quotes, double_quotes
|
|
||||||
Style/StringLiteralsInInterpolation:
|
|
||||||
Exclude:
|
|
||||||
- 'lib/tasks/dump_db.rake'
|
|
||||||
|
|
||||||
# Offense count: 79
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, MinSize, SupportedStyles.
|
|
||||||
# SupportedStyles: percent, brackets
|
|
||||||
Style/SymbolArray:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 11
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: IgnoredMethods.
|
|
||||||
# IgnoredMethods: respond_to, define_method
|
|
||||||
Style/SymbolProc:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/admin/comments_controller.rb'
|
|
||||||
- 'app/controllers/admin/questions_controller.rb'
|
|
||||||
- 'app/helpers/application_helper.rb'
|
|
||||||
- 'app/models/ability.rb'
|
|
||||||
- 'app/models/admin_ability.rb'
|
|
||||||
- 'db/migrate/20140730104658_migrate_roles_for_cancancan.rb'
|
|
||||||
- 'spec/controllers/admin/conferences_controller_spec.rb'
|
|
||||||
- 'spec/support/flash.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowSafeAssignment.
|
|
||||||
# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex
|
|
||||||
Style/TernaryParentheses:
|
|
||||||
Exclude:
|
|
||||||
- 'app/helpers/format_helper.rb'
|
|
||||||
|
|
||||||
# Offense count: 23
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyleForMultiline, SupportedStylesForMultiline.
|
|
||||||
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
|
||||||
Style/TrailingCommaInLiteral:
|
|
||||||
Exclude:
|
|
||||||
- 'Guardfile'
|
|
||||||
- 'db/migrate/20140701123203_add_events_per_week_to_conference.rb'
|
|
||||||
- 'spec/models/conference_spec.rb'
|
|
||||||
|
|
|
||||||
14
Gemfile
14
Gemfile
|
|
@ -1,9 +1,9 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
# rails-assets requires >= 1.8.4
|
# rails-assets requires >= 1.8.4
|
||||||
if Gem::Version.new(Bundler::VERSION) < Gem::Version.new('1.8.4')
|
abort 'Bundler version >= 1.8.4 is required' if Gem::Version.new(Bundler::VERSION) < Gem::Version.new('1.8.4')
|
||||||
abort "Bundler version >= 1.8.4 is required"
|
|
||||||
end
|
|
||||||
|
|
||||||
# as web framework
|
# as web framework
|
||||||
gem 'rails', '~> 5.0.5'
|
gem 'rails', '~> 5.0.5'
|
||||||
|
|
@ -60,7 +60,7 @@ gem 'rolify'
|
||||||
gem 'unobtrusive_flash', '>=3'
|
gem 'unobtrusive_flash', '>=3'
|
||||||
|
|
||||||
# as state machine
|
# as state machine
|
||||||
gem 'transitions', :require => %w( transitions active_record/transitions )
|
gem 'transitions', require: %w[transitions active_record/transitions]
|
||||||
|
|
||||||
# for comments
|
# for comments
|
||||||
gem 'acts_as_commentable_with_threading'
|
gem 'acts_as_commentable_with_threading'
|
||||||
|
|
@ -164,7 +164,7 @@ gem 'piwik_analytics', '~> 1.0.1'
|
||||||
|
|
||||||
# for recurring jobs
|
# for recurring jobs
|
||||||
gem 'delayed_job_active_record'
|
gem 'delayed_job_active_record'
|
||||||
gem 'whenever', :require => false
|
gem 'whenever', require: false
|
||||||
|
|
||||||
# to run scripts
|
# to run scripts
|
||||||
gem 'daemons'
|
gem 'daemons'
|
||||||
|
|
@ -192,7 +192,7 @@ gem 'dotenv-rails'
|
||||||
gem 'feature'
|
gem 'feature'
|
||||||
|
|
||||||
# For countable.js
|
# For countable.js
|
||||||
gem "countable-rails", "~> 0.0.1"
|
gem 'countable-rails', '~> 0.0.1'
|
||||||
|
|
||||||
# Both are not in a group as we use it also for rake data:demo
|
# Both are not in a group as we use it also for rake data:demo
|
||||||
# for fake data
|
# for fake data
|
||||||
|
|
@ -244,7 +244,7 @@ group :test do
|
||||||
# as test framework
|
# as test framework
|
||||||
gem 'capybara'
|
gem 'capybara'
|
||||||
gem 'database_cleaner'
|
gem 'database_cleaner'
|
||||||
gem 'phantomjs', :require => 'phantomjs/poltergeist'
|
gem 'phantomjs', require: 'phantomjs/poltergeist'
|
||||||
gem 'poltergeist'
|
gem 'poltergeist'
|
||||||
gem 'rspec-rails', '~> 3.5', '>= 3.5.2'
|
gem 'rspec-rails', '~> 3.5', '>= 3.5.2'
|
||||||
# for measuring test coverage
|
# for measuring test coverage
|
||||||
|
|
|
||||||
18
Guardfile
Normal file → Executable file
18
Guardfile
Normal file → Executable file
|
|
@ -1,4 +1,6 @@
|
||||||
#!/usr/bin/ruby
|
#!/usr/bin/ruby
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
#
|
#
|
||||||
# More info at https://github.com/guard/guard#readme
|
# More info at https://github.com/guard/guard#readme
|
||||||
|
|
||||||
|
|
@ -8,7 +10,9 @@ guard_opts = {
|
||||||
cmd: 'spring rspec'
|
cmd: 'spring rspec'
|
||||||
}
|
}
|
||||||
|
|
||||||
def model_specs ; 'spec/models' end
|
def model_specs
|
||||||
|
'spec/models'
|
||||||
|
end
|
||||||
|
|
||||||
def model_spec(model)
|
def model_spec(model)
|
||||||
"spec/models/#{model}_spec.rb"
|
"spec/models/#{model}_spec.rb"
|
||||||
|
|
@ -19,19 +23,19 @@ def all_testunit_tests
|
||||||
model_tests,
|
model_tests,
|
||||||
controller_tests,
|
controller_tests,
|
||||||
helper_tests,
|
helper_tests,
|
||||||
integration_tests,
|
integration_tests
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
def all_specs
|
def all_specs
|
||||||
[
|
[
|
||||||
model_specs,
|
model_specs
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
def startup_guards
|
def startup_guards
|
||||||
watch(%r{^Gemfile$}) { yield }
|
watch(/^Gemfile$/) { yield }
|
||||||
watch(%r{^Gemfile.lock$}) { yield }
|
watch(/^Gemfile.lock$/) { yield }
|
||||||
watch(%r{^config/routes.rb$}) { yield }
|
watch(%r{^config/routes.rb$}) { yield }
|
||||||
watch(%r{^config/application\.rb$}) { yield }
|
watch(%r{^config/application\.rb$}) { yield }
|
||||||
watch(%r{^config/environment\.rb$}) { yield }
|
watch(%r{^config/environment\.rb$}) { yield }
|
||||||
|
|
@ -49,9 +53,9 @@ end
|
||||||
|
|
||||||
group :rspec do
|
group :rspec do
|
||||||
guard 'rspec', guard_opts do
|
guard 'rspec', guard_opts do
|
||||||
#startup_guards { all_specs }
|
# startup_guards { all_specs }
|
||||||
rspec_guards
|
rspec_guards
|
||||||
#all_specs
|
# all_specs
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
4
Rakefile
Normal file → Executable file
4
Rakefile
Normal file → Executable file
|
|
@ -1,7 +1,9 @@
|
||||||
#!/usr/bin/env rake
|
#!/usr/bin/env rake
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||||
|
|
||||||
require File.expand_path('../config/application', __FILE__)
|
require File.expand_path('config/application', __dir__)
|
||||||
|
|
||||||
Osem::Application.load_tasks
|
Osem::Application.load_tasks
|
||||||
|
|
|
||||||
10
Vagrantfile
vendored
10
Vagrantfile
vendored
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# -*- mode: ruby -*-
|
# -*- mode: ruby -*-
|
||||||
# vi: set ft=ruby :
|
# vi: set ft=ruby :
|
||||||
|
|
||||||
|
|
@ -12,7 +14,7 @@ Vagrant.configure(2) do |config|
|
||||||
|
|
||||||
# Every Vagrant development environment requires a box. You can search for
|
# Every Vagrant development environment requires a box. You can search for
|
||||||
# boxes at https://atlas.hashicorp.com/search.
|
# boxes at https://atlas.hashicorp.com/search.
|
||||||
config.vm.box = "opensuse/openSUSE-42.2-x86_64"
|
config.vm.box = 'opensuse/openSUSE-42.2-x86_64'
|
||||||
|
|
||||||
# Disable automatic box update checking. If you disable this, then
|
# Disable automatic box update checking. If you disable this, then
|
||||||
# boxes will only be checked for updates when the user runs
|
# boxes will only be checked for updates when the user runs
|
||||||
|
|
@ -22,7 +24,7 @@ Vagrant.configure(2) do |config|
|
||||||
# Create a forwarded port mapping which allows access to a specific port
|
# Create a forwarded port mapping which allows access to a specific port
|
||||||
# within the machine from a port on the host machine. In the example below,
|
# within the machine from a port on the host machine. In the example below,
|
||||||
# accessing "localhost:8080" will access port 80 on the guest machine.
|
# accessing "localhost:8080" will access port 80 on the guest machine.
|
||||||
config.vm.network "forwarded_port", guest: 3000, host: 3000
|
config.vm.network 'forwarded_port', guest: 3000, host: 3000
|
||||||
|
|
||||||
# Create a private network, which allows host-only access to the machine
|
# Create a private network, which allows host-only access to the machine
|
||||||
# using a specific IP.
|
# using a specific IP.
|
||||||
|
|
@ -47,7 +49,7 @@ Vagrant.configure(2) do |config|
|
||||||
# mount without working about the group mismatch
|
# mount without working about the group mismatch
|
||||||
VAGRANT_UID = 1000 # User vagrant
|
VAGRANT_UID = 1000 # User vagrant
|
||||||
VAGRANT_GID = 100 # Group users
|
VAGRANT_GID = 100 # Group users
|
||||||
config.vm.synced_folder ".", "/vagrant",
|
config.vm.synced_folder '.', '/vagrant',
|
||||||
owner: VAGRANT_UID, group: VAGRANT_GID
|
owner: VAGRANT_UID, group: VAGRANT_GID
|
||||||
|
|
||||||
# Provider-specific configuration so you can fine-tune various
|
# Provider-specific configuration so you can fine-tune various
|
||||||
|
|
@ -75,7 +77,7 @@ Vagrant.configure(2) do |config|
|
||||||
# Enable provisioning with a shell script. Additional provisioners such as
|
# Enable provisioning with a shell script. Additional provisioners such as
|
||||||
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
|
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
|
||||||
# documentation for more information about their specific syntax and use.
|
# documentation for more information about their specific syntax and use.
|
||||||
config.vm.provision :shell, path: "bootstrap.sh"
|
config.vm.provision :shell, path: 'bootstrap.sh'
|
||||||
# config.vm.provision "shell", inline: <<-SHELL
|
# config.vm.provision "shell", inline: <<-SHELL
|
||||||
# sudo apt-get update
|
# sudo apt-get update
|
||||||
# sudo apt-get install -y apache2
|
# sudo apt-get install -y apache2
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class BaseController < ApplicationController
|
class BaseController < ApplicationController
|
||||||
before_action :verify_user_admin
|
before_action :verify_user_admin
|
||||||
|
|
@ -9,7 +11,7 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def verify_user_admin
|
def verify_user_admin
|
||||||
if (current_user.nil?)
|
if current_user.nil?
|
||||||
redirect_to sign_in_path
|
redirect_to sign_in_path
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
@ -17,7 +19,7 @@ module Admin
|
||||||
(current_user.has_cached_role? :info_desk, :any) || (current_user.has_cached_role? :organization_admin, :any) ||
|
(current_user.has_cached_role? :info_desk, :any) || (current_user.has_cached_role? :organization_admin, :any) ||
|
||||||
(current_user.has_cached_role? :volunteers_coordinator, :any) ||
|
(current_user.has_cached_role? :volunteers_coordinator, :any) ||
|
||||||
(current_user.has_cached_role? :track_organizer, :any) || current_user.is_admin
|
(current_user.has_cached_role? :track_organizer, :any) || current_user.is_admin
|
||||||
raise CanCan::AccessDenied.new('You are not authorized to access this page.')
|
raise CanCan::AccessDenied, 'You are not authorized to access this page.'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class BoothsController < Admin::BaseController
|
class BoothsController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
|
@ -51,7 +53,7 @@ module Admin
|
||||||
def update
|
def update
|
||||||
@url = admin_conference_booth_path(@conference.short_title, @booth.id)
|
@url = admin_conference_booth_path(@conference.short_title, @booth.id)
|
||||||
|
|
||||||
@booth.update_attributes(booth_params)
|
@booth.update(booth_params)
|
||||||
|
|
||||||
if @booth.save
|
if @booth.save
|
||||||
redirect_to admin_conference_booths_path,
|
redirect_to admin_conference_booths_path,
|
||||||
|
|
@ -67,9 +69,7 @@ module Admin
|
||||||
@booth.accept!
|
@booth.accept!
|
||||||
|
|
||||||
if @booth.save
|
if @booth.save
|
||||||
if @conference.email_settings.send_on_booths_acceptance
|
Mailbot.conference_booths_acceptance_mail(@booth).deliver if @conference.email_settings.send_on_booths_acceptance
|
||||||
Mailbot.conference_booths_acceptance_mail(@booth).deliver
|
|
||||||
end
|
|
||||||
redirect_to admin_conference_booths_path(conference_id: @conference.short_title),
|
redirect_to admin_conference_booths_path(conference_id: @conference.short_title),
|
||||||
notice: 'Booth successfully accepted!'
|
notice: 'Booth successfully accepted!'
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class CampaignsController < Admin::BaseController
|
class CampaignsController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
|
@ -25,7 +27,7 @@ module Admin
|
||||||
def edit; end
|
def edit; end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @campaign.update_attributes(campaign_params)
|
if @campaign.update(campaign_params)
|
||||||
redirect_to admin_conference_campaigns_path(conference_id: @conference.short_title),
|
redirect_to admin_conference_campaigns_path(conference_id: @conference.short_title),
|
||||||
notice: "Campaign '#{@campaign.name}' successfully updated."
|
notice: "Campaign '#{@campaign.name}' successfully updated."
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class CfpsController < Admin::BaseController
|
class CfpsController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
|
@ -33,7 +35,7 @@ module Admin
|
||||||
|
|
||||||
send_mail_on_cfp_dates_updates = @cfp.notify_on_cfp_date_update?
|
send_mail_on_cfp_dates_updates = @cfp.notify_on_cfp_date_update?
|
||||||
|
|
||||||
if @cfp.update_attributes(cfp_params)
|
if @cfp.update(cfp_params)
|
||||||
ConferenceCfpUpdateMailJob.perform_later(@conference) if send_mail_on_cfp_dates_updates
|
ConferenceCfpUpdateMailJob.perform_later(@conference) if send_mail_on_cfp_dates_updates
|
||||||
redirect_to admin_conference_program_cfps_path(@conference.short_title),
|
redirect_to admin_conference_program_cfps_path(@conference.short_title),
|
||||||
notice: 'Call for papers successfully updated.'
|
notice: 'Call for papers successfully updated.'
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class CommentsController < Admin::BaseController
|
class CommentsController < Admin::BaseController
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
|
|
@ -20,9 +22,9 @@ module Admin
|
||||||
Comment.accessible_by(current_ability).joins('INNER JOIN events ON commentable_id = events.id').order('events.title', 'comments.created_at DESC')
|
Comment.accessible_by(current_ability).joins('INNER JOIN events ON commentable_id = events.id').order('events.title', 'comments.created_at DESC')
|
||||||
end
|
end
|
||||||
|
|
||||||
# Grouping all comments by conference, and by event. It returns {:conference => {:event => [{comment_2}, {comment_1 }]}}
|
# Grouping all comments by conference, and by event. It returns {:conference => {:event => [{comment_2}, {comment_1 }]}}
|
||||||
def grouped_comments(remarks)
|
def grouped_comments(remarks)
|
||||||
remarks.group_by{ |comment| comment.commentable.program.conference }.map {|conference, comments| [conference, comments.group_by{|comment| comment.commentable}]}.to_h
|
remarks.group_by { |comment| comment.commentable.program.conference }.map { |conference, comments| [conference, comments.group_by(&:commentable)] }.to_h
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class CommercialsController < Admin::BaseController
|
class CommercialsController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
load_and_authorize_resource through: :conference, except: [:new, :create]
|
load_and_authorize_resource through: :conference, except: %i[new create]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@commercials = @conference.commercials
|
@commercials = @conference.commercials
|
||||||
|
|
@ -43,7 +45,7 @@ module Admin
|
||||||
def render_commercial
|
def render_commercial
|
||||||
result = Commercial.render_from_url(params[:url])
|
result = Commercial.render_from_url(params[:url])
|
||||||
if result[:error]
|
if result[:error]
|
||||||
render text: result[:error], status: 400
|
render text: result[:error], status: :bad_request
|
||||||
else
|
else
|
||||||
render text: result[:html]
|
render text: result[:html]
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class ConferencesController < Admin::BaseController
|
class ConferencesController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
|
@ -99,7 +101,7 @@ module Admin
|
||||||
@conference.assign_attributes(conference_params)
|
@conference.assign_attributes(conference_params)
|
||||||
send_mail_on_conf_update = @conference.notify_on_dates_changed?
|
send_mail_on_conf_update = @conference.notify_on_dates_changed?
|
||||||
|
|
||||||
if @conference.update_attributes(conference_params)
|
if @conference.update(conference_params)
|
||||||
ConferenceDateUpdateMailJob.perform_later(@conference) if send_mail_on_conf_update
|
ConferenceDateUpdateMailJob.perform_later(@conference) if send_mail_on_conf_update
|
||||||
redirect_to edit_admin_conference_path(id: @conference.short_title),
|
redirect_to edit_admin_conference_path(id: @conference.short_title),
|
||||||
notice: 'Conference was successfully updated.'
|
notice: 'Conference was successfully updated.'
|
||||||
|
|
@ -136,7 +138,7 @@ module Admin
|
||||||
@conference_progress = @conference.get_status
|
@conference_progress = @conference.get_status
|
||||||
|
|
||||||
# Line charts
|
# Line charts
|
||||||
@registrations = {@conference.short_title => @conference.get_registrations_per_week}
|
@registrations = { @conference.short_title => @conference.get_registrations_per_week }
|
||||||
@registration_weeks = [0]
|
@registration_weeks = [0]
|
||||||
@registration_weeks.push(@registrations[@conference.short_title].length)
|
@registration_weeks.push(@registrations[@conference.short_title].length)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class ContactsController < Admin::BaseController
|
class ContactsController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class DifficultyLevelsController < Admin::BaseController
|
class DifficultyLevelsController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
|
@ -5,7 +7,7 @@ module Admin
|
||||||
load_and_authorize_resource through: :program
|
load_and_authorize_resource through: :program
|
||||||
|
|
||||||
def index
|
def index
|
||||||
# authorize! :index, DifficultyLevel.new(program_id: @program.id)
|
# authorize! :index, DifficultyLevel.new(program_id: @program.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit; end
|
def edit; end
|
||||||
|
|
@ -26,7 +28,7 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @difficulty_level.update_attributes(difficulty_level_params)
|
if @difficulty_level.update(difficulty_level_params)
|
||||||
redirect_to admin_conference_program_difficulty_levels_path(conference_id: @conference.short_title),
|
redirect_to admin_conference_program_difficulty_levels_path(conference_id: @conference.short_title),
|
||||||
notice: 'Difficulty level successfully updated.'
|
notice: 'Difficulty level successfully updated.'
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class EmailsController < Admin::BaseController
|
class EmailsController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
|
@ -6,11 +8,13 @@ module Admin
|
||||||
def update
|
def update
|
||||||
if @conference.email_settings.update(email_params)
|
if @conference.email_settings.update(email_params)
|
||||||
redirect_to admin_conference_emails_path(
|
redirect_to admin_conference_emails_path(
|
||||||
@conference.short_title),
|
@conference.short_title
|
||||||
|
),
|
||||||
notice: 'Email settings have been successfully updated.'
|
notice: 'Email settings have been successfully updated.'
|
||||||
else
|
else
|
||||||
redirect_to admin_conference_emails_path(
|
redirect_to admin_conference_emails_path(
|
||||||
@conference.short_title),
|
@conference.short_title
|
||||||
|
),
|
||||||
error: "Updating email settings failed. #{@conference.email_settings.errors.to_a.join('. ')}."
|
error: "Updating email settings failed. #{@conference.email_settings.errors.to_a.join('. ')}."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class EventSchedulesController < Admin::BaseController
|
class EventSchedulesController < Admin::BaseController
|
||||||
load_and_authorize_resource :event_schedule
|
load_and_authorize_resource :event_schedule
|
||||||
|
|
@ -6,7 +8,7 @@ module Admin
|
||||||
if @event_schedule.save
|
if @event_schedule.save
|
||||||
render json: { event_schedule_id: @event_schedule.id }
|
render json: { event_schedule_id: @event_schedule.id }
|
||||||
else
|
else
|
||||||
render json: { errors: "The event couldn't be scheduled. #{@event_schedule.errors.full_messages.join('. ')}" }, status: 422
|
render json: { errors: "The event couldn't be scheduled. #{@event_schedule.errors.full_messages.join('. ')}" }, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -14,7 +16,7 @@ module Admin
|
||||||
if @event_schedule.update(event_schedule_params)
|
if @event_schedule.update(event_schedule_params)
|
||||||
render json: { event_schedule_id: @event_schedule.id }
|
render json: { event_schedule_id: @event_schedule.id }
|
||||||
else
|
else
|
||||||
render json: { errors: "The event couldn't be scheduled. #{@event_schedule.errors.full_messages.join('. ')}" }, status: 422
|
render json: { errors: "The event couldn't be scheduled. #{@event_schedule.errors.full_messages.join('. ')}" }, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -22,7 +24,7 @@ module Admin
|
||||||
if @event_schedule.destroy
|
if @event_schedule.destroy
|
||||||
render json: {}
|
render json: {}
|
||||||
else
|
else
|
||||||
render json: { errors: "The event couldn't be unscheduled. #{@event_schedule.errors.full_messages.join('. ')}" }, status: 422
|
render json: { errors: "The event couldn't be unscheduled. #{@event_schedule.errors.full_messages.join('. ')}" }, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class EventTypesController < Admin::BaseController
|
class EventTypesController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
|
@ -24,7 +26,7 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @event_type.update_attributes(event_type_params)
|
if @event_type.update(event_type_params)
|
||||||
redirect_to admin_conference_program_event_types_path(conference_id: @conference.short_title),
|
redirect_to admin_conference_program_event_types_path(conference_id: @conference.short_title),
|
||||||
notice: 'Event type successfully updated.'
|
notice: 'Event type successfully updated.'
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class EventsController < Admin::BaseController
|
class EventsController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
|
@ -7,7 +9,7 @@ module Admin
|
||||||
# For some reason this doesn't work, so a workaround is used
|
# For some reason this doesn't work, so a workaround is used
|
||||||
# load_and_authorize_resource :track, through: :program, only: [:index, :show, :edit]
|
# load_and_authorize_resource :track, through: :program, only: [:index, :show, :edit]
|
||||||
|
|
||||||
before_action :assign_tracks, only: [:index, :show, :edit]
|
before_action :assign_tracks, only: %i[index show edit]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@difficulty_levels = @program.difficulty_levels
|
@difficulty_levels = @program.difficulty_levels
|
||||||
|
|
@ -17,7 +19,7 @@ module Admin
|
||||||
@scheduled_event_distribution = @conference.scheduled_event_distribution
|
@scheduled_event_distribution = @conference.scheduled_event_distribution
|
||||||
@file_name = "events_for_#{@conference.short_title}"
|
@file_name = "events_for_#{@conference.short_title}"
|
||||||
@event_export_option = params[:event_export_option]
|
@event_export_option = params[:event_export_option]
|
||||||
@export_formats = [:pdf, :csv, :xlsx]
|
@export_formats = %i[pdf csv xlsx]
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
|
|
@ -69,7 +71,7 @@ module Admin
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@languages = @program.languages_list
|
@languages = @program.languages_list
|
||||||
if @event.update_attributes(event_params)
|
if @event.update(event_params)
|
||||||
|
|
||||||
if request.xhr?
|
if request.xhr?
|
||||||
render js: 'index'
|
render js: 'index'
|
||||||
|
|
@ -139,8 +141,8 @@ module Admin
|
||||||
def vote
|
def vote
|
||||||
@votes = @event.votes.includes(:user)
|
@votes = @event.votes.includes(:user)
|
||||||
|
|
||||||
if (votes = current_user.votes.find_by_event_id(params[:id]))
|
if (votes = current_user.votes.find_by(event_id: params[:id]))
|
||||||
votes.update_attributes(rating: params[:rating])
|
votes.update(rating: params[:rating])
|
||||||
else
|
else
|
||||||
@myvote = @event.votes.build
|
@myvote = @event.votes.build
|
||||||
@myvote.user = current_user
|
@myvote.user = current_user
|
||||||
|
|
@ -178,7 +180,8 @@ module Admin
|
||||||
:track_id, :state, :language, :is_highlight, :max_attendees,
|
:track_id, :state, :language, :is_highlight, :max_attendees,
|
||||||
# Not used anymore?
|
# Not used anymore?
|
||||||
:proposal_additional_speakers, :user, :users_attributes,
|
:proposal_additional_speakers, :user, :users_attributes,
|
||||||
speaker_ids: [])
|
speaker_ids: []
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def comment_params
|
def comment_params
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class LodgingsController < Admin::BaseController
|
class LodgingsController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
load_and_authorize_resource :lodging, through: :conference
|
load_and_authorize_resource :lodging, through: :conference
|
||||||
|
|
||||||
def index
|
def index; end
|
||||||
end
|
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@lodging = @conference.lodgings.new
|
@lodging = @conference.lodgings.new
|
||||||
|
|
@ -24,7 +25,7 @@ module Admin
|
||||||
def edit; end
|
def edit; end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @lodging.update_attributes(lodging_params)
|
if @lodging.update(lodging_params)
|
||||||
redirect_to admin_conference_lodgings_path(conference_id: @conference.short_title),
|
redirect_to admin_conference_lodgings_path(conference_id: @conference.short_title),
|
||||||
notice: 'Lodging successfully updated.'
|
notice: 'Lodging successfully updated.'
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class OrganizationsController < Admin::BaseController
|
class OrganizationsController < Admin::BaseController
|
||||||
load_and_authorize_resource :organization
|
load_and_authorize_resource :organization
|
||||||
before_action :verify_user, only: [:assign_org_admins, :unassign_org_admins]
|
before_action :verify_user, only: %i[assign_org_admins unassign_org_admins]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@organizations = Organization.all
|
@organizations = Organization.all
|
||||||
|
|
@ -25,7 +27,7 @@ module Admin
|
||||||
def edit; end
|
def edit; end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @organization.update_attributes(organization_params)
|
if @organization.update(organization_params)
|
||||||
redirect_to admin_organizations_path,
|
redirect_to admin_organizations_path,
|
||||||
notice: 'Organization successfully updated'
|
notice: 'Organization successfully updated'
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class PhysicalTicketsController < Admin::BaseController
|
class PhysicalTicketsController < Admin::BaseController
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class ProgramsController < Admin::BaseController
|
class ProgramsController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
|
@ -14,7 +16,7 @@ module Admin
|
||||||
send_mail_on_schedule_public = @program.notify_on_schedule_public?
|
send_mail_on_schedule_public = @program.notify_on_schedule_public?
|
||||||
event_schedules_count_was = @program.event_schedules.count
|
event_schedules_count_was = @program.event_schedules.count
|
||||||
|
|
||||||
if @program.update_attributes(program_params)
|
if @program.update(program_params)
|
||||||
ConferenceScheduleUpdateMailJob.perform_later(@conference) if send_mail_on_schedule_public
|
ConferenceScheduleUpdateMailJob.perform_later(@conference) if send_mail_on_schedule_public
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html do
|
format.html do
|
||||||
|
|
@ -30,7 +32,7 @@ module Admin
|
||||||
flash.now[:error] = "Updating program failed. #{@program.errors.to_a.join('. ')}."
|
flash.now[:error] = "Updating program failed. #{@program.errors.to_a.join('. ')}."
|
||||||
render :new
|
render :new
|
||||||
end
|
end
|
||||||
format.js { render json: { errors: "The selected schedule couldn't be updated #{@program.errors.to_a.join('. ')}" }, status: 422 }
|
format.js { render json: { errors: "The selected schedule couldn't be updated #{@program.errors.to_a.join('. ')}" }, status: :unprocessable_entity }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class QuestionsController < Admin::BaseController
|
class QuestionsController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
load_and_authorize_resource through: :conference, except: [:new, :create]
|
load_and_authorize_resource through: :conference, except: %i[new create]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
authorize! :index, Question.new(conference_id: @conference.id)
|
authorize! :index, Question.new(conference_id: @conference.id)
|
||||||
|
|
@ -24,9 +26,7 @@ module Admin
|
||||||
@question.conference_id = @conference.id
|
@question.conference_id = @conference.id
|
||||||
authorize! :create, @question
|
authorize! :create, @question
|
||||||
|
|
||||||
if @question.question_type_id == QuestionType.find_by(title: 'Yes/No').id
|
@question.answers = [Answer.find_by(title: 'Yes'), Answer.find_by(title: 'No')] if @question.question_type_id == QuestionType.find_by(title: 'Yes/No').id
|
||||||
@question.answers = [Answer.find_by(title: 'Yes'), Answer.find_by(title: 'No')]
|
|
||||||
end
|
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @conference.save
|
if @conference.save
|
||||||
|
|
@ -39,14 +39,12 @@ module Admin
|
||||||
|
|
||||||
# GET questions/1/edit
|
# GET questions/1/edit
|
||||||
def edit
|
def edit
|
||||||
if @question.global
|
redirect_to admin_conference_questions_path(conference_id: @conference.short_title), error: 'Sorry, you cannot edit global questions. Create a new one.' if @question.global
|
||||||
redirect_to admin_conference_questions_path(conference_id: @conference.short_title), error: 'Sorry, you cannot edit global questions. Create a new one.'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# PUT questions/1
|
# PUT questions/1
|
||||||
def update
|
def update
|
||||||
if @question.update_attributes(question_params)
|
if @question.update(question_params)
|
||||||
redirect_to admin_conference_questions_path(conference_id: @conference.short_title), notice: "Question '#{@question.title}' for #{@conference.short_title} successfully updated."
|
redirect_to admin_conference_questions_path(conference_id: @conference.short_title), notice: "Question '#{@question.title}' for #{@conference.short_title} successfully updated."
|
||||||
else
|
else
|
||||||
redirect_to admin_conference_questions_path(conference_id: @conference.short_title), notice: "Update of questions for #{@conference.short_title} failed. #{@question.errors.full_messages.join('. ')}"
|
redirect_to admin_conference_questions_path(conference_id: @conference.short_title), notice: "Update of questions for #{@conference.short_title} failed. #{@question.errors.full_messages.join('. ')}"
|
||||||
|
|
@ -56,7 +54,7 @@ module Admin
|
||||||
# Update questions used for the conference
|
# Update questions used for the conference
|
||||||
def update_conference
|
def update_conference
|
||||||
authorize! :update, Question.new(conference_id: @conference.id)
|
authorize! :update, Question.new(conference_id: @conference.id)
|
||||||
if @conference.update_attributes(conference_params)
|
if @conference.update(conference_params)
|
||||||
redirect_to admin_conference_questions_path(conference_id: @conference.short_title), notice: "Questions for #{@conference.short_title} successfully updated."
|
redirect_to admin_conference_questions_path(conference_id: @conference.short_title), notice: "Questions for #{@conference.short_title} successfully updated."
|
||||||
else
|
else
|
||||||
redirect_to admin_conference_questions_path(conference_id: @conference.short_title), notice: "Update of questions for #{@conference.short_title} failed."
|
redirect_to admin_conference_questions_path(conference_id: @conference.short_title), notice: "Update of questions for #{@conference.short_title} failed."
|
||||||
|
|
@ -73,12 +71,9 @@ module Admin
|
||||||
# Delete question and its answers
|
# Delete question and its answers
|
||||||
begin
|
begin
|
||||||
Question.transaction do
|
Question.transaction do
|
||||||
|
|
||||||
@question.destroy
|
@question.destroy
|
||||||
@question.answers.each do |a|
|
@question.answers.each(&:destroy)
|
||||||
a.destroy
|
flash[:notice] = "Deleted question: #{@question.title} and its answers: #{@question.answers.map(&:title).join ','}"
|
||||||
end
|
|
||||||
flash[:notice] = "Deleted question: #{@question.title} and its answers: #{@question.answers.map {|a| a.title}.join ','}"
|
|
||||||
end
|
end
|
||||||
rescue ActiveRecord::RecordInvalid
|
rescue ActiveRecord::RecordInvalid
|
||||||
flash[:error] = 'Could not delete question.'
|
flash[:error] = 'Could not delete question.'
|
||||||
|
|
@ -95,7 +90,7 @@ module Admin
|
||||||
private
|
private
|
||||||
|
|
||||||
def question_params
|
def question_params
|
||||||
params.require(:question).permit(:title, :global, :answer_ids, :question_type_id, :conference_id, answers_attributes: [:id, :title])
|
params.require(:question).permit(:title, :global, :answer_ids, :question_type_id, :conference_id, answers_attributes: %i[id title])
|
||||||
end
|
end
|
||||||
|
|
||||||
def conference_params
|
def conference_params
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class RegistrationPeriodsController < Admin::BaseController
|
class RegistrationPeriodsController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
|
@ -21,11 +23,9 @@ module Admin
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit; end
|
||||||
end
|
|
||||||
|
|
||||||
def show
|
def show; end
|
||||||
end
|
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@registration_period.assign_attributes(registration_period_params)
|
@registration_period.assign_attributes(registration_period_params)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class RegistrationsController < Admin::BaseController
|
class RegistrationsController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
|
@ -17,9 +19,9 @@ module Admin
|
||||||
def edit; end
|
def edit; end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@user.update_attributes(user_params)
|
@user.update(user_params)
|
||||||
|
|
||||||
@registration.update_attributes(registration_params)
|
@registration.update(registration_params)
|
||||||
if @registration.save
|
if @registration.save
|
||||||
redirect_to admin_conference_registrations_path(@conference.short_title),
|
redirect_to admin_conference_registrations_path(@conference.short_title),
|
||||||
notice: "Successfully updated registration for #{@registration.user.email}!"
|
notice: "Successfully updated registration for #{@registration.user.email}!"
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class ReportsController < Admin::BaseController
|
class ReportsController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class ResourcesController < Admin::BaseController
|
class ResourcesController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
load_and_authorize_resource :resource, only: [:show, :edit, :update, :destroy]
|
load_and_authorize_resource :resource, only: %i[show edit update destroy]
|
||||||
|
|
||||||
def index; end
|
def index; end
|
||||||
|
|
||||||
|
|
@ -23,7 +25,7 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @resource.update_attributes(resource_params)
|
if @resource.update(resource_params)
|
||||||
redirect_to admin_conference_resources_path(conference_id: @conference.short_title),
|
redirect_to admin_conference_resources_path(conference_id: @conference.short_title),
|
||||||
notice: 'Resource successfully updated.'
|
notice: 'Resource successfully updated.'
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class RolesController < Admin::BaseController
|
class RolesController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
|
@ -34,7 +36,7 @@ module Admin
|
||||||
def update
|
def update
|
||||||
role_name = @role.name
|
role_name = @role.name
|
||||||
|
|
||||||
if @role.update_attributes(role_params)
|
if @role.update(role_params)
|
||||||
url = if @track
|
url = if @track
|
||||||
admin_conference_program_track_role_path(@conference.short_title, @track, @role.name)
|
admin_conference_program_track_role_path(@conference.short_title, @track, @role.name)
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class RoomsController < Admin::BaseController
|
class RoomsController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
|
@ -24,7 +26,7 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @room.update_attributes(room_params)
|
if @room.update(room_params)
|
||||||
redirect_to admin_conference_venue_rooms_path(conference_id: @conference.short_title),
|
redirect_to admin_conference_venue_rooms_path(conference_id: @conference.short_title),
|
||||||
notice: 'Room successfully updated.'
|
notice: 'Room successfully updated.'
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class SchedulesController < Admin::BaseController
|
class SchedulesController < Admin::BaseController
|
||||||
# By authorizing 'conference' resource, we can ensure there will be no unauthorized access to
|
# By authorizing 'conference' resource, we can ensure there will be no unauthorized access to
|
||||||
# the schedule of a conference, which should not be accessed in the first place
|
# the schedule of a conference, which should not be accessed in the first place
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
load_and_authorize_resource :program, through: :conference, singleton: true
|
load_and_authorize_resource :program, through: :conference, singleton: true
|
||||||
load_and_authorize_resource :schedule, through: :program, except: [:new, :create]
|
load_and_authorize_resource :schedule, through: :program, except: %i[new create]
|
||||||
load_resource :event_schedules, through: :schedule
|
load_resource :event_schedules, through: :schedule
|
||||||
load_resource :selected_schedule, through: :program, singleton: true
|
load_resource :selected_schedule, through: :program, singleton: true
|
||||||
load_resource :venue, through: :conference, singleton: true
|
load_resource :venue, through: :conference, singleton: true
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class SplashpagesController < Admin::BaseController
|
class SplashpagesController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
|
@ -23,7 +25,7 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @splashpage.update_attributes(splashpage_params)
|
if @splashpage.update(splashpage_params)
|
||||||
redirect_to admin_conference_splashpage_path,
|
redirect_to admin_conference_splashpage_path,
|
||||||
notice: 'Splashpage successfully updated.'
|
notice: 'Splashpage successfully updated.'
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class SponsorsController < Admin::BaseController
|
class SponsorsController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
load_and_authorize_resource :sponsor, through: :conference
|
load_and_authorize_resource :sponsor, through: :conference
|
||||||
before_action :sponsorship_level_required, only: [:index, :new]
|
before_action :sponsorship_level_required, only: %i[index new]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
authorize! :index, Sponsor.new(conference_id: @conference.id)
|
authorize! :index, Sponsor.new(conference_id: @conference.id)
|
||||||
|
|
@ -26,9 +28,10 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @sponsor.update_attributes(sponsor_params)
|
if @sponsor.update(sponsor_params)
|
||||||
redirect_to admin_conference_sponsors_path(
|
redirect_to admin_conference_sponsors_path(
|
||||||
conference_id: @conference.short_title),
|
conference_id: @conference.short_title
|
||||||
|
),
|
||||||
notice: 'Sponsor successfully updated.'
|
notice: 'Sponsor successfully updated.'
|
||||||
else
|
else
|
||||||
flash.now[:error] = "Update sponsor failed: #{@sponsor.errors.full_messages.join('. ')}."
|
flash.now[:error] = "Update sponsor failed: #{@sponsor.errors.full_messages.join('. ')}."
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class SponsorshipLevelsController < Admin::BaseController
|
class SponsorshipLevelsController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
|
@ -25,9 +27,10 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @sponsorship_level.update_attributes(sponsorship_level_params)
|
if @sponsorship_level.update(sponsorship_level_params)
|
||||||
redirect_to admin_conference_sponsorship_levels_path(
|
redirect_to admin_conference_sponsorship_levels_path(
|
||||||
conference_id: @conference.short_title),
|
conference_id: @conference.short_title
|
||||||
|
),
|
||||||
notice: 'Sponsorship level successfully updated.'
|
notice: 'Sponsorship level successfully updated.'
|
||||||
else
|
else
|
||||||
flash.now[:error] = "Update Sponsorship level failed: #{@sponsorship_level.errors.full_messages.join('. ')}."
|
flash.now[:error] = "Update Sponsorship level failed: #{@sponsorship_level.errors.full_messages.join('. ')}."
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class TargetsController < Admin::BaseController
|
class TargetsController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
|
@ -23,7 +25,7 @@ module Admin
|
||||||
def edit; end
|
def edit; end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @target.update_attributes(target_params)
|
if @target.update(target_params)
|
||||||
redirect_to admin_conference_targets_path(conference_id: @conference.short_title),
|
redirect_to admin_conference_targets_path(conference_id: @conference.short_title),
|
||||||
notice: 'Target successfully updated.'
|
notice: 'Target successfully updated.'
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class TicketScanningsController < Admin::BaseController
|
class TicketScanningsController < Admin::BaseController
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class TicketsController < Admin::BaseController
|
class TicketsController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
|
@ -27,7 +29,7 @@ module Admin
|
||||||
def edit; end
|
def edit; end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @ticket.update_attributes(ticket_params)
|
if @ticket.update(ticket_params)
|
||||||
redirect_to admin_conference_tickets_path(conference_id: @conference.short_title),
|
redirect_to admin_conference_tickets_path(conference_id: @conference.short_title),
|
||||||
notice: 'Ticket successfully updated.'
|
notice: 'Ticket successfully updated.'
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class TracksController < Admin::BaseController
|
class TracksController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
|
@ -54,7 +56,7 @@ module Admin
|
||||||
def edit; end
|
def edit; end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @track.update_attributes(track_params)
|
if @track.update(track_params)
|
||||||
redirect_to admin_conference_program_tracks_path(conference_id: @conference.short_title),
|
redirect_to admin_conference_program_tracks_path(conference_id: @conference.short_title),
|
||||||
notice: 'Track successfully updated.'
|
notice: 'Track successfully updated.'
|
||||||
else
|
else
|
||||||
|
|
@ -120,13 +122,13 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_selected_schedule
|
def update_selected_schedule
|
||||||
if @track.update_attributes(params.require(:track).permit(:selected_schedule_id))
|
if @track.update(params.require(:track).permit(:selected_schedule_id))
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js { render json: {} }
|
format.js { render json: {} }
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js { render json: { errors: "The selected schedule couldn't be updated #{@track.errors.to_a.join('. ')}" }, status: 422 }
|
format.js { render json: { errors: "The selected schedule couldn't be updated #{@track.errors.to_a.join('. ')}" }, status: :unprocessable_entity }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class UsersController < Admin::BaseController
|
class UsersController < Admin::BaseController
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
|
|
@ -36,9 +38,9 @@ module Admin
|
||||||
# Variable @show_attributes holds the attributes that are visible for the 'show' action
|
# Variable @show_attributes holds the attributes that are visible for the 'show' action
|
||||||
# If you want to change the attributes that are shown in the 'show' action of users
|
# If you want to change the attributes that are shown in the 'show' action of users
|
||||||
# add/remove the attributes in the following string array
|
# add/remove the attributes in the following string array
|
||||||
@show_attributes = %w(name email username nickname affiliation biography registered attended roles created_at
|
@show_attributes = %w[name email username nickname affiliation biography registered attended roles created_at
|
||||||
updated_at sign_in_count current_sign_in_at last_sign_in_at
|
updated_at sign_in_count current_sign_in_at last_sign_in_at
|
||||||
current_sign_in_ip last_sign_in_ip)
|
current_sign_in_ip last_sign_in_ip]
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|
@ -49,7 +51,7 @@ module Admin
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if @user.update_attributes(user_params)
|
if @user.update(user_params)
|
||||||
redirect_to admin_users_path, notice: "Updated #{@user.name} (#{@user.email})!" + message
|
redirect_to admin_users_path, notice: "Updated #{@user.name} (#{@user.email})!" + message
|
||||||
else
|
else
|
||||||
redirect_to admin_users_path, error: "Could not update #{@user.name} (#{@user.email}). #{@user.errors.full_messages.join('. ')}."
|
redirect_to admin_users_path, error: "Could not update #{@user.name} (#{@user.email}). #{@user.errors.full_messages.join('. ')}."
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class VenueCommercialsController < Admin::BaseController
|
class VenueCommercialsController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
|
@ -38,7 +40,7 @@ module Admin
|
||||||
def render_commercial
|
def render_commercial
|
||||||
result = Commercial.render_from_url(params[:url])
|
result = Commercial.render_from_url(params[:url])
|
||||||
if result[:error]
|
if result[:error]
|
||||||
render text: result[:error], status: 400
|
render text: result[:error], status: :bad_request
|
||||||
else
|
else
|
||||||
render text: result[:html]
|
render text: result[:html]
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class VenuesController < Admin::BaseController
|
class VenuesController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
|
@ -23,7 +25,7 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @venue.update_attributes(venue_params)
|
if @venue.update(venue_params)
|
||||||
redirect_to admin_conference_venue_path(conference_id: @conference.short_title),
|
redirect_to admin_conference_venue_path(conference_id: @conference.short_title),
|
||||||
notice: 'Venue was successfully updated.'
|
notice: 'Venue was successfully updated.'
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class VersionsController < Admin::BaseController
|
class VersionsController < Admin::BaseController
|
||||||
load_resource :conference, find_by: :short_title, only: :index
|
load_resource :conference, find_by: :short_title, only: :index
|
||||||
load_and_authorize_resource class: PaperTrail::Version
|
load_and_authorize_resource class: PaperTrail::Version
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@conferences_with_role = current_user.is_admin? ? Conference.pluck(:short_title) : Conference.with_role([:organizer, :cfp, :info_desk], current_user).pluck(:short_title)
|
@conferences_with_role = current_user.is_admin? ? Conference.pluck(:short_title) : Conference.with_role(%i[organizer cfp info_desk], current_user).pluck(:short_title)
|
||||||
|
|
||||||
if current_user.has_cached_role? :organization_admin, :any
|
@conferences_with_role = Organization.with_role('organization_admin', current_user).map { |org| org.conferences.pluck :short_title }.flatten if current_user.has_cached_role? :organization_admin, :any
|
||||||
@conferences_with_role = Organization.with_role('organization_admin', current_user).map { |org| org.conferences.pluck :short_title }.flatten
|
|
||||||
end
|
|
||||||
@conferences_with_role.uniq!
|
@conferences_with_role.uniq!
|
||||||
|
|
||||||
return if @conference.blank?
|
return if @conference.blank?
|
||||||
|
|
@ -16,7 +16,7 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def revert_attribute
|
def revert_attribute
|
||||||
if params[:attribute] && @version.changeset.reject{ |_, values| values[0].blank? && values[1].blank? }.keys.include?(params[:attribute])
|
if params[:attribute] && @version.changeset.reject { |_, values| values[0].blank? && values[1].blank? }.keys.include?(params[:attribute])
|
||||||
if @version.item[params[:attribute]] == @version.changeset[params[:attribute]][0]
|
if @version.item[params[:attribute]] == @version.changeset[params[:attribute]][0]
|
||||||
flash[:error] = 'The item is already in the state that you are trying to revert it back to'
|
flash[:error] = 'The item is already in the state that you are trying to revert it back to'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class VolunteersController < Admin::BaseController
|
class VolunteersController < Admin::BaseController
|
||||||
include VolunteersHelper
|
include VolunteersHelper
|
||||||
|
|
@ -24,7 +26,7 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @conference.update_attributes(conference_params)
|
if @conference.update(conference_params)
|
||||||
redirect_to admin_conference_volunteers_info_path(conference_id: params[:conference_id]), notice: 'Volunteering options were successfully updated.'
|
redirect_to admin_conference_volunteers_info_path(conference_id: params[:conference_id]), notice: 'Volunteering options were successfully updated.'
|
||||||
else
|
else
|
||||||
redirect_to admin_conference_volunteers_info_path(conference_id: params[:conference_id]), error: "Volunteering options update failed: #{@conference.errors.full_messages.join '. '}"
|
redirect_to admin_conference_volunteers_info_path(conference_id: params[:conference_id]), error: "Volunteering options update failed: #{@conference.errors.full_messages.join '. '}"
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Api
|
module Api
|
||||||
class BaseController < ActionController::Base
|
class BaseController < ActionController::Base
|
||||||
protect_from_forgery with: :exception
|
protect_from_forgery with: :exception
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Api
|
module Api
|
||||||
module V1
|
module V1
|
||||||
class ConferencesController < Api::BaseController
|
class ConferencesController < Api::BaseController
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Api
|
module Api
|
||||||
module V1
|
module V1
|
||||||
class EventsController < Api::BaseController
|
class EventsController < Api::BaseController
|
||||||
|
|
@ -10,9 +12,7 @@ module Api
|
||||||
def index
|
def index
|
||||||
events = Event.includes(:track, :event_type, event_users: :user)
|
events = Event.includes(:track, :event_type, event_users: :user)
|
||||||
|
|
||||||
if @conference
|
events = events.where(program: @conference.program) if @conference
|
||||||
events = events.where(program: @conference.program)
|
|
||||||
end
|
|
||||||
|
|
||||||
respond_with events.confirmed, callback: params[:callback]
|
respond_with events.confirmed, callback: params[:callback]
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Api
|
module Api
|
||||||
module V1
|
module V1
|
||||||
class RoomsController < Api::BaseController
|
class RoomsController < Api::BaseController
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Api
|
module Api
|
||||||
module V1
|
module V1
|
||||||
class SpeakersController < Api::BaseController
|
class SpeakersController < Api::BaseController
|
||||||
|
|
@ -9,13 +11,13 @@ module Api
|
||||||
|
|
||||||
def index
|
def index
|
||||||
if @conference
|
if @conference
|
||||||
users = User.joins(event_users: { event: { program: :conference} })
|
users = User.joins(event_users: { event: { program: :conference } })
|
||||||
users = users.where(conferences: { short_title: @conference.short_title })
|
users = users.where(conferences: { short_title: @conference.short_title })
|
||||||
else
|
else
|
||||||
users = User.joins(:event_users)
|
users = User.joins(:event_users)
|
||||||
end
|
end
|
||||||
|
|
||||||
users = users.where(event_users: {event_role: :speaker}).uniq
|
users = users.where(event_users: { event_role: :speaker }).uniq
|
||||||
render json: users, each_serializer: SpeakerSerializer, callback: params['callback']
|
render json: users, each_serializer: SpeakerSerializer, callback: params['callback']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Api
|
module Api
|
||||||
module V1
|
module V1
|
||||||
class TracksController < Api::BaseController
|
class TracksController < Api::BaseController
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
before_action :set_paper_trail_whodunnit
|
before_action :set_paper_trail_whodunnit
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
|
|
@ -11,7 +13,7 @@ class ApplicationController < ActionController::Base
|
||||||
def store_location
|
def store_location
|
||||||
# store last url - this is needed for post-login redirect to whatever the user last visited.
|
# store last url - this is needed for post-login redirect to whatever the user last visited.
|
||||||
return unless request.get?
|
return unless request.get?
|
||||||
if (request.path != '/accounts/sign_in' &&
|
if request.path != '/accounts/sign_in' &&
|
||||||
request.path != '/accounts/sign_up' &&
|
request.path != '/accounts/sign_up' &&
|
||||||
request.path != '/accounts/password/new' &&
|
request.path != '/accounts/password/new' &&
|
||||||
request.path != '/accounts/password/edit' &&
|
request.path != '/accounts/password/edit' &&
|
||||||
|
|
@ -19,7 +21,7 @@ class ApplicationController < ActionController::Base
|
||||||
request.path != '/accounts/sign_out' &&
|
request.path != '/accounts/sign_out' &&
|
||||||
request.path != '/users/ichain_registration/ichain_sign_up' &&
|
request.path != '/users/ichain_registration/ichain_sign_up' &&
|
||||||
!request.path.starts_with?(Devise.ichain_base_url) &&
|
!request.path.starts_with?(Devise.ichain_base_url) &&
|
||||||
!request.xhr?) # don't store ajax calls
|
!request.xhr? # don't store ajax calls
|
||||||
session[:return_to] = request.fullpath
|
session[:return_to] = request.fullpath
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -65,6 +67,6 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def not_found
|
def not_found
|
||||||
raise ActionController::RoutingError.new('Not Found')
|
raise ActionController::RoutingError, 'Not Found'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class BoothsController < ApplicationController
|
class BoothsController < ApplicationController
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
load_resource :conference, find_by: :short_title
|
load_resource :conference, find_by: :short_title
|
||||||
load_and_authorize_resource through: :conference
|
load_and_authorize_resource through: :conference
|
||||||
skip_authorize_resource only: [:withdraw, :confirm, :restart]
|
skip_authorize_resource only: %i[withdraw confirm restart]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@booths = current_user.booths.where(conference_id: @conference.id).uniq
|
@booths = current_user.booths.where(conference_id: @conference.id).uniq
|
||||||
|
|
@ -34,7 +36,7 @@ class BoothsController < ApplicationController
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@url = conference_booth_path(@conference.short_title, @booth.id)
|
@url = conference_booth_path(@conference.short_title, @booth.id)
|
||||||
@booth.update_attributes(booth_params)
|
@booth.update(booth_params)
|
||||||
|
|
||||||
if @booth.save
|
if @booth.save
|
||||||
redirect_to conference_booths_path,
|
redirect_to conference_booths_path,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class CommercialsController < ApplicationController
|
class CommercialsController < ApplicationController
|
||||||
load_resource :conference, find_by: :short_title
|
load_resource :conference, find_by: :short_title
|
||||||
before_action :set_event
|
before_action :set_event
|
||||||
|
|
@ -35,7 +37,7 @@ class CommercialsController < ApplicationController
|
||||||
def render_commercial
|
def render_commercial
|
||||||
result = Commercial.render_from_url(params[:url])
|
result = Commercial.render_from_url(params[:url])
|
||||||
if result[:error]
|
if result[:error]
|
||||||
render text: result[:error], status: 400
|
render text: result[:error], status: :bad_request
|
||||||
else
|
else
|
||||||
render text: result[:html]
|
render text: result[:html]
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ConferenceRegistrationsController < ApplicationController
|
class ConferenceRegistrationsController < ApplicationController
|
||||||
before_action :authenticate_user!, except: [:new, :create]
|
before_action :authenticate_user!, except: %i[new create]
|
||||||
load_resource :conference, find_by: :short_title
|
load_resource :conference, find_by: :short_title
|
||||||
authorize_resource :conference_registrations, class: Registration, except: [:new, :create]
|
authorize_resource :conference_registrations, class: Registration, except: %i[new create]
|
||||||
before_action :set_registration, only: [:edit, :update, :destroy, :show]
|
before_action :set_registration, only: %i[edit update destroy show]
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@registration = Registration.new(conference_id: @conference.id)
|
@registration = Registration.new(conference_id: @conference.id)
|
||||||
|
|
@ -54,9 +56,7 @@ class ConferenceRegistrationsController < ApplicationController
|
||||||
ahoy.track 'Registered', title: 'New registration'
|
ahoy.track 'Registered', title: 'New registration'
|
||||||
|
|
||||||
# Sign in the new user
|
# Sign in the new user
|
||||||
unless current_user
|
sign_in(@registration.user) unless current_user
|
||||||
sign_in(@registration.user)
|
|
||||||
end
|
|
||||||
|
|
||||||
if @conference.tickets.any? && !current_user.supports?(@conference)
|
if @conference.tickets.any? && !current_user.supports?(@conference)
|
||||||
redirect_to conference_tickets_path(@conference.short_title),
|
redirect_to conference_tickets_path(@conference.short_title),
|
||||||
|
|
@ -73,7 +73,7 @@ class ConferenceRegistrationsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @registration.update_attributes(registration_params)
|
if @registration.update(registration_params)
|
||||||
redirect_to conference_conference_registration_path(@conference.short_title),
|
redirect_to conference_conference_registration_path(@conference.short_title),
|
||||||
notice: 'Registration was successfully updated.'
|
notice: 'Registration was successfully updated.'
|
||||||
else
|
else
|
||||||
|
|
@ -116,8 +116,9 @@ class ConferenceRegistrationsController < ApplicationController
|
||||||
vchoice_ids: [], qanswer_ids: [],
|
vchoice_ids: [], qanswer_ids: [],
|
||||||
qanswers_attributes: [],
|
qanswers_attributes: [],
|
||||||
event_ids: [],
|
event_ids: [],
|
||||||
user_attributes: [
|
user_attributes: %i[
|
||||||
:username, :email, :name, :password, :password_confirmation]
|
username email name password password_confirmation
|
||||||
|
]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ConferencesController < ApplicationController
|
class ConferencesController < ApplicationController
|
||||||
protect_from_forgery with: :null_session
|
protect_from_forgery with: :null_session
|
||||||
before_action :respond_to_options
|
before_action :respond_to_options
|
||||||
|
|
@ -21,9 +23,7 @@ class ConferencesController < ApplicationController
|
||||||
|
|
||||||
splashpage = @conference.splashpage
|
splashpage = @conference.splashpage
|
||||||
|
|
||||||
unless splashpage.present?
|
redirect_to admin_conference_splashpage_path(@conference.short_title) && return if splashpage.blank?
|
||||||
redirect_to admin_conference_splashpage_path(@conference.short_title) && return
|
|
||||||
end
|
|
||||||
|
|
||||||
if splashpage.include_cfp
|
if splashpage.include_cfp
|
||||||
cfps = @conference.program.cfps
|
cfps = @conference.program.cfps
|
||||||
|
|
@ -42,16 +42,10 @@ class ConferencesController < ApplicationController
|
||||||
:room
|
:room
|
||||||
).order('tracks.name')
|
).order('tracks.name')
|
||||||
end
|
end
|
||||||
if splashpage.include_booths
|
@booths = @conference.confirmed_booths.order('title') if splashpage.include_booths
|
||||||
@booths = @conference.confirmed_booths.order('title')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if splashpage.include_registrations || splashpage.include_tickets
|
|
||||||
@tickets = @conference.tickets.order('price_cents')
|
|
||||||
end
|
|
||||||
if splashpage.include_lodgings
|
|
||||||
@lodgings = @conference.lodgings.order('name')
|
|
||||||
end
|
end
|
||||||
|
@tickets = @conference.tickets.order('price_cents') if splashpage.include_registrations || splashpage.include_tickets
|
||||||
|
@lodgings = @conference.lodgings.order('name') if splashpage.include_lodgings
|
||||||
if splashpage.include_sponsors
|
if splashpage.include_sponsors
|
||||||
@sponsorship_levels = @conference.sponsorship_levels.eager_load(
|
@sponsorship_levels = @conference.sponsorship_levels.eager_load(
|
||||||
:sponsors
|
:sponsors
|
||||||
|
|
@ -71,8 +65,10 @@ class ConferencesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def respond_to_options
|
def respond_to_options
|
||||||
|
if request.options?
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { head :ok }
|
format.html { head :ok }
|
||||||
end if request.options?
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ConfirmationsController < Devise::ConfirmationsController
|
class ConfirmationsController < Devise::ConfirmationsController
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class OpenidsController < ApplicationController
|
class OpenidsController < ApplicationController
|
||||||
load_and_authorize_resource :user
|
load_and_authorize_resource :user
|
||||||
load_and_authorize_resource through: :user
|
load_and_authorize_resource through: :user
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class OrganizationsController < ApplicationController
|
class OrganizationsController < ApplicationController
|
||||||
load_and_authorize_resource :organization
|
load_and_authorize_resource :organization
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class PaymentsController < ApplicationController
|
class PaymentsController < ApplicationController
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
|
|
@ -10,9 +12,7 @@ class PaymentsController < ApplicationController
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@total_amount_to_pay = Ticket.total_price(@conference, current_user, paid: false)
|
@total_amount_to_pay = Ticket.total_price(@conference, current_user, paid: false)
|
||||||
if @total_amount_to_pay.zero?
|
raise CanCan::AccessDenied.new('Nothing to pay for!', :new, Payment) if @total_amount_to_pay.zero?
|
||||||
raise CanCan::AccessDenied.new('Nothing to pay for!', :new, Payment)
|
|
||||||
end
|
|
||||||
@unpaid_ticket_purchases = current_user.ticket_purchases.unpaid.by_conference(@conference)
|
@unpaid_ticket_purchases = current_user.ticket_purchases.unpaid.by_conference(@conference)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class PhysicalTicketsController < ApplicationController
|
class PhysicalTicketsController < ApplicationController
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
load_resource :conference, find_by: :short_title
|
load_resource :conference, find_by: :short_title
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ProposalsController < ApplicationController
|
class ProposalsController < ApplicationController
|
||||||
before_action :authenticate_user!, except: [:show, :new, :create]
|
before_action :authenticate_user!, except: %i[show new create]
|
||||||
load_resource :conference, find_by: :short_title
|
load_resource :conference, find_by: :short_title
|
||||||
load_resource :program, through: :conference, singleton: true
|
load_resource :program, through: :conference, singleton: true
|
||||||
load_and_authorize_resource :event, parent: false, through: :program
|
load_and_authorize_resource :event, parent: false, through: :program
|
||||||
# We authorize manually in these actions
|
# We authorize manually in these actions
|
||||||
skip_authorize_resource :event, only: [:confirm, :restart, :withdraw]
|
skip_authorize_resource :event, only: %i[confirm restart withdraw]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@event = @program.events.new
|
@event = @program.events.new
|
||||||
|
|
@ -168,8 +170,7 @@ class ProposalsController < ApplicationController
|
||||||
params.require(:event).permit(:event_type_id, :track_id, :difficulty_level_id,
|
params.require(:event).permit(:event_type_id, :track_id, :difficulty_level_id,
|
||||||
:title, :subtitle, :abstract, :description,
|
:title, :subtitle, :abstract, :description,
|
||||||
:require_registration, :max_attendees, :language,
|
:require_registration, :max_attendees, :language,
|
||||||
speaker_ids: []
|
speaker_ids: [])
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_params
|
def user_params
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class RegistrationsController < Devise::RegistrationsController
|
class RegistrationsController < Devise::RegistrationsController
|
||||||
prepend_before_action :check_captcha, only: [:create]
|
prepend_before_action :check_captcha, only: [:create]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class SchedulesController < ApplicationController
|
class SchedulesController < ApplicationController
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
protect_from_forgery with: :null_session
|
protect_from_forgery with: :null_session
|
||||||
|
|
@ -8,11 +10,9 @@ class SchedulesController < ApplicationController
|
||||||
def show
|
def show
|
||||||
@rooms = @conference.venue.rooms if @conference.venue
|
@rooms = @conference.venue.rooms if @conference.venue
|
||||||
schedules = @program.selected_event_schedules
|
schedules = @program.selected_event_schedules
|
||||||
unless schedules
|
redirect_to events_conference_schedule_path(@conference.short_title) unless schedules
|
||||||
redirect_to events_conference_schedule_path(@conference.short_title)
|
|
||||||
end
|
|
||||||
|
|
||||||
@events_xml = schedules.map(&:event).group_by{ |event| event.time.to_date } if schedules
|
@events_xml = schedules.map(&:event).group_by { |event| event.time.to_date } if schedules
|
||||||
@dates = @conference.start_date..@conference.end_date
|
@dates = @conference.start_date..@conference.end_date
|
||||||
@step_minutes = @program.schedule_interval.minutes
|
@step_minutes = @program.schedule_interval.minutes
|
||||||
@conf_start = @conference.start_hour
|
@conf_start = @conference.start_hour
|
||||||
|
|
@ -20,7 +20,7 @@ class SchedulesController < ApplicationController
|
||||||
|
|
||||||
# the schedule takes you to today if it is a date of the schedule
|
# the schedule takes you to today if it is a date of the schedule
|
||||||
@current_day = @conference.current_conference_day
|
@current_day = @conference.current_conference_day
|
||||||
@day = @current_day.present? ? @current_day : @dates.first
|
@day = @current_day.presence || @dates.first
|
||||||
unless @current_day
|
unless @current_day
|
||||||
# the schedule takes you to the current time if it is beetween the start and the end time.
|
# the schedule takes you to the current time if it is beetween the start and the end time.
|
||||||
@hour_column = @conference.hours_from_start_time(@conf_start, @conference.end_hour)
|
@hour_column = @conference.hours_from_start_time(@conf_start, @conference.end_hour)
|
||||||
|
|
@ -37,7 +37,7 @@ class SchedulesController < ApplicationController
|
||||||
@dates = @conference.start_date..@conference.end_date
|
@dates = @conference.start_date..@conference.end_date
|
||||||
|
|
||||||
@events_schedules = @program.selected_event_schedules
|
@events_schedules = @program.selected_event_schedules
|
||||||
@events_schedules = [] unless @events_schedules
|
@events_schedules ||= []
|
||||||
|
|
||||||
@unscheduled_events = @program.events.confirmed - @events_schedules.map(&:event)
|
@unscheduled_events = @program.events.confirmed - @events_schedules.map(&:event)
|
||||||
|
|
||||||
|
|
@ -48,8 +48,10 @@ class SchedulesController < ApplicationController
|
||||||
private
|
private
|
||||||
|
|
||||||
def respond_to_options
|
def respond_to_options
|
||||||
|
if request.options?
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { head :ok }
|
format.html { head :ok }
|
||||||
end if request.options?
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class SubscriptionsController < ApplicationController
|
class SubscriptionsController < ApplicationController
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
load_resource :conference, find_by: :short_title
|
load_resource :conference, find_by: :short_title
|
||||||
load_and_authorize_resource only: [:create, :destroy], through: :conference
|
load_and_authorize_resource only: %i[create destroy], through: :conference
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@subscription = current_user.subscriptions.build(conference_id: @conference.id)
|
@subscription = current_user.subscriptions.build(conference_id: @conference.id)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class TicketPurchasesController < ApplicationController
|
class TicketPurchasesController < ApplicationController
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
load_resource :conference, find_by: :short_title
|
load_resource :conference, find_by: :short_title
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class TicketsController < ApplicationController
|
class TicketsController < ApplicationController
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
load_resource :conference, find_by: :short_title
|
load_resource :conference, find_by: :short_title
|
||||||
|
|
@ -8,8 +10,6 @@ class TicketsController < ApplicationController
|
||||||
def index; end
|
def index; end
|
||||||
|
|
||||||
def check_load_resource
|
def check_load_resource
|
||||||
if @tickets.empty?
|
redirect_to root_path, notice: "There are no tickets available for #{@conference.title}!" if @tickets.empty?
|
||||||
redirect_to root_path, notice: "There are no tickets available for #{@conference.title}!"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class TracksController < ApplicationController
|
class TracksController < ApplicationController
|
||||||
load_resource :conference, find_by: :short_title
|
load_resource :conference, find_by: :short_title
|
||||||
load_resource :program, through: :conference, singleton: true
|
load_resource :program, through: :conference, singleton: true
|
||||||
|
|
@ -29,7 +31,7 @@ class TracksController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @track.update_attributes(track_params)
|
if @track.update(track_params)
|
||||||
redirect_to conference_program_tracks_path(conference_id: @conference.short_title),
|
redirect_to conference_program_tracks_path(conference_id: @conference.short_title),
|
||||||
notice: 'Track request successfully updated.'
|
notice: 'Track request successfully updated.'
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Users
|
module Users
|
||||||
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
||||||
skip_before_filter :verify_authenticity_token
|
skip_before_action :verify_authenticity_token
|
||||||
skip_authorization_check
|
skip_authorization_check
|
||||||
|
|
||||||
User.omniauth_providers.each do |provider|
|
User.omniauth_providers.each do |provider|
|
||||||
|
|
@ -11,7 +13,7 @@ module Users
|
||||||
|
|
||||||
def handle(provider)
|
def handle(provider)
|
||||||
auth_hash = request.env['omniauth.auth']
|
auth_hash = request.env['omniauth.auth']
|
||||||
unless auth_hash.info.email.present?
|
if auth_hash.info.email.blank?
|
||||||
flash[:error] = "Email field is missing in your #{provider} account"
|
flash[:error] = "Email field is missing in your #{provider} account"
|
||||||
redirect_to new_user_registration_path
|
redirect_to new_user_registration_path
|
||||||
return
|
return
|
||||||
|
|
@ -27,15 +29,13 @@ module Users
|
||||||
|
|
||||||
begin
|
begin
|
||||||
user.save!
|
user.save!
|
||||||
if openid.user != user
|
openid.user = user if openid.user != user
|
||||||
openid.user = user
|
|
||||||
end
|
|
||||||
openid.save!
|
openid.save!
|
||||||
|
|
||||||
sign_in user
|
sign_in user
|
||||||
redirect_to request.env['omniauth.origin'] || root_path,
|
redirect_to request.env['omniauth.origin'] || root_path,
|
||||||
notice: "#{user.email} signed in successfully with #{provider}"
|
notice: "#{user.email} signed in successfully with #{provider}"
|
||||||
rescue => e
|
rescue StandardError => e
|
||||||
flash[:error] = e.message
|
flash[:error] = e.message
|
||||||
redirect_back_or_to new_user_registration_path
|
redirect_back_or_to new_user_registration_path
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class UsersController < ApplicationController
|
class UsersController < ApplicationController
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
|
|
||||||
|
|
@ -7,8 +9,7 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /users/1/edit
|
# GET /users/1/edit
|
||||||
def edit
|
def edit; end
|
||||||
end
|
|
||||||
|
|
||||||
# PATCH/PUT /users/1
|
# PATCH/PUT /users/1
|
||||||
def update
|
def update
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
module VolunteersHelper
|
module VolunteersHelper
|
||||||
def can_manage_volunteers?(conference)
|
def can_manage_volunteers?(conference)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module ApplicationHelper
|
module ApplicationHelper
|
||||||
# Returns a string build from the start and end date of the given conference.
|
# Returns a string build from the start and end date of the given conference.
|
||||||
#
|
#
|
||||||
|
|
@ -60,7 +62,7 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def difficulty_levels(conference)
|
def difficulty_levels(conference)
|
||||||
all = conference.program.difficulty_levels.map {|t| t.title}
|
all = conference.program.difficulty_levels.map(&:title)
|
||||||
first = all[0...-1]
|
first = all[0...-1]
|
||||||
last = all[-1]
|
last = all[-1]
|
||||||
ts = ''
|
ts = ''
|
||||||
|
|
@ -83,16 +85,14 @@ module ApplicationHelper
|
||||||
# Output will be 'title, description and conference'
|
# Output will be 'title, description and conference'
|
||||||
def updated_attributes(version)
|
def updated_attributes(version)
|
||||||
version.changeset
|
version.changeset
|
||||||
.reject{ |_, values| values[0].blank? && values[1].blank? }
|
.reject { |_, values| values[0].blank? && values[1].blank? }
|
||||||
.keys.map{ |key| key.gsub('_id', '').tr('_', ' ')}.join(', ')
|
.keys.map { |key| key.gsub('_id', '').tr('_', ' ') }.join(', ')
|
||||||
.reverse.sub(',', ' dna ').reverse
|
.reverse.sub(',', ' dna ').reverse
|
||||||
end
|
end
|
||||||
|
|
||||||
def normalize_array_length(hashmap, length)
|
def normalize_array_length(hashmap, length)
|
||||||
hashmap.each_value do |value|
|
hashmap.each_value do |value|
|
||||||
if value.length < length
|
value.fill(value[-1], value.length...length) if value.length < length
|
||||||
value.fill(value[-1], value.length...length)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -115,28 +115,26 @@ module ApplicationHelper
|
||||||
other_event_schedules.each do |other_event_schedule|
|
other_event_schedules.each do |other_event_schedule|
|
||||||
next unless other_event_schedule.event.confirmed?
|
next unless other_event_schedule.event.confirmed?
|
||||||
other_event_time_range = (other_event_schedule.start_time.strftime '%Y-%m-%d %H:%M')...(other_event_schedule.end_time.strftime '%Y-%m-%d %H:%M')
|
other_event_time_range = (other_event_schedule.start_time.strftime '%Y-%m-%d %H:%M')...(other_event_schedule.end_time.strftime '%Y-%m-%d %H:%M')
|
||||||
if (event_time_range.to_a & other_event_time_range.to_a).present?
|
concurrent_events << other_event_schedule.event if (event_time_range.to_a & other_event_time_range.to_a).present?
|
||||||
concurrent_events << other_event_schedule.event
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
concurrent_events
|
concurrent_events
|
||||||
end
|
end
|
||||||
|
|
||||||
def speaker_links(event)
|
def speaker_links(event)
|
||||||
safe_join(event.speakers.map{ |speaker| link_to speaker.name, admin_user_path(speaker) }, ',')
|
safe_join(event.speakers.map { |speaker| link_to speaker.name, admin_user_path(speaker) }, ',')
|
||||||
end
|
end
|
||||||
|
|
||||||
def speaker_selector_input(form)
|
def speaker_selector_input(form)
|
||||||
users = User.active.pluck(:id, :name, :username, :email).map { |user| [user[0], user[1].blank? ? user[2] : user[1], user[2], user[3]] }.sort_by { |user| user[1].downcase }
|
users = User.active.pluck(:id, :name, :username, :email).map { |user| [user[0], user[1].presence || user[2], user[2], user[3]] }.sort_by { |user| user[1].downcase }
|
||||||
form.input :speakers, as: :select,
|
form.input :speakers, as: :select,
|
||||||
collection: options_for_select(users.map {|user| ["#{user[1]} (#{user[2]}) #{user[3]}", user[0]]}, @event.speakers.map(&:id)),
|
collection: options_for_select(users.map { |user| ["#{user[1]} (#{user[2]}) #{user[3]}", user[0]] }, @event.speakers.map(&:id)),
|
||||||
include_blank: false, label: 'Speakers', input_html: { class: 'select-help-toggle', multiple: 'true' }
|
include_blank: false, label: 'Speakers', input_html: { class: 'select-help-toggle', multiple: 'true' }
|
||||||
end
|
end
|
||||||
|
|
||||||
def responsibles_selector_input(form)
|
def responsibles_selector_input(form)
|
||||||
users = User.active.pluck(:id, :name, :username, :email).map { |user| [user[0], user[1].blank? ? user[2] : user[1], user[2], user[3]] }.sort_by { |user| user[1].downcase }
|
users = User.active.pluck(:id, :name, :username, :email).map { |user| [user[0], user[1].presence || user[2], user[2], user[3]] }.sort_by { |user| user[1].downcase }
|
||||||
form.input :responsibles, as: :select,
|
form.input :responsibles, as: :select,
|
||||||
collection: options_for_select(users.map {|user| ["#{user[1]} (#{user[2]}) #{user[3]}", user[0]]}, @booth.responsibles.map(&:id)),
|
collection: options_for_select(users.map { |user| ["#{user[1]} (#{user[2]}) #{user[3]}", user[0]] }, @booth.responsibles.map(&:id)),
|
||||||
include_blank: false, label: 'Responsibles', input_html: { class: 'select-help-toggle', multiple: 'true' },
|
include_blank: false, label: 'Responsibles', input_html: { class: 'select-help-toggle', multiple: 'true' },
|
||||||
hint: 'The people responsible for the booth. You can only select existing users.'
|
hint: 'The people responsible for the booth. You can only select existing users.'
|
||||||
end
|
end
|
||||||
|
|
@ -154,9 +152,7 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def rescheduling_hint(affected_event_count)
|
def rescheduling_hint(affected_event_count)
|
||||||
if affected_event_count > 0
|
"You have #{affected_event_count} scheduled #{'event'.pluralize(affected_event_count)}. Changing the conference hours will unschedule those scheduled outside the conference hours." if affected_event_count > 0
|
||||||
"You have #{affected_event_count} scheduled #{'event'.pluralize(affected_event_count)}. Changing the conference hours will unschedule those scheduled outside the conference hours."
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module ConferenceHelper
|
module ConferenceHelper
|
||||||
# Return true if only call_for_papers or call_for_tracks or call_for_booths is open
|
# Return true if only call_for_papers or call_for_tracks or call_for_booths is open
|
||||||
def one_call_open(*calls)
|
def one_call_open(*calls)
|
||||||
|
|
@ -6,7 +8,7 @@ module ConferenceHelper
|
||||||
# Return true if exactly two of those calls are open: call_for_papers , call_for_tracks , call_for_booths
|
# Return true if exactly two of those calls are open: call_for_papers , call_for_tracks , call_for_booths
|
||||||
|
|
||||||
def two_calls_open(*calls)
|
def two_calls_open(*calls)
|
||||||
calls.count{ |call| call.try(:open?) } == 2
|
calls.count { |call| call.try(:open?) } == 2
|
||||||
end
|
end
|
||||||
|
|
||||||
# URL for sponsorship emails
|
# URL for sponsorship emails
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module DateTimeHelper
|
module DateTimeHelper
|
||||||
##
|
##
|
||||||
# Includes functions related to date or time manipulations
|
# Includes functions related to date or time manipulations
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module EventsHelper
|
module EventsHelper
|
||||||
##
|
##
|
||||||
# Includes functions related to events
|
# Includes functions related to events
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module FormatHelper
|
module FormatHelper
|
||||||
##
|
##
|
||||||
# Includes functions related to formatting (like adding classes, colors)
|
# Includes functions related to formatting (like adding classes, colors)
|
||||||
|
|
@ -44,9 +46,8 @@ module FormatHelper
|
||||||
def target_progress_color(progress)
|
def target_progress_color(progress)
|
||||||
progress = progress.to_i
|
progress = progress.to_i
|
||||||
result =
|
result =
|
||||||
case
|
if progress >= 90 then 'green'
|
||||||
when progress >= 90 then 'green'
|
elsif progress < 90 && progress >= 80 then 'orange'
|
||||||
when progress < 90 && progress >= 80 then 'orange'
|
|
||||||
else 'red'
|
else 'red'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -55,12 +56,12 @@ module FormatHelper
|
||||||
|
|
||||||
def days_left_color(days_left)
|
def days_left_color(days_left)
|
||||||
days_left = days_left.to_i
|
days_left = days_left.to_i
|
||||||
if days_left > 30
|
result = if days_left > 30
|
||||||
result = 'green'
|
'green'
|
||||||
elsif days_left < 30 && days_left > 10
|
elsif days_left < 30 && days_left > 10
|
||||||
result = 'orange'
|
'orange'
|
||||||
else
|
else
|
||||||
result = 'red'
|
'red'
|
||||||
end
|
end
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
@ -116,7 +117,7 @@ module FormatHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def word_pluralize(count, singular, plural = nil)
|
def word_pluralize(count, singular, plural = nil)
|
||||||
word = if (count == 1 || count =~ /^1(\.0+)?$/)
|
word = if count == 1 || count =~ /^1(\.0+)?$/
|
||||||
singular
|
singular
|
||||||
else
|
else
|
||||||
plural || singular.pluralize
|
plural || singular.pluralize
|
||||||
|
|
@ -134,7 +135,7 @@ module FormatHelper
|
||||||
g = hexcolor[3..4].to_i(16)
|
g = hexcolor[3..4].to_i(16)
|
||||||
b = hexcolor[5..6].to_i(16)
|
b = hexcolor[5..6].to_i(16)
|
||||||
yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000
|
yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000
|
||||||
(yiq >= 128) ? 'black' : 'white'
|
yiq >= 128 ? 'black' : 'white'
|
||||||
end
|
end
|
||||||
|
|
||||||
def td_height(rooms)
|
def td_height(rooms)
|
||||||
|
|
@ -178,17 +179,15 @@ module FormatHelper
|
||||||
item_class = 'item'
|
item_class = 'item'
|
||||||
item_class += ' first' if number == 0
|
item_class += ' first' if number == 0
|
||||||
item_class += ' last' if number == (carousel_number - 1)
|
item_class += ' last' if number == (carousel_number - 1)
|
||||||
if (col && ((col / num_cols) == number)) || (!col && number == 0)
|
item_class += ' active' if (col && ((col / num_cols) == number)) || (!col && number == 0)
|
||||||
item_class += ' active'
|
|
||||||
end
|
|
||||||
item_class
|
item_class
|
||||||
end
|
end
|
||||||
|
|
||||||
def selected_scheduled?(schedule)
|
def selected_scheduled?(schedule)
|
||||||
(schedule == @selected_schedule) ? 'Yes' : 'No'
|
schedule == @selected_schedule ? 'Yes' : 'No'
|
||||||
end
|
end
|
||||||
|
|
||||||
def markdown(text, escape_html=true)
|
def markdown(text, escape_html = true)
|
||||||
return '' if text.nil?
|
return '' if text.nil?
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
|
@ -200,7 +199,7 @@ module FormatHelper
|
||||||
markdown.render(text).html_safe
|
markdown.render(text).html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
def markdown_hint(text='')
|
def markdown_hint(text = '')
|
||||||
markdown("#{text} Please look at #{link_to '**Markdown Syntax**', 'https://daringfireball.net/projects/markdown/syntax', target: '_blank'} to format your text", false)
|
markdown("#{text} Please look at #{link_to '**Markdown Syntax**', 'https://daringfireball.net/projects/markdown/syntax', target: '_blank'} to format your text", false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module PathsHelper
|
module PathsHelper
|
||||||
##
|
##
|
||||||
# Includes functions related to links or redirects
|
# Includes functions related to links or redirects
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module UsersHelper
|
module UsersHelper
|
||||||
##
|
##
|
||||||
# Includes functions related to users
|
# Includes functions related to users
|
||||||
|
|
@ -12,10 +14,8 @@ module UsersHelper
|
||||||
Devise.omniauth_providers.each do |provider|
|
Devise.omniauth_providers.each do |provider|
|
||||||
provider_key = "#{provider}_key"
|
provider_key = "#{provider}_key"
|
||||||
provider_secret = "#{provider}_secret"
|
provider_secret = "#{provider}_secret"
|
||||||
unless Rails.application.secrets.send(provider_key).blank? || Rails.application.secrets.send(provider_secret).blank?
|
providers << provider unless Rails.application.secrets.send(provider_key).blank? || Rails.application.secrets.send(provider_secret).blank?
|
||||||
providers << provider
|
providers << provider if ENV["OSEM_#{provider.upcase}_KEY"].present? && ENV["OSEM_#{provider.upcase}_SECRET"].present?
|
||||||
end
|
|
||||||
providers << provider if !ENV["OSEM_#{provider.upcase}_KEY"].blank? && !ENV["OSEM_#{provider.upcase}_SECRET"].blank?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
providers.uniq
|
providers.uniq
|
||||||
|
|
@ -25,6 +25,6 @@ module UsersHelper
|
||||||
# Outputs the roles of a user, including the conferences for which the user has the roles
|
# Outputs the roles of a user, including the conferences for which the user has the roles
|
||||||
# Eg. organizer(oSC13, oSC14), cfp(oSC12, oSC13)
|
# Eg. organizer(oSC13, oSC14), cfp(oSC12, oSC13)
|
||||||
def show_roles(roles)
|
def show_roles(roles)
|
||||||
roles.map{ |x| x[0].titleize + ' (' + x[1].join(', ') + ')' }.join ', '
|
roles.map { |x| x[0].titleize + ' (' + x[1].join(', ') + ')' }.join ', '
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module VersionsHelper
|
module VersionsHelper
|
||||||
##
|
##
|
||||||
# Groups functions related to change description
|
# Groups functions related to change description
|
||||||
|
|
@ -119,10 +121,9 @@ module VersionsHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def event_change_description(version)
|
def event_change_description(version)
|
||||||
case
|
if version.event == 'create' then 'submitted new'
|
||||||
when version.event == 'create' then 'submitted new'
|
|
||||||
|
|
||||||
when version.changeset['state']
|
elsif version.changeset['state']
|
||||||
case version.changeset['state'][1]
|
case version.changeset['state'][1]
|
||||||
when 'unconfirmed' then 'accepted'
|
when 'unconfirmed' then 'accepted'
|
||||||
when 'withdrawn' then 'withdrew'
|
when 'withdrawn' then 'withdrew'
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ApplicationJob < ActiveJob::Base
|
class ApplicationJob < ActiveJob::Base
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ConferenceCfpUpdateMailJob < ApplicationJob
|
class ConferenceCfpUpdateMailJob < ApplicationJob
|
||||||
queue_as :default
|
queue_as :default
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ConferenceDateUpdateMailJob < ApplicationJob
|
class ConferenceDateUpdateMailJob < ApplicationJob
|
||||||
queue_as :default
|
queue_as :default
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ConferenceRegistrationDateUpdateMailJob < ApplicationJob
|
class ConferenceRegistrationDateUpdateMailJob < ApplicationJob
|
||||||
queue_as :default
|
queue_as :default
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ConferenceScheduleUpdateMailJob < ApplicationJob
|
class ConferenceScheduleUpdateMailJob < ApplicationJob
|
||||||
queue_as :default
|
queue_as :default
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ConferenceVenueUpdateMailJob < ApplicationJob
|
class ConferenceVenueUpdateMailJob < ApplicationJob
|
||||||
queue_as :default
|
queue_as :default
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class EventCommentMailJob < ApplicationJob
|
class EventCommentMailJob < ApplicationJob
|
||||||
queue_as :default
|
queue_as :default
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Mailbot < ActionMailer::Base
|
class Mailbot < ActionMailer::Base
|
||||||
def registration_mail(conference, user)
|
def registration_mail(conference, user)
|
||||||
mail(to: user.email,
|
mail(to: user.email,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Ability
|
class Ability
|
||||||
include CanCan::Ability
|
include CanCan::Ability
|
||||||
|
|
||||||
|
|
@ -15,7 +17,7 @@ class Ability
|
||||||
|
|
||||||
# Abilities for not signed in users (guests)
|
# Abilities for not signed in users (guests)
|
||||||
def not_signed_in
|
def not_signed_in
|
||||||
can [:index, :conferences], Organization
|
can %i[index conferences], Organization
|
||||||
can [:index], Conference
|
can [:index], Conference
|
||||||
can [:show], Conference do |conference|
|
can [:show], Conference do |conference|
|
||||||
conference.splashpage && conference.splashpage.public == true
|
conference.splashpage && conference.splashpage.public == true
|
||||||
|
|
@ -31,20 +33,16 @@ class Ability
|
||||||
|
|
||||||
# can view Commercials of confirmed Events
|
# can view Commercials of confirmed Events
|
||||||
can :show, Commercial, commercialable_type: 'Event', commercialable_id: Event.where(state: 'confirmed').pluck(:id)
|
can :show, Commercial, commercialable_type: 'Event', commercialable_id: Event.where(state: 'confirmed').pluck(:id)
|
||||||
can [:show, :create], User
|
can %i[show create], User
|
||||||
unless ENV['OSEM_ICHAIN_ENABLED'] == 'true'
|
unless ENV['OSEM_ICHAIN_ENABLED'] == 'true'
|
||||||
can :show, Registration do |registration|
|
can :show, Registration, &:new_record?
|
||||||
registration.new_record?
|
|
||||||
end
|
|
||||||
|
|
||||||
can [:new, :create], Registration do |registration|
|
can [:new, :create], Registration do |registration|
|
||||||
conference = registration.conference
|
conference = registration.conference
|
||||||
conference.registration_open? && registration.new_record? && !conference.registration_limit_exceeded?
|
conference.registration_open? && registration.new_record? && !conference.registration_limit_exceeded?
|
||||||
end
|
end
|
||||||
|
|
||||||
can :show, Event do |event|
|
can :show, Event, &:new_record?
|
||||||
event.new_record?
|
|
||||||
end
|
|
||||||
|
|
||||||
can [:new, :create], Event do |event|
|
can [:new, :create], Event do |event|
|
||||||
event.program.cfp_open? && event.new_record?
|
event.program.cfp_open? && event.new_record?
|
||||||
|
|
@ -78,8 +76,8 @@ class Ability
|
||||||
can :index, Organization
|
can :index, Organization
|
||||||
can :index, Ticket
|
can :index, Ticket
|
||||||
can :manage, TicketPurchase, user_id: user.id
|
can :manage, TicketPurchase, user_id: user.id
|
||||||
can [:new, :create], Payment, user_id: user.id
|
can %i[new create], Payment, user_id: user.id
|
||||||
can [:index, :show], PhysicalTicket, user: user
|
can %i[index show], PhysicalTicket, user: user
|
||||||
|
|
||||||
can [:new, :create], Booth do |booth|
|
can [:new, :create], Booth do |booth|
|
||||||
booth.new_record? && booth.conference.program.cfps.for_booths.try(:open?)
|
booth.new_record? && booth.conference.program.cfps.for_booths.try(:open?)
|
||||||
|
|
@ -89,7 +87,7 @@ class Ability
|
||||||
booth.users.include?(user)
|
booth.users.include?(user)
|
||||||
end
|
end
|
||||||
|
|
||||||
can [:create, :destroy], Subscription, user_id: user.id
|
can %i[create destroy], Subscription, user_id: user.id
|
||||||
|
|
||||||
can [:new, :create], Event do |event|
|
can [:new, :create], Event do |event|
|
||||||
event.program.cfp_open? && event.new_record?
|
event.program.cfp_open? && event.new_record?
|
||||||
|
|
@ -108,7 +106,7 @@ class Ability
|
||||||
track.new_record? && track.program.cfps.for_tracks.try(:open?)
|
track.new_record? && track.program.cfps.for_tracks.try(:open?)
|
||||||
end
|
end
|
||||||
|
|
||||||
can [:index, :show, :restart, :confirm, :withdraw], Track, submitter_id: user.id
|
can %i[index show restart confirm withdraw], Track, submitter_id: user.id
|
||||||
|
|
||||||
can [:edit, :update], Track do |track|
|
can [:edit, :update], Track do |track|
|
||||||
user == track.submitter && !(track.accepted? || track.confirmed?)
|
user == track.submitter && !(track.accepted? || track.confirmed?)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class AdminAbility
|
class AdminAbility
|
||||||
include CanCan::Ability
|
include CanCan::Ability
|
||||||
|
|
||||||
|
|
@ -28,12 +30,12 @@ class AdminAbility
|
||||||
conference.registration_open? && !conference.registration_limit_exceeded? || conference.program.speakers.confirmed.include?(user)
|
conference.registration_open? && !conference.registration_limit_exceeded? || conference.program.speakers.confirmed.include?(user)
|
||||||
end
|
end
|
||||||
|
|
||||||
can [:index, :admins], Organization
|
can %i[index admins], Organization
|
||||||
can :index, Ticket
|
can :index, Ticket
|
||||||
can :manage, TicketPurchase, user_id: user.id
|
can :manage, TicketPurchase, user_id: user.id
|
||||||
can [:new, :create], Payment, user_id: user.id
|
can %i[new create], Payment, user_id: user.id
|
||||||
|
|
||||||
can [:create, :destroy], Subscription, user_id: user.id
|
can %i[create destroy], Subscription, user_id: user.id
|
||||||
|
|
||||||
can [:new, :create], Event do |event|
|
can [:new, :create], Event do |event|
|
||||||
event.program.cfp_open? && event.new_record?
|
event.program.cfp_open? && event.new_record?
|
||||||
|
|
@ -45,11 +47,11 @@ class AdminAbility
|
||||||
can [:destroy], Openid
|
can [:destroy], Openid
|
||||||
can :access, Admin
|
can :access, Admin
|
||||||
can :index, Commercial, commercialable_type: 'Conference'
|
can :index, Commercial, commercialable_type: 'Conference'
|
||||||
cannot [:edit, :update, :destroy], Question, global: true
|
cannot %i[edit update destroy], Question, global: true
|
||||||
# for admins
|
# for admins
|
||||||
can :manage, :all if user.is_admin
|
can :manage, :all if user.is_admin
|
||||||
# even admin cannot create new users with ICHAIN enabled
|
# even admin cannot create new users with ICHAIN enabled
|
||||||
cannot [:new, :create], User if ENV['OSEM_ICHAIN_ENABLED'] == 'true'
|
cannot %i[new create], User if ENV['OSEM_ICHAIN_ENABLED'] == 'true'
|
||||||
cannot :revert_object, PaperTrail::Version do |version|
|
cannot :revert_object, PaperTrail::Version do |version|
|
||||||
(version.event == 'create' && %w[Conference User Event].include?(version.item_type))
|
(version.event == 'create' && %w[Conference User Event].include?(version.item_type))
|
||||||
end
|
end
|
||||||
|
|
@ -67,9 +69,7 @@ class AdminAbility
|
||||||
end
|
end
|
||||||
|
|
||||||
# Prevent requests for tracks from being destroyed
|
# Prevent requests for tracks from being destroyed
|
||||||
cannot :destroy, Track do |track|
|
cannot :destroy, Track, &:self_organized?
|
||||||
track.self_organized?
|
|
||||||
end
|
|
||||||
# Can't accept a booth when booth_limit is reached
|
# Can't accept a booth when booth_limit is reached
|
||||||
cannot :accept, Booth do |booth|
|
cannot :accept, Booth do |booth|
|
||||||
conference = booth.conference
|
conference = booth.conference
|
||||||
|
|
@ -92,10 +92,10 @@ class AdminAbility
|
||||||
org_ids_for_organization_admin = Organization.with_role(:organization_admin, user).pluck(:id)
|
org_ids_for_organization_admin = Organization.with_role(:organization_admin, user).pluck(:id)
|
||||||
conf_ids_for_organization_admin = Conference.where(organization_id: org_ids_for_organization_admin).pluck(:id)
|
conf_ids_for_organization_admin = Conference.where(organization_id: org_ids_for_organization_admin).pluck(:id)
|
||||||
|
|
||||||
can [:read, :update, :destroy, :assign_org_admins, :unassign_org_admins, :admins], Organization, id: org_ids_for_organization_admin
|
can %i[read update destroy assign_org_admins unassign_org_admins admins], Organization, id: org_ids_for_organization_admin
|
||||||
can :new, Conference
|
can :new, Conference
|
||||||
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 %i[index show], Role
|
||||||
|
|
||||||
signed_in_with_organizer_role(user, conf_ids_for_organization_admin)
|
signed_in_with_organizer_role(user, conf_ids_for_organization_admin)
|
||||||
end
|
end
|
||||||
|
|
@ -108,7 +108,7 @@ class AdminAbility
|
||||||
track_ids = Track.joins(:program).where('programs.conference_id IN (?)', conf_ids).pluck(:id)
|
track_ids = Track.joins(:program).where('programs.conference_id IN (?)', conf_ids).pluck(:id)
|
||||||
|
|
||||||
can :manage, Resource, conference_id: conf_ids
|
can :manage, Resource, conference_id: conf_ids
|
||||||
can [:read, :update, :destroy], Conference, id: conf_ids
|
can %i[read update destroy], Conference, id: conf_ids
|
||||||
can :manage, Splashpage, conference_id: conf_ids
|
can :manage, Splashpage, conference_id: conf_ids
|
||||||
can :manage, Contact, conference_id: conf_ids
|
can :manage, Contact, conference_id: conf_ids
|
||||||
can :manage, EmailSettings, conference_id: conf_ids
|
can :manage, EmailSettings, conference_id: conf_ids
|
||||||
|
|
@ -163,8 +163,8 @@ class AdminAbility
|
||||||
role.resource_type == 'Track' && (track_ids.include? role.resource_id)
|
role.resource_type == 'Track' && (track_ids.include? role.resource_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
can [:index, :revert_object, :revert_attribute], PaperTrail::Version, item_type: 'User'
|
can %i[index revert_object revert_attribute], PaperTrail::Version, item_type: 'User'
|
||||||
can [:index, :revert_object, :revert_attribute], PaperTrail::Version, conference_id: conf_ids
|
can %i[index revert_object revert_attribute], PaperTrail::Version, conference_id: conf_ids
|
||||||
end
|
end
|
||||||
|
|
||||||
def signed_in_with_cfp_role(user)
|
def signed_in_with_cfp_role(user)
|
||||||
|
|
@ -174,7 +174,7 @@ class AdminAbility
|
||||||
can :show, Conference do |conf|
|
can :show, Conference do |conf|
|
||||||
conf_ids_for_cfp.include?(conf.id)
|
conf_ids_for_cfp.include?(conf.id)
|
||||||
end
|
end
|
||||||
can [:index, :show, :update], Resource, conference_id: conf_ids_for_cfp
|
can %i[index show update], Resource, conference_id: conf_ids_for_cfp
|
||||||
can :manage, Booth, conference_id: conf_ids_for_cfp
|
can :manage, Booth, conference_id: conf_ids_for_cfp
|
||||||
can :manage, Event, program: { conference_id: conf_ids_for_cfp }
|
can :manage, Event, program: { conference_id: conf_ids_for_cfp }
|
||||||
can :manage, EventType, program: { conference_id: conf_ids_for_cfp }
|
can :manage, EventType, program: { conference_id: conf_ids_for_cfp }
|
||||||
|
|
@ -203,7 +203,7 @@ class AdminAbility
|
||||||
(Conference.with_role(:cfp, user).pluck(:id).include? role.resource_id)
|
(Conference.with_role(:cfp, user).pluck(:id).include? role.resource_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
can [:index, :revert_object, :revert_attribute], PaperTrail::Version,
|
can %i[index revert_object revert_attribute], PaperTrail::Version,
|
||||||
item_type: %w[Event EventType Track DifficultyLevel EmailSettings Room Cfp Program Comment], conference_id: conf_ids_for_cfp
|
item_type: %w[Event EventType Track DifficultyLevel EmailSettings Room Cfp Program Comment], conference_id: conf_ids_for_cfp
|
||||||
can [:index, :revert_object, :revert_attribute], PaperTrail::Version,
|
can [:index, :revert_object, :revert_attribute], PaperTrail::Version,
|
||||||
["item_type = 'Commercial' AND conference_id IN (?) AND (object LIKE '%Event%' OR object_changes LIKE '%Event%')", conf_ids_for_cfp] do |version|
|
["item_type = 'Commercial' AND conference_id IN (?) AND (object LIKE '%Event%' OR object_changes LIKE '%Event%')", conf_ids_for_cfp] do |version|
|
||||||
|
|
@ -219,7 +219,7 @@ class AdminAbility
|
||||||
can :show, Conference do |conf|
|
can :show, Conference do |conf|
|
||||||
conf_ids_for_info_desk.include?(conf.id)
|
conf_ids_for_info_desk.include?(conf.id)
|
||||||
end
|
end
|
||||||
can [:index, :show, :update], Resource, conference_id: conf_ids_for_info_desk
|
can %i[index show update], Resource, conference_id: conf_ids_for_info_desk
|
||||||
can :manage, Registration, conference_id: conf_ids_for_info_desk
|
can :manage, Registration, conference_id: conf_ids_for_info_desk
|
||||||
can :manage, Question, conference_id: conf_ids_for_info_desk
|
can :manage, Question, conference_id: conf_ids_for_info_desk
|
||||||
can :manage, Question do |question|
|
can :manage, Question do |question|
|
||||||
|
|
@ -240,7 +240,7 @@ class AdminAbility
|
||||||
role.resource_type == 'Conference' && role.name == 'info_desk' &&
|
role.resource_type == 'Conference' && role.name == 'info_desk' &&
|
||||||
(Conference.with_role(:info_desk, user).pluck(:id).include? role.resource_id)
|
(Conference.with_role(:info_desk, user).pluck(:id).include? role.resource_id)
|
||||||
end
|
end
|
||||||
can [:index, :revert_object, :revert_attribute], PaperTrail::Version, item_type: 'Registration', conference_id: conf_ids_for_info_desk
|
can %i[index revert_object revert_attribute], PaperTrail::Version, item_type: 'Registration', conference_id: conf_ids_for_info_desk
|
||||||
end
|
end
|
||||||
|
|
||||||
def signed_in_with_volunteers_coordinator_role(user)
|
def signed_in_with_volunteers_coordinator_role(user)
|
||||||
|
|
@ -250,7 +250,7 @@ class AdminAbility
|
||||||
can :show, Conference do |conf|
|
can :show, Conference do |conf|
|
||||||
conf_ids_for_volunteers_coordinator.include?(conf.id)
|
conf_ids_for_volunteers_coordinator.include?(conf.id)
|
||||||
end
|
end
|
||||||
can [:index, :show, :update], Resource, conference_id: conf_ids_for_volunteers_coordinator
|
can %i[index show update], Resource, conference_id: conf_ids_for_volunteers_coordinator
|
||||||
can :manage, Vposition, conference_id: conf_ids_for_volunteers_coordinator
|
can :manage, Vposition, conference_id: conf_ids_for_volunteers_coordinator
|
||||||
can :manage, Vday, conference_id: conf_ids_for_volunteers_coordinator
|
can :manage, Vday, conference_id: conf_ids_for_volunteers_coordinator
|
||||||
|
|
||||||
|
|
@ -286,9 +286,7 @@ class AdminAbility
|
||||||
|
|
||||||
can :manage, Track, id: track_ids_for_track_organizer
|
can :manage, Track, id: track_ids_for_track_organizer
|
||||||
|
|
||||||
cannot [:edit, :update], Track do |track|
|
cannot %i[edit update], Track, &:self_organized_and_accepted_or_confirmed?
|
||||||
track.self_organized_and_accepted_or_confirmed?
|
|
||||||
end
|
|
||||||
|
|
||||||
# Show Roles in the admin sidebar and allow authorization of the index action
|
# Show Roles in the admin sidebar and allow authorization of the index action
|
||||||
can [:index, :show], Role do |role|
|
can [:index, :show], Role do |role|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Ahoy
|
module Ahoy
|
||||||
class Event < ApplicationRecord
|
class Event < ApplicationRecord
|
||||||
self.table_name = 'ahoy_events'
|
self.table_name = 'ahoy_events'
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Answer < ApplicationRecord
|
class Answer < ApplicationRecord
|
||||||
has_many :qanswers
|
has_many :qanswers
|
||||||
has_many :questions, through: :qanswers
|
has_many :questions, through: :qanswers
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ApplicationRecord < ActiveRecord::Base
|
class ApplicationRecord < ActiveRecord::Base
|
||||||
self.abstract_class = true
|
self.abstract_class = true
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Booth < ApplicationRecord
|
class Booth < ApplicationRecord
|
||||||
include ActiveRecord::Transitions
|
include ActiveRecord::Transitions
|
||||||
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }
|
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }
|
||||||
|
|
@ -41,28 +43,28 @@ class Booth < ApplicationRecord
|
||||||
state :confirmed
|
state :confirmed
|
||||||
|
|
||||||
event :restart do
|
event :restart do
|
||||||
transitions to: :new, from: [:withdrawn, :rejected, :canceled]
|
transitions to: :new, from: %i[withdrawn rejected canceled]
|
||||||
end
|
end
|
||||||
event :withdraw do
|
event :withdraw do
|
||||||
transitions to: :withdrawn, from: [:new, :to_accept, :accepted, :to_reject, :rejected, :confirmed]
|
transitions to: :withdrawn, from: %i[new to_accept accepted to_reject rejected confirmed]
|
||||||
end
|
end
|
||||||
event :confirm do
|
event :confirm do
|
||||||
transitions to: :confirmed, from: [:accepted]
|
transitions to: :confirmed, from: [:accepted]
|
||||||
end
|
end
|
||||||
event :to_accept do
|
event :to_accept do
|
||||||
transitions to: :to_accept, from: [:new, :to_reject]
|
transitions to: :to_accept, from: %i[new to_reject]
|
||||||
end
|
end
|
||||||
event :to_reject do
|
event :to_reject do
|
||||||
transitions to: :to_reject, from: [:new, :to_accept]
|
transitions to: :to_reject, from: %i[new to_accept]
|
||||||
end
|
end
|
||||||
event :accept do
|
event :accept do
|
||||||
transitions to: :accepted, from: [:new, :to_accept]
|
transitions to: :accepted, from: %i[new to_accept]
|
||||||
end
|
end
|
||||||
event :reject do
|
event :reject do
|
||||||
transitions to: :rejected, from: [:new, :to_reject]
|
transitions to: :rejected, from: %i[new to_reject]
|
||||||
end
|
end
|
||||||
event :cancel do
|
event :cancel do
|
||||||
transitions to: :canceled, from: [:accepted, :rejected, :to_accept, :to_reject, :confirmed]
|
transitions to: :canceled, from: %i[accepted rejected to_accept to_reject confirmed]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class BoothRequest < ApplicationRecord
|
class BoothRequest < ApplicationRecord
|
||||||
belongs_to :booth
|
belongs_to :booth
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Campaign < ApplicationRecord
|
class Campaign < ApplicationRecord
|
||||||
validates :name, :utm_campaign, presence: true
|
validates :name, :utm_campaign, presence: true
|
||||||
|
|
||||||
|
|
@ -66,11 +68,11 @@ class Campaign < ApplicationRecord
|
||||||
# * +Hash+ -> parameter => value
|
# * +Hash+ -> parameter => value
|
||||||
def get_parameters
|
def get_parameters
|
||||||
conditions = {}
|
conditions = {}
|
||||||
conditions[:utm_source] = self[:utm_source] unless self[:utm_source].blank?
|
conditions[:utm_source] = self[:utm_source] if self[:utm_source].present?
|
||||||
conditions[:utm_medium] = self[:utm_medium] unless self[:utm_medium].blank?
|
conditions[:utm_medium] = self[:utm_medium] if self[:utm_medium].present?
|
||||||
conditions[:utm_term] = self[:utm_term] unless self[:utm_term].blank?
|
conditions[:utm_term] = self[:utm_term] if self[:utm_term].present?
|
||||||
conditions[:utm_content] = self[:utm_content] unless self[:utm_content].blank?
|
conditions[:utm_content] = self[:utm_content] if self[:utm_content].present?
|
||||||
conditions[:utm_campaign] = self[:utm_campaign] unless self[:utm_campaign].blank?
|
conditions[:utm_campaign] = self[:utm_campaign] if self[:utm_campaign].present?
|
||||||
conditions
|
conditions
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# cannot delete program if there are events submitted
|
# cannot delete program if there are events submitted
|
||||||
|
|
||||||
class Cfp < ApplicationRecord
|
class Cfp < ApplicationRecord
|
||||||
TYPES = %w(events booths tracks).freeze
|
TYPES = %w[events booths tracks].freeze
|
||||||
|
|
||||||
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }
|
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }
|
||||||
belongs_to :program
|
belongs_to :program
|
||||||
|
|
@ -27,11 +29,11 @@ class Cfp < ApplicationRecord
|
||||||
# * +True+ -> If cfp dates is updated and all other parameters are set
|
# * +True+ -> If cfp dates is updated and all other parameters are set
|
||||||
# * +False+ -> Either cfp date is not updated or one or more parameter is not set
|
# * +False+ -> Either cfp date is not updated or one or more parameter is not set
|
||||||
def notify_on_cfp_date_update?
|
def notify_on_cfp_date_update?
|
||||||
!end_date.blank? && !start_date.blank?\
|
end_date.present? && start_date.present?\
|
||||||
&& (start_date_changed? || end_date_changed?)\
|
&& (start_date_changed? || end_date_changed?)\
|
||||||
&& program.conference.email_settings.send_on_cfp_dates_updated\
|
&& program.conference.email_settings.send_on_cfp_dates_updated\
|
||||||
&& !program.conference.email_settings.cfp_dates_updated_subject.blank?\
|
&& program.conference.email_settings.cfp_dates_updated_subject.present?\
|
||||||
&& !program.conference.email_settings.cfp_dates_updated_body.blank?
|
&& program.conference.email_settings.cfp_dates_updated_body.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
@ -106,20 +108,22 @@ class Cfp < ApplicationRecord
|
||||||
private
|
private
|
||||||
|
|
||||||
def before_end_of_conference
|
def before_end_of_conference
|
||||||
if program && program.conference && program.conference.end_date && end_date && (end_date > program.conference.end_date)
|
if program&.conference && program.conference.end_date && end_date && (end_date > program.conference.end_date)
|
||||||
errors
|
errors
|
||||||
.add(:end_date, "can't be after the conference end date (#{program.conference.end_date})")
|
.add(:end_date, "can't be after the conference end date (#{program.conference.end_date})")
|
||||||
end
|
end
|
||||||
|
|
||||||
if program && program.conference && program.conference.end_date && start_date && (start_date > program.conference.end_date)
|
if program&.conference && program.conference.end_date && start_date && (start_date > program.conference.end_date)
|
||||||
errors
|
errors
|
||||||
.add(:start_date, "can't be after the conference end date (#{program.conference.end_date})")
|
.add(:start_date, "can't be after the conference end date (#{program.conference.end_date})")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def start_after_end_date
|
def start_after_end_date
|
||||||
|
if start_date && end_date && start_date > end_date
|
||||||
errors
|
errors
|
||||||
.add(:start_date, "can't be after the end date") if start_date && end_date && start_date > end_date
|
.add(:start_date, "can't be after the end date")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def conference_id
|
def conference_id
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,21 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Comment < ApplicationRecord
|
class Comment < ApplicationRecord
|
||||||
acts_as_nested_set scope: %i(commentable_id commentable_type)
|
acts_as_nested_set scope: %i[commentable_id commentable_type]
|
||||||
validates :body, presence: true
|
validates :body, presence: true
|
||||||
validates :user, presence: true
|
validates :user, presence: true
|
||||||
after_create :send_notification
|
after_create :send_notification
|
||||||
|
|
||||||
# NOTE: install the acts_as_votable plugin if you
|
# NOTE: install the acts_as_votable plugin if you
|
||||||
# want user to vote on the quality of comments.
|
# want user to vote on the quality of comments.
|
||||||
#acts_as_votable
|
# acts_as_votable
|
||||||
|
|
||||||
belongs_to :commentable, counter_cache: true, polymorphic: true
|
belongs_to :commentable, counter_cache: true, polymorphic: true
|
||||||
|
|
||||||
# NOTE: Comments belong to a user
|
# NOTE: Comments belong to a user
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
has_paper_trail on: %i(create destroy), meta: { conference_id: :conference_id }
|
has_paper_trail on: %i[create destroy], meta: { conference_id: :conference_id }
|
||||||
|
|
||||||
# Helper class method that allows you to build a comment
|
# Helper class method that allows you to build a comment
|
||||||
# by passing a commentable object, a user_id, and comment text
|
# by passing a commentable object, a user_id, and comment text
|
||||||
|
|
@ -25,7 +27,7 @@ class Comment < ApplicationRecord
|
||||||
user_id: user_id
|
user_id: user_id
|
||||||
end
|
end
|
||||||
|
|
||||||
#helper method to check if a comment has children
|
# helper method to check if a comment has children
|
||||||
def has_children?
|
def has_children?
|
||||||
children.any?
|
children.any?
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Commercial < ApplicationRecord
|
class Commercial < ApplicationRecord
|
||||||
require 'oembed'
|
require 'oembed'
|
||||||
|
|
||||||
|
|
@ -6,7 +8,7 @@ class Commercial < ApplicationRecord
|
||||||
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }
|
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }
|
||||||
|
|
||||||
validates :url, presence: true, uniqueness: { scope: :commercialable }
|
validates :url, presence: true, uniqueness: { scope: :commercialable }
|
||||||
validates :url, format: URI::regexp(%w(http https))
|
validates :url, format: URI.regexp(%w[http https])
|
||||||
|
|
||||||
validate :valid_url
|
validate :valid_url
|
||||||
|
|
||||||
|
|
@ -36,9 +38,7 @@ class Commercial < ApplicationRecord
|
||||||
errors[:no_event] << id && next unless event
|
errors[:no_event] << id && next unless event
|
||||||
|
|
||||||
commercial = event.commercials.new(url: url)
|
commercial = event.commercials.new(url: url)
|
||||||
unless commercial.save
|
errors[:validation_errors] << "Could not create commercial for event with ID #{event.id} (" + commercial.errors.full_messages.to_sentence + ')' unless commercial.save
|
||||||
errors[:validation_errors] << "Could not create commercial for event with ID #{event.id} (" + commercial.errors.full_messages.to_sentence + ')'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
errors
|
errors
|
||||||
end
|
end
|
||||||
|
|
@ -47,9 +47,7 @@ class Commercial < ApplicationRecord
|
||||||
|
|
||||||
def valid_url
|
def valid_url
|
||||||
result = Commercial.render_from_url(url)
|
result = Commercial.render_from_url(url)
|
||||||
if result[:error]
|
errors.add(:base, result[:error]) if result[:error]
|
||||||
errors.add(:base, result[:error])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.register_provider
|
def self.register_provider
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module RevisionCount
|
module RevisionCount
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Conference < ApplicationRecord
|
class Conference < ApplicationRecord
|
||||||
include RevisionCount
|
include RevisionCount
|
||||||
require 'uri'
|
require 'uri'
|
||||||
|
|
@ -12,7 +14,7 @@ class Conference < ApplicationRecord
|
||||||
|
|
||||||
belongs_to :organization
|
belongs_to :organization
|
||||||
|
|
||||||
has_paper_trail ignore: %i(updated_at guid revision events_per_week), meta: { conference_id: :id }
|
has_paper_trail ignore: %i[updated_at guid revision events_per_week], meta: { conference_id: :id }
|
||||||
|
|
||||||
has_and_belongs_to_many :questions
|
has_and_belongs_to_many :questions
|
||||||
|
|
||||||
|
|
@ -91,7 +93,7 @@ class Conference < ApplicationRecord
|
||||||
after_create :create_free_ticket
|
after_create :create_free_ticket
|
||||||
after_update :delete_event_schedules
|
after_update :delete_event_schedules
|
||||||
|
|
||||||
enum ticket_layout: [:portrait, :landscape]
|
enum ticket_layout: %i[portrait landscape]
|
||||||
|
|
||||||
##
|
##
|
||||||
# Checks if the user is registered to the conference
|
# Checks if the user is registered to the conference
|
||||||
|
|
@ -101,7 +103,7 @@ class Conference < ApplicationRecord
|
||||||
# ====Returns
|
# ====Returns
|
||||||
# * +false+ -> If the user is registered
|
# * +false+ -> If the user is registered
|
||||||
# * +true+ - If the user isn't registered
|
# * +true+ - If the user isn't registered
|
||||||
def user_registered? user
|
def user_registered?(user)
|
||||||
user.present? && registrations.where(user_id: user.id).count > 0
|
user.present? && registrations.where(user_id: user.id).count > 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -151,7 +153,7 @@ class Conference < ApplicationRecord
|
||||||
def get_submissions_per_week
|
def get_submissions_per_week
|
||||||
result = []
|
result = []
|
||||||
|
|
||||||
if program && program.cfp && program.events
|
if program&.cfp && program.events
|
||||||
submissions = program.events.select(:week).group(:week).order(:week).count
|
submissions = program.events.select(:week).group(:week).order(:week).count
|
||||||
start_week = program.cfp.start_week
|
start_week = program.cfp.start_week
|
||||||
weeks = program.cfp.weeks
|
weeks = program.cfp.weeks
|
||||||
|
|
@ -168,7 +170,7 @@ class Conference < ApplicationRecord
|
||||||
# * +Array+ -> e.g. 'Submitted' => [0, 3, 3, 5] -> first week 0 events, second week 3 events.
|
# * +Array+ -> e.g. 'Submitted' => [0, 3, 3, 5] -> first week 0 events, second week 3 events.
|
||||||
def get_submissions_data
|
def get_submissions_data
|
||||||
result = {}
|
result = {}
|
||||||
if program && program.cfp && program.events
|
if program&.cfp && program.events
|
||||||
result = get_events_per_week_by_state
|
result = get_events_per_week_by_state
|
||||||
|
|
||||||
start_week = program.cfp.start_week
|
start_week = program.cfp.start_week
|
||||||
|
|
@ -269,8 +271,7 @@ class Conference < ApplicationRecord
|
||||||
def registration_weeks
|
def registration_weeks
|
||||||
result = 0
|
result = 0
|
||||||
weeks = 0
|
weeks = 0
|
||||||
if registration_period &&
|
if registration_period&.start_date &&
|
||||||
registration_period.start_date &&
|
|
||||||
registration_period.end_date
|
registration_period.end_date
|
||||||
weeks = Date.new(registration_period.start_date.year, 12, 31)
|
weeks = Date.new(registration_period.start_date.year, 12, 31)
|
||||||
.strftime('%W').to_i
|
.strftime('%W').to_i
|
||||||
|
|
@ -343,7 +344,7 @@ class Conference < ApplicationRecord
|
||||||
tracks: tracks_set?,
|
tracks: tracks_set?,
|
||||||
event_types: event_types_set?,
|
event_types: event_types_set?,
|
||||||
difficulty_levels: difficulty_levels_set?,
|
difficulty_levels: difficulty_levels_set?,
|
||||||
splashpage: splashpage && splashpage.public?
|
splashpage: splashpage&.public?
|
||||||
}
|
}
|
||||||
|
|
||||||
result.update(
|
result.update(
|
||||||
|
|
@ -671,9 +672,7 @@ class Conference < ApplicationRecord
|
||||||
result[state.name] = count
|
result[state.name] = count
|
||||||
end
|
end
|
||||||
|
|
||||||
unless conference.events_per_week
|
conference.events_per_week = {} unless conference.events_per_week
|
||||||
conference.events_per_week = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
# Write to database
|
# Write to database
|
||||||
conference.events_per_week[week] = result
|
conference.events_per_week[week] = result
|
||||||
|
|
@ -785,7 +784,7 @@ class Conference < ApplicationRecord
|
||||||
# the color. We make use of big prime numbers to avoid repetition and to make
|
# the color. We make use of big prime numbers to avoid repetition and to make
|
||||||
# consecutive colors clearly different.
|
# consecutive colors clearly different.
|
||||||
def next_color_component(component, i)
|
def next_color_component(component, i)
|
||||||
big_prime_numbers = {r: 113, g: 67, b: 151}
|
big_prime_numbers = { r: 113, g: 67, b: 151 }
|
||||||
((i * big_prime_numbers[component]) % 239 + 16).to_s(16)
|
((i * big_prime_numbers[component]) % 239 + 16).to_s(16)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -861,14 +860,11 @@ class Conference < ApplicationRecord
|
||||||
# Completed weeks
|
# Completed weeks
|
||||||
events_per_week.each do |week, values|
|
events_per_week.each do |week, values|
|
||||||
values.each do |state, value|
|
values.each do |state, value|
|
||||||
if %i(confirmed unconfirmed).include?(state)
|
next unless %i[confirmed unconfirmed].include?(state)
|
||||||
unless result[state.to_s.capitalize]
|
result[state.to_s.capitalize] = {} unless result[state.to_s.capitalize]
|
||||||
result[state.to_s.capitalize] = {}
|
|
||||||
end
|
|
||||||
result[state.to_s.capitalize][week.strftime('%W').to_i] = value
|
result[state.to_s.capitalize][week.strftime('%W').to_i] = value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
# Actual week
|
# Actual week
|
||||||
this_week = Date.today.end_of_week.strftime('%W').to_i
|
this_week = Date.today.end_of_week.strftime('%W').to_i
|
||||||
|
|
@ -923,9 +919,7 @@ class Conference < ApplicationRecord
|
||||||
# * +Array+
|
# * +Array+
|
||||||
def pad_left(first_week, start_week)
|
def pad_left(first_week, start_week)
|
||||||
left = []
|
left = []
|
||||||
if first_week > start_week
|
left = Array.new(first_week - start_week - 1, 0) if first_week > start_week
|
||||||
left = Array.new(first_week - start_week - 1, 0)
|
|
||||||
end
|
|
||||||
left
|
left
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -938,9 +932,7 @@ class Conference < ApplicationRecord
|
||||||
def assert_keys_are_continuously(hash)
|
def assert_keys_are_continuously(hash)
|
||||||
keys = hash.keys
|
keys = hash.keys
|
||||||
(keys.min..keys.max).each do |key|
|
(keys.min..keys.max).each do |key|
|
||||||
unless hash[key]
|
hash[key] = 0 unless hash[key]
|
||||||
hash[key] = 0
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
Hash[hash.sort]
|
Hash[hash.sort]
|
||||||
end
|
end
|
||||||
|
|
@ -1048,13 +1040,12 @@ class Conference < ApplicationRecord
|
||||||
|
|
||||||
grouped.each do |event|
|
grouped.each do |event|
|
||||||
object = event.send(symbol)
|
object = event.send(symbol)
|
||||||
if object
|
next unless object
|
||||||
result[object.title] = {
|
result[object.title] = {
|
||||||
'value' => counter[object.id],
|
'value' => counter[object.id],
|
||||||
'color' => object.color
|
'color' => object.color
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -1067,13 +1058,12 @@ class Conference < ApplicationRecord
|
||||||
def calculate_track_distribution_hash(tracks_grouped, tracks_counter)
|
def calculate_track_distribution_hash(tracks_grouped, tracks_counter)
|
||||||
result = {}
|
result = {}
|
||||||
tracks_grouped.each do |event|
|
tracks_grouped.each do |event|
|
||||||
if event.track
|
next unless event.track
|
||||||
result[event.track.name] = {
|
result[event.track.name] = {
|
||||||
'value' => tracks_counter[event.track_id],
|
'value' => tracks_counter[event.track_id],
|
||||||
'color' => event.track.color
|
'color' => event.track.color
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -1145,9 +1135,7 @@ class Conference < ApplicationRecord
|
||||||
counter.each do |key, value|
|
counter.each do |key, value|
|
||||||
# make PG happy by including the user_id in ORDER
|
# make PG happy by including the user_id in ORDER
|
||||||
submitter = submitters.where(user_id: key).order(:user_id).first
|
submitter = submitters.where(user_id: key).order(:user_id).first
|
||||||
if submitter
|
result[submitter.user] = value if submitter
|
||||||
result[submitter.user] = value
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
@ -1165,9 +1153,9 @@ class Conference < ApplicationRecord
|
||||||
#
|
#
|
||||||
def generate_guid
|
def generate_guid
|
||||||
guid = SecureRandom.urlsafe_base64
|
guid = SecureRandom.urlsafe_base64
|
||||||
# begin
|
# begin
|
||||||
# guid = SecureRandom.urlsafe_base64
|
# guid = SecureRandom.urlsafe_base64
|
||||||
# end while User.where(:guid => guid).exists?
|
# end while User.where(:guid => guid).exists?
|
||||||
self.guid = guid
|
self.guid = guid
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -1175,19 +1163,17 @@ class Conference < ApplicationRecord
|
||||||
# Adds a random color to the conference
|
# Adds a random color to the conference
|
||||||
#
|
#
|
||||||
def add_color
|
def add_color
|
||||||
unless color
|
self.color = get_color unless color
|
||||||
self.color = get_color
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_color
|
def get_color
|
||||||
%w(
|
%w[
|
||||||
#000000 #0000FF #00FF00 #FF0000 #FFFF00 #9900CC
|
#000000 #0000FF #00FF00 #FF0000 #FFFF00 #9900CC
|
||||||
#CC0066 #00FFFF #FF00FF #C0C0C0 #00008B #FFD700
|
#CC0066 #00FFFF #FF00FF #C0C0C0 #00008B #FFD700
|
||||||
#FFA500 #FF1493 #FF00FF #F0FFFF #EE82EE #D2691E
|
#FFA500 #FF1493 #FF00FF #F0FFFF #EE82EE #D2691E
|
||||||
#C0C0C0 #A52A2A #9ACD32 #9400D3 #8B008B #8B0000
|
#C0C0C0 #A52A2A #9ACD32 #9400D3 #8B008B #8B0000
|
||||||
#87CEEB #808080 #800080 #008B8B #006400
|
#87CEEB #808080 #800080 #008B8B #006400
|
||||||
).sample
|
].sample
|
||||||
end
|
end
|
||||||
|
|
||||||
# Calculates items per week from a hash.
|
# Calculates items per week from a hash.
|
||||||
|
|
@ -1206,9 +1192,7 @@ class Conference < ApplicationRecord
|
||||||
|
|
||||||
items.each do |key, value|
|
items.each do |key, value|
|
||||||
# Padding
|
# Padding
|
||||||
if last_key < (key.to_i - 1)
|
result += Array.new(key.to_i - last_key - 1, sum) if last_key < (key.to_i - 1)
|
||||||
result += Array.new(key.to_i - last_key - 1, sum)
|
|
||||||
end
|
|
||||||
|
|
||||||
sum += value
|
sum += value
|
||||||
result.push(sum)
|
result.push(sum)
|
||||||
|
|
@ -1216,9 +1200,7 @@ class Conference < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
# Padding right
|
# Padding right
|
||||||
if result.length < weeks
|
result += Array.new(weeks - result.length, sum) if result.length < weeks
|
||||||
result += Array.new(weeks - result.length, sum)
|
|
||||||
end
|
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Contact < ApplicationRecord
|
class Contact < ApplicationRecord
|
||||||
has_paper_trail on: [:update], ignore: [:updated_at], meta: { conference_id: :conference_id }
|
has_paper_trail on: [:update], ignore: [:updated_at], meta: { conference_id: :conference_id }
|
||||||
|
|
||||||
|
|
@ -6,7 +8,7 @@ class Contact < ApplicationRecord
|
||||||
validates :conference, presence: true
|
validates :conference, presence: true
|
||||||
# Conferences only have one contact
|
# Conferences only have one contact
|
||||||
validates :facebook, :twitter, :googleplus, :instagram, :mastodon,
|
validates :facebook, :twitter, :googleplus, :instagram, :mastodon,
|
||||||
format: URI::regexp(%w(http https)), allow_blank: true
|
format: URI.regexp(%w[http https]), allow_blank: true
|
||||||
|
|
||||||
def has_social_media?
|
def has_social_media?
|
||||||
return true if facebook.present? || twitter.present? || googleplus.present? || instagram.present? || mastodon.present? || email.present?
|
return true if facebook.present? || twitter.present? || googleplus.present? || instagram.present? || mastodon.present? || email.present?
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DifficultyLevel < ApplicationRecord
|
class DifficultyLevel < ApplicationRecord
|
||||||
belongs_to :program, touch: true
|
belongs_to :program, touch: true
|
||||||
has_many :events, dependent: :nullify
|
has_many :events, dependent: :nullify
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class EmailSettings < ApplicationRecord
|
class EmailSettings < ApplicationRecord
|
||||||
belongs_to :conference
|
belongs_to :conference
|
||||||
|
|
||||||
|
|
@ -11,12 +13,15 @@ class EmailSettings < ApplicationRecord
|
||||||
'conference_start_date' => conference.start_date,
|
'conference_start_date' => conference.start_date,
|
||||||
'conference_end_date' => conference.end_date,
|
'conference_end_date' => conference.end_date,
|
||||||
'registrationlink' => Rails.application.routes.url_helpers.conference_conference_registration_url(
|
'registrationlink' => Rails.application.routes.url_helpers.conference_conference_registration_url(
|
||||||
conference.short_title, host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000')),
|
conference.short_title, host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000')
|
||||||
|
),
|
||||||
'conference_splash_link' => Rails.application.routes.url_helpers.conference_url(
|
'conference_splash_link' => Rails.application.routes.url_helpers.conference_url(
|
||||||
conference.short_title, host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000')),
|
conference.short_title, host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000')
|
||||||
|
),
|
||||||
|
|
||||||
'schedule_link' => Rails.application.routes.url_helpers.conference_schedule_url(
|
'schedule_link' => Rails.application.routes.url_helpers.conference_schedule_url(
|
||||||
conference.short_title, host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000'))
|
conference.short_title, host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000')
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if conference.program.cfp
|
if conference.program.cfp
|
||||||
|
|
@ -43,12 +48,11 @@ class EmailSettings < ApplicationRecord
|
||||||
if event
|
if event
|
||||||
h['eventtitle'] = event.title
|
h['eventtitle'] = event.title
|
||||||
h['proposalslink'] = Rails.application.routes.url_helpers.conference_program_proposals_url(
|
h['proposalslink'] = Rails.application.routes.url_helpers.conference_program_proposals_url(
|
||||||
conference.short_title, host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000'))
|
conference.short_title, host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000')
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
if booth
|
h['booth_title'] = booth.title if booth
|
||||||
h['booth_title'] = booth.title
|
|
||||||
end
|
|
||||||
h
|
h
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -71,8 +75,8 @@ class EmailSettings < ApplicationRecord
|
||||||
|
|
||||||
def parse_template(text, values)
|
def parse_template(text, values)
|
||||||
values.each do |key, value|
|
values.each do |key, value|
|
||||||
if value.kind_of?(Date)
|
if value.is_a?(Date)
|
||||||
text = text.gsub "{#{key}}", value.strftime('%Y-%m-%d') unless text.blank?
|
text = text.gsub "{#{key}}", value.strftime('%Y-%m-%d') if text.present?
|
||||||
else
|
else
|
||||||
text = text.gsub "{#{key}}", value unless text.blank? || value.blank?
|
text = text.gsub "{#{key}}", value unless text.blank? || value.blank?
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue