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

View file

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

View file

@ -7,15 +7,7 @@ module Admin
# For some reason this doesn't work, so a workaround is used
# load_and_authorize_resource :track, through: :program, only: [:index, :show, :edit]
before_action :get_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
before_action :assign_tracks, only: [:index, :show, :edit]
def index
@difficulty_levels = @program.difficulty_levels
@ -35,7 +27,7 @@ module Admin
response.headers['Content-Disposition'] = "attachment; filename=\"#{@file_name}.xlsx\""
render 'events'
end
format.pdf {render 'events'}
format.pdf { render 'events' }
format.csv do
response.headers['Content-Disposition'] = "attachment; filename=\"#{@file_name}.csv\""
render 'events'
@ -70,9 +62,7 @@ module Admin
comment.commentable = @event
comment.user_id = current_user.id
comment.save!
unless params[:parent].nil?
comment.move_to_child_of(params[:parent])
end
comment.move_to_child_of(params[:parent]) unless params[:parent].nil?
redirect_to admin_conference_program_event_path(@conference.short_title, @event)
end
@ -207,7 +197,7 @@ module Admin
end
end
def get_tracks
def assign_tracks
@tracks = Track.accessible_by(current_ability).where(program: @program).confirmed
end
end

View file

@ -6,11 +6,14 @@
= "(#{@events.length})" if @events.any?
.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
- 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
- @export_formats.each do |export_format|
@ -34,17 +37,25 @@
%b 11:https://youtube.com/myvideo
.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
.modal-footer
= f.submit 'Add', class: 'btn btn-primary'
.row
.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
= 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
= 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
.col-md-12
.margin-event-table
@ -61,7 +72,7 @@
%b Submitter
%th
%b Speakers
-if @program.languages.present?
- if @program.languages.present?
%th
%b Language
%th