UI/UX changes related to tracks
Add confirmed and cfp_active scopes to Track Render markdown in track's description Make the views more similar to the proposal/events views Change the sequence of columns in admin/Tracks#index Remove the short_name column from the index views Add button "My Tracks" in the user menu Fix track count in proposals Add details of track in admin/Tracks#show Use tabs to show track details and events
This commit is contained in:
parent
f9903eba16
commit
3d250ecf75
14 changed files with 269 additions and 132 deletions
|
|
@ -182,6 +182,7 @@ linters:
|
|||
- "app/views/tracks/show.html.haml"
|
||||
- "app/views/conferences/_call_for_tracks.html.haml"
|
||||
- "app/views/admin/tracks/_change_state_dropdown.html.haml"
|
||||
- "app/views/proposals/_encouragement_text.html.haml"
|
||||
|
||||
# Offense count: 223
|
||||
InstanceVariables:
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ module Admin
|
|||
|
||||
def index
|
||||
@events = @program.events
|
||||
@tracks = @program.tracks
|
||||
@tracks = @program.tracks.confirmed.cfp_active
|
||||
@difficulty_levels = @program.difficulty_levels
|
||||
@event_types = @program.event_types
|
||||
@tracks_distribution_confirmed = @conference.tracks_distribution(:confirmed)
|
||||
|
|
@ -43,7 +43,7 @@ module Admin
|
|||
end
|
||||
|
||||
def show
|
||||
@tracks = @program.tracks
|
||||
@tracks = @program.tracks.confirmed.cfp_active
|
||||
@event_types = @program.event_types
|
||||
@comments = @event.root_comments
|
||||
@comment_count = @event.comment_threads.count
|
||||
|
|
@ -58,7 +58,7 @@ module Admin
|
|||
|
||||
def edit
|
||||
@event_types = @program.event_types
|
||||
@tracks = Track.all
|
||||
@tracks = @program.tracks.confirmed.cfp_active
|
||||
@comments = @event.root_comments
|
||||
@comment_count = @event.comment_threads.count
|
||||
@user = @event.submitter
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def tracks(conference)
|
||||
all = conference.program.tracks.where(state: 'confirmed', cfp_active: true).pluck(:name)
|
||||
all = conference.program.tracks.confirmed.cfp_active.pluck(:name)
|
||||
first = all[0...-1]
|
||||
last = all[-1]
|
||||
ts = ''
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ class Track < ActiveRecord::Base
|
|||
|
||||
before_validation :capitalize_color
|
||||
|
||||
scope :confirmed, -> { where(state: 'confirmed') }
|
||||
scope :cfp_active, -> { where(cfp_active: true) }
|
||||
|
||||
state_machine initial: :pending do
|
||||
state :new
|
||||
state :to_accept
|
||||
|
|
|
|||
|
|
@ -6,39 +6,46 @@
|
|||
Categorize events in your conference
|
||||
.row
|
||||
.col-md-12
|
||||
%table.table.table-hover#tracks
|
||||
%table.table.table-hover.table-striped.table-bordered.datatable#tracks
|
||||
%thead
|
||||
%th Name
|
||||
%th Short name
|
||||
%th Description
|
||||
%th Submitter
|
||||
%th Color
|
||||
%th State
|
||||
%th Included in the Cfp
|
||||
%th Room
|
||||
%th Start Date
|
||||
%th End Date
|
||||
%th Submitter
|
||||
%th Included in Cfp
|
||||
%th State
|
||||
%th Actions
|
||||
%tbody
|
||||
- @tracks.each do |track|
|
||||
%tr
|
||||
%td
|
||||
= link_to(admin_conference_program_track_path(@conference.short_title, track)) do
|
||||
= track.name
|
||||
%td
|
||||
= track.short_name
|
||||
%td{style: "padding: 15px 0px 0px 10px;"}
|
||||
= link_to admin_conference_program_track_path(@conference.short_title, track), class: 'btn' do
|
||||
%span.label{style: "background-color: #{track.color}; color: #{ contrast_color(track.color) }"}
|
||||
= track.name
|
||||
%td
|
||||
%p
|
||||
= truncate(track.description)
|
||||
= markdown(truncate(track.description))
|
||||
%td
|
||||
- if track.self_organized?
|
||||
= link_to track.submitter.name, admin_user_path(track.submitter)
|
||||
- else
|
||||
N/A
|
||||
= track.room.try(:name)
|
||||
%td
|
||||
%span.label{style: "background-color: #{track.color}; color: #{ contrast_color(track.color) }"}
|
||||
= track.color
|
||||
= track.start_date.strftime('%A, %B %-d. %Y') if track.start_date
|
||||
%td
|
||||
= track.end_date.strftime('%A, %B %-d. %Y') if track.end_date
|
||||
%td
|
||||
= link_to track.submitter.name, admin_user_path(track.submitter) if track.self_organized?
|
||||
%td.text-center
|
||||
= check_box_tag "#{@conference.short_title}_#{track.short_name}", track.id, track.cfp_active,
|
||||
class: 'switch-checkbox', method: :patch,
|
||||
url: toggle_cfp_inclusion_admin_conference_program_track_path(@conference.short_title, id: track.short_name)+"?included=",
|
||||
data: { size: 'small',
|
||||
on_color: 'success',
|
||||
off_color: 'warning',
|
||||
on_text: 'Yes',
|
||||
off_text: 'No' }
|
||||
|
||||
%td.text-center
|
||||
- if track.self_organized?
|
||||
.btn-group
|
||||
%button{ type: 'button', class: 'btn btn-link dropdown-toggle', 'data-toggle' => 'dropdown' }
|
||||
|
|
@ -48,39 +55,12 @@
|
|||
= render 'change_state_dropdown', track: track
|
||||
- else
|
||||
= track.state.humanize
|
||||
%td
|
||||
= check_box_tag "#{@conference.short_title}_#{track.short_name}", track.id, track.cfp_active,
|
||||
class: 'switch-checkbox', method: :patch,
|
||||
url: toggle_cfp_inclusion_admin_conference_program_track_path(@conference.short_title, id: track.short_name)+"?included=",
|
||||
data: { size: 'small',
|
||||
on_color: 'success',
|
||||
off_color: 'warning',
|
||||
on_text: 'Yes',
|
||||
off_text: 'No' }
|
||||
|
||||
%td
|
||||
- if track.room
|
||||
= link_to track.room.name, admin_conference_venue_room_path(@conference.short_title, track.room.id)
|
||||
- else
|
||||
N/A
|
||||
%td
|
||||
- if track.start_date
|
||||
= track.start_date.strftime('%A, %B %-d. %Y')
|
||||
- else
|
||||
N/A
|
||||
%td
|
||||
- if track.end_date
|
||||
= track.end_date.strftime('%A, %B %-d. %Y')
|
||||
- else
|
||||
N/A
|
||||
%td
|
||||
.btn-group{role: "group"}
|
||||
- if can? :edit, track
|
||||
= link_to 'Edit', edit_admin_conference_program_track_path(@conference.short_title, track),
|
||||
method: :get, class: 'btn btn-primary'
|
||||
= link_to 'Edit', edit_admin_conference_program_track_path(@conference.short_title, track), class: 'btn btn-primary'
|
||||
- if can? :destroy, track
|
||||
= link_to 'Delete', admin_conference_program_track_path(@conference.short_title, track),
|
||||
method: :delete, class: 'btn btn-danger',
|
||||
= link_to 'Delete', admin_conference_program_track_path(@conference.short_title, track), method: :delete, class: 'btn btn-danger',
|
||||
data: { confirm: "Do you really want to delete #{track.name}? Attention: This track will be removed from all Events that have it set" }
|
||||
.row
|
||||
.col-md-12.text-right
|
||||
|
|
|
|||
|
|
@ -4,27 +4,114 @@
|
|||
%h1
|
||||
= @track.name
|
||||
Track
|
||||
%p.text-muted
|
||||
Events in this track
|
||||
.row
|
||||
.col-md-12
|
||||
%table.table.table-hover.datatable
|
||||
%thead
|
||||
%th Title
|
||||
%th Type
|
||||
%th Submitter
|
||||
%th State
|
||||
%th Time
|
||||
%tbody
|
||||
- @track.events.each_with_index do |event|
|
||||
%tr
|
||||
%td
|
||||
=link_to event.title, admin_conference_program_event_path(@conference.short_title, event)
|
||||
%td
|
||||
= event.event_type.title
|
||||
%td
|
||||
=link_to event.submitter.name, admin_user_path(event.submitter)
|
||||
%td
|
||||
= event.state
|
||||
%td
|
||||
= event.time
|
||||
|
||||
.tabbable
|
||||
%ul.nav.nav-tabs
|
||||
%li.active
|
||||
= link_to 'Details', '#details', 'data-toggle' => 'tab'
|
||||
%li
|
||||
= link_to 'Events', '#events', 'data-toggle' => 'tab'
|
||||
|
||||
.tab-content
|
||||
.tab-pane.active#details
|
||||
.row
|
||||
.col-md-12
|
||||
.btn-group.pull-right
|
||||
- if can? :edit, @track
|
||||
= link_to 'Edit', edit_admin_conference_program_track_path(@conference.short_title, @track),
|
||||
method: :get, class: 'btn btn-primary'
|
||||
- if can? :destroy, @track
|
||||
= link_to 'Delete', admin_conference_program_track_path(@conference.short_title, @track),
|
||||
method: :delete, class: 'btn btn-danger',
|
||||
data: { confirm: "Do you really want to delete #{@track.name}? Attention: This track will be removed from all Events that have it set" }
|
||||
.row
|
||||
.col-md-12
|
||||
%table.table
|
||||
%tr
|
||||
%td.col-md-2
|
||||
%b Color
|
||||
%td
|
||||
%span.label{ style: "background-color: #{@track.color}; color: #{ contrast_color(@track.color) }" }
|
||||
= @track.color
|
||||
%tr
|
||||
%td
|
||||
%b Room
|
||||
%td
|
||||
= @track.room.try(:name)
|
||||
%tr
|
||||
%td
|
||||
%b Start date
|
||||
%td
|
||||
= @track.start_date.strftime('%A, %B %-d. %Y') if @track.start_date
|
||||
%tr
|
||||
%td
|
||||
%b End date
|
||||
%td
|
||||
= @track.end_date.strftime('%A, %B %-d. %Y') if @track.end_date
|
||||
- if @track.self_organized?
|
||||
%tr
|
||||
%td
|
||||
%b Submitter
|
||||
%td
|
||||
= link_to @track.submitter.name, admin_user_path(@track.submitter)
|
||||
- if @track.confirmed?
|
||||
%tr
|
||||
%td
|
||||
%b Organizers
|
||||
%td
|
||||
- Role.find_by(name: 'track_organizer', resource: @track).users.each do |organizer|
|
||||
%div
|
||||
= link_to organizer.name, admin_user_path(organizer)
|
||||
%tr
|
||||
%td
|
||||
%b Included in the Cfp?
|
||||
%td
|
||||
= check_box_tag "#{@conference.short_title}_#{@track.short_name}", @track.id, @track.cfp_active,
|
||||
class: 'switch-checkbox', method: :patch,
|
||||
url: toggle_cfp_inclusion_admin_conference_program_track_path(@conference.short_title, id: @track.short_name)+"?included=",
|
||||
data: { size: 'small',
|
||||
on_color: 'success',
|
||||
off_color: 'warning',
|
||||
on_text: 'Yes',
|
||||
off_text: 'No' }
|
||||
%tr
|
||||
%td
|
||||
%b State
|
||||
%td
|
||||
- if @track.self_organized?
|
||||
.btn-group
|
||||
%button{ type: 'button', class: 'btn btn-link dropdown-toggle', 'data-toggle' => 'dropdown' }
|
||||
= @track.state.humanize
|
||||
%span.caret
|
||||
%ul.dropdown-menu{ role: 'menu' }
|
||||
= render 'change_state_dropdown', track: @track
|
||||
- else
|
||||
= @track.state.humanize
|
||||
%tr
|
||||
%td
|
||||
%b Description
|
||||
%td
|
||||
= markdown(@track.description)
|
||||
|
||||
.tab-pane#events
|
||||
.col-md-12
|
||||
%table.table.table-hover.datatable
|
||||
%thead
|
||||
%th Title
|
||||
%th Type
|
||||
%th Submitter
|
||||
%th State
|
||||
%th Time
|
||||
%tbody
|
||||
- @track.events.each_with_index do |event|
|
||||
%tr
|
||||
%td
|
||||
=link_to event.title, admin_conference_program_event_path(@conference.short_title, event)
|
||||
%td
|
||||
= event.event_type.title
|
||||
%td
|
||||
=link_to event.submitter.name, admin_user_path(event.submitter)
|
||||
%td
|
||||
= event.state
|
||||
%td
|
||||
= event.time
|
||||
|
|
|
|||
|
|
@ -10,13 +10,22 @@
|
|||
- if @conference.splashpage and @conference.program.tracks.any? and @conference.splashpage.include_tracks
|
||||
See rock-star speakers cover the topics of
|
||||
- if @conference.splashpage and @conference.splashpage.include_tracks
|
||||
- @conference.program.tracks.each_slice(3) do |slice|
|
||||
- @conference.program.tracks.confirmed.cfp_active.each_slice(3) do |slice|
|
||||
.row.row-centered
|
||||
- slice.each do |track|
|
||||
.col-md-4.col-sm-4.col-centered.col-top.track
|
||||
%h4.text-center
|
||||
= track.name
|
||||
= markdown(track.description)
|
||||
- if track.start_date
|
||||
%br
|
||||
From: #{track.start_date.strftime('%A, %B %-d. %Y')}
|
||||
- if track.end_date
|
||||
%br
|
||||
To: #{track.end_date.strftime('%A, %B %-d. %Y')}
|
||||
- if track.room
|
||||
%br
|
||||
In: #{track.room.name}
|
||||
|
||||
- if @conference.program and @conference.program.schedule_public
|
||||
.row
|
||||
|
|
|
|||
|
|
@ -12,6 +12,10 @@
|
|||
= link_to(conference_program_proposals_path(@conference.short_title)) do
|
||||
%span.fa.fa-comment
|
||||
My Submissions
|
||||
%li
|
||||
= link_to(conference_program_tracks_path(@conference.short_title)) do
|
||||
%span.fa.fa-road
|
||||
My Tracks
|
||||
%li
|
||||
- if ENV['OSEM_ICHAIN_ENABLED'] == 'true'
|
||||
= link_to(destroy_user_ichain_session_path, method: 'delete') do
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
= "#{event_types(@conference)}."
|
||||
- if @program.tracks.any?
|
||||
Proposals should fit in one of the
|
||||
= "#{pluralize(@program.tracks.count, 'track')}:"
|
||||
= "#{pluralize(@program.tracks.confirmed.cfp_active.count, 'track')}:"
|
||||
= "#{tracks(@conference)}."
|
||||
- if @program.cfp_open?
|
||||
The submission period has begun
|
||||
|
|
|
|||
|
|
@ -15,5 +15,5 @@
|
|||
= f.input :color, input_html: {size: 6, type: 'color'}, required: true
|
||||
= f.input :start_date, as: :string, input_html: { id: 'registration-period-start-datepicker', start_date: @conference.start_date, end_date: @conference.end_date, readonly: 'readonly' }
|
||||
= f.input :end_date, as: :string, input_html: { id: 'registration-period-end-datepicker', readonly: 'readonly' }
|
||||
= f.input :description, input_html: {rows: 2, data: { provide: 'markdown-editable' } }, required: true, hint: markdown_hint
|
||||
= f.input :description, input_html: {rows: 2, data: { provide: 'markdown-editable' } }, required: true, hint: "This will be public #{markdown_hint}".html_safe
|
||||
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }
|
||||
|
|
|
|||
|
|
@ -6,46 +6,60 @@
|
|||
%span.notranslate
|
||||
= @conference.title
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
%p.text-right
|
||||
= link_to '#status-help', class: 'btn btn-default', "data-toggle"=>"collapse" do
|
||||
Help?
|
||||
.collapse#status-help
|
||||
%p
|
||||
%strong
|
||||
What happens next with my track request?
|
||||
%p
|
||||
If you submit a track request, the conference organizers will review it and either accept or reject it.
|
||||
%br
|
||||
If your track request is accepted, the conference organizers expect you to confirm that you will be able to hold it.
|
||||
Then you will gain the Track organizer role.
|
||||
%br
|
||||
If your track request is rejected, you can either live with that or adapt it and resubmit it for review again.
|
||||
%br
|
||||
If something changes and you can't organize the track any more, you should withdraw it.
|
||||
|
||||
- if @tracks.any?
|
||||
.row
|
||||
.col-md-12
|
||||
%table.table.table-hover#tracks
|
||||
%thead
|
||||
%th Name
|
||||
%th Short name
|
||||
%th Description
|
||||
%th Color
|
||||
%th State
|
||||
%th Start Date
|
||||
%th End Date
|
||||
%th Actions
|
||||
%tbody
|
||||
- @tracks.each do |track|
|
||||
%tr
|
||||
%td
|
||||
= link_to(conference_program_track_path(@conference.short_title, track)) do
|
||||
= track.name
|
||||
%td
|
||||
= track.short_name
|
||||
%td
|
||||
%p
|
||||
= truncate(track.description)
|
||||
%td
|
||||
%table.table.table-striped#tracks
|
||||
- @tracks.each do |track|
|
||||
%tr
|
||||
%td{style: "padding:15px 0px 0px 8px;"}
|
||||
- if %w(new to_accept to_reject).include? track.state
|
||||
%span{ title: 'In review', class: 'fa fa-eye' }
|
||||
- elsif track.state == 'accepted'
|
||||
%span{ title: 'Accepted', class: 'fa fa-check text-muted' }
|
||||
- elsif track.state == 'confirmed'
|
||||
%spam{ title: 'Confirmed', class: 'fa fa-check text-success' }
|
||||
- elsif %w(rejected withdrawn canceled).include? track.state
|
||||
%span{ title: track.state.humanize, class: 'fa fa-ban'}
|
||||
%td{style: "padding: 15px 0px 0px 0px;"}
|
||||
= link_to conference_program_track_path(@conference.short_title, track), class: 'btn' do
|
||||
%span.label{style: "background-color: #{track.color}; color: #{ contrast_color(track.color) }"}
|
||||
= track.color
|
||||
%td
|
||||
= track.state.humanize
|
||||
%td
|
||||
- if track.start_date
|
||||
= track.start_date.strftime('%A, %B %-d. %Y')
|
||||
- else
|
||||
N/A
|
||||
%td
|
||||
- if track.end_date
|
||||
= track.end_date.strftime('%A, %B %-d. %Y')
|
||||
- else
|
||||
N/A
|
||||
%td
|
||||
= track.name
|
||||
%td
|
||||
= markdown(truncate(track.description))
|
||||
%td
|
||||
- if track.start_date
|
||||
From:
|
||||
= track.start_date.strftime('%A, %B %-d. %Y')
|
||||
%td
|
||||
- if track.end_date
|
||||
To:
|
||||
= track.end_date.strftime('%A, %B %-d. %Y')
|
||||
%td
|
||||
- if track.room
|
||||
In:
|
||||
= track.room.name
|
||||
%td
|
||||
.pull-right
|
||||
- if track.transition_possible? :confirm
|
||||
= link_to 'Confirm', confirm_conference_program_track_path(@conference.short_title, track),
|
||||
method: :patch, class: 'btn btn-mini btn-success', id: "confirm_track_#{track.id}"
|
||||
|
|
@ -57,8 +71,7 @@
|
|||
= link_to 'Re-Submit', restart_conference_program_track_path(@conference.short_title, track),
|
||||
method: :patch, class: 'btn btn-mini btn-success', id: "resubmit_track_request_#{track.id}"
|
||||
- if can? :edit, track
|
||||
= link_to 'Edit', edit_conference_program_track_path(@conference.short_title, track),
|
||||
method: :get, class: 'btn btn-primary'
|
||||
= link_to 'Edit', edit_conference_program_track_path(@conference.short_title, track), class: 'btn btn-default'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
|
|
|
|||
|
|
@ -2,9 +2,12 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.page-header
|
||||
%h1
|
||||
%h2
|
||||
= @track.name
|
||||
Track
|
||||
.btn-group.pull-right
|
||||
- if can? :edit, @track
|
||||
= link_to 'Edit Track request', edit_conference_program_track_path(@conference.short_title, @track), class: 'btn btn-primary'
|
||||
.row
|
||||
.col-md-8
|
||||
%dl.dl-horizontal
|
||||
|
|
@ -16,26 +19,23 @@
|
|||
%dt
|
||||
State:
|
||||
%dd
|
||||
= @track.state.humanize
|
||||
- if %w(new to_accept to_reject).include? @track.state
|
||||
New
|
||||
- else
|
||||
= @track.state.humanize
|
||||
%dt
|
||||
Start date:
|
||||
%dd
|
||||
- if @track.start_date
|
||||
= @track.start_date.strftime('%A, %B %-d. %Y')
|
||||
- else
|
||||
N/A
|
||||
= @track.start_date.strftime('%A, %B %-d. %Y') if @track.start_date
|
||||
%dt
|
||||
End date:
|
||||
%dd
|
||||
- if @track.end_date
|
||||
= @track.end_date.strftime('%A, %B %-d. %Y')
|
||||
- else
|
||||
N/A
|
||||
= @track.end_date.strftime('%A, %B %-d. %Y') if @track.end_date
|
||||
%dt
|
||||
Room:
|
||||
%dd
|
||||
= @track.room.try(:name)
|
||||
%dt
|
||||
Description
|
||||
%dd
|
||||
= @track.description
|
||||
.row
|
||||
.col-md-12.text-right
|
||||
- if can? :edit, @track
|
||||
= link_to 'Edit Track request', edit_conference_program_track_path(@conference.short_title, @track), class: 'btn btn-primary'
|
||||
= markdown(@track.description)
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ feature Track do
|
|||
within('table#tracks') do
|
||||
expect(page.has_content?(track.name)).to be false
|
||||
expect(page.has_content?(track.description)).to be false
|
||||
expect(page.assert_selector('tr', count: 1)).to be true
|
||||
expect(page.has_content?('No data available in table')).to eq true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -120,6 +120,46 @@ describe Track do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'scope' do
|
||||
describe '#confirmed' do
|
||||
before :each do
|
||||
@program = create(:program)
|
||||
end
|
||||
|
||||
context 'includes' do
|
||||
it 'when track is confirmed' do
|
||||
confirmed_track = create(:track, state: 'confirmed', program: @program)
|
||||
expect(@program.tracks.confirmed.include?(confirmed_track)).to eq true
|
||||
end
|
||||
end
|
||||
|
||||
context 'excludes' do
|
||||
%w[new to_accept accepted to_reject rejected canceled withdrawn].each do |state|
|
||||
it "when track is #{state.humanize}" do
|
||||
unconfirmed_track = create(:track, state: state, program: @program)
|
||||
expect(@program.tracks.confirmed.include?(unconfirmed_track)).to eq false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#cfp_active' do
|
||||
before :each do
|
||||
@program = create(:program)
|
||||
@cfp_active_track = create(:track, cfp_active: true, program: @program)
|
||||
@non_cfp_active_track = create(:track, cfp_active: false, program: @program)
|
||||
end
|
||||
|
||||
it 'include tracks with the cfp_active flag enabled' do
|
||||
expect(@program.tracks.cfp_active.include?(@cfp_active_track)).to eq true
|
||||
end
|
||||
|
||||
it 'excludes tracks with the cfp_active flag disabled' do
|
||||
expect(@program.tracks.cfp_active.include?(@non_cfp_active_track)).to eq false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#self_organized?' do
|
||||
it 'returns true when it has a submitter' do
|
||||
expect(self_organized_track.submitter).to be_a User
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue