Tidying up.

This commit is contained in:
James Mason 2018-02-22 21:23:41 -08:00
parent 81bad2eb4d
commit 4951d085f5
4 changed files with 28 additions and 36 deletions

View file

@ -156,7 +156,6 @@ Layout/MultilineMethodCallIndentation:
# SupportedStyles: aligned, indented # SupportedStyles: aligned, indented
Layout/MultilineOperationIndentation: Layout/MultilineOperationIndentation:
Exclude: Exclude:
- 'app/controllers/admin/events_controller.rb'
- 'app/controllers/application_controller.rb' - 'app/controllers/application_controller.rb'
- 'app/models/conference.rb' - 'app/models/conference.rb'
- 'app/models/event.rb' - 'app/models/event.rb'
@ -212,7 +211,6 @@ Layout/SpaceBeforeSemicolon:
Layout/SpaceInsideBlockBraces: Layout/SpaceInsideBlockBraces:
Exclude: Exclude:
- 'app/controllers/admin/comments_controller.rb' - 'app/controllers/admin/comments_controller.rb'
- 'app/controllers/admin/events_controller.rb'
- 'app/controllers/admin/questions_controller.rb' - 'app/controllers/admin/questions_controller.rb'
- 'app/helpers/application_helper.rb' - 'app/helpers/application_helper.rb'
- 'app/models/program.rb' - 'app/models/program.rb'
@ -325,7 +323,7 @@ Metrics/MethodLength:
# Offense count: 4 # Offense count: 4
# Configuration parameters: CountComments. # Configuration parameters: CountComments.
Metrics/ModuleLength: Metrics/ModuleLength:
Max: 171 Max: 200
# Offense count: 20 # Offense count: 20
Metrics/PerceivedComplexity: Metrics/PerceivedComplexity:
@ -334,7 +332,6 @@ Metrics/PerceivedComplexity:
# Offense count: 20 # Offense count: 20
Naming/AccessorMethodName: Naming/AccessorMethodName:
Exclude: Exclude:
- 'app/controllers/admin/events_controller.rb'
- 'app/controllers/application_controller.rb' - 'app/controllers/application_controller.rb'
- 'app/models/campaign.rb' - 'app/models/campaign.rb'
- 'app/models/conference.rb' - 'app/models/conference.rb'
@ -473,7 +470,6 @@ Style/HashSyntax:
# Configuration parameters: MaxLineLength. # Configuration parameters: MaxLineLength.
Style/IfUnlessModifier: Style/IfUnlessModifier:
Exclude: Exclude:
- 'app/controllers/admin/events_controller.rb'
- 'app/controllers/api/v1/events_controller.rb' - '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/controllers/users/omniauth_callbacks_controller.rb'

View file

@ -111,10 +111,7 @@ module Admin
end end
def show def show
@program = @conference.program @program = @conference.program || Program.new(conference_id: @conference.id)
unless @conference.program
@program = Program.new(conference_id: @conference.id)
end
# Overview and since last login information # Overview and since last login information
@total_reg = @conference.registrations.count @total_reg = @conference.registrations.count
@ -147,7 +144,6 @@ module Admin
@submissions = Conference.get_event_state_line_colors @submissions = Conference.get_event_state_line_colors
@submissions_data = {}
@submissions_data = @conference.get_submissions_data @submissions_data = @conference.get_submissions_data
@cfp_weeks = 0 @cfp_weeks = 0
if @submissions_data['Weeks'] if @submissions_data['Weeks']
@ -155,7 +151,6 @@ module Admin
@submissions_data = @submissions_data.except('Weeks') @submissions_data = @submissions_data.except('Weeks')
end end
@tickets_data = {}
@tickets_data = @conference.get_tickets_data @tickets_data = @conference.get_tickets_data
@ticket_weeks = 0 @ticket_weeks = 0
if @tickets_data['Weeks'] if @tickets_data['Weeks']

View file

@ -7,15 +7,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 :get_tracks, only: [:index, :show, :edit] before_action :assign_tracks, only: [:index, :show, :edit]
# FIXME: The timezome should only be applied on output, otherwise
# you get lost in timezone conversions...
# around_filter :set_timezone_for_this_request
def set_timezone_for_this_request(&block)
Time.use_zone(@conference.timezone, &block)
end
def index def index
@difficulty_levels = @program.difficulty_levels @difficulty_levels = @program.difficulty_levels
@ -70,9 +62,7 @@ module Admin
comment.commentable = @event comment.commentable = @event
comment.user_id = current_user.id comment.user_id = current_user.id
comment.save! comment.save!
unless params[:parent].nil? comment.move_to_child_of(params[:parent]) unless params[:parent].nil?
comment.move_to_child_of(params[:parent])
end
redirect_to admin_conference_program_event_path(@conference.short_title, @event) redirect_to admin_conference_program_event_path(@conference.short_title, @event)
end end
@ -207,7 +197,7 @@ module Admin
end end
end end
def get_tracks def assign_tracks
@tracks = Track.accessible_by(current_ability).where(program: @program).confirmed @tracks = Track.accessible_by(current_ability).where(program: @program).confirmed
end end
end end

View file

@ -6,11 +6,14 @@
= "(#{@events.length})" if @events.any? = "(#{@events.length})" if @events.any?
.btn-group.pull-right .btn-group.pull-right
%button.btn.btn-primary{ 'data-toggle' => 'modal', 'data-target' => '#mass-commercials-modal', title: 'Mass import of commercials for events' } %button.btn.btn-primary{ title: 'Mass import of commercials for events',
data: { toggle: 'modal', target: '#mass-commercials-modal' } }
Add Commercials Add Commercials
- if can? :create, Event - if can? :create, Event
= link_to 'Add Event', new_admin_conference_program_event_path(@conference.short_title), class: 'button btn btn-default btn-info' = link_to 'Add Event',
new_admin_conference_program_event_path(@conference.short_title),
class: 'button btn btn-default btn-info'
- if can? :read, Event - if can? :read, Event
- @export_formats.each do |export_format| - @export_formats.each do |export_format|
@ -34,17 +37,25 @@
%b 11:https://youtube.com/myvideo %b 11:https://youtube.com/myvideo
.modal-body .modal-body
= semantic_form_for '', url: mass_upload_commercials_admin_conference_program_path(@conference.short_title), method: :post do |f| = semantic_form_for '',
url: mass_upload_commercials_admin_conference_program_path(@conference.short_title),
method: :post do |f|
= f.input 'file', as: :file = f.input 'file', as: :file
.modal-footer .modal-footer
= f.submit 'Add', class: 'btn btn-primary' = f.submit 'Add', class: 'btn btn-primary'
.row .row
.col-md-4 .col-md-4
= render partial: 'admin/conferences/doughnut_chart', locals: { title: 'Events state', data: @event_distribution } = render 'admin/conferences/doughnut_chart',
title: 'Events state',
data: @event_distribution
.col-md-4 .col-md-4
= render partial: 'admin/conferences/doughnut_chart', locals: { title: 'Confirmed events scheduled', data: @scheduled_event_distribution } = render 'admin/conferences/doughnut_chart',
title: 'Confirmed events scheduled',
data: @scheduled_event_distribution
.col-md-4 .col-md-4
= render partial: 'admin/conferences/doughnut_chart', locals: { title: 'Tracks of confirmed events', data: @tracks_distribution_confirmed } = render 'admin/conferences/doughnut_chart',
title: 'Tracks of confirmed events',
data: @tracks_distribution_confirmed
.row .row
.col-md-12 .col-md-12
.margin-event-table .margin-event-table