From feaf9d807874ebde0349914a6a906439c5082e22 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Sat, 5 Mar 2016 02:54:09 +0100 Subject: [PATCH] Feature: Add/change Track for Event --- app/controllers/proposal_controller.rb | 2 +- app/models/event.rb | 1 + app/views/proposal/_proposal_form.html.haml | 5 ++++ app/views/proposal/_tooltip.html.haml | 28 ++++++--------------- app/views/proposal/index.html.haml | 3 ++- 5 files changed, 17 insertions(+), 22 deletions(-) diff --git a/app/controllers/proposal_controller.rb b/app/controllers/proposal_controller.rb index 95042af5..82706e64 100644 --- a/app/controllers/proposal_controller.rb +++ b/app/controllers/proposal_controller.rb @@ -140,7 +140,7 @@ class ProposalController < ApplicationController private def event_params - params.require(:event).permit(:title, :subtitle, :event_type_id, :abstract, :description, :require_registration, :difficulty_level_id) + params.require(:event).permit(:title, :subtitle, :track_id, :event_type_id, :abstract, :description, :require_registration, :difficulty_level_id) end def user_params diff --git a/app/models/event.rb b/app/models/event.rb index 780e65b9..fc1c8f52 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -194,6 +194,7 @@ class Event < ActiveRecord::Base commercials: self.commercials.any?, biography: !self.submitter.biography.blank?, subtitle: !self.subtitle.blank?, + track: !self.track.blank?, difficulty_level: !self.difficulty_level.blank?, title: true, abstract: true diff --git a/app/views/proposal/_proposal_form.html.haml b/app/views/proposal/_proposal_form.html.haml index d30ad689..5addd7d2 100644 --- a/app/views/proposal/_proposal_form.html.haml +++ b/app/views/proposal/_proposal_form.html.haml @@ -4,6 +4,11 @@ = f.input :subtitle, as: :string + - if @program.tracks.any? + = f.input :track_id, as: :select, + collection: @program.tracks.map {|track| ["#{track.name}", track.id] }, + include_blank: true + = f.input :event_type_id, as: :select, collection: @conference.program.event_types.map {|type| ["#{type.title} - #{show_time(type.length)}", type.id, data: { min_words: type.minimum_abstract_length, max_words: type.maximum_abstract_length }]}, diff --git a/app/views/proposal/_tooltip.html.haml b/app/views/proposal/_tooltip.html.haml index aced298b..dd626209 100644 --- a/app/views/proposal/_tooltip.html.haml +++ b/app/views/proposal/_tooltip.html.haml @@ -3,33 +3,21 @@ %li{'class'=>class_for_todo(progress_status['registered'])} %span{'class'=>icon_for_todo(progress_status['registered'])} - if progress_status['registered'] - = link_to 'Edit your registration', edit_conference_conference_registrations_path(event.program.conference.short_title) + = link_to 'Register to the conference', edit_conference_conference_registrations_path(event.program.conference.short_title) - else = link_to 'Register to the conference', new_conference_conference_registrations_path(event.program.conference.short_title) - %li{'class'=>class_for_todo(progress_status['biography'])} %span{'class'=>icon_for_todo(progress_status['biography'])} - - if progress_status['biography'] - = link_to 'Edit your biography', edit_user_path(event.submitter) - - else - = link_to 'Fill out your biography', edit_user_path(event.submitter) - + = link_to 'Fill out your biography', edit_user_path(event.submitter) %li{'class'=>class_for_todo(progress_status['subtitle'])} %span{'class'=>icon_for_todo(progress_status['subtitle'])} - - if progress_status['subtitle'] - = link_to 'Edit the subtitle', edit_conference_program_proposal_path(event.program.conference.short_title, event) - - else - = link_to 'Add a subtitle', edit_conference_program_proposal_path(event.program.conference.short_title, event) - + = link_to 'Add a subtitle', edit_conference_program_proposal_path(event.program.conference.short_title, event) %li{'class'=>class_for_todo(progress_status['commercials'])} %span{'class'=>icon_for_todo(progress_status['commercials'])} - - if progress_status['commercials'] - = link_to 'Edit the commercials', edit_conference_program_proposal_path(event.program.conference.short_title, event, anchor: 'commercials-content') - - else - = link_to 'Add a commercial', edit_conference_program_proposal_path(event.program.conference.short_title, event, anchor: 'commercials-content') + = link_to 'Add a commercial', edit_conference_program_proposal_path(event.program.conference.short_title, event, anchor: 'commercials-content') + %li{'class'=>class_for_todo(progress_status['track'])} + %span{'class'=>icon_for_todo(progress_status['track'])} + = link_to 'Add a track', edit_conference_program_proposal_path(event.program.conference.short_title, event) %li{'class'=>class_for_todo(progress_status['difficulty_level'])} %span{'class'=>icon_for_todo(progress_status['difficulty_level'])} - - if progress_status['difficulty_level'] - = link_to 'Change the difficulty level', edit_conference_program_proposal_path(event.program.conference.short_title, event) - - else - = link_to 'Add a difficulty level', edit_conference_program_proposal_path(event.program.conference.short_title, event) + = link_to 'Add a difficulty level', edit_conference_program_proposal_path(event.program.conference.short_title, event) diff --git a/app/views/proposal/index.html.haml b/app/views/proposal/index.html.haml index 0a514daa..c72b6a93 100644 --- a/app/views/proposal/index.html.haml +++ b/app/views/proposal/index.html.haml @@ -65,12 +65,13 @@ %small.text-muted = event.event_type.title = "(#{event.event_type.length} min)" + = "in #{event.track.name}" if event.track - if event.state == 'confirmed' && event.require_registration == true , Pre-registered: #{pre_registered(event).count} %td.col-md-2{style: "padding:20px 8px 20px 8px;"} - = link_to 'Complete your todo list', 'javascript: void(0)', "type"=>"button", "data-trigger"=>"focus", "data-toggle"=>"popover", "title"=>"Your todo list", "data-content"=>"#{render partial: 'tooltip', locals: { event: event} }" + = link_to 'Complete your proposal', 'javascript: void(0)', "type"=>"button", "data-trigger"=>"focus", "data-toggle"=>"popover", "title"=>"Your todo list", "data-content"=>"#{render partial: 'tooltip', locals: { event: event} }" - progress_percentage = event.calculate_progress .progress