diff --git a/app/assets/stylesheets/osem.css.scss b/app/assets/stylesheets/osem.css.scss index 03c221da..2f44ba19 100644 --- a/app/assets/stylesheets/osem.css.scss +++ b/app/assets/stylesheets/osem.css.scss @@ -55,7 +55,9 @@ fieldset { margin: 20px 0 20px 0; } -.bootstrap-switch { height: 1.7em } +.bootstrap-switch { + height: 1.7em +} .comment-reply{ padding-top: 40px; diff --git a/app/controllers/admin/events_controller.rb b/app/controllers/admin/events_controller.rb index 019d0116..2334531d 100644 --- a/app/controllers/admin/events_controller.rb +++ b/app/controllers/admin/events_controller.rb @@ -179,12 +179,12 @@ module Admin def update_state(transition, notice, mail = false, subject = false, send_mail = false) alert = @event.update_state(transition, mail, subject, send_mail, params[:send_mail].blank?) - if !alert.blank? - flash[:error] = error - return redirect_back_or_to(admin_conference_events_path(conference_id: @conference.short_title)) && return - else + if alert.blank? flash[:notice] = notice redirect_back_or_to(admin_conference_events_path(conference_id: @conference.short_title)) && return + else + flash[:error] = alert + return redirect_back_or_to(admin_conference_events_path(conference_id: @conference.short_title)) && return end end end diff --git a/app/controllers/admin/registrations_controller.rb b/app/controllers/admin/registrations_controller.rb index 9bafb828..70abe4a1 100644 --- a/app/controllers/admin/registrations_controller.rb +++ b/app/controllers/admin/registrations_controller.rb @@ -17,9 +17,9 @@ module Admin @registration.update_attributes(registration_params) if @registration.save redirect_to admin_conference_registrations_path(@conference.short_title), - notice: 'Successfully updated registration!' + notice: "Successfully updated registration for #{@registration.user.email}!" else - flash[:error] = "An error prohibited the Registration for #{@conference.title}: "\ + flash[:error] = "An error prohibited the Registration for #{@registration.user.email}: "\ "#{@registration.errors.full_messages.join('. ')}." render :edit end @@ -56,7 +56,7 @@ module Admin permit( :conference_id, :arrival, :departure, :volunteer, - vchoice_ids: [], qanswer_ids: [], + vchoice_ids: [], qanswer_ids: [], event_ids: [], qanswers_attributes: [], user_attributes: [ :id, :name, :tshirt, :mobile, :volunteer_experience, :languages, diff --git a/app/views/admin/event_types/index.html.haml b/app/views/admin/event_types/index.html.haml index fddc2dd3..e5513eff 100644 --- a/app/views/admin/event_types/index.html.haml +++ b/app/views/admin/event_types/index.html.haml @@ -9,6 +9,7 @@ %table.table.table-hover#event_types %thead %th Title + %th Description %th Length %th Abstract Length %th Color @@ -18,6 +19,8 @@ %tr %td = event_type.title + %td + = event_type.description %td = event_type.length Minutes diff --git a/app/views/admin/events/index.html.haml b/app/views/admin/events/index.html.haml index 1f591268..10a99f6d 100644 --- a/app/views/admin/events/index.html.haml +++ b/app/views/admin/events/index.html.haml @@ -54,6 +54,14 @@ = javascript_tag "$('label[avgrate=true]').prevAll().andSelf().addClass('bright');" - else = label_tag "label_rating", "", :class => "avgrating" + %br + - voted = event.voted?(event, current_user) + - if voted + %span.label.label-success + Your rating: #{voted.rating} + - else + %span.label.label-danger + Not rated - else 0/#{@conference.call_for_paper.rating} %br diff --git a/app/views/admin/registrations/_questions.html.haml b/app/views/admin/registrations/_questions.html.haml index f82a1213..473a3976 100644 --- a/app/views/admin/registrations/_questions.html.haml +++ b/app/views/admin/registrations/_questions.html.haml @@ -4,6 +4,6 @@ = q.title %b A: - - registration.qanswers.where(:question_id => q.id).each do |qa| + - registration.qanswers.where(question_id: q.id).each do |qa| = qa.answer.title - %br \ No newline at end of file + %br diff --git a/app/views/admin/registrations/edit.html.haml b/app/views/admin/registrations/edit.html.haml index caa84108..694da7a5 100644 --- a/app/views/admin/registrations/edit.html.haml +++ b/app/views/admin/registrations/edit.html.haml @@ -2,25 +2,17 @@ .col-md-12 .page-header %h1 - Edit registration of #{@user.username} for #{@conference.short_title} + Registration for #{@user.username} .row - .col-md-8 - = semantic_form_for(@registration, :url => admin_conference_registration_path(@conference.short_title, @registration)) do |f| + .col-md-6 + = semantic_form_for(@registration, url: admin_conference_registration_path(@conference.short_title, @registration)) do |f| = f.inputs 'Personal Information' do = f.fields_for :user do |u| = u.input :name, as: :string = u.input :nickname, as: :string = u.input :affiliation, placeholder: 'Company/User Group/nothing', as: :string = f.inputs 'Registration Information' do - - @conference.questions.each do |q| - %h5 - = "Q: #{q.title}" - - if q.question_type.id == 1 || q.question_type.id == 2 # yes/no or single choice - = f.input :qanswers, :collection => q.qanswers, :as => :select, :input_html => { :multiple => false }, :label => false, :include_blank => "Please make your choice", - :member_label => Proc.new {|a| a.answer.title} - - if q.question_type.id == 3 # multiple choice - = f.input :qanswers, :collection => q.qanswers, :as => :check_boxes, :label => false, - :member_label => Proc.new {|a| a.answer.title} + = render partial: 'conference_registrations/registration_info', locals: { f: f } -# Not necessary - if @conference.social_events.count > 0 @@ -28,4 +20,4 @@ %br Yes, I'll be attending... %br = f.input :social_events, as: :check_boxes, label: false, collection: @conference.social_events - = f.action :submit, button_html: { value: 'Edit Registration', class: 'btn btn-primary' } + = f.action :submit, button_html: { class: 'btn btn-primary' } diff --git a/app/views/admin/registrations/index.html.haml b/app/views/admin/registrations/index.html.haml index ae48c678..4e3a843e 100644 --- a/app/views/admin/registrations/index.html.haml +++ b/app/views/admin/registrations/index.html.haml @@ -6,8 +6,8 @@ = "(#{@registrations.length})" if @registrations .btn-group.pull-right - if can? :read, Registration - = link_to "Export PDF", admin_conference_registrations_path(@conference.short_title, :format => :pdf), :class => "btn btn-default" - = link_to "Export XLS", {:format => :xlsx}, :class => "btn btn-default" + = link_to 'Export PDF', admin_conference_registrations_path(@conference.short_title, format: :pdf), class: 'btn btn-success' + = link_to 'Export XLS', {format: :xlsx}, class: 'btn btn-success' %p.text-muted All the people who registered to your event %table.table.table-hover.datatable#registrations @@ -32,12 +32,12 @@ = registration.email %td - if registration.arrival - = registration.arrival.strftime("%d %b %H:%M") + = registration.arrival.strftime('%d %b %H:%M') - else n/a %td - if registration.departure - = registration.departure.strftime("%d %b %H:%M") + = registration.departure.strftime('%d %b %H:%M') - else n/a -if @conference.questions.any? @@ -47,7 +47,7 @@ = check_box_tag "#{@conference.short_title}_#{registration.id}", registration.id, registration.attended, class: 'switch-checkbox', method: :patch, url: toggle_attendance_admin_conference_registration_path(@conference.short_title, id: registration.id)+"?attended=", - data: { size: "small", + data: { size: 'small', on_color: 'success', off_color: 'warning', on_text: 'Present', @@ -61,7 +61,7 @@ .questions{class: "question#{index}", style: 'display:none;'} = render partial: 'questions', locals: { registration: registration } -.modal.fade{ id: "questions", 'role' => 'dialog', 'aria-hidden' => 'true' } +.modal.fade{ id: 'questions', 'role' => 'dialog', 'aria-hidden' => 'true' } .modal-dialog .modal-content .modal-header diff --git a/app/views/conference/index.html.haml b/app/views/conference/index.html.haml index 79ea924d..b94f5075 100644 --- a/app/views/conference/index.html.haml +++ b/app/views/conference/index.html.haml @@ -4,19 +4,19 @@ .page-header %h2 Upcoming Conferences - @current.each do |conference| - = render :partial => "conference_details", :locals => {:conference => conference} + = render partial: 'conference_details', locals: { conference: conference } -if @antiquated and @antiquated.any? .row .col-md-12 %p.text-right - %button{:type=>"button", :class=>"btn btn-link btn-sm", "data-toggle"=>"collapse", "data-target"=>"#antiquated", "aria-expanded"=>"true", "aria-controls"=>"antiquated"} + %button{ type: 'button', class: 'btn btn-link btn-sm', 'data-toggle' => 'collapse', 'data-target' => '#antiquated', 'aria-expanded' => 'true', 'aria-controls' => 'antiquated'} Older conferences = "(#{@antiquated.count})" %i.fa.fa-chevron-right - %i.fa.fa-chevron-down{:style => 'display: none'} + %i.fa.fa-chevron-down{ style: 'display: none' } #antiquated.collapse - @antiquated.each do |conference| - = render :partial => "conference_details", :locals => {:conference => conference} + = render partial: 'conference_details', locals: { conference: conference} -content_for :script_body do :javascript diff --git a/app/views/conference_registrations/_form.html.haml b/app/views/conference_registrations/_form.html.haml index f3b282f1..7678abef 100644 --- a/app/views/conference_registrations/_form.html.haml +++ b/app/views/conference_registrations/_form.html.haml @@ -21,14 +21,7 @@ = semantic_form_for(@registration, url: conference_conference_registrations_path(@conference.short_title)) do |f| = render partial: 'devise/shared/sign_up_form_embedded' - - if @conference.questions.any? - = render partial: 'questions', locals: { f: f } - - if @conference.events.workshops.any? - =f.inputs 'Register to Workshops' do - = f.input :events, as: :check_boxes, label: false, collection: @conference.events.workshops - = f.inputs 'Your Travel Info' do - = f.input :arrival, as: :string, label: 'Your arrival time', input_html: { value: (f.object.arrival.to_formatted_s(:db_without_seconds) unless f.object.arrival.nil?), id: 'registration-arrival-datepicker', readonly: 'readonly' } - = f.input :departure, as: :string, label: 'Your departure time', input_html: { value: (f.object.departure.to_formatted_s(:db_without_seconds) unless f.object.departure.nil?), id: 'registration-departure-datepicker', readonly: 'readonly' } + = render partial: 'registration_info', locals: { f: f } .row .col-md-12 %p.pull-right diff --git a/app/views/conference_registrations/_questions.html.haml b/app/views/conference_registrations/_questions.html.haml index 2443b7dc..56ee7836 100644 --- a/app/views/conference_registrations/_questions.html.haml +++ b/app/views/conference_registrations/_questions.html.haml @@ -5,4 +5,4 @@ :member_label => Proc.new {|a| a.answer.title} - if q.question_type.id == 3 # multiple choice = f.input :qanswers, :collection => q.qanswers, :as => :check_boxes, label: q.title, - :member_label => Proc.new {|a| a.answer.title} \ No newline at end of file + :member_label => Proc.new {|a| a.answer.title} diff --git a/app/views/conference_registrations/_registration_info.html.haml b/app/views/conference_registrations/_registration_info.html.haml new file mode 100644 index 00000000..9653862d --- /dev/null +++ b/app/views/conference_registrations/_registration_info.html.haml @@ -0,0 +1,8 @@ +- if @conference.questions.any? + = render partial: 'conference_registrations/questions', locals: { f: f } +- if @conference.events.workshops.any? + =f.inputs 'Pre-registration required for the following:' do + = f.input :events, as: :check_boxes, label: false, collection: @conference.events.workshops += f.inputs 'Your Travel Info' do + = f.input :arrival, as: :string, label: 'Your arrival time', input_html: { value: (f.object.arrival.to_formatted_s(:db_without_seconds) unless f.object.arrival.nil?), id: 'registration-arrival-datepicker', readonly: 'readonly' } + = f.input :departure, as: :string, label: 'Your departure time', input_html: { value: (f.object.departure.to_formatted_s(:db_without_seconds) unless f.object.departure.nil?), id: 'registration-departure-datepicker', readonly: 'readonly' } diff --git a/app/views/layouts/_admin_sidebar.html.haml b/app/views/layouts/_admin_sidebar.html.haml index 9fc01035..016c77a2 100644 --- a/app/views/layouts/_admin_sidebar.html.haml +++ b/app/views/layouts/_admin_sidebar.html.haml @@ -29,9 +29,14 @@ Dashboard - if can? :show, @conference %li{:class=> "#{active_nav_li(edit_admin_conference_path(@conference.short_title))}"} - = link_to(edit_admin_conference_path(@conference.short_title)) do - %span.fa.fa-home - Basics + - if can? :edit, @conference + = link_to(edit_admin_conference_path(@conference.short_title)) do + %span.fa.fa-home + Basics + - else + %a + %span.fa.fa-home + Basics %ul - if can? :update, Contact.new(conference_id: @conference.id) %li{:class=> "#{active_nav_li(edit_admin_conference_contact_path(@conference.short_title))}"} diff --git a/app/views/proposal/_form.html.haml b/app/views/proposal/_form.html.haml index f7eb3f3b..c0bc8dc8 100644 --- a/app/views/proposal/_form.html.haml +++ b/app/views/proposal/_form.html.haml @@ -4,9 +4,9 @@ .tabbable %ul.nav.nav-tabs %li.active - = link_to "Proposal", "#proposal-content", "data-toggle"=>"tab" + = link_to 'Proposal', '#proposal-content', 'data-toggle' => 'tab' %li - = link_to 'Commercials', '#commercials-content', 'data-toggle'=>'tab' + = link_to 'Commercials', '#commercials-content', 'data-toggle' => 'tab' .tab-content #proposal-content.tab-pane.active = render 'proposal/proposal_form' @@ -29,7 +29,7 @@ = link_to 'Edit', edit_conference_proposal_commercial_path(@conference.short_title, @event.id, commercial.id), class: 'btn btn-primary' - if can? :destroy, commercial = link_to 'Delete', conference_proposal_commercial_path(@conference.short_title, @event.id, commercial.id), - :method => :delete, :data => { :confirm => 'Are you sure?' }, class: 'btn btn-danger' + method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger' - if can? :create, @event.commercials.new %hr = link_to 'Add Commercial', new_conference_proposal_commercial_path(@conference.short_title, @event.id), class: 'btn btn-primary' diff --git a/app/views/proposal/_proposal_form.html.haml b/app/views/proposal/_proposal_form.html.haml index 8b748139..83b34a5f 100644 --- a/app/views/proposal/_proposal_form.html.haml +++ b/app/views/proposal/_proposal_form.html.haml @@ -43,11 +43,11 @@ = f.input :is_highlight %p.text-right - = link_to '#description', "data-toggle"=>"collapse" do + = link_to '#description', 'data-toggle' => 'collapse' do Do you require something special? .collapse#description = f.input :description, input_html: { rows: 5 }, label: 'Requirements', placeholder: 'Eg. Whiteboard, printer, or something like that.' %p.text-right - = f.action :submit, :as => :button, :button_html => {:class => "btn btn-success"}, label: 'Update Proposal' + = f.submit 'Update Proposal', class: 'btn btn-success' diff --git a/app/views/proposal/new.html.haml b/app/views/proposal/new.html.haml index 1d91c157..e4b4fd99 100644 --- a/app/views/proposal/new.html.haml +++ b/app/views/proposal/new.html.haml @@ -11,11 +11,11 @@ - if !current_user %legend %span - =link_to('#signup', role: 'tab', "aria-controls" => "home", "data-toggle" => "tab") do + =link_to('#signup', role: 'tab', 'aria-controls' => 'home', 'data-toggle' => 'tab') do = CONFIG['name'] Account %span.pull-right#account-already - =link_to('#signin', role: 'tab', "aria-controls" => "home", "data-toggle" => "tab") do + =link_to('#signin', role: 'tab', 'aria-controls' => 'home', 'data-toggle' => 'tab') do Already have an account? .tab-content .tab-pane.active{role: 'tabpanel', id: 'signup'} @@ -25,7 +25,7 @@ = render partial: 'devise/shared/sign_up_form_embedded' = f.inputs name: 'Proposal Information' do - = f.input :title, as: :string, required: true + = f.input :title, as: :string, required: true, input_html: { required: true } = f.input :event_type_id, as: :select, collection: @conference.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 }]}, @@ -38,7 +38,7 @@ :javascript $("##{@conference.event_types.first.id}-help").collapse('show'); - = f.input :abstract, input_html: { rows: 5 }, + = f.input :abstract, input_html: { rows: 5, required: true }, required: true, hint: link_to('Tips to improve your presentations', 'http://blog.hubspot.com/blog/tabid/6307/bid/5975/10-Rules-to-Instantly-Improve-Your-Presentations.aspx') %p @@ -55,12 +55,13 @@ = f.input :require_registration, label: 'Require participants to register to your event' %p.text-right - = link_to '#description', "data-toggle"=>"collapse", id: 'description_link' do + = link_to '#description', 'data-toggle' => 'collapse', id: 'description_link' do Do you require something special? .collapse#description = f.input :description, input_html: { rows: 5 }, label: 'Requirements', placeholder: 'Eg. Whiteboard, printer, or something like that.' %p.text-right - = f.action :submit, :as => :button, :button_html => {:class => "btn btn-success"}, label: 'Create Proposal' + = f.submit 'Create Proposal', class: 'btn btn-success' + .tab-pane{role: 'tabpanel', id: 'signin'} = render partial: 'devise/shared/sign_in_form_embedded' diff --git a/db/migrate/20150929142405_change_postalcode_format_in_venues.rb b/db/migrate/20150929142405_change_postalcode_format_in_venues.rb new file mode 100644 index 00000000..010f9349 --- /dev/null +++ b/db/migrate/20150929142405_change_postalcode_format_in_venues.rb @@ -0,0 +1,9 @@ +class ChangePostalcodeFormatInVenues < ActiveRecord::Migration + def up + change_column :venues, :postalcode, :string + end + + def down + raise ActiveRecord::IrreversibleMigration.new('Cannot reverse migration.') + end +end diff --git a/db/schema.rb b/db/schema.rb index fcab5102..f29255db 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,6 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. + ActiveRecord::Schema.define(version: 20151005161518) do create_table "ahoy_events", force: true do |t| diff --git a/spec/features/ability_spec.rb b/spec/features/ability_spec.rb index 53f21818..c7abb168 100644 --- a/spec/features/ability_spec.rb +++ b/spec/features/ability_spec.rb @@ -105,7 +105,8 @@ feature 'Has correct abilities' do visit admin_conference_path(conference2.short_title) expect(page).to have_selector('li.nav-header.nav-header-bigger a', text: 'Dashboard') - expect(page).to have_link('Basics', href: "/admin/conference/#{conference2.short_title}/edit") + expect(page).to_not have_link('Basics', href: "/admin/conference/#{conference2.short_title}/edit") + expect(page).to have_text('Basics') expect(page).to_not have_link('Contact', href: "/admin/conference/#{conference2.short_title}/contact/edit") expect(page).to have_link('Commercials', href: "/admin/conference/#{conference2.short_title}/commercials") expect(page).to have_link('Events', href: "/admin/conference/#{conference2.short_title}/events") @@ -176,7 +177,8 @@ feature 'Has correct abilities' do visit admin_conference_path(conference3.short_title) expect(page).to have_selector('li.nav-header.nav-header-bigger a', text: 'Dashboard') - expect(page).to have_link('Basics', href: "/admin/conference/#{conference3.short_title}/edit") + expect(page).to_not have_link('Basics', href: "/admin/conference/#{conference2.short_title}/edit") + expect(page).to have_text('Basics') expect(page).to_not have_link('Contact', href: "/admin/conference/#{conference3.short_title}/contact/edit") expect(page).to have_link('Commercials', href: "/admin/conference/#{conference3.short_title}/commercials") expect(page).to_not have_link('Events', href: "/admin/conference/#{conference3.short_title}/events")