From 28063129c72307e3b66bd2df16ca8497bd82fdfa Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Tue, 25 Nov 2014 10:47:18 +0100 Subject: [PATCH] Implement consistent admin interface * Consistent route/model/controller/view layout * Get rid of unused photos, speakers, dietchoices, social_events controllers * Drop unused :public from Rooms and :description from CallForPapers --- app/assets/javascripts/osem-datatables.js | 3 +- .../admin/call_for_papers_controller.rb | 60 ++++++++++++++ .../admin/callforpapers_controller.rb | 51 ------------ .../admin/dietchoices_controller.rb | 19 ----- .../admin/difficulty_levels_controller.rb | 61 +++++++++----- .../admin/event_types_controller.rb | 52 +++++++++--- app/controllers/admin/lodgings_controller.rb | 4 +- app/controllers/admin/photos_controller.rb | 53 ------------ .../admin/registrations_controller.rb | 36 +++++--- .../admin/social_events_controller.rb | 18 ---- app/controllers/admin/speakers_controller.rb | 21 ----- app/controllers/admin/sponsors_controller.rb | 47 +++++++++-- app/controllers/admin/targets_controller.rb | 53 +++++++++--- app/controllers/admin/tracks_controller.rb | 56 ++++++++++--- app/models/ability.rb | 10 +-- .../{call_for_papers.rb => call_for_paper.rb} | 8 +- app/models/conference.rb | 20 ++--- app/models/room.rb | 4 +- app/models/track.rb | 2 +- .../admin/call_for_papers/_form.html.haml | 15 ++++ .../admin/call_for_papers/show.html.haml | 66 +++++++++++++++ app/views/admin/callforpapers/show.html.haml | 11 --- app/views/admin/campaigns/_form.html.haml | 36 +++++--- app/views/admin/campaigns/edit.html.haml | 2 - app/views/admin/campaigns/index.html.haml | 69 ++++++++-------- app/views/admin/campaigns/new.html.haml | 2 - app/views/admin/commercials/_form.html.haml | 29 +++++-- app/views/admin/commercials/edit.html.haml | 8 -- app/views/admin/commercials/index.html.haml | 33 ++++---- app/views/admin/commercials/new.html.haml | 7 -- .../admin/conference/_edit_form.html.haml | 15 ---- .../admin/conference/_edit_show.html.haml | 42 ---------- .../admin/conference/_todo_list.html.haml | 4 +- app/views/admin/conference/edit.html.haml | 33 ++++---- app/views/admin/contacts/_form.html.haml | 13 --- app/views/admin/contacts/_show.html.haml | 36 -------- app/views/admin/contacts/edit.html.haml | 29 ++++--- .../_dietary_choice_fields.html.erb | 6 -- .../admin/dietchoices/diets_list.html.haml | 6 -- .../_difficulty_level_fields.html.haml | 6 -- .../admin/difficulty_levels/_form.html.haml | 16 ++++ .../admin/difficulty_levels/index.html.haml | 37 +++++++-- app/views/admin/emails/_help.html.haml | 8 +- .../event_types/_event_type_fields.html.erb | 10 --- app/views/admin/event_types/_form.html.haml | 18 ++++ app/views/admin/event_types/index.html.haml | 42 +++++++++- .../admin/events/_events_stats.html.haml | 48 ----------- app/views/admin/events/_proposal.html.haml | 2 +- app/views/admin/events/_voting.html.haml | 10 +-- app/views/admin/events/index.html.haml | 27 +++--- app/views/admin/lodgings/_form.html.haml | 27 ++++-- app/views/admin/lodgings/index.html.haml | 53 +++++++----- app/views/admin/lodgings/show.html.haml | 16 ---- app/views/admin/photos/_form.html.haml | 7 -- app/views/admin/photos/edit.html.haml | 6 -- app/views/admin/photos/index.html.haml | 22 ----- app/views/admin/photos/new.html.haml | 6 -- .../admin/questions/_questions.html.haml | 30 +++---- app/views/admin/questions/index.html.haml | 22 +++-- .../registration_periods/_form.html.haml | 8 +- .../admin/registration_periods/show.html.haml | 29 ++++--- app/views/admin/registrations/edit.html.haml | 6 +- app/views/admin/registrations/index.html.haml | 56 ++++++++----- app/views/admin/rooms/_form.html.haml | 19 ++++- app/views/admin/rooms/edit.html.haml | 8 -- app/views/admin/rooms/index.html.haml | 24 +++--- app/views/admin/rooms/new.html.haml | 7 -- .../_social_event_fields.html.erb | 8 -- app/views/admin/social_events/index.html.haml | 5 -- app/views/admin/speakers/_form.html.haml | 11 --- app/views/admin/speakers/edit.js.erb | 2 - app/views/admin/splashpages/_form.html.haml | 11 ++- app/views/admin/splashpages/show.html.haml | 30 ++++--- app/views/admin/sponsors/_form.html.haml | 19 +++++ .../admin/sponsors/_sponsor_fields.html.erb | 11 --- app/views/admin/sponsors/index.html.haml | 42 +++++++++- .../admin/sponsorship_levels/_form.html.haml | 16 +++- .../admin/sponsorship_levels/edit.html.haml | 8 -- .../admin/sponsorship_levels/index.html.haml | 15 ++-- .../admin/sponsorship_levels/new.html.haml | 7 -- app/views/admin/supporters/index.html.haml | 37 --------- app/views/admin/targets/_form.html.haml | 15 ++++ .../admin/targets/_target_fields.html.haml | 6 -- app/views/admin/targets/index.html.haml | 38 ++++++++- app/views/admin/tickets/_form.html.haml | 22 +++-- app/views/admin/tickets/edit.html.haml | 6 -- app/views/admin/tickets/index.html.haml | 43 +++++----- app/views/admin/tickets/new.html.haml | 6 -- app/views/admin/tickets/show.html.haml | 66 +++++++-------- app/views/admin/tracks/_form.html.haml | 15 ++++ app/views/admin/tracks/_track_fields.html.erb | 9 -- app/views/admin/tracks/index.html.haml | 39 ++++++++- app/views/admin/tracks/show.html.haml | 31 +++++++ app/views/admin/users/_submissions.html.haml | 4 +- app/views/admin/venues/_form.html.haml | 22 +++-- app/views/admin/venues/show.html.haml | 10 ++- ...rs.html.haml => _call_for_paper.html.haml} | 8 +- .../conference/_conference_details.html.haml | 2 +- app/views/conference/_program.html.haml | 4 +- app/views/conference/show.html.haml | 6 +- .../conference_registrations/show.html.haml | 4 +- app/views/layouts/_admin_sidebar.html.haml | 11 +-- app/views/proposal/_proposal_form.html.haml | 4 +- app/views/proposal/new.html.haml | 23 +++++- config/routes.rb | 57 +++++-------- .../20141120205757_remove_public_from_room.rb | 5 ++ ..._remove_description_from_call_for_paper.rb | 5 ++ db/schema.rb | 22 +++-- .../admin/conferences_controller_spec.rb | 6 +- .../controllers/conference_controller_spec.rb | 12 --- .../{call_for_papers.rb => call_for_paper.rb} | 4 +- spec/factories/photos.rb | 14 ---- spec/features/ability_spec.rb | 24 +++--- spec/features/campaign_spec.rb | 8 +- spec/features/cfp_spec.rb | 53 +++++------- spec/features/commercials_spec.rb | 2 +- spec/features/conference_spec.rb | 5 +- spec/features/contact_spec.rb | 4 +- spec/features/difficulty_levels_spec.rb | 56 ++++++------- spec/features/event_types_spec.rb | 57 ++++++------- spec/features/lodgings_spec.rb | 1 - spec/features/photo_spec.rb | 68 --------------- spec/features/proposal_spec.rb | 2 +- spec/features/rooms_spec.rb | 2 +- spec/features/sponsor_spec.rb | 64 ++++----------- spec/features/tracks_spec.rb | 79 ++++++++++-------- spec/models/ability_spec.rb | 2 +- spec/models/conference_spec.rb | 82 +++++++++---------- spec/models/photo_spec.rb | 14 ---- .../call_for_papers/show.html.haml_spec.rb | 13 +++ .../callforpapers/show.html.haml_spec.rb | 14 ---- .../social_events/index.html.haml_spec.rb | 15 ---- spec/views/conference/show.html.haml_spec.rb | 6 +- 133 files changed, 1461 insertions(+), 1461 deletions(-) create mode 100644 app/controllers/admin/call_for_papers_controller.rb delete mode 100644 app/controllers/admin/callforpapers_controller.rb delete mode 100644 app/controllers/admin/dietchoices_controller.rb delete mode 100644 app/controllers/admin/photos_controller.rb delete mode 100644 app/controllers/admin/social_events_controller.rb delete mode 100644 app/controllers/admin/speakers_controller.rb rename app/models/{call_for_papers.rb => call_for_paper.rb} (95%) create mode 100644 app/views/admin/call_for_papers/_form.html.haml create mode 100644 app/views/admin/call_for_papers/show.html.haml delete mode 100644 app/views/admin/callforpapers/show.html.haml delete mode 100644 app/views/admin/campaigns/edit.html.haml delete mode 100644 app/views/admin/campaigns/new.html.haml delete mode 100644 app/views/admin/commercials/edit.html.haml delete mode 100644 app/views/admin/commercials/new.html.haml delete mode 100644 app/views/admin/conference/_edit_form.html.haml delete mode 100644 app/views/admin/conference/_edit_show.html.haml delete mode 100644 app/views/admin/contacts/_form.html.haml delete mode 100644 app/views/admin/contacts/_show.html.haml delete mode 100644 app/views/admin/dietchoices/_dietary_choice_fields.html.erb delete mode 100644 app/views/admin/dietchoices/diets_list.html.haml delete mode 100644 app/views/admin/difficulty_levels/_difficulty_level_fields.html.haml create mode 100644 app/views/admin/difficulty_levels/_form.html.haml delete mode 100644 app/views/admin/event_types/_event_type_fields.html.erb create mode 100644 app/views/admin/event_types/_form.html.haml delete mode 100644 app/views/admin/events/_events_stats.html.haml delete mode 100644 app/views/admin/lodgings/show.html.haml delete mode 100644 app/views/admin/photos/_form.html.haml delete mode 100644 app/views/admin/photos/edit.html.haml delete mode 100644 app/views/admin/photos/index.html.haml delete mode 100644 app/views/admin/photos/new.html.haml delete mode 100644 app/views/admin/rooms/edit.html.haml delete mode 100644 app/views/admin/rooms/new.html.haml delete mode 100644 app/views/admin/social_events/_social_event_fields.html.erb delete mode 100644 app/views/admin/social_events/index.html.haml delete mode 100644 app/views/admin/speakers/_form.html.haml delete mode 100644 app/views/admin/speakers/edit.js.erb create mode 100644 app/views/admin/sponsors/_form.html.haml delete mode 100644 app/views/admin/sponsors/_sponsor_fields.html.erb delete mode 100644 app/views/admin/sponsorship_levels/edit.html.haml delete mode 100644 app/views/admin/sponsorship_levels/new.html.haml delete mode 100644 app/views/admin/supporters/index.html.haml create mode 100644 app/views/admin/targets/_form.html.haml delete mode 100644 app/views/admin/targets/_target_fields.html.haml delete mode 100644 app/views/admin/tickets/edit.html.haml delete mode 100644 app/views/admin/tickets/new.html.haml create mode 100644 app/views/admin/tracks/_form.html.haml delete mode 100644 app/views/admin/tracks/_track_fields.html.erb create mode 100644 app/views/admin/tracks/show.html.haml rename app/views/conference/{_call_for_papers.html.haml => _call_for_paper.html.haml} (82%) create mode 100644 db/migrate/20141120205757_remove_public_from_room.rb create mode 100644 db/migrate/20141121102656_remove_description_from_call_for_paper.rb rename spec/factories/{call_for_papers.rb => call_for_paper.rb} (66%) delete mode 100644 spec/factories/photos.rb delete mode 100644 spec/features/photo_spec.rb delete mode 100644 spec/models/photo_spec.rb create mode 100644 spec/views/admin/call_for_papers/show.html.haml_spec.rb delete mode 100644 spec/views/admin/callforpapers/show.html.haml_spec.rb delete mode 100644 spec/views/admin/social_events/index.html.haml_spec.rb diff --git a/app/assets/javascripts/osem-datatables.js b/app/assets/javascripts/osem-datatables.js index 5ba701bc..9e8d67e4 100644 --- a/app/assets/javascripts/osem-datatables.js +++ b/app/assets/javascripts/osem-datatables.js @@ -3,7 +3,8 @@ $(function () { $('.datatable').DataTable({ // ajax: ..., autoWidth: false, - pagingType: 'full_numbers' + pagingType: 'full_numbers', + "lengthMenu": [[25, 50, 100, -1], [25, 50, 100, "All"]] }); }); }); diff --git a/app/controllers/admin/call_for_papers_controller.rb b/app/controllers/admin/call_for_papers_controller.rb new file mode 100644 index 00000000..4e4e3e13 --- /dev/null +++ b/app/controllers/admin/call_for_papers_controller.rb @@ -0,0 +1,60 @@ +module Admin + class CallForPapersController < Admin::BaseController + load_and_authorize_resource :conference, find_by: :short_title + load_and_authorize_resource through: :conference, singleton: true + + def show; end + + def new + @call_for_paper = @conference.build_call_for_paper + end + + def edit; end + + def create + @call_for_paper = @conference.build_call_for_paper(call_for_paper_params) + + if @call_for_paper.save + redirect_to admin_conference_call_for_paper_path, + notice: 'Call for papers successfully created.' + else + flash[:alert] = "Creating the call for papers failed. #{@call_for_paper.errors.full_messages.join('. ')}." + render :new + end + end + + def update + authorize! :update, @conference.call_for_paper + @cfp = @conference.call_for_paper + @cfp.assign_attributes(params[:call_for_paper]) + send_mail_on_schedule_public = @cfp.notify_on_schedule_public? + + send_mail_on_cfp_dates_updates = @cfp.notify_on_cfp_date_update? + + if @cfp.update_attributes(params[:call_for_paper]) + Mailbot.delay.send_on_call_for_papers_dates_updates(@conference) if send_mail_on_cfp_dates_updates + Mailbot.delay.send_on_schedule_public(@conference) if send_mail_on_schedule_public + redirect_to(admin_conference_call_for_paper_path(@conference.short_title), + notice: 'Call for papers successfully updated.') + else + flash[:alert] = "Updating call for papers failed. #{@cfp.errors.to_a.join('. ')}." + render :new + end + end + + def destroy + if @call_for_paper.destroy + redirect_to admin_conference_call_for_paper_path, notice: 'Call for Papers was successfully deleted.' + else + redirect_to admin_conference_call_for_paper_path, alert: 'A error prohibited this Call for Papers from being destroyed: '\ + "#{@call_for_paper.errors.full_messages.join('. ')}." + end + end + + private + + def call_for_paper_params + params[:call_for_paper] + end + end +end diff --git a/app/controllers/admin/callforpapers_controller.rb b/app/controllers/admin/callforpapers_controller.rb deleted file mode 100644 index 650c9901..00000000 --- a/app/controllers/admin/callforpapers_controller.rb +++ /dev/null @@ -1,51 +0,0 @@ -module Admin - class CallforpapersController < Admin::BaseController - load_and_authorize_resource :conference, find_by: :short_title -# load_and_authorize_resource :cfp, class: 'CallForPapers', through: :conference - - def show - authorize! :show, CallForPapers.new(conference_id: @conference.id) - @cfp = @conference.call_for_papers - if @cfp.nil? - @cfp = CallForPapers.new - end - end - - def update - authorize! :update, @conference.call_for_papers - @cfp = @conference.call_for_papers - @cfp.assign_attributes(params[:call_for_papers]) - send_mail_on_schedule_public = @cfp.notify_on_schedule_public? - - send_mail_on_cfp_dates_updates = @cfp.notify_on_cfp_date_update? - - if @cfp.update_attributes(params[:call_for_papers]) - Mailbot.delay.send_on_call_for_papers_dates_updates(@conference) if send_mail_on_cfp_dates_updates - Mailbot.delay.send_on_schedule_public(@conference) if send_mail_on_schedule_public - redirect_to(admin_conference_callforpapers_path( - id: @conference.short_title), - notice: 'Call for Papers was successfully updated.') - else - redirect_to(admin_conference_callforpapers_path( - id: @conference.short_title), - alert: "Updating call for papers failed. #{@cfp.errors.to_a.join('. ')}.") - end - end - - def create - authorize! :update, CallForPapers.new(conference_id: @conference.id) - @cfp = CallForPapers.new(params[:call_for_papers]) - if @cfp.valid? - @cfp.save - @conference.call_for_papers = @cfp - redirect_to(admin_conference_callforpapers_path( - id: @conference.short_title), - notice: 'Call for Papers was successfully created.') - else - redirect_to(admin_conference_callforpapers_path( - id: @conference.short_title), - alert: "Creating the call for papers failed. #{@cfp.errors.to_a.join('. ')}.") - end - end - end -end diff --git a/app/controllers/admin/dietchoices_controller.rb b/app/controllers/admin/dietchoices_controller.rb deleted file mode 100644 index 2720577c..00000000 --- a/app/controllers/admin/dietchoices_controller.rb +++ /dev/null @@ -1,19 +0,0 @@ -module Admin - class DietchoicesController < Admin::BaseController - load_and_authorize_resource :conference, find_by: :short_title - load_and_authorize_resource :dietary_choice, through: :conference - - def show - render :diets_list - end - - def update - begin - @conference.update_attributes!(params[:conference]) - redirect_to(admin_conference_dietary_list_path(conference_id: @conference.short_title), notice: 'Dietary choices were successfully updated.') - rescue => e - redirect_to(admin_conference_dietary_list_path(conference_id: @conference.short_title), alert: "Dietary choices update failed: #{e.message}") - end - end - end -end diff --git a/app/controllers/admin/difficulty_levels_controller.rb b/app/controllers/admin/difficulty_levels_controller.rb index b8cb674c..70957f79 100644 --- a/app/controllers/admin/difficulty_levels_controller.rb +++ b/app/controllers/admin/difficulty_levels_controller.rb @@ -1,32 +1,55 @@ module Admin class DifficultyLevelsController < Admin::BaseController load_and_authorize_resource :conference, find_by: :short_title - authorize_resource through: :conference + load_and_authorize_resource :difficulty_level, through: :conference def index authorize! :index, DifficultyLevel.new(conference_id: @conference.id) end - def update - if @conference.update_attributes(params[:conference]) - if !(@conference.difficulty_levels.count > 0) && @conference.use_difficulty_levels == true - begin - @conference.use_difficulty_levels = false - @conference.save! - flash[:error] = 'You cannot enable the usage of difficulty levels without having set any levels.' - redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title)) - rescue ActiveRecord::RecordInvalid - flash[:error] = 'Something went wrong. Difficulty Levels update failed.' - redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title)) - end - else - flash[:notice] = 'Difficulty Levels were successfully updated.' - redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title)) - end + def edit; end + + def new + @difficulty_level = @conference.difficulty_levels.new + end + + def create + @difficulty_level = @conference.difficulty_levels.new(difficulty_level_params) + if @difficulty_level.save + redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title), + notice: 'Difficulty level successfully created.') else - flash[:error] = 'Difficulty Levels update failed.' - redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title)) + flash[:error] = "Creating difficulty level failed: #{@difficulty_level.errors.full_messages.join('. ')}." + render :new end end + + def update + if @difficulty_level.update_attributes(difficulty_level_params) + redirect_to(admin_conference_difficulty_levels_path( + conference_id: @conference.short_title), + notice: 'Difficulty level successfully updated.') + else + flash[:error] = "Update difficulty level failed: #{@difficulty_level.errors.full_messages.join('. ')}." + render :edit + end + end + + def destroy + if @difficulty_level.destroy + redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title), + notice: 'Difficulty level successfully deleted.') + else + redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title), + error: 'Deleting difficulty level type failed! ' \ + "#{@difficulty_level.errors.full_messages.join('. ')}.") + end + end + + private + + def difficulty_level_params + params[:difficulty_level] + end end end diff --git a/app/controllers/admin/event_types_controller.rb b/app/controllers/admin/event_types_controller.rb index f6cfaab2..85d1ff6b 100644 --- a/app/controllers/admin/event_types_controller.rb +++ b/app/controllers/admin/event_types_controller.rb @@ -1,25 +1,55 @@ module Admin class EventTypesController < Admin::BaseController load_and_authorize_resource :conference, find_by: :short_title - authorize_resource :event_type, through: :conference + load_and_authorize_resource :event_type, through: :conference def index authorize! :index, EventType.new(conference_id: @conference.id) end - def show - render :eventtypes + def edit; end + + def new + @event_type = @conference.event_types.new + end + + def create + @event_type = @conference.event_types.new(event_type_params) + if @event_type.save + redirect_to(admin_conference_event_types_path(conference_id: @conference.short_title), + notice: 'Event type successfully created.') + else + flash[:error] = "Creating event type failed: #{@event_type.errors.full_messages.join('. ')}." + render :new + end end def update - @conference.update_attributes!(params[:conference]) - redirect_to(admin_conference_event_types_path( - conference_id: @conference.short_title), - notice: 'Event types were successfully updated.') - rescue => e - redirect_to(admin_conference_event_types_path( - conference_id: @conference.short_title), - alert: "Event types update failed: #{e.message}") + if @event_type.update_attributes(event_type_params) + redirect_to(admin_conference_event_types_path( + conference_id: @conference.short_title), + notice: 'Event type successfully updated.') + else + flash[:error] = "Update event type failed: #{@event_type.errors.full_messages.join('. ')}." + render :edit + end + end + + def destroy + if @event_type.destroy + redirect_to(admin_conference_event_types_path(conference_id: @conference.short_title), + notice: 'Event type successfully deleted.') + else + redirect_to(admin_conference_event_types_path(conference_id: @conference.short_title), + error: 'Destroying event type failed! ' \ + "#{@event_type.errors.full_messages.join('. ')}.") + end + end + + private + + def event_type_params + params[:event_type] end end end diff --git a/app/controllers/admin/lodgings_controller.rb b/app/controllers/admin/lodgings_controller.rb index 43600b26..9b4fabdb 100644 --- a/app/controllers/admin/lodgings_controller.rb +++ b/app/controllers/admin/lodgings_controller.rb @@ -6,8 +6,6 @@ module Admin def index end - def show; end - def new @lodging = @conference.lodgings.new end @@ -27,7 +25,7 @@ module Admin def update if @lodging.update_attributes(lodging_params) - redirect_to(admin_conference_lodging_path(conference_id: @conference.short_title, id: @lodging.id), + redirect_to(admin_conference_lodgings_path(conference_id: @conference.short_title), notice: 'Lodging successfully updated.') else flash[:error] = "Update Lodging failed: #{@lodging.errors.full_messages.join('. ')}." diff --git a/app/controllers/admin/photos_controller.rb b/app/controllers/admin/photos_controller.rb deleted file mode 100644 index bde977a0..00000000 --- a/app/controllers/admin/photos_controller.rb +++ /dev/null @@ -1,53 +0,0 @@ -module Admin - class PhotosController < Admin::BaseController - load_and_authorize_resource :conference, find_by: :short_title - load_and_authorize_resource through: :conference - -# GET /admin/photos - def index - @photos = @conference.photos.all - end - -# GET /admin/photos/new - def new - @photo = @conference.photos.build - end - -# GET /admin/photos/1/edit - def edit; end - -# POST /admin/photos - def create - @photo = @conference.photos.build(photo_params) - if @photo.save - redirect_to admin_conference_photos_path, notice: 'Photo was successfully created.' - else - flash[:alert] = "A error prohibited this Photo from being saved: #{@photo.errors.full_messages.join('. ')}." - render :new - end - end - -# PATCH/PUT /admin/photos/1 - def update - if @photo.update(photo_params) - redirect_to admin_conference_photos_path, notice: 'Photo was successfully updated.' - else - flash[:alert] = "A error prohibited this Photo from being saved: #{@photo.errors.full_messages.join('. ')}." - render :edit - end - end - -# DELETE /admin/photos/1 - def destroy - @photo.destroy - redirect_to admin_conference_photos_path, notice: 'Photo was successfully destroyed.' - end - - private - -# Only allow a trusted parameter "white list" through. - def photo_params - params[:photo] - end - end -end diff --git a/app/controllers/admin/registrations_controller.rb b/app/controllers/admin/registrations_controller.rb index 45a3a301..2d516cd4 100644 --- a/app/controllers/admin/registrations_controller.rb +++ b/app/controllers/admin/registrations_controller.rb @@ -11,18 +11,6 @@ module Admin @attended = @conference.registrations.where('attended = ?', true).count end - def toogle_attended - @registration.attended = !@registration.attended - if @registration.save - flash[:notice] = "Successfully updated Attended for #{@user.email}" - redirect_to admin_conference_registrations_path(@conference.short_title) - else - flash[:notice] = "Update Attended for #{@user.email} failed!" \ - "#{@registration.errors.full_messages.join('. ')}" - redirect_to admin_conference_registrations_path(@conference.short_title) - end - end - def edit; end def update @@ -48,6 +36,30 @@ module Admin end end + def present + @registration.attended = true + if @registration.save + flash[:notice] = "#{@user.email} has attended" + redirect_to admin_conference_registrations_path(@conference.short_title) + else + flash[:notice] = "Update Attended for #{@user.email} failed!" \ + "#{@registration.errors.full_messages.join('. ')}" + redirect_to admin_conference_registrations_path(@conference.short_title) + end + end + + def absent + @registration.attended = false + if @registration.save + flash[:notice] = "#{@user.email} has not attended" + redirect_to admin_conference_registrations_path(@conference.short_title) + else + flash[:notice] = "Update Attended for #{@user.email} failed!" \ + "#{@registration.errors.full_messages.join('. ')}" + redirect_to admin_conference_registrations_path(@conference.short_title) + end + end + protected def set_user diff --git a/app/controllers/admin/social_events_controller.rb b/app/controllers/admin/social_events_controller.rb deleted file mode 100644 index bc8dae88..00000000 --- a/app/controllers/admin/social_events_controller.rb +++ /dev/null @@ -1,18 +0,0 @@ -module Admin - class SocialEventsController < Admin::BaseController - load_and_authorize_resource :conference, find_by: :short_title - authorize_resource :social_event, through: :conference - - def show - render :social_events_list - end - - def update - if @conference.update_attributes(params[:conference]) - redirect_to(admin_conference_social_events_path(conference_id: @conference.short_title), notice: 'Social events were successfully updated.') - else - redirect_to(admin_conference_social_events_path(conference_id: @conference.short_title), notice: 'Social events update failed.') - end - end - end -end diff --git a/app/controllers/admin/speakers_controller.rb b/app/controllers/admin/speakers_controller.rb deleted file mode 100644 index d3dfe700..00000000 --- a/app/controllers/admin/speakers_controller.rb +++ /dev/null @@ -1,21 +0,0 @@ -module Admin - class SpeakersController < Admin::BaseController - load_and_authorize_resource :conference, find_by: :short_title - load_and_authorize_resource :event - - respond_to :js, :html - - def edit - authorize! :update, @conference.events.new - @speaker = @event.event_users.where(event_role: 'speaker').first - end - - def update - authorize! :update, @conference.events.new - @speaker = @event.event_users.where(event_role: 'speaker').first - @speaker.user_id = params[:speaker][:user_id] - @speaker.save - respond_with @speaker, location: admin_conference_events_path(@conference.short_title) - end - end -end diff --git a/app/controllers/admin/sponsors_controller.rb b/app/controllers/admin/sponsors_controller.rb index 26d1df6e..64db50d9 100644 --- a/app/controllers/admin/sponsors_controller.rb +++ b/app/controllers/admin/sponsors_controller.rb @@ -1,22 +1,55 @@ module Admin class SponsorsController < Admin::BaseController load_and_authorize_resource :conference, find_by: :short_title - authorize_resource :sponsor, through: :conference + load_and_authorize_resource :sponsor, through: :conference def index authorize! :index, Sponsor.new(conference_id: @conference.id) end - def update - if @conference.update_attributes(params[:conference]) - redirect_to(admin_conference_sponsors_path( - conference_id: @conference.short_title), - notice: 'Sponsorships were successfully updated.') + def edit; end + + def new + @sponsor = @conference.sponsors.new + end + + def create + @sponsor = @conference.sponsors.new(sponsor_params) + if @sponsor.save + redirect_to(admin_conference_sponsors_path(conference_id: @conference.short_title), + notice: 'Sponsor successfully created.') else + flash[:error] = "Creating sponsor failed: #{@sponsor.errors.full_messages.join('. ')}." + render :new + end + end + + def update + if @sponsor.update_attributes(sponsor_params) redirect_to(admin_conference_sponsors_path( conference_id: @conference.short_title), - alert: 'Sponsorships update failed.') + notice: 'Sponsor successfully updated.') + else + flash[:error] = "Update sponsor failed: #{@sponsor.errors.full_messages.join('. ')}." + render :edit end end + + def destroy + if @sponsor.destroy + redirect_to(admin_conference_sponsors_path(conference_id: @conference.short_title), + notice: 'Sponsor successfully deleted.') + else + redirect_to(admin_conference_sponsors_path(conference_id: @conference.short_title), + error: 'Deleting sponsor failed! ' \ + "#{@sponsor.errors.full_messages.join('. ')}.") + end + end + + private + + def sponsor_params + params[:sponsor] + end end end diff --git a/app/controllers/admin/targets_controller.rb b/app/controllers/admin/targets_controller.rb index 21246185..b069cb76 100644 --- a/app/controllers/admin/targets_controller.rb +++ b/app/controllers/admin/targets_controller.rb @@ -1,25 +1,54 @@ module Admin class TargetsController < Admin::BaseController load_and_authorize_resource :conference, find_by: :short_title - authorize_resource through: :conference + load_and_authorize_resource :target, through: :conference def index - authorize! :index, Target.new(conference_id: @conference.id) + authorize! :update, Target.new(conference_id: @conference.id) end - def update - authorize! :update, @conference => Target + def new + @target = @conference.targets.new + end - if @conference.update_attributes(params[:conference]) - redirect_to(admin_conference_targets_path( - conference_id: @conference.short_title), - notice: 'Targets were successfully updated.') + def create + @target = @conference.targets.new(target_params) + if @target.save(target_params) + redirect_to(admin_conference_targets_path(conference_id: @conference.short_title), + notice: 'Target successfully created.') else - redirect_to(admin_conference_targets_path( - conference_id: @conference.short_title), - alert: 'Targets update failed: ' \ - "#{@conference.errors.full_messages.join('. ')}") + flash[:alert] = "Creating target failed: #{@target.errors.full_messages.join('. ')}." + render :new end end + + def edit; end + + def update + if @target.update_attributes(target_params) + redirect_to(admin_conference_targets_path(conference_id: @conference.short_title), + notice: 'Target successfully updated.') + else + flash[:alert] = "Target update failed: #{@target.errors.full_messages.join('. ')}." + render :edit + end + end + + def destroy + if @target.destroy + redirect_to(admin_conference_targets_path(conference_id: @conference.short_title), + notice: 'Target successfully destroyed.') + else + redirect_to(admin_conference_targets_path(conference_id: @conference.short_title), + alert: 'Target was successfully destroyed.' \ + "#{@target.errors.full_messages.join('. ')}.") + end + end + + private + + def target_params + params[:target] + end end end diff --git a/app/controllers/admin/tracks_controller.rb b/app/controllers/admin/tracks_controller.rb index 089afacc..797d92cc 100644 --- a/app/controllers/admin/tracks_controller.rb +++ b/app/controllers/admin/tracks_controller.rb @@ -1,29 +1,59 @@ module Admin class TracksController < Admin::BaseController load_and_authorize_resource :conference, find_by: :short_title - authorize_resource through: :conference + load_and_authorize_resource :track, through: :conference - def index - authorize! :index, Track.new(conference_id: @conference.id) - end + def index; end def show respond_to do |format| - format.html { render :tracks_list } + format.html { render } format.json { render json: @conference.tracks.to_json } end end - def update - if @conference.update_attributes(params[:conference]) - redirect_to(admin_conference_tracks_path( - conference_id: @conference.short_title), - notice: 'Tracks were successfully updated.') + def new + @track = @conference.tracks.new + end + + def create + @track = @conference.tracks.new(track_params) + if @track.save + redirect_to(admin_conference_tracks_path(conference_id: @conference.short_title), + notice: 'Track successfully created.') else - redirect_to(admin_conference_tracks_path( - conference_id: @conference.short_title), - notice: 'Tracks update failed.') + flash[:alert] = "Creating Track failed: #{@track.errors.full_messages.join('. ')}." + render :new end end + + def edit; end + + def update + if @track.update_attributes(track_params) + redirect_to(admin_conference_tracks_path(conference_id: @conference.short_title), + notice: 'Track successfully updated.') + else + flash[:alert] = "Track update failed: #{@track.errors.full_messages.join('. ')}." + render :edit + end + end + + def destroy + if @track.destroy + redirect_to(admin_conference_tracks_path(conference_id: @conference.short_title), + notice: 'Track successfully deleted.') + else + redirect_to(admin_conference_tracks_path(conference_id: @conference.short_title), + alert: 'Track couldn\'t be deleted.' \ + "#{@track.errors.full_messages.join('. ')}.") + end + end + + private + + def track_params + params[:track] + end end end diff --git a/app/models/ability.rb b/app/models/ability.rb index 9ec2b3ee..332c612f 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -78,16 +78,12 @@ class Ability # the user can also vote can :manage, Event, conference_id: conf_ids_for_organizer + conf_ids_for_cfp can :create, Event - can :manage, CallForPapers, conference_id: conf_ids_for_organizer + conf_ids_for_cfp can :manage, EventType, conference_id: conf_ids_for_organizer + conf_ids_for_cfp can :manage, Track, conference_id: conf_ids_for_organizer + conf_ids_for_cfp can :manage, DifficultyLevel, conference_id: conf_ids_for_organizer + conf_ids_for_cfp can :manage, EmailSettings, conference_id: conf_ids_for_organizer + conf_ids_for_cfp can :manage, Campaign, conference_id: conf_ids_for_organizer - can :manage, Venue, conference_id: conf_ids_for_organizer - can :index, Venue, conference_id: conf_ids_for_organizer + conf_ids_for_cfp can :manage, Lodging, conference_id: conf_ids_for_organizer - can :manage, Photo, conference_id: conf_ids_for_organizer can :manage, Room, conference_id: conf_ids_for_organizer + conf_ids_for_cfp can :manage, Sponsor, conference_id: conf_ids_for_organizer can :manage, SponsorshipLevel, conference_id: conf_ids_for_organizer @@ -99,14 +95,16 @@ class Ability can :manage, Commercial, commercialable_type: 'Event', commercialable_id: Event.where(conference_id: conf_ids_for_organizer + conf_ids_for_cfp).pluck(:id) can :manage, Contact, conference_id: conf_ids_for_organizer can :manage, Campaign, conference_id: conf_ids_for_organizer - can :manage, Photo, conference_id: conf_ids_for_organizer can :manage, RegistrationPeriod, conference_id: conf_ids_for_organizer can :manage, Splashpage, conference_id: conf_ids_for_organizer + can :manage, CallForPaper, conference_id: conf_ids_for_organizer + conf_ids_for_cfp + can :manage, Venue, conference_id: conf_ids_for_organizer + can :index, Venue, conference_id: conf_ids_for_organizer + conf_ids_for_cfp end def guest ## Abilities for everyone, even guests (not logged in users) - can [:index, :show, :gallery_photos], Conference do |conference| + can [:index, :show], Conference do |conference| conference.splashpage && conference.splashpage.public == true end diff --git a/app/models/call_for_papers.rb b/app/models/call_for_paper.rb similarity index 95% rename from app/models/call_for_papers.rb rename to app/models/call_for_paper.rb index 7876efa2..eab866ed 100644 --- a/app/models/call_for_papers.rb +++ b/app/models/call_for_paper.rb @@ -1,8 +1,8 @@ -class CallForPapers < ActiveRecord::Base - attr_accessible :start_date, :end_date, - :description, :schedule_changes, :rating, - :schedule_public, :include_cfp_in_splash, :conference_id +class CallForPaper < ActiveRecord::Base belongs_to :conference + attr_accessible :start_date, :end_date, + :schedule_changes, :rating, + :schedule_public, :include_cfp_in_splash, :conference_id validates_presence_of :start_date, :end_date validates :rating, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 10 } diff --git a/app/models/conference.rb b/app/models/conference.rb index 63c4065d..f79d9678 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -28,7 +28,7 @@ class Conference < ActiveRecord::Base has_one :contact, dependent: :destroy has_one :registration_period, dependent: :destroy has_one :email_settings, dependent: :destroy - has_one :call_for_papers, dependent: :destroy + has_one :call_for_paper, dependent: :destroy has_one :venue, dependent: :destroy has_many :social_events, dependent: :destroy has_many :ticket_purchases @@ -161,7 +161,7 @@ class Conference < ActiveRecord::Base # * +true+ -> If today is in the CFP period. def cfp_open? today = Date.current - cfp = self.call_for_papers + cfp = self.call_for_paper if !cfp.nil? && (cfp.start_date.. cfp.end_date).cover?(today) return true end @@ -177,10 +177,10 @@ class Conference < ActiveRecord::Base def get_submissions_per_week result = [] - if call_for_papers && events + if call_for_paper && events submissions = events.group(:week).count - start_week = call_for_papers.start_week - weeks = call_for_papers.weeks + start_week = call_for_paper.start_week + weeks = call_for_paper.weeks result = calculate_items_per_week(start_week, weeks, submissions) end result @@ -194,10 +194,10 @@ class Conference < ActiveRecord::Base # * +Array+ -> e.g. 'Submitted' => [0, 3, 3, 5] -> first week 0 events, second week 3 events. def get_submissions_data result = {} - if call_for_papers && events + if call_for_paper && events result = get_events_per_week_by_state - start_week = call_for_papers.start_week + start_week = call_for_paper.start_week end_week = end_date.strftime('%W').to_i weeks = weeks(start_week, end_week) @@ -260,8 +260,8 @@ class Conference < ActiveRecord::Base # * +Integer+ -> weeks def cfp_weeks result = 0 - if call_for_papers - result = call_for_papers.weeks + if call_for_paper + result = call_for_paper.weeks end result end @@ -743,7 +743,7 @@ class Conference < ActiveRecord::Base # * +True+ -> If conference has a cfp object. # * +False+ -> If conference has no cfp object. def cfp_set? - !!call_for_papers + !!call_for_paper end ## diff --git a/app/models/room.rb b/app/models/room.rb index c4044a0a..cf59e39b 100644 --- a/app/models/room.rb +++ b/app/models/room.rb @@ -1,5 +1,5 @@ class Room < ActiveRecord::Base - attr_accessible :name, :size, :public, :conference_id + attr_accessible :name, :size, :conference_id belongs_to :conference has_many :events @@ -10,8 +10,6 @@ class Room < ActiveRecord::Base validates :size, numericality: { only_integer: true, greater_than: 0 }, allow_nil: true - validates :size, presence: true, if: :public? - private def generate_guid diff --git a/app/models/track.rb b/app/models/track.rb index 4e7deba7..7a992246 100644 --- a/app/models/track.rb +++ b/app/models/track.rb @@ -1,7 +1,7 @@ class Track < ActiveRecord::Base attr_accessible :name, :description, :color, :conference_id - belongs_to :conference + has_many :events before_create :generate_guid diff --git a/app/views/admin/call_for_papers/_form.html.haml b/app/views/admin/call_for_papers/_form.html.haml new file mode 100644 index 00000000..11f6476d --- /dev/null +++ b/app/views/admin/call_for_papers/_form.html.haml @@ -0,0 +1,15 @@ +.row + .col-md-12 + .page-header + %h1 Call for Papers +.row + .col-md-8 + = semantic_form_for(@call_for_paper, :url => admin_conference_call_for_paper_path(@conference.short_title),:html => {:multipart => true}) do |f| + = f.input :start_date, :as => :string, :input_html => { :id => "conference-start-datepicker", :readonly => "readonly" } + = f.input :end_date, :as => :string, :input_html => { :id => "conference-end-datepicker", :readonly => "readonly" } + = f.input :include_cfp_in_splash, label: "Show Call for Papers on the splash page" + = f.input :schedule_public, label: "Show Schedule on the home and splash page" + = f.input :schedule_changes, label: "Allow submitters to change their event after it is scheduled" + = f.input :rating, :hint => "Enter the number of different rating levels you want to have for voting on proposals. Enter 0 if you do not want to vote on proposals." + %p.text-right + = f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"} diff --git a/app/views/admin/call_for_papers/show.html.haml b/app/views/admin/call_for_papers/show.html.haml new file mode 100644 index 00000000..01322c75 --- /dev/null +++ b/app/views/admin/call_for_papers/show.html.haml @@ -0,0 +1,66 @@ +.row + .col-md-12 + .page-header + %h1 Call for Papers + %p.text-muted + Call for people to submit events to your conference +- if @call_for_paper + .row + .col-md-8 + %dl.dl-horizontal + %dt + Start Date: + %dd#start_date + = @call_for_paper.start_date.strftime('%A, %B %-d. %Y') + %dt + Start Date: + %dd#end_date + = @call_for_paper.end_date.strftime('%A, %B %-d. %Y') + %dt + Days Left: + %dd + - days = (@call_for_paper.end_date - Date.today).to_i + = pluralize(days, 'days') + %dt + Event types: + %dd + = event_types(@conference) + %dt + Tracks: + %dd + = tracks(@conference) + %dt + Public + %dd#cfp_in_splash + - if @call_for_paper.include_cfp_in_splash + True + - else + False + %dt + Public Schedule + %dd#schedule_public + - if @call_for_paper.schedule_public + Yes + - else + No + %dt + Schedule changeable? + %dd#schedule_changes + - if @call_for_paper.schedule_changes + Yes + - else + No + %dt + Rating Levels + %dd#rating + = @call_for_paper.rating + .row + .col-md-12.text-right + = link_to(edit_admin_conference_call_for_paper_path(@conference.short_title), class: 'btn btn-primary') do + Edit + = link_to(admin_conference_call_for_paper_path(@conference.short_title), method: 'delete', class: 'btn btn-danger') do + Delete +-else + .row + .col-md-12.text-right + = link_to 'Create Call for Papers', new_admin_conference_call_for_paper_path(@conference.short_title), class: 'btn btn-primary' diff --git a/app/views/admin/callforpapers/show.html.haml b/app/views/admin/callforpapers/show.html.haml deleted file mode 100644 index 8b76117a..00000000 --- a/app/views/admin/callforpapers/show.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -.row - .col-md-8 - = semantic_form_for(@cfp, :url => admin_conference_callforpapers_path(@conference.short_title),:html => {:multipart => true}) do |f| - = f.input :include_cfp_in_splash, label: 'Include Call for Papers in Splash', hint: 'On setting this true you will enable the call for papers to be displayed on the splash page' - = f.input :start_date, :as => :string, :input_html => { :id => "conference-start-datepicker", :readonly => "readonly" } - = f.input :end_date, :as => :string, :input_html => { :id => "conference-end-datepicker", :readonly => "readonly" } - = f.input :description, hint: markdown_hint("Welcome text for the Call for Papers."), input_html: { data: { provide: "markdown-editable" } } - = f.input :schedule_changes - = f.input :schedule_public - = f.input :rating, :hint => "Enter the number of different rating levels you want to have for voting on proposals. Enter 0 if you do not want to vote on proposals." - = f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"} diff --git a/app/views/admin/campaigns/_form.html.haml b/app/views/admin/campaigns/_form.html.haml index 3493849c..c65f49f1 100644 --- a/app/views/admin/campaigns/_form.html.haml +++ b/app/views/admin/campaigns/_form.html.haml @@ -1,12 +1,24 @@ -= f.inputs do - = f.input :name - = f.inputs name: 'UTM Parameters' do - = f.input :utm_campaign, label: 'Campaign', hint: 'Groups all of the content form one campaign. E.g. 20percentpromocode' - = f.input :utm_source, label: 'Source', hint: 'Which website is sending you traffic. E.g. Facebook, google+, blog' - = f.input :utm_medium, label: 'Medium', hint: 'The type of marketing medium that the link is featured in. E.g. Facebook wallpost or facebook advertisement' - = f.input :utm_term, label: 'Term', hint: 'Campaign keywords. E.g. marketing+conference+opensource' - = f.input :utm_content, label: 'Content', hint: 'Used to track the different types of content that point to the same URL (A/B Test).' - = f.inputs name: 'Targets' do - = f.input :targets -= f.actions do - = f.action :submit, button_html: { class: 'btn btn-primary' } +.row + .col-md-12 + .page-header + %h1 + -if @campaign.new_record? + New + Campaign + = @campaign.name + +.row + .col-md-8 + = semantic_form_for(@campaign, :url => (@campaign.new_record? ? admin_conference_campaigns_path : admin_conference_campaign_path(@conference.short_title, @campaign))) do |f| + = f.inputs do + = f.input :name + = f.inputs name: 'UTM Parameters' do + = f.input :utm_campaign, label: 'Campaign', hint: 'Groups all of the content from one campaign. E.g. 20percentpromocode' + = f.input :utm_source, label: 'Source', hint: 'Which website is sending you traffic. E.g. Facebook, google+, blog' + = f.input :utm_medium, label: 'Medium', hint: 'The type of marketing medium that the link is featured in. E.g. Facebook wallpost or facebook advertisement' + = f.input :utm_term, label: 'Term', hint: 'Campaign keywords. E.g. marketing+conference+opensource' + = f.input :utm_content, label: 'Content', hint: 'Used to track the different types of content that point to the same URL (A/B Test).' + = f.inputs name: 'Targets' do + = f.input :targets + %p.text-right + = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } diff --git a/app/views/admin/campaigns/edit.html.haml b/app/views/admin/campaigns/edit.html.haml deleted file mode 100644 index db20bce2..00000000 --- a/app/views/admin/campaigns/edit.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -= semantic_form_for(@campaign, url: admin_conference_campaign_path(@conference.short_title, @campaign)) do |f| - = render partial: 'form', locals: {f: f} diff --git a/app/views/admin/campaigns/index.html.haml b/app/views/admin/campaigns/index.html.haml index fd59016f..d368dcfd 100644 --- a/app/views/admin/campaigns/index.html.haml +++ b/app/views/admin/campaigns/index.html.haml @@ -1,41 +1,42 @@ -%h1 - Campaigns .row .col-md-12 - .table-responsive - %table.table - %thead + .page-header + %h1 Campaigns + %p.text-muted + Track where people come from +.row + .col-md-12 + %table.table.table-hover#campaigns + %thead + %tr + %th Name + %th Visits + %th Registrations + %th Submissions + %th Link + %th Actions + %tbody + - @campaigns.each do |campaign| %tr - %th # - %th Name - %th Visits - %th Registrations - %th Submissions - %th Link - %th Edit - %th Delete - %tbody - - @campaigns.each_with_index do |campaign, index| - %tr - %td - = index + 1 - %td{'id'=> "name_#{index}"} - = campaign.name - %td{'id'=> "visits_#{index}"} - = campaign.visits_count - %td{'id'=> "registrations_#{index}"} - = campaign.registrations_count - %td{'id'=> "submissions_#{ + index}"} - = campaign.submissions_count - %td - %a.copyLink{'href'=> '#', 'data-url'=>root_path + campaign.url_parameters} - Copy link - %td + %td{'id'=> "name_#{campaign.id}"} + = campaign.name + %td{'id'=> "visits_#{campaign.id}"} + = campaign.visits_count + %td{'id'=> "registrations_#{campaign.id}"} + = campaign.registrations_count + %td{'id'=> "submissions_#{campaign.id}"} + = campaign.submissions_count + %td + %a.copyLink{'href'=> '#', 'data-url'=>root_path + campaign.url_parameters} + Copy link + %td + .btn-group = link_to 'Edit', - edit_admin_conference_campaign_path(@conference.short_title, campaign.id) - %td + edit_admin_conference_campaign_path(@conference.short_title, campaign.id), + class: 'btn btn-primary' = link_to 'Delete', - admin_conference_campaign_path(@conference.short_title, campaign.id), method: :delete + admin_conference_campaign_path(@conference.short_title, campaign.id), + method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete the campaign #{campaign.name}?" } .row .col-md-12 - %b= link_to 'New Campaign', new_admin_conference_campaign_path, class: 'btn btn-success' + = link_to 'New Campaign', new_admin_conference_campaign_path, class: 'btn btn-success pull-right' diff --git a/app/views/admin/campaigns/new.html.haml b/app/views/admin/campaigns/new.html.haml deleted file mode 100644 index aba7247d..00000000 --- a/app/views/admin/campaigns/new.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -= semantic_form_for(@campaign, url: admin_conference_campaigns_path(@conference.short_title)) do |f| - = render partial: 'form', locals: {f: f} diff --git a/app/views/admin/commercials/_form.html.haml b/app/views/admin/commercials/_form.html.haml index ea9e75cd..169c04b6 100644 --- a/app/views/admin/commercials/_form.html.haml +++ b/app/views/admin/commercials/_form.html.haml @@ -1,9 +1,20 @@ -= f.input :commercial_type, as: :select, label: 'Conference Promo Media Type', class: 'form-control', collection: CONFIG['commercial_types'].values, include_blank: false, hint: 'This media-item will be used to represent this conference at various places in OSEM.' -= f.input :commercial_id, label: 'Conference Promo Media ID', as: :string -%p{ class: 'help-block media-type', id: 'youtube-help' } Go to your YouTube video, click on "share" and copy everything behind http://youtu.be/" -%p{ class: 'help-block media-type', id: 'slideshare-help', style: 'display:none' } Go to your SlideShare, click on "share" -> "embed" and copy the id -%p{ class: 'help-block media-type', id: 'flickr-help', style: 'display:none' } Go to your flickr image, click on "Grab the link" -> "Show short url" and copy everything behind https://flic.kr/p/ -%p{ class: 'help-block media-type', id: 'vimeo-help', style: 'display:none' } Go to your vimeo video, click on "share" and copy everything behind http://vimeo.com/ -%p{ class: 'help-block media-type', id: 'speakerdeck-help', style: 'display:none' } Go to your SpeakerDeck, click on "share" -> "embed" and copy the data-id -%p{ class: 'help-block media-type', id: 'instagram-help', style: 'display:none' } Go to your Instagram photo page and copy everything behind instagram.com/p/ (without trailing /# hash symbol) -= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } +.row + .col-md-12 + .page-header + %h1 + -if @commercial.new_record? + New + Commercial +.row + .col-md-8 + = semantic_form_for(@commercial, :url => (@commercial.new_record? ? admin_conference_commercials_path : admin_conference_commercial_path(@conference.short_title, @commercial))) do |f| + = f.input :commercial_type, as: :select, label: 'Conference Promo Media Type', class: 'form-control', collection: CONFIG['commercial_types'].values, include_blank: false, hint: 'This media-item will be used to represent this conference at various places in OSEM.' + = f.input :commercial_id, label: 'Conference Promo Media ID', as: :string + %p{ class: 'help-block media-type', id: 'youtube-help' } Go to your YouTube video, click on "share" and copy everything behind http://youtu.be/" + %p{ class: 'help-block media-type', id: 'slideshare-help', style: 'display:none' } Go to your SlideShare, click on "share" -> "embed" and copy the id + %p{ class: 'help-block media-type', id: 'flickr-help', style: 'display:none' } Go to your flickr image, click on "Grab the link" -> "Show short url" and copy everything behind https://flic.kr/p/ + %p{ class: 'help-block media-type', id: 'vimeo-help', style: 'display:none' } Go to your vimeo video, click on "share" and copy everything behind http://vimeo.com/ + %p{ class: 'help-block media-type', id: 'speakerdeck-help', style: 'display:none' } Go to your SpeakerDeck, click on "share" -> "embed" and copy the data-id + %p{ class: 'help-block media-type', id: 'instagram-help', style: 'display:none' } Go to your Instagram photo page and copy everything behind instagram.com/p/ (without trailing /# hash symbol) + %p.text-right + = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } diff --git a/app/views/admin/commercials/edit.html.haml b/app/views/admin/commercials/edit.html.haml deleted file mode 100644 index eecd7324..00000000 --- a/app/views/admin/commercials/edit.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -%h1 Editing Commercial - -.row - .col-md-8 - = semantic_form_for @commercial, url: admin_conference_commercial_path(conference_id: @conference.short_title, id: @commercial.id) do |f| - = render 'form', f: f - -= link_to 'Back', admin_conference_commercials_path diff --git a/app/views/admin/commercials/index.html.haml b/app/views/admin/commercials/index.html.haml index e8f72d53..9146f654 100644 --- a/app/views/admin/commercials/index.html.haml +++ b/app/views/admin/commercials/index.html.haml @@ -1,10 +1,11 @@ -%h1 Commercials - -%p.text-muted - You can add commercials for your conference. These commercials will be displayed on the event detail site if - the event submitter doesn't add a commercial. Currently supported commercial types are YouTube, Vimeo, Instagram - Flickr, Speakerdeck and SlideShare. - +.row + .col-md-12 + .page-header + %h1 Commercials + %p.text-muted + Conference commercials will be displayed on the events in the + = link_to "schedule,", conference_schedule_path(@conference.short_title) + if the event speaker didn't add an event commercial. - @commercials.each_slice(3) do |slice| .row - slice.each do |commercial| @@ -14,11 +15,13 @@ = commercial.commercial_type .flexvideo = render partial: 'shared/media_item', locals: { commercial_type: commercial.commercial_type, commercial_id: commercial.commercial_id } - - if can? :update, commercial - = link_to 'Edit', edit_admin_conference_commercial_path(@conference.short_title, commercial.id), class: 'btn btn-primary' - - if can? :destroy, commercial - = link_to 'Delete', admin_conference_commercial_path(@conference.short_title, commercial.id), - method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger' -- if can? :create, @conference.commercials.new - %br - = link_to 'New Commercial', new_admin_conference_commercial_path, class: 'btn btn-primary' + .caption + - if can? :update, commercial + = link_to 'Edit', edit_admin_conference_commercial_path(@conference.short_title, commercial.id), class: 'btn btn-primary' + - if can? :destroy, commercial + = link_to 'Delete', admin_conference_commercial_path(@conference.short_title, commercial.id), + method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger' +.row + .col-md-12.text-right + - if can? :create, @conference.commercials.new + = link_to 'Add Commercial', new_admin_conference_commercial_path, class: 'btn btn-primary' diff --git a/app/views/admin/commercials/new.html.haml b/app/views/admin/commercials/new.html.haml deleted file mode 100644 index 875624b6..00000000 --- a/app/views/admin/commercials/new.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -%h1 New Commercial -.row - .col-md-8 - = semantic_form_for @commercial, url: admin_conference_commercials_path(conference_id: @conference.short_title) do |f| - = render 'form', f: f - -= link_to 'Back', admin_conference_commercials_path diff --git a/app/views/admin/conference/_edit_form.html.haml b/app/views/admin/conference/_edit_form.html.haml deleted file mode 100644 index 117c52c2..00000000 --- a/app/views/admin/conference/_edit_form.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -.row - .col-md-8 - = semantic_form_for(@conference, :url => admin_conference_path(@conference.short_title),:html => {:multipart => true}) do |f| - = f.input :title, :hint => "The full title of the conference, e.g. 'openSUSE Conference 2014'" - = f.input :short_title, :hint => "A short title, e.g. 'oSC14', to be used in URLs" - = f.input :description, hint: markdown_hint('A description of the conference.'), input_html: { rows: 5, data: { provide: 'markdown-editable' } } - = f.input :color, :hint => "The color will be used eg for the dashboard.", :input_html => {:size => 6, :type => "color"} - - if !@conference.logo.blank? - = image_tag @conference.logo(:thumb) - = f.input :logo, :label => "Conference Logo", :hint => "This will be displayed on the front page." - = f.inputs :name => "Scheduling" do - = f.input :timezone, :as => :time_zone, :hint => "The conference time zone" - = f.input :start_date, :as => :string, :input_html => { :id => "conference-start-datepicker", :readonly => "readonly" } - = f.input :end_date, :as => :string, :input_html => { :id => "conference-end-datepicker", :readonly => "readonly" } - = f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"} diff --git a/app/views/admin/conference/_edit_show.html.haml b/app/views/admin/conference/_edit_show.html.haml deleted file mode 100644 index aed09aad..00000000 --- a/app/views/admin/conference/_edit_show.html.haml +++ /dev/null @@ -1,42 +0,0 @@ -.row{'style'=>'padding-top: 15px;'} - .col-md-6 - %dl.dl-horizontal - %dt - Title - %dd - = @conference.title - %dt - Short Title - %dd - = @conference.short_title - %dt - Description - %dd - - unless @conference.description.blank? - = markdown(@conference.description) - %dt - Date - %dd - = @date_string - %dt - Color - %dd - %div.text-center{'style'=>"width: 25px; height: 25px; background: #{@conference.color};"} -.row.row-flex.row-flex-wrap - .col-md-4 - .thumbnail.flex-col - %h3.text-center - Conference Logo - - if @conference.logo? - = image_tag(@conference.logo(:large), class: 'img-responsive') - .caption.flex-grow - .caption - %p - %dl.dl-horizontal - %dt - Filename - %dd - = @conference.logo_file_name - -else - %h4.text-center - Not set! diff --git a/app/views/admin/conference/_todo_list.html.haml b/app/views/admin/conference/_todo_list.html.haml index f3f64cb1..d5a700d6 100644 --- a/app/views/admin/conference/_todo_list.html.haml +++ b/app/views/admin/conference/_todo_list.html.haml @@ -17,8 +17,8 @@ Set up registration period %li{'class'=>class_for_todo(conference_progress['cfp'])} %span{'class'=>icon_for_todo(conference_progress['cfp'])} - - if can? :update, CallForPapers.new(conference_id: @conference.id) - = link_to 'Set up call for papers', admin_conference_callforpapers_path(conference_progress['short_title']) + - if can? :update, CallForPaper.new(conference_id: @conference.id) + = link_to 'Set up call for papers', admin_conference_call_for_paper_path(conference_progress['short_title']) - else Set up call for papers %li{'class'=>class_for_todo(conference_progress['venue'])} diff --git a/app/views/admin/conference/edit.html.haml b/app/views/admin/conference/edit.html.haml index 76bf58cb..5a931d1e 100644 --- a/app/views/admin/conference/edit.html.haml +++ b/app/views/admin/conference/edit.html.haml @@ -1,17 +1,22 @@ .row .col-md-12 - %ul.nav.nav-tabs{'role'=>'tablist'} - %li.active - %a{'href'=> '#show', 'role'=>'tab', 'data-toggle'=>'tab'} - Show - %li - %a{'href'=> '#edit', 'role'=>'tab', 'data-toggle'=>'tab'} - Edit -%br + .page-header + %h1 Basics + %p.text-muted + The most basic settings of your conference .row - .col-md-12 - .tab-content - .tab-pane.active#show - = render partial: 'edit_show' - .tab-pane#edit - = render partial: 'edit_form' + .col-md-8 + = semantic_form_for(@conference, :url => admin_conference_path(@conference.short_title),:html => {:multipart => true}) do |f| + = f.input :title, :hint => "The full title of the conference, e.g. 'openSUSE Conference 2014'" + = f.input :short_title, :hint => "A short title, e.g. 'oSC14', to be used in URLs" + = f.input :description, hint: markdown_hint('A description of the conference.'), input_html: { rows: 5, data: { provide: 'markdown-editable' } } + = f.input :color, :hint => "The color will be used eg for the dashboard.", :input_html => {:size => 6, :type => "color"} + - if !@conference.logo.blank? + = image_tag @conference.logo(:thumb) + = f.input :logo, :label => "Conference Logo", :hint => "This will be displayed on the front page." + = f.inputs :name => "Scheduling" do + = f.input :timezone, :as => :time_zone, :hint => "The conference time zone" + = f.input :start_date, :as => :string, :input_html => { :id => "conference-start-datepicker", :readonly => "readonly" } + = f.input :end_date, :as => :string, :input_html => { :id => "conference-end-datepicker", :readonly => "readonly" } + = f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"} + diff --git a/app/views/admin/contacts/_form.html.haml b/app/views/admin/contacts/_form.html.haml deleted file mode 100644 index 320f9f90..00000000 --- a/app/views/admin/contacts/_form.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -.row - .col-md-8 - = semantic_form_for(@contact, :url => admin_conference_contact_path(@conference.short_title),:html => {:multipart => true}) do |f| - = f.inputs :name => 'Contact' do - = f.input :email, hint: 'Contact email address for your conference. Will be used as reply-to address in emails sent out by the system.' - = f.input :sponsor_email, hint: 'This will appear in the sponsor segment of the splash for the sponsors to contact to the organizers' - = f.inputs :name => 'Social Media' do - = f.input :social_tag, hint: "The hashtag you'll use on Twitter and Google+. Don't include the '#' sign!'" - = f.input :facebook, hint: 'This will appear in the social media section as link to the Facebook page of your Conference' - = f.input :googleplus, label: 'Google+ Url', hint: 'This will appear in the social media section as the link to the Google+ Page of your Conference' - = f.input :twitter, hint: 'This will appear in the social media section as the link to the Twitter Page of your Conference' - = f.input :instagram, hint: 'This will appear in the social media section as the link to the Instagram Page of your Conference' - = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } diff --git a/app/views/admin/contacts/_show.html.haml b/app/views/admin/contacts/_show.html.haml deleted file mode 100644 index 025c2046..00000000 --- a/app/views/admin/contacts/_show.html.haml +++ /dev/null @@ -1,36 +0,0 @@ -%ul.list-unstyled - - unless @contact.email.blank? - %li - = link_to "#{ @contact.email }" do - %i.fa.fa-envelope.fa-3x - = @contact.email - - unless @contact.sponsor_email.blank? - %li - = link_to "#{ @contact.sponsor_email }" do - %i.fa.fa-money.fa-3x - = @contact.sponsor_email - - unless @contact.social_tag.blank? - %li - = link_to "#{ @contact.social_tag }" do - %i.fa.fa-thumbs-o-up.fa-3x - = "##{@contact.social_tag}" - - unless @contact.facebook.blank? - %li - = link_to "#{ @contact.facebook }" do - %i.fa.fa-facebook-square.fa-3x - = @contact.facebook - - unless @contact.twitter.blank? - %li - = link_to "#{ @contact.twitter }" do - %i.fa.fa-twitter.fa-3x - = @contact.twitter - - unless @contact.instagram.blank? - %li - = link_to "#{ @contact.instagram }" do - %i.fa.fa-instagram.fa-3x - = @contact.instagram - - unless @contact.googleplus.blank? - %li - = link_to "#{ @contact.googleplus }" do - %i.fa.fa-google.fa-3x - = @contact.googleplus \ No newline at end of file diff --git a/app/views/admin/contacts/edit.html.haml b/app/views/admin/contacts/edit.html.haml index b0adb5d0..9dd62b88 100644 --- a/app/views/admin/contacts/edit.html.haml +++ b/app/views/admin/contacts/edit.html.haml @@ -1,16 +1,19 @@ .row .col-md-12 - %ul.nav.nav-tabs{'role'=>'tablist'} - %li.active - %a{'href'=> '#show', 'role'=>'tab', 'data-toggle'=>'tab'} - Show - %li - %a{'href'=> '#edit', 'role'=>'tab', 'data-toggle'=>'tab'} - Edit + .page-header + %h1 Contact + %p.text-muted + How people can contact you .row - .col-md-12 - .tab-content - .tab-pane.active#show - = render partial: 'show' - .tab-pane#edit - = render partial: 'form' \ No newline at end of file + .col-md-8 + = semantic_form_for(@contact, :url => admin_conference_contact_path(@conference.short_title),:html => {:multipart => true}) do |f| + = f.inputs :name => 'Mail' do + = f.input :email, hint: 'Contact email address for your conference. Will be used as reply-to address in emails sent out by the system.' + = f.input :sponsor_email, hint: 'This will appear in the sponsor segment of the splash for the sponsors to contact to the organizers' + = f.inputs :name => 'Social Media' do + = f.input :social_tag, hint: "The hashtag you'll use on Twitter and Google+. Don't include the '#' sign!'" + = f.input :facebook, hint: 'This will appear in the social media section as link to the Facebook page of your Conference' + = f.input :googleplus, label: 'Google+ Url', hint: 'This will appear in the social media section as the link to the Google+ Page of your Conference' + = f.input :twitter, hint: 'This will appear in the social media section as the link to the Twitter Page of your Conference' + = f.input :instagram, hint: 'This will appear in the social media section as the link to the Instagram Page of your Conference' + = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } diff --git a/app/views/admin/dietchoices/_dietary_choice_fields.html.erb b/app/views/admin/dietchoices/_dietary_choice_fields.html.erb deleted file mode 100644 index a71a416f..00000000 --- a/app/views/admin/dietchoices/_dietary_choice_fields.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -
- <%= f.inputs do %> - <%= f.input :title %> - <%= remove_association_link :dietary_choice, f %> - <% end %> -
diff --git a/app/views/admin/dietchoices/diets_list.html.haml b/app/views/admin/dietchoices/diets_list.html.haml deleted file mode 100644 index c4fdd8d9..00000000 --- a/app/views/admin/dietchoices/diets_list.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -.row - .col-md-8 - = semantic_form_for(@conference, :url => admin_conference_dietary_update_path(@conference.short_title)) do |f| - = f.input :use_dietary_choices, :label => false - = dynamic_association :dietary_choices, "Dietary Choices", f - = f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"} \ No newline at end of file diff --git a/app/views/admin/difficulty_levels/_difficulty_level_fields.html.haml b/app/views/admin/difficulty_levels/_difficulty_level_fields.html.haml deleted file mode 100644 index 5e8d86ab..00000000 --- a/app/views/admin/difficulty_levels/_difficulty_level_fields.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -.nested-fields - = f.inputs do - = f.input :title, :required => true - = f.input :description, :input_html => {:rows => 3, :class => "span6"} - = f.input :color, :input_html => {:size => 6, :type => "color"} - = remove_association_link :difficulty_level, f \ No newline at end of file diff --git a/app/views/admin/difficulty_levels/_form.html.haml b/app/views/admin/difficulty_levels/_form.html.haml new file mode 100644 index 00000000..f0b43cd0 --- /dev/null +++ b/app/views/admin/difficulty_levels/_form.html.haml @@ -0,0 +1,16 @@ +.row + .col-md-12 + .page-header + %h1 + - if @difficulty_level.new_record? + New + Difficulty Level + = @difficulty_level.title +.row + .col-md-8 + = semantic_form_for(@difficulty_level, :url => (@difficulty_level.new_record? ? admin_conference_difficulty_levels_path : admin_conference_difficulty_level_path(@conference.short_title, @difficulty_level))) do |f| + = f.input :title, :required => true + = f.input :description, :input_html => {:rows => 3, :class => "span6"} + = f.input :color, :input_html => {:size => 6, :type => "color"} + %p.text-right + = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } \ No newline at end of file diff --git a/app/views/admin/difficulty_levels/index.html.haml b/app/views/admin/difficulty_levels/index.html.haml index 88d844dc..60b3f7e8 100644 --- a/app/views/admin/difficulty_levels/index.html.haml +++ b/app/views/admin/difficulty_levels/index.html.haml @@ -1,6 +1,33 @@ .row - .col-md-8 - = semantic_form_for @conference, :url => admin_conference_difficulty_level_path(@conference.short_title, @conference.difficulty_levels) do |f| - = f.input :use_difficulty_levels, :label => false - = dynamic_association :difficulty_levels, "Difficulty_Levels", f - = f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"} + .col-md-12 + .page-header + %h1 Difficulty Levels + %p.text-muted + Classify your conference events by difficulty +.row + .col-md-12 + %table.table.table-hover#difficulty_levels + %thead + %th Title + %th Description + %th Color + %th Actions + %tbody + - @conference.difficulty_levels.each do |difficulty_level| + %tr + %td + = difficulty_level.title + %td + = difficulty_level.description + %td + %span.label{style: "background-color: #{difficulty_level.color};"} + = difficulty_level.color + %td + .btn-group{role: "group"} + = link_to 'Edit', edit_admin_conference_difficulty_level_path(@conference.short_title, difficulty_level.id), + method: :get, class: 'btn btn-primary' + = link_to 'Delete', admin_conference_difficulty_level_path(@conference.short_title, difficulty_level.id), + method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete #{difficulty_level.title}?" } +.row + .col-md-12.text-right + = link_to 'Add Difficulty Level', new_admin_conference_difficulty_level_path(@conference.short_title), class: 'btn btn-primary' \ No newline at end of file diff --git a/app/views/admin/emails/_help.html.haml b/app/views/admin/emails/_help.html.haml index 66014197..5555988d 100644 --- a/app/views/admin/emails/_help.html.haml +++ b/app/views/admin/emails/_help.html.haml @@ -33,22 +33,22 @@ %tr %td {registrationlink} %td A link to the registration page - - unless @conference.venue.name.blank? + - if @conference.venue %tr %td {venue} %td The name of the venue - - unless @conference.venue.address.blank? + - if @conference.venue %tr %td {venue_address} %td The address of the venue - - unless @conference.call_for_papers.blank? || @conference.call_for_papers.start_date.blank? || @conference.call_for_papers.end_date.blank? + - unless @conference.call_for_paper.blank? || @conference.call_for_paper.start_date.blank? || @conference.call_for_paper.end_date.blank? %tr %td {cfp_start_date} %td The call for papers start date %tr %td {cfp_end_date} %td The call for papers end date - -if @conference.call_for_papers.schedule_public + -if @conference.call_for_paper.schedule_public %td {schedule_link} %td The link to complete schedule of the conference - if @conference.splashpage && @conference.splashpage.public diff --git a/app/views/admin/event_types/_event_type_fields.html.erb b/app/views/admin/event_types/_event_type_fields.html.erb deleted file mode 100644 index d4a0c546..00000000 --- a/app/views/admin/event_types/_event_type_fields.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -
- <%= f.inputs do %> - <%= f.input :title %> - <%= f.input :length, :input_html => {:size => 3} %> - <%= f.input :minimum_abstract_length, :input_html => {:size => 3} %> - <%= f.input :maximum_abstract_length, :input_html => {:size => 3} %> - <%= f.input :color, :input_html => { :size => 6, :type => 'color' } %> - <%= remove_association_link :event_type, f %> - <% end %> -
diff --git a/app/views/admin/event_types/_form.html.haml b/app/views/admin/event_types/_form.html.haml new file mode 100644 index 00000000..8ef37e4e --- /dev/null +++ b/app/views/admin/event_types/_form.html.haml @@ -0,0 +1,18 @@ +.row + .col-md-12 + .page-header + %h1 + - if @event_type.new_record? + New + Event Type + = @event_type.title +.row + .col-md-12 + = semantic_form_for(@event_type, :url => (@event_type.new_record? ? admin_conference_event_types_path : admin_conference_event_type_path(@conference.short_title, @event_type))) do |f| + = f.input :title + = f.input :length, :input_html => {:size => 3} + = f.input :minimum_abstract_length, :input_html => {:size => 3} + = f.input :maximum_abstract_length, :input_html => {:size => 3} + = f.input :color, :input_html => { :size => 6, :type => 'color' } + %p.text-right + = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } \ No newline at end of file diff --git a/app/views/admin/event_types/index.html.haml b/app/views/admin/event_types/index.html.haml index c225bd66..6a9326a1 100644 --- a/app/views/admin/event_types/index.html.haml +++ b/app/views/admin/event_types/index.html.haml @@ -1,5 +1,39 @@ .row - .col-md-8 - = semantic_form_for(@conference, url: admin_conference_event_types_path(@conference.short_title, @conference.event_types)) do |f| - = dynamic_association :event_types, "Event Types", f - = f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"} + .col-md-12 + .page-header + %h1 Event Types + %p.text-muted + The character of events in your conference +.row + .col-md-12 + %table.table.table-hover#event_types + %thead + %th Title + %th Length + %th Abstract Length + %th Color + %th Actions + %tbody + - @conference.event_types.each do |event_type| + %tr + %td + = event_type.title + %td + = event_type.length + Minutes + %td + = "#{event_type.minimum_abstract_length}:#{event_type.maximum_abstract_length}" + Words + %td + %span.label{style: "background-color: #{event_type.color};"} + = event_type.color + %td + .btn-group{role: "group"} + = link_to 'Edit', edit_admin_conference_event_type_path(@conference.short_title, event_type.id), + method: :get, class: 'btn btn-primary' + = link_to 'Delete', admin_conference_event_type_path(@conference.short_title, event_type.id), + method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete #{event_type.name}?" } +.row + .col-md-12.text-right + = link_to 'Add Event Type', new_admin_conference_event_type_path(@conference.short_title), class: 'btn btn-primary' + diff --git a/app/views/admin/events/_events_stats.html.haml b/app/views/admin/events/_events_stats.html.haml deleted file mode 100644 index cace57fb..00000000 --- a/app/views/admin/events/_events_stats.html.haml +++ /dev/null @@ -1,48 +0,0 @@ -.row - .col-md-12 - = link_to "Show Events Stats", "#", :id => "events-stats-link", :class => "btn btn-default pull-right" - .clearfix - #events-stats - .span12 - %table.table.table-bordered.table-striped - %thead - %th - - @mystates.each do |state| - %th{:colspan => 2, :style => "text-align:center"} - State "#{state.name}" - %th{:colspan => 2, :style => "text-align:center"} - Total - %br - No & Time - %tr - %td - %b Total - - @mystates.each do |mystate| - %td - %b - = @eventstats["#{mystate.name}"]["count"] - %td - %b - #{@eventstats["#{mystate.name}"]["length"] / 60} h #{@eventstats["#{mystate.name}"]["length"] - @eventstats["#{mystate.name}"]["length"] / 60 * 60} m - %td - %b= @events.count - %td - %b= show_time(@eventstats["totallength"]) - - - @mytypes.each do |mytype| - %tr - %td= "#{mytype.title} (#{show_time(mytype.length)})" - - @mystates.each do |mystate| - %td= @eventstats["#{mytype.title}"]["#{mystate.name}"]["type_state_count"] unless @eventstats["#{mytype.title}"]["#{mystate.name}"] == nil - %td= show_time(@eventstats["#{mytype.title}"]["#{mystate.name}"]["type_state_length"]) unless @eventstats["#{mytype.title}"]["#{mystate.name}"] == nil - %td= @eventstats["#{mytype.title}"]["count"] - %td= show_time(@eventstats["#{mytype.title}"]["length"]) - - -:javascript - $(document).ready( function() { - $("#events-stats").hide(); - $("#events-stats-link").click(function() { - $("#events-stats").toggle(); - }); - }); \ No newline at end of file diff --git a/app/views/admin/events/_proposal.html.haml b/app/views/admin/events/_proposal.html.haml index 239b6852..d4f9a2c1 100644 --- a/app/views/admin/events/_proposal.html.haml +++ b/app/views/admin/events/_proposal.html.haml @@ -107,7 +107,7 @@ %b Description %td= simple_format(@event.description) - - if @conference.call_for_papers && @conference.call_for_papers.rating && @conference.call_for_papers.rating > 0 + - if @conference.call_for_paper && @conference.call_for_paper.rating && @conference.call_for_paper.rating > 0 = render :partial => "voting" .row diff --git a/app/views/admin/events/_voting.html.haml b/app/views/admin/events/_voting.html.haml index c9277796..43e54ff1 100644 --- a/app/views/admin/events/_voting.html.haml +++ b/app/views/admin/events/_voting.html.haml @@ -4,11 +4,11 @@ %b Rating %td - if @event.average_rating.to_f > 0 - #{@event.average_rating}/#{@conference.call_for_papers.rating} + #{@event.average_rating}/#{@conference.call_for_paper.rating} - else - Rating: 0/#{@conference.call_for_papers.rating} + Rating: 0/#{@conference.call_for_paper.rating} - - @conference.call_for_papers.rating.times do |counter| + - @conference.call_for_paper.rating.times do |counter| - if @event.average_rating.to_f.round == counter+1 = label_tag "label_rating", "", :class => "avgrating", :avgrate => true = javascript_tag "$('label[avgrate=true]').prevAll().andSelf().addClass('bright');" @@ -27,7 +27,7 @@ %td %b Your vote %td - - @conference.call_for_papers.rating.times do |counter| + - @conference.call_for_paper.rating.times do |counter| - voted = @event.voted?(@event, current_user) - if voted && voted.rating == counter+1 = link_to "", vote_admin_conference_event_path(@conference.short_title, @event, :rating => counter+1), :remote => true, :id =>"label#{counter+1}", :class => "myrating", :voted => true @@ -42,7 +42,7 @@ %td = rate.name %td - - @conference.call_for_papers.rating.times do |counter| + - @conference.call_for_paper.rating.times do |counter| - voted = @event.voted?(@event, rate.user) - if voted && voted.rating == counter+1 = label_tag "label#{counter+1}", "", :class => "othersrating", :voted => true diff --git a/app/views/admin/events/index.html.haml b/app/views/admin/events/index.html.haml index 12c556ee..8739c81e 100644 --- a/app/views/admin/events/index.html.haml +++ b/app/views/admin/events/index.html.haml @@ -1,18 +1,21 @@ -= render :partial => "events_stats" - .row .col-md-12 - %h2 - Events - - if @events - = "(#{@events.length})" + .page-header + %h1 + Events + - if @events.any? + = "(#{@events.length})" + %p.text-muted + All the submissions of your speakers +.row + .col-md-12 %table.table.table-striped.table-bordered.table-hover.datatable %thead %th %b ID %th %b Title - - if @conference.call_for_papers && @conference.call_for_papers.rating && @conference.call_for_papers.rating > 0 + - if @conference.call_for_paper && @conference.call_for_paper.rating && @conference.call_for_paper.rating > 0 %th %b Rating %th @@ -34,21 +37,21 @@ %td =link_to event.title, admin_conference_event_path(@conference.short_title, event) - - if @conference.call_for_papers && @conference.call_for_papers.rating && @conference.call_for_papers.rating > 0 + - if @conference.call_for_paper && @conference.call_for_paper.rating && @conference.call_for_paper.rating > 0 %td{:style => "width:96px"} - if event.average_rating.to_f > 0 - #{event.average_rating}/#{@conference.call_for_papers.rating} + #{event.average_rating}/#{@conference.call_for_paper.rating} %br #{pluralize(event.voters.length, 'voter')} %br - - @conference.call_for_papers.rating.times do |counter| + - @conference.call_for_paper.rating.times do |counter| - if event.average_rating.to_f.round == counter+1 = label_tag "label_rating", "", :class => "avgrating", :avgrate => true = javascript_tag "$('label[avgrate=true]').prevAll().andSelf().addClass('bright');" - else = label_tag "label_rating", "", :class => "avgrating" - else - 0/#{@conference.call_for_papers.rating} + 0/#{@conference.call_for_paper.rating} %br - if event.submitter && event.submitter.registrations && event.submitter.registrations.count < 1 @@ -94,7 +97,7 @@ %li= link_to track.name, admin_conference_event_path(@conference.short_title, event, :track_id => track.id) , :method => :put, :track_id => track.id %td - = event.difficulty_level.title if @conference.use_difficulty_levels && event.difficulty_level + = event.difficulty_level.title if event.difficulty_level %td - if event.state == "withdrawn" Withdrawn diff --git a/app/views/admin/lodgings/_form.html.haml b/app/views/admin/lodgings/_form.html.haml index 9c4d7765..d34a1b8c 100644 --- a/app/views/admin/lodgings/_form.html.haml +++ b/app/views/admin/lodgings/_form.html.haml @@ -1,8 +1,19 @@ -= semantic_form_for(@lodging, :url => (@lodging.new_record? ? admin_conference_lodgings_path : admin_conference_lodging_path(@conference.short_title, @lodging))) do |f| - = f.input :name - = f.input :website_link - = f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown-editable' } }, hint: markdown_hint - - unless @lodging.photo.blank? - = image_tag @lodging.photo(:thumb) - = f.input :photo - = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } +.row + .col-md-12 + .page-header + %h1 + - if @lodging.new_record? + New + Lodging + = @lodging.name +.row + .col-md-8 + = semantic_form_for(@lodging, :url => (@lodging.new_record? ? admin_conference_lodgings_path : admin_conference_lodging_path(@conference.short_title, @lodging))) do |f| + = f.input :name + = f.input :website_link + = f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown-editable' } }, hint: markdown_hint + - unless @lodging.photo.blank? + = image_tag @lodging.photo(:thumb) + = f.input :photo + %p.text-right + = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } diff --git a/app/views/admin/lodgings/index.html.haml b/app/views/admin/lodgings/index.html.haml index f3a15e45..0775b7b9 100644 --- a/app/views/admin/lodgings/index.html.haml +++ b/app/views/admin/lodgings/index.html.haml @@ -1,26 +1,35 @@ -%h1 Lodgings -- if @conference.lodgings.any? +.row + .col-md-12 + .page-header + %h1 Lodgings + %p.text-muted + Recommended some Hotels, Motels, Hostels or Campsites around your venue + +- @conference.lodgings.each_slice(3) do |slice| .row - .col-md-12 - %table.table - %thead - %th # - %th Name - %th Edit - %th Delete - %tbody - - @conference.lodgings.each_with_index do |lodging, index| - %tr - %td - = index + 1 - %td - = link_to lodging.name, admin_conference_lodging_path(@conference.short_title, lodging.id) - %td - = link_to 'Edit', edit_admin_conference_lodging_path(@conference.short_title, lodging.id), - method: :get, class: 'btn btn-primary' - %td - = link_to 'Delete', admin_conference_lodging_path(@conference.short_title, lodging.id), + - slice.each do |lodging| + .col-md-4 + .thumbnail + - if lodging.photo.blank? + %p.text-center + %i.fa.fa-home.fa-5x + - else + -if lodging.website_link.present? + = link_to(lodging.website_link, class: 'thumbnail') do + = image_tag lodging.photo(:thumb), class: 'img-responsive img-lodging' + - else + = image_tag lodging.photo(:thumb), class: 'img-responsive img-lodging' + .caption + %h3.text-center + = lodging.name + -if lodging.description.present? + = markdown(lodging.description) + .actions.text-right + = link_to 'Edit', edit_admin_conference_lodging_path(@conference.short_title, lodging), class: 'btn btn-primary' + = link_to 'Delete', admin_conference_lodging_path(@conference.short_title, lodging), method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete the lodging #{lodging.name}?" } -= link_to 'Add Lodging', new_admin_conference_lodging_path(@conference.short_title), class: 'btn btn-success' +.row + .col-md-12.text-right + = link_to 'Add Lodging', new_admin_conference_lodging_path(@conference.short_title), class: 'btn btn-primary' diff --git a/app/views/admin/lodgings/show.html.haml b/app/views/admin/lodgings/show.html.haml deleted file mode 100644 index 865474ae..00000000 --- a/app/views/admin/lodgings/show.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -%h1 - = @lodging.name -- unless @lodging.photo.blank? || @lodging.description.blank? || @lodging.website_link.blank? - .div.thumbnail - - unless @lodging.photo.blank? - = image_tag @lodging.photo(:large), class: 'img-responsive' - - unless @lodging.description.blank? - .lead.text-center #{ markdown(@lodging.description) } - - unless @lodging.website_link.blank? - .text-center - = link_to 'Go to Website', @lodging.website_link - -= link_to 'Edit', edit_admin_conference_lodging_path(@conference.short_title, @lodging.id), - method: :get, class: 'btn btn-primary' - -= link_to 'Back', admin_conference_lodgings_path(@conference.short_title) \ No newline at end of file diff --git a/app/views/admin/photos/_form.html.haml b/app/views/admin/photos/_form.html.haml deleted file mode 100644 index 2c01af4c..00000000 --- a/app/views/admin/photos/_form.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -= f.inputs do - - if !f.object.errors - = image_tag(f.object.picture(:thumb)) unless f.object.picture.blank? - = f.input :picture, hint: 'This photo will appear in the gallery of the splash so please give photos of banner sizes.' - = f.input :description, :input_html => {:rows => 2 }, hint: 'This description will appear at the bottom of each photo.' - .actions - = f.button 'Save Photo', :class => 'btn btn-primary' diff --git a/app/views/admin/photos/edit.html.haml b/app/views/admin/photos/edit.html.haml deleted file mode 100644 index 9b87054b..00000000 --- a/app/views/admin/photos/edit.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -%h1 Editing Photo - -= semantic_form_for @photo, url: admin_conference_photo_path(conference_id: @conference.short_title, id: @photo.id) do |f| - = render 'form', f: f - -= link_to 'Back', admin_conference_photos_path diff --git a/app/views/admin/photos/index.html.haml b/app/views/admin/photos/index.html.haml deleted file mode 100644 index 77f4f5d7..00000000 --- a/app/views/admin/photos/index.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -%h1 Photos -%p.text-muted - Photo's will appear in the gallery of the conference splash page. -- @photos.each_slice(3) do |slice| - .row.row-flex.row-flex-wrap - - slice.each do |photo| - .col-md-4 - .thumbnail.flex-col - %h3.text-center - = photo.picture_file_name - = image_tag(photo.picture(:large), class: 'img-responsive', title: photo.description) - .caption.flex-grow - .caption - = link_to edit_admin_conference_photo_path(@conference.short_title, photo.id), class: 'btn btn-primary' do - %i.fa.fa-pencil-square-o - Edit - = link_to admin_conference_photo_path(@conference.short_title, photo.id), method: :delete, class: 'btn btn-danger' do - %i.fa.fa-times-circle - Delete -.row{'style'=>'padding-top: 10px;'} - .col-md-12 - = link_to 'New Photo', new_admin_conference_photo_path, class: 'btn btn-primary' diff --git a/app/views/admin/photos/new.html.haml b/app/views/admin/photos/new.html.haml deleted file mode 100644 index 68115b49..00000000 --- a/app/views/admin/photos/new.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -%h1 New Photo - -= semantic_form_for @photo, url: admin_conference_photos_path(conference_id: @conference.short_title) do |f| - = render 'form', f: f - -= link_to 'Back', admin_conference_photos_path diff --git a/app/views/admin/questions/_questions.html.haml b/app/views/admin/questions/_questions.html.haml index 145261e3..124fa060 100644 --- a/app/views/admin/questions/_questions.html.haml +++ b/app/views/admin/questions/_questions.html.haml @@ -1,10 +1,9 @@ -%h2 - Questions for #{@conference.short_title} - - if @questions_conference.count - = "(#{@questions_conference.count})" -%i The questions will appear in the registration page of the conference - -%table.table +%table.table.table-hover#questions + %th Enabled + %th Question + %th Type + %th Answers + %th Actions - @questions.each do |q| %tr %td @@ -12,15 +11,16 @@ = check_box_tag "conference[question_ids][]", q.id, @conference.question_ids.include?(q.id), id: dom_id(q) %td - = label_tag dom_id(q), q.title - %br - = label_tag dom_id(q), "Type: #{q.question_type.title}" - = ',' - = label_tag dom_id(q), "Answers: #{q.answers.map {|a| a.title}.join(', ')}" + = q.title + %td + = q.question_type.title + %td + = q.answers.map {|a| a.title}.join(', ') - %td= link_to 'Edit', edit_admin_conference_question_path(@conference.short_title, q), + %td + .btn-group + = link_to 'Edit', edit_admin_conference_question_path(@conference.short_title, q), class: 'btn btn-primary', disabled: !(can? :update, q) - - %td= link_to 'Delete', admin_conference_question_path(@conference.short_title, q), + = link_to 'Delete', admin_conference_question_path(@conference.short_title, q), method: :delete, remote: true, class: 'btn btn-danger', confirm: "Delete question '#{q.title}'?", disabled: !(can? :destroy, q) diff --git a/app/views/admin/questions/index.html.haml b/app/views/admin/questions/index.html.haml index 7810ddb7..9fe119ba 100644 --- a/app/views/admin/questions/index.html.haml +++ b/app/views/admin/questions/index.html.haml @@ -1,17 +1,21 @@ .row - .col-md-8 - .pull-right - - if can? :create, Question.new(conference_id: @conference.id) - %b= link_to 'Create New Question','#', 'data-toggle' => 'modal', - 'data-target' => '#new-question', class: 'btn btn-success' - %br - %br + .col-md-12 + .page-header + %h1 + Questions + - if can? :create, Question.new(conference_id: @conference.id) + = link_to 'Create New Question','#', 'data-toggle' => 'modal', + 'data-target' => '#new-question', class: 'btn btn-success pull-right' + %p.text-muted + People will have to answer your questions during registration to your conference +.row + .col-md-12 - if @questions.count > 0 - = semantic_form_for(@conference, url: admin_conference_questions_update_conference_path(@conference.short_title)) do |f| + = semantic_form_for(@conference, url: update_conference_admin_conference_questions_path(@conference.short_title)) do |f| .questions{id: 'myquestions'} = render partial: 'questions' - if can? :update, @conference - = f.submit "Update Questions for #{@conference.short_title}", class: 'btn btn-primary', + = f.submit "Save Questions", class: 'btn btn-primary pull-right', confirm: 'Are you sure you want to make these changes?' .modal.fade{id: 'new-question', 'role' => 'dialog', 'aria-hidden' => 'true'} diff --git a/app/views/admin/registration_periods/_form.html.haml b/app/views/admin/registration_periods/_form.html.haml index a8dbc9f3..0e03500b 100644 --- a/app/views/admin/registration_periods/_form.html.haml +++ b/app/views/admin/registration_periods/_form.html.haml @@ -1,7 +1,11 @@ -%h1 Registration Period +.row + .col-md-12 + .page-header + %h1 Registration Period .row .col-md-8 = semantic_form_for(@registration_period, url: admin_conference_registration_period_path(@conference.short_title)) do |f| = f.input :start_date, as: :string, input_html: { id: 'registration-period-start-datepicker', readonly: 'readonly' } = f.input :end_date, as: :string, input_html: { id: 'registration-period-end-datepicker', readonly: 'readonly' } - = f.submit 'Save Registration Period', class: 'btn btn-primary' + %p.text-right + = f.submit 'Save Registration Period', class: 'btn btn-primary' diff --git a/app/views/admin/registration_periods/show.html.haml b/app/views/admin/registration_periods/show.html.haml index bf2e2157..9ef02e37 100644 --- a/app/views/admin/registration_periods/show.html.haml +++ b/app/views/admin/registration_periods/show.html.haml @@ -1,7 +1,12 @@ -%h1 Registration Period +.row + .col-md-12 + .page-header + %h1 Registration Period + %p.text-muted + The stretch of time where people can register to your conference - if @registration_period .row - .col-md-6 + .col-md-8 %dl.dl-horizontal %dt Start Date @@ -11,12 +16,14 @@ End Date %dd = @registration_period.end_date - - - if can? :update, @registration_period - = link_to 'Edit', edit_admin_conference_registration_period_path, class: 'btn btn-primary' - - if can? :destroy, @registration_period - = link_to 'Delete', admin_conference_registration_period_path, - method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger' -- else - - if can? :create, @conference - = link_to 'New Registration Period', new_admin_conference_registration_period_path, class: 'btn btn-primary' +.row + .col-md-12.text-right + - if @registration_period + - if can? :update, @registration_period + = link_to 'Edit', edit_admin_conference_registration_period_path, class: 'btn btn-primary' + - if can? :destroy, @registration_period + = link_to 'Delete', admin_conference_registration_period_path, + method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger' + - else + - if can? :create, @conference + = link_to 'New Registration Period', new_admin_conference_registration_period_path, class: 'btn btn-primary' diff --git a/app/views/admin/registrations/edit.html.haml b/app/views/admin/registrations/edit.html.haml index 9780702b..caa84108 100644 --- a/app/views/admin/registrations/edit.html.haml +++ b/app/views/admin/registrations/edit.html.haml @@ -1,8 +1,8 @@ .row .col-md-12 - %h3 - Edit registration of #{@user.name} (#{@user.email}) for #{@conference.title} - %br + .page-header + %h1 + Edit registration of #{@user.username} for #{@conference.short_title} .row .col-md-8 = semantic_form_for(@registration, :url => admin_conference_registration_path(@conference.short_title, @registration)) do |f| diff --git a/app/views/admin/registrations/index.html.haml b/app/views/admin/registrations/index.html.haml index 6e81e341..eb89719a 100644 --- a/app/views/admin/registrations/index.html.haml +++ b/app/views/admin/registrations/index.html.haml @@ -1,32 +1,31 @@ .row .col-md-12 .page-header - %h2 + %h1 Registrations - - if @registrations - = "(#{@registrations.length})" - = " - Attended (#{@attended})" + = "(#{@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" - %table.table.table-bordered.table-striped.table-hover#registrations-datatable + %p.text-muted + All the people who registered to your event + %table.table.table-hover.datatable#registrations %thead %tr - %th # + %th ID# %th Name %th E-Mail %th Arrival %th Departure - %th Attended - %th Questions - %th Edit - %th Delete + - if @conference.questions.any? + %th Questions + %th Actions %tbody - @registrations.each_with_index do |registration, index| %tr %td - = index + 1 + = registration.id %td = registration.name %td @@ -41,17 +40,32 @@ = registration.departure.strftime("%d %b %H:%M") - else n/a + -if @conference.questions.any? + %td + = link_to 'Questions','#', class: 'btn btn-success question-btn', 'data-id' => index, 'data-name' => registration.name %td - = link_to "#{registration.attended}", admin_conference_registrations_toogle_attended_path(@conference.short_title, id: registration.id), - method: :patch, class: 'btn btn-success' - %td - = link_to 'Questions','#', class: 'btn btn-success question-btn', 'data-id' => index, 'data-name' => registration.name - %td - = link_to 'Edit', edit_admin_conference_registration_path(@conference.short_title, id: registration), - method: :get, class: 'btn btn-primary' - %td - = link_to 'Delete', admin_conference_registration_path(@conference.short_title, registration), - method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete the Registration for #{registration.name}?" } + .btn-group + .btn-group + - if registration.attended + - btnclass = 'btn-success' + - else + - btnclass = 'btn-warning' + %button{type: "button", class: "btn #{btnclass} dropdown-toggle", "data-toggle" => "dropdown", "aria-expanded" => "false"} + - if registration.attended + Present + - else + Absent + %span.caret + %ul.dropdown-menu{role: "menu"} + %li + = link_to "Present", present_admin_conference_registration_path(@conference.short_title, id: registration.id), + method: :patch + = link_to "Absent" , absent_admin_conference_registration_path(@conference.short_title, id: registration.id), + method: :patch + = link_to 'Edit', edit_admin_conference_registration_path(@conference.short_title, id: registration), + method: :get, class: 'btn btn-primary' + = link_to 'Delete', admin_conference_registration_path(@conference.short_title, registration), + method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete the Registration for #{registration.name}?" } - @registrations.each_with_index do |registration, index| .questions{class: "question#{index}", style: 'display:none;'} = render partial: 'questions', locals: { registration: registration } diff --git a/app/views/admin/rooms/_form.html.haml b/app/views/admin/rooms/_form.html.haml index 48617d02..05cf1b0d 100644 --- a/app/views/admin/rooms/_form.html.haml +++ b/app/views/admin/rooms/_form.html.haml @@ -1,4 +1,15 @@ -= f.input :name -= f.input :size, :input_html => {:size => 5} -= f.input :public, :as => :boolean -= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } \ No newline at end of file +.row + .col-md-12 + .page-header + %h1 + - if @room.new_record? + New + Room + = @room.name +.row + .col-md-8 + = semantic_form_for(@room, :url => (@room.new_record? ? admin_conference_rooms_path : admin_conference_room_path(@conference.short_title, @room))) do |f| + = f.input :name + = f.input :size, :input_html => {:size => 5} + %p.text-right + = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } \ No newline at end of file diff --git a/app/views/admin/rooms/edit.html.haml b/app/views/admin/rooms/edit.html.haml deleted file mode 100644 index eb5f9974..00000000 --- a/app/views/admin/rooms/edit.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -%h1 Editing Room - -.row - .col-md-8 - = semantic_form_for @room, url: admin_conference_room_path(conference_id: @conference.short_title, id: @room.id) do |f| - = render 'form', f: f - -= link_to 'Back', admin_conference_rooms_path diff --git a/app/views/admin/rooms/index.html.haml b/app/views/admin/rooms/index.html.haml index 5584fba8..f9007a79 100644 --- a/app/views/admin/rooms/index.html.haml +++ b/app/views/admin/rooms/index.html.haml @@ -1,32 +1,30 @@ -%h1 Rooms +.row + .col-md-12 + .page-header + %h1 Rooms + %p.text-muted + The rooms of your conference venue - if @conference.rooms.any? .row .col-md-12 - %table.table#rooms + %table.table.table-hover#rooms %thead - %th # %th Name %th Size - %th Public - %th Edit - %th Delete + %th Actions %tbody - @conference.rooms.each_with_index do |room, index| %tr - %td - = index + 1 %td = room.name %td = room.size - %td - = room.public %td = link_to 'Edit', edit_admin_conference_room_path(@conference.short_title, room.id), method: :get, class: 'btn btn-primary' - %td = link_to 'Delete', admin_conference_room_path(@conference.short_title, room.id), method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete #{room.name}?" } - -= link_to 'New Room', new_admin_conference_room_path(@conference.short_title), class: 'btn btn-success' +.row + .col-md-12.text-right + = link_to 'Add Room', new_admin_conference_room_path(@conference.short_title), class: 'btn btn-primary' diff --git a/app/views/admin/rooms/new.html.haml b/app/views/admin/rooms/new.html.haml deleted file mode 100644 index 1b347c51..00000000 --- a/app/views/admin/rooms/new.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -%h1 New Room -.row - .col-md-8 - = semantic_form_for @room, url: admin_conference_rooms_path(conference_id: @conference.short_title) do |f| - = render 'form', f: f - -= link_to 'Back', admin_conference_rooms_path diff --git a/app/views/admin/social_events/_social_event_fields.html.erb b/app/views/admin/social_events/_social_event_fields.html.erb deleted file mode 100644 index e7d995b7..00000000 --- a/app/views/admin/social_events/_social_event_fields.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -
- <%= f.inputs do %> - <%= f.input :title %> - <%= f.input :description, :input_html => {:rows => 5} %> - <%= f.date_select :date, as: :string %> - <%= remove_association_link :social_event, f %> - <% end %> -
diff --git a/app/views/admin/social_events/index.html.haml b/app/views/admin/social_events/index.html.haml deleted file mode 100644 index aa724fb8..00000000 --- a/app/views/admin/social_events/index.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -.row - .col-md-8 - = semantic_form_for(@conference, :url => admin_conference_social_event_path(@conference.short_title, @conference.social_events)) do |f| - = dynamic_association :social_events, "Social Events", f - = f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"} diff --git a/app/views/admin/speakers/_form.html.haml b/app/views/admin/speakers/_form.html.haml deleted file mode 100644 index aad39894..00000000 --- a/app/views/admin/speakers/_form.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -.modal-header - %button.close{:type => "button", :data => {:dismiss => "modal"}} × - %h3 - Assign speaker -= semantic_form_for @speaker, :as => :speaker, :url => admin_conference_event_speaker_path(@conference.short_title, @event), :method => :put do |f| - .form-inputs.form-horizontal.modal-body - = f.collection_select(:user_id, User.order(:name), :id, :name) - - .modal-footer - = link_to "Close", "#", :data => {:dismiss => "modal"}, :class => 'btn' - = f.button "Assign", :class => 'btn btn-primary' diff --git a/app/views/admin/speakers/edit.js.erb b/app/views/admin/speakers/edit.js.erb deleted file mode 100644 index 0c28c11f..00000000 --- a/app/views/admin/speakers/edit.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -build_dialog('edit_speaker', '<%= j render :partial => 'form' %>'); - diff --git a/app/views/admin/splashpages/_form.html.haml b/app/views/admin/splashpages/_form.html.haml index bbafa330..59babd14 100644 --- a/app/views/admin/splashpages/_form.html.haml +++ b/app/views/admin/splashpages/_form.html.haml @@ -1,4 +1,7 @@ -%h1 Splashpage +.row + .col-md-12 + .page-header + %h1 Splashpage .row .col-md-8 = semantic_form_for(@splashpage, url: admin_conference_splashpage_path(@conference.short_title)) do |f| @@ -11,5 +14,7 @@ = f.input :include_lodgings, label: 'Display the lodgings on the splashpage?' = f.input :include_sponsors, label: 'Display sponsors on the splashpage?' = f.input :include_social_media, label: 'Display social media on the splashpage?' - = f.input :public, label: 'Make splash page public?' - = f.submit 'Save Splashpage', class: 'btn btn-primary' + = f.inputs name: 'Access' do + = f.input :public, label: 'Make splash page public?' + %p.text-right + = f.submit 'Save Splashpage', class: 'btn btn-primary' diff --git a/app/views/admin/splashpages/show.html.haml b/app/views/admin/splashpages/show.html.haml index f10db054..cd26a461 100644 --- a/app/views/admin/splashpages/show.html.haml +++ b/app/views/admin/splashpages/show.html.haml @@ -1,5 +1,11 @@ -%h1 Splashpage -%br +.row + .col-md-12 + .page-header + %h1 Splashpage + %p.text-muted + Build a + = link_to "splash page", conference_path(@conference.short_title) + with all the information for your conference - if @splashpage .row .col-md-8 @@ -53,13 +59,15 @@ Yes - else No - - %br - - if can? :update, @splashpage - = link_to 'Edit', edit_admin_conference_splashpage_path, class: 'btn btn-primary' - - if can? :destroy, @splashpage - = link_to 'Delete', admin_conference_splashpage_path, - method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger' + .row + .col-md-12 + - if can? :update, @splashpage + = link_to 'Edit', edit_admin_conference_splashpage_path, class: 'btn btn-primary' + - if can? :destroy, @splashpage + = link_to 'Delete', admin_conference_splashpage_path, + method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger' - else - - if can? :create, @conference - = link_to 'Create Splashpage', new_admin_conference_splashpage_path, class: 'btn btn-primary' + .row + .col-md-12.text-right + - if can? :create, @conference + = link_to 'Create Splashpage', new_admin_conference_splashpage_path, class: 'btn btn-primary' diff --git a/app/views/admin/sponsors/_form.html.haml b/app/views/admin/sponsors/_form.html.haml new file mode 100644 index 00000000..fe5b12e2 --- /dev/null +++ b/app/views/admin/sponsors/_form.html.haml @@ -0,0 +1,19 @@ +.row + .col-md-12 + .page-header + -if @sponsor.new_record? + New + %h1 + Sponsor + = @sponsor.name +.row + .col-md-8 + = semantic_form_for(@sponsor, :url => (@sponsor.new_record? ? admin_conference_sponsors_path : admin_conference_sponsor_path(@conference.short_title, @sponsor))) do |f| + = f.input :name + = f.input :description + = image_tag f.object.logo(:thumb) if !f.object.logo.blank? + = f.input :logo + = f.input :website_url + = f.input :sponsorship_level, collection: @conference.sponsorship_levels + %p.text-right + = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } \ No newline at end of file diff --git a/app/views/admin/sponsors/_sponsor_fields.html.erb b/app/views/admin/sponsors/_sponsor_fields.html.erb deleted file mode 100644 index 2cc3131c..00000000 --- a/app/views/admin/sponsors/_sponsor_fields.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -
- <%= f.inputs do %> - <%= f.input :name %> - <%= f.input :description %> - <%= image_tag f.object.logo(:thumb) if !f.object.logo.blank? %> - <%= f.input :logo %> - <%= f.input :website_url %> - <%= f.input :sponsorship_level, collection: @conference.sponsorship_levels %> - <%= remove_association_link :sponsor, f %> - <% end %> -
diff --git a/app/views/admin/sponsors/index.html.haml b/app/views/admin/sponsors/index.html.haml index bd36c6a9..d6364cb0 100644 --- a/app/views/admin/sponsors/index.html.haml +++ b/app/views/admin/sponsors/index.html.haml @@ -1,5 +1,39 @@ .row - .col-md-8 - = semantic_form_for(@conference, :url => admin_conference_sponsor_path(@conference.short_title, @conference.sponsors)) do |f| - = dynamic_association :sponsors, "Sponsors", f - = f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"} + .col-md-12 + .page-header + %h1 Sponsors + %p.text-muted + People supporting your conference +- if @conference.sponsors.any? + .row + .col-md-12 + %table.table.table-hover#sponsors + %thead + %th Logo + %th Name + %th Description + %th URL + %th Level + %th Actions + %tbody + - @conference.sponsors.each do |sponsor| + %tr + %td + = image_tag(sponsor.logo(:thumb), width: '20%') + %td + = sponsor.name + %td + = truncate(sponsor.description) + %td + = sponsor.website_url + %td + = sponsor.sponsorship_level.title + %td + .btn-group + = link_to 'Edit', edit_admin_conference_sponsor_path(@conference.short_title, sponsor), + method: :get, class: 'btn btn-primary' + = link_to 'Delete', admin_conference_sponsor_path(@conference.short_title, sponsor), + method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete the sponsor #{sponsor.name}?" } +.row + .col-md-12 + = link_to 'Add Sponsor', new_admin_conference_sponsor_path(@conference.short_title), class: 'btn btn-primary pull-right' diff --git a/app/views/admin/sponsorship_levels/_form.html.haml b/app/views/admin/sponsorship_levels/_form.html.haml index f90c751c..666e8753 100644 --- a/app/views/admin/sponsorship_levels/_form.html.haml +++ b/app/views/admin/sponsorship_levels/_form.html.haml @@ -1,2 +1,14 @@ -= f.input :title -= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } \ No newline at end of file +.row + .col-md-12 + .page-header + %h1 + - if @sponsorship_level.new_record? + New + Sponsorship Level + = @sponsorship_level.title +.row + .col-md-8 + = semantic_form_for(@sponsorship_level, :url => (@sponsorship_level.new_record? ? admin_conference_sponsorship_levels_path : admin_conference_sponsorship_level_path(@conference.short_title, @sponsorship_level))) do |f| + = f.input :title + %p.text-right + = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } \ No newline at end of file diff --git a/app/views/admin/sponsorship_levels/edit.html.haml b/app/views/admin/sponsorship_levels/edit.html.haml deleted file mode 100644 index 91d80ff7..00000000 --- a/app/views/admin/sponsorship_levels/edit.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -%h1 Editing Sponsorship Level - -.row - .col-md-8 - = semantic_form_for @sponsorship_level, url: admin_conference_sponsorship_level_path(conference_id: @conference.short_title, id: @sponsorship_level.id) do |f| - = render 'form', f: f - -= link_to 'Back', admin_conference_sponsorship_levels_path diff --git a/app/views/admin/sponsorship_levels/index.html.haml b/app/views/admin/sponsorship_levels/index.html.haml index 507ca985..c73c5582 100644 --- a/app/views/admin/sponsorship_levels/index.html.haml +++ b/app/views/admin/sponsorship_levels/index.html.haml @@ -1,9 +1,13 @@ -%h1 Sponsorship Levels - +.row + .col-md-12 + .page-header + %h1 Sponsorship Levels + %p.text-muted + Classify your sponsors - if @conference.sponsorship_levels.any? .row .col-md-12 - %table.table#sponsorship_levels + %table.table.table-hover#sponsorship_levels %thead %th Title %th Position @@ -25,5 +29,6 @@ method: :get, class: 'btn btn-primary' = link_to 'Delete', admin_conference_sponsorship_level_path(@conference.short_title, sponsorship_level.id), method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete the sponsorship level #{sponsorship_level.title}?" } - -= link_to 'New Sponsorship Level', new_admin_conference_sponsorship_level_path(@conference.short_title), class: 'btn btn-success' +.row + .col-md-12 + = link_to 'New Sponsorship Level', new_admin_conference_sponsorship_level_path(@conference.short_title), class: 'btn btn-success pull-right' diff --git a/app/views/admin/sponsorship_levels/new.html.haml b/app/views/admin/sponsorship_levels/new.html.haml deleted file mode 100644 index 76d7a511..00000000 --- a/app/views/admin/sponsorship_levels/new.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -%h1 New Sponsorship Level -.row - .col-md-8 - = semantic_form_for @sponsorship_level, url: admin_conference_sponsorship_levels_path(conference_id: @conference.short_title) do |f| - = render 'form', f: f - -= link_to 'Back', admin_conference_sponsorship_levels_path diff --git a/app/views/admin/supporters/index.html.haml b/app/views/admin/supporters/index.html.haml deleted file mode 100644 index d7f48042..00000000 --- a/app/views/admin/supporters/index.html.haml +++ /dev/null @@ -1,37 +0,0 @@ -#new-supporter-dialog - = semantic_form_for :supporter_registration, :html => {:id => "supporter-add-form"} do |f| - = f.input :name, :label => "Supporter Name" - = f.input :email, :label => "Supporter Email" - = f.input :supporter_level_id, :as => :select, :collection => @conference.supporter_levels - = f.input :code, :label => "Confirmation code" - = f.input :code_is_valid, :as => :boolean, :label => false - = f.action :submit, :button_html => { :value => "Save", :class => "btn btn-primary" } - -.row - .col-md-12 - .pull-right{:style=>"margin-top:20px; margin-bottom:20px;"} - = link_to "New Supporter", "#", :id => "new-supporter-button", :class => "btn btn-success" -.row - .col-md-12 - %h2 Supporters - .well - %table.table.table-striped#supporters - %thead - %th - Name - %th - Email - %th - Level - %th - Code - %th - Code Valid - %tbody - - @conference.supporter_registrations.each do |u| - %tr - %td= u.name - %td= u.email - %td= u.supporter_level.title if u.supporter_level - %td= u.code - %td= u.code_is_valid diff --git a/app/views/admin/targets/_form.html.haml b/app/views/admin/targets/_form.html.haml new file mode 100644 index 00000000..53c74c84 --- /dev/null +++ b/app/views/admin/targets/_form.html.haml @@ -0,0 +1,15 @@ +.row + .col-md-12 + .page-header + %h1 + -if @target.new_record? + New + Target +.row + .col-md-8 + = semantic_form_for(@target, :url => (@target.new_record? ? admin_conference_targets_path : admin_conference_target_path(@conference.short_title, @target))) do |f| + = f.input :due_date, as: :string, input_html: { class: 'target-due-date-datepicker'}, label: 'Until when do you want to have ' + = f.input :target_count, label: 'this amount of ' + = f.input :unit, as: :select, label: 'Unit', class: 'form-control', collection: Target.units.values, include_blank: false, label: 'units ' + %p.text-right + = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } diff --git a/app/views/admin/targets/_target_fields.html.haml b/app/views/admin/targets/_target_fields.html.haml deleted file mode 100644 index b64e44d5..00000000 --- a/app/views/admin/targets/_target_fields.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -.nested-fields - = f.inputs do - = f.input :due_date, as: :string, input_html: { class: 'target-due-date-datepicker', readonly: 'readonly' } - = f.input :target_count - = f.input :unit, as: :select, label: 'Unit', class: 'form-control', collection: Target.units.values, include_blank: false - = remove_association_link :target, f \ No newline at end of file diff --git a/app/views/admin/targets/index.html.haml b/app/views/admin/targets/index.html.haml index 001e4042..9c1ab7b5 100644 --- a/app/views/admin/targets/index.html.haml +++ b/app/views/admin/targets/index.html.haml @@ -1,5 +1,35 @@ .row - .col-md-8 - = semantic_form_for(@conference, url: admin_conference_target_path(@conference.short_title, @conference.targets)) do |f| - = dynamic_association :targets, 'Targets', f - = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } + .col-md-12 + .page-header + %h1 Targets + %p.text-muted + Set up goals for your conference +.row + .col-md-12 + %table.table.table-hover#targets + %thead + %tr + %th Due Date + %th Target Count + %th Unit + %th Actions + %tbody + - @targets.each do |target| + %tr + %td{'id'=> "due_date_#{target.id}"} + = target.due_date + %td{'id'=> "count#{target.id}"} + = target.target_count + %td{'id'=> "unit_#{target.id}"} + = target.unit + %td + .btn-group + = link_to 'Edit', + edit_admin_conference_target_path(@conference.short_title, target.id), + class: 'btn btn-primary' + = link_to 'Delete', + admin_conference_target_path(@conference.short_title, target.id), + method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete this target?" } +.row + .col-md-12 + = link_to 'New Target', new_admin_conference_target_path, class: 'btn btn-success pull-right' diff --git a/app/views/admin/tickets/_form.html.haml b/app/views/admin/tickets/_form.html.haml index 77e6c9e4..7ff0821c 100644 --- a/app/views/admin/tickets/_form.html.haml +++ b/app/views/admin/tickets/_form.html.haml @@ -1,5 +1,17 @@ -= f.input :title -= f.input :description, input_html: { rows: 5, data: { provide: "markdown-editable" } } -= f.input :price -= f.input :price_currency, as: :select, class: 'form-control', collection: ['USD', 'EUR', 'GBP', 'INR', 'CNY'], include_blank: false -= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } +.row + .col-md-12 + .page-header + %h1 + - if @ticket.new_record? + New + = @ticket.title + Ticket +.row + .col-md-8 + = semantic_form_for(@ticket, :url => (@ticket.new_record? ? admin_conference_tickets_path : admin_conference_ticket_path(@conference.short_title, @ticket))) do |f| + = f.input :title + = f.input :description, input_html: { rows: 5, data: { provide: "markdown-editable" } } + = f.input :price + = f.input :price_currency, as: :select, class: 'form-control', collection: ['USD', 'EUR', 'GBP', 'INR', 'CNY'], include_blank: false + %p.text-right + = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } diff --git a/app/views/admin/tickets/edit.html.haml b/app/views/admin/tickets/edit.html.haml deleted file mode 100644 index 2bef591a..00000000 --- a/app/views/admin/tickets/edit.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -%h1 - Edit Ticket -.row - .col-md-8 - = semantic_form_for(@ticket, :url => admin_conference_ticket_path(@conference.short_title, @ticket)) do |f| - = render partial: 'form', locals: { f: f } diff --git a/app/views/admin/tickets/index.html.haml b/app/views/admin/tickets/index.html.haml index f8d30ed9..e4828c44 100644 --- a/app/views/admin/tickets/index.html.haml +++ b/app/views/admin/tickets/index.html.haml @@ -1,38 +1,35 @@ -%h1 Tickets -%p.lead - If you add Tickets to your Conference, people will be redirected after registration to a page where they can purchase tickets. +.row + .col-md-12 + .page-header + %h1 Tickets + %p.text-muted + Tickets to purchase during registration - if @conference.tickets.any? .row .col-md-12 - %table.table + %table.table.table-hover#tickets %thead - %th # %th Title %th Price - %th Buyer - %th Show - %th Edit - %th Delete + %th Sold + %th Actions %tbody - - @conference.tickets.each_with_index do |ticket, index| + - @conference.tickets.each do |ticket| %tr %td - = index + 1 - %td - = ticket.title + = link_to(admin_conference_ticket_path(@conference.short_title, ticket.id)) do + = ticket.title %td = humanized_money_with_symbol ticket.price %td = ticket.buyers.count %td - = link_to 'Show', admin_conference_ticket_path(@conference.short_title, ticket.id), - method: :get, class: 'btn btn-success' - %td - = link_to 'Edit', edit_admin_conference_ticket_path(@conference.short_title, ticket.id), - method: :get, class: 'btn btn-primary' - %td - = link_to 'Delete', admin_conference_ticket_path(@conference.short_title, ticket.id), - method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete the Ticket for #{ticket.title}?" } - -= link_to 'Add Ticket', new_admin_conference_ticket_path, class: 'btn btn-success' + .btn-group + = link_to 'Edit', edit_admin_conference_ticket_path(@conference.short_title, ticket.id), + method: :get, class: 'btn btn-primary' + = link_to 'Delete', admin_conference_ticket_path(@conference.short_title, ticket.id), + method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete the Ticket for #{ticket.title}?" } +.row + .col-md-12 + = link_to 'Add Ticket', new_admin_conference_ticket_path, class: 'btn btn-success pull-right' diff --git a/app/views/admin/tickets/new.html.haml b/app/views/admin/tickets/new.html.haml deleted file mode 100644 index 129de0c7..00000000 --- a/app/views/admin/tickets/new.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -%h1 - New Ticket -.row - .col-md-8 - = semantic_form_for(@ticket, :url => admin_conference_tickets_path(@conference.short_title, @ticket)) do |f| - = render partial: 'form', locals: { f: f } diff --git a/app/views/admin/tickets/show.html.haml b/app/views/admin/tickets/show.html.haml index 6f37d1b1..f92b03b6 100644 --- a/app/views/admin/tickets/show.html.haml +++ b/app/views/admin/tickets/show.html.haml @@ -1,33 +1,35 @@ -%h1 - = @ticket.title - %small - = humanized_money_with_symbol @ticket.price -- if @ticket.description.present? - %p.lead - = markdown(@ticket.description) +.row + .col-md-12 + .page-header + %h1 + = @ticket.title + Ticket + %small + = humanized_money_with_symbol @ticket.price + %p.text-muted + People who bought this ticket +.row + .col-md-12 + %table.table.table-hover.datatable + %thead + %th # + %th Name + %th E-Mail + %th Affiliation + %th Paid + %tbody + - @ticket.buyers.each_with_index do |buyer, index| + %tr + %td + = index + 1 + %td + = buyer.name + %span.label.label-success + = buyer.ticket_purchases.find_by(ticket_id: @ticket.id).quantity + %td + = buyer.email + %td + = buyer.affiliation + %td + = @ticket.paid?(buyer) -%h4 The following persons bought this ticket: -%table.table.table-striped.table-bordered.table-hover.datatable - %thead - %th # - %th Name - %th E-Mail - %th Affiliation - %th Paid - %tbody - - @ticket.buyers.each_with_index do |buyer, index| - %tr - %td - = index + 1 - %td - = buyer.name - %span.label.label-success - = buyer.ticket_purchases.find_by(ticket_id: @ticket.id).quantity - %td - = buyer.email - %td - = buyer.affiliation - %td - = @ticket.paid?(buyer) -= link_to 'Edit', edit_admin_conference_ticket_path(@conference.short_title, @ticket.id), - method: :get, class: 'btn btn-primary' diff --git a/app/views/admin/tracks/_form.html.haml b/app/views/admin/tracks/_form.html.haml new file mode 100644 index 00000000..db18e963 --- /dev/null +++ b/app/views/admin/tracks/_form.html.haml @@ -0,0 +1,15 @@ +.row + .col-md-12 + .page-header + %h1 + -if @track.new_record? + New + = @track.name + Track +.row + .col-md-12 + = semantic_form_for(@track, :url => (@track.new_record? ? admin_conference_tracks_path : admin_conference_track_path(@conference.short_title, @track))) do |f| + = f.input :name + = f.input :color, :input_html => {:size => 6, :type => "color"}, :required=> true + = f.input :description, :input_html => {:rows => 2, data: { provide: "markdown-editable" } }, hint: markdown_hint + = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } \ No newline at end of file diff --git a/app/views/admin/tracks/_track_fields.html.erb b/app/views/admin/tracks/_track_fields.html.erb deleted file mode 100644 index a3115ba0..00000000 --- a/app/views/admin/tracks/_track_fields.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -
- <%= f.inputs do %> - <%= f.input :name %> - <%= f.input :color, :input_html => {:size => 6, :type => "color"}, :required=> true %> - <%= f.input :description, :input_html => {:rows => 2, data: { provide: "markdown-editable" } }, hint: markdown_hint %> - <%= remove_association_link :track, f %> - <% end %> -
- diff --git a/app/views/admin/tracks/index.html.haml b/app/views/admin/tracks/index.html.haml index 27bdedde..986ea522 100644 --- a/app/views/admin/tracks/index.html.haml +++ b/app/views/admin/tracks/index.html.haml @@ -1,5 +1,36 @@ .row - .col-md-8 - = semantic_form_for(@conference, :url => admin_conference_track_path(@conference.short_title, @conference.tracks)) do |f| - = dynamic_association :tracks, "Tracks", f - = f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"} + .col-md-12 + .page-header + %h1 Tracks + %p.text-muted + Categorize events in your conference +.row + .col-md-12 + %table.table.table-hover#tracks + %thead + %th Name + %th Description + %th Color + %th Actions + %tbody + - @conference.tracks.each do |track| + %tr + %td + = link_to(admin_conference_track_path(@conference.short_title, track)) do + = track.name + %td + %p + = truncate(track.description) + %td + %span.label{style: "background-color: #{track.color};"} + = track.color + %td + .btn-group{role: "group"} + = link_to 'Edit', edit_admin_conference_track_path(@conference.short_title, track.id), + method: :get, class: 'btn btn-primary' + = link_to 'Delete', admin_conference_track_path(@conference.short_title, track.id), + method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete #{track.name}?" } +.row + .col-md-12.text-right + = link_to 'New Track', new_admin_conference_track_path(@conference.short_title), class: 'btn btn-success' + diff --git a/app/views/admin/tracks/show.html.haml b/app/views/admin/tracks/show.html.haml new file mode 100644 index 00000000..5f6ffc04 --- /dev/null +++ b/app/views/admin/tracks/show.html.haml @@ -0,0 +1,31 @@ +.row + .col-md-12 + .page-header + %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_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.start_time + diff --git a/app/views/admin/users/_submissions.html.haml b/app/views/admin/users/_submissions.html.haml index 1a0a0857..c671a45b 100644 --- a/app/views/admin/users/_submissions.html.haml +++ b/app/views/admin/users/_submissions.html.haml @@ -22,8 +22,8 @@ %td= event.state %td= "#{event.event_type.title} (#{show_time(event.event_type.length)})" %td - - if event.conference.call_for_papers && event.conference.call_for_papers.rating && event.conference.call_for_papers.rating > 0 - - event.conference.call_for_papers.rating.times do |counter| + - if event.conference.call_for_paper && event.conference.call_for_paper.rating && event.conference.call_for_paper.rating > 0 + - event.conference.call_for_paper.rating.times do |counter| - if event.average_rating.to_f.round == counter+1 = label_tag 'label_rating', '', class: 'avgrating', avgrate: true = javascript_tag "$('label[avgrate=true]').prevAll().andSelf().addClass('bright');" diff --git a/app/views/admin/venues/_form.html.haml b/app/views/admin/venues/_form.html.haml index bc74818c..26bd1622 100644 --- a/app/views/admin/venues/_form.html.haml +++ b/app/views/admin/venues/_form.html.haml @@ -1,8 +1,14 @@ -= semantic_form_for(@venue, url: admin_conference_venue_path(@conference.short_title)) do |f| - = f.inputs :name, :website - = f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown-editable' } }, hint: markdown_hint - = f.inputs :street, :postalcode, :city, :country, :longitude, :latitude - - unless @venue.photo.blank? - = image_tag @venue.photo(:thumb) - = f.input :photo - = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } +.row + .col-md-12 + .page-header + %h1 Venue +.row + .col-md-8 + = semantic_form_for(@venue, url: admin_conference_venue_path(@conference.short_title)) do |f| + = f.inputs :name, :website + = f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown-editable' } }, hint: markdown_hint + = f.inputs :street, :postalcode, :city, :country, :longitude, :latitude + - unless @venue.photo.blank? + = image_tag @venue.photo(:thumb) + = f.input :photo + = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } diff --git a/app/views/admin/venues/show.html.haml b/app/views/admin/venues/show.html.haml index f421aeaa..900e2b9e 100644 --- a/app/views/admin/venues/show.html.haml +++ b/app/views/admin/venues/show.html.haml @@ -1,3 +1,9 @@ +.row + .col-md-12 + .page-header + %h1 Venue + %p.text-muted + The place where your conference takes place -if @venue .row .col-md-6 @@ -20,6 +26,6 @@ Delete Venue -else .row - .col-md-12 - = link_to(new_admin_conference_venue_path(@conference.short_title), class: 'btn btn-success') do + .col-md-12.text-right + = link_to(new_admin_conference_venue_path(@conference.short_title), class: 'btn btn-primary') do Create Venue \ No newline at end of file diff --git a/app/views/conference/_call_for_papers.html.haml b/app/views/conference/_call_for_paper.html.haml similarity index 82% rename from app/views/conference/_call_for_papers.html.haml rename to app/views/conference/_call_for_paper.html.haml index e3f618af..1526751c 100644 --- a/app/views/conference/_call_for_papers.html.haml +++ b/app/views/conference/_call_for_paper.html.haml @@ -21,12 +21,12 @@ = "#{tracks(@conference)}." The submission period has begun %em - = @conference.call_for_papers.start_date.strftime('%A, %B %-d. %Y') + = @conference.call_for_paper.start_date.strftime('%A, %B %-d. %Y') and closes %em - = @conference.call_for_papers.end_date.strftime('%A, %B %-d. %Y.') + = @conference.call_for_paper.end_date.strftime('%A, %B %-d. %Y.') That means you have only - - days = (@conference.call_for_papers.end_date - Date.today).to_i + - days = (@conference.call_for_paper.end_date - Date.today).to_i %b = pluralize(days, 'days') left! @@ -36,4 +36,4 @@ .row .col-md-12.text-center %p.cta-button - = link_to "Submit your paper now", conference_proposal_index_path(@conference.short_title), class: 'btn btn-success btn-lg text-center' \ No newline at end of file + = link_to "Submit your paper now", conference_proposal_index_path(@conference.short_title), class: 'btn btn-success btn-lg text-center' diff --git a/app/views/conference/_conference_details.html.haml b/app/views/conference/_conference_details.html.haml index 29d12933..7724c1aa 100644 --- a/app/views/conference/_conference_details.html.haml +++ b/app/views/conference/_conference_details.html.haml @@ -25,7 +25,7 @@ = link_to "Modify Registration", edit_conference_conference_registrations_path(conference.short_title), :class =>"btn btn-default" - else = link_to "Register", new_conference_conference_registrations_path(conference.short_title), :class =>"btn btn-success" - = link_to "Schedule", conference_schedule_path(conference.short_title), :class =>"btn btn-default" if conference.call_for_papers and conference.call_for_papers.schedule_public + = link_to "Schedule", conference_schedule_path(conference.short_title), :class =>"btn btn-default" if conference.call_for_paper and conference.call_for_paper.schedule_public - if !current_user.nil? && current_user.proposal_count(conference) > 0 = link_to "View My Proposals", conference_proposal_index_path(conference.short_title), :class =>"btn btn-default" - elsif conference.cfp_open? diff --git a/app/views/conference/_program.html.haml b/app/views/conference/_program.html.haml index a07de85a..f352528d 100644 --- a/app/views/conference/_program.html.haml +++ b/app/views/conference/_program.html.haml @@ -17,7 +17,7 @@ = track.name = markdown(track.description) - - if @conference.call_for_papers and @conference.call_for_papers.schedule_public + - if @conference.call_for_paper and @conference.call_for_paper.schedule_public .row .col-md-12 %p.cta-button.text-center @@ -31,4 +31,4 @@ = content_for :splash_nav do %li =link_to('#program', class: 'smoothscroll') do - Program \ No newline at end of file + Program diff --git a/app/views/conference/show.html.haml b/app/views/conference/show.html.haml index 35cfce79..4cc793d2 100644 --- a/app/views/conference/show.html.haml +++ b/app/views/conference/show.html.haml @@ -33,9 +33,9 @@ %section#program = render 'program' - - if @conference.cfp_open? and @conference.call_for_papers.include_cfp_in_splash? + - if @conference.cfp_open? and @conference.call_for_paper.include_cfp_in_splash? %section#callforpapers - = render 'call_for_papers' + = render 'call_for_paper' - if @conference.venue and @conference.splashpage.include_venue %section#venue @@ -70,4 +70,4 @@ var pattern = t.generate(document.body.clientWidth, ($( "#banner" ).height() + 200 )); $('#banner').css('background-image', pattern.dataUrl); }); - }); \ No newline at end of file + }); diff --git a/app/views/conference_registrations/show.html.haml b/app/views/conference_registrations/show.html.haml index 4a876fd8..d28198be 100644 --- a/app/views/conference_registrations/show.html.haml +++ b/app/views/conference_registrations/show.html.haml @@ -8,11 +8,11 @@ = date_string(@conference.start_date, @conference.end_date) .row .col-md-6 - - if @conference.venue.name and @conference.venue.website and @conference.venue.street + - if @conference.venue %p %small at - = link_to @conference.venue.name, @conference.venue.website + = link_to @conference.venue.name , = link_to @conference.venue.address, "http://maps.google.com/maps?q=#{@conference.venue.address}" .col-md-4 diff --git a/app/views/layouts/_admin_sidebar.html.haml b/app/views/layouts/_admin_sidebar.html.haml index 1271319e..63b15ded 100644 --- a/app/views/layouts/_admin_sidebar.html.haml +++ b/app/views/layouts/_admin_sidebar.html.haml @@ -39,12 +39,9 @@ - if can? :index, @conference.commercials.build %li{:class=> "#{active_nav_li(admin_conference_commercials_path(@conference.short_title))}"} = link_to 'Commercials', admin_conference_commercials_path(@conference.short_title) - - if can? :update, @conference.photos.build - %li{:class=> "#{active_nav_li(admin_conference_photos_path(@conference.short_title))}"} - = link_to 'Photos', admin_conference_photos_path(@conference.short_title) - if can? :update, @conference %li{:class=> active_nav_li(edit_admin_conference_splashpage_path(@conference.short_title))} - = link_to 'Splashpage', edit_admin_conference_splashpage_path(@conference.short_title) + = link_to 'Splashpage', admin_conference_splashpage_path(@conference.short_title) - if can? :index, Venue.new(conference_id: @conference.id) %li{:class=> "#{active_nav_li(admin_conference_venue_path(@conference.short_title))}"} = link_to(admin_conference_venue_path(@conference.short_title)) do @@ -65,9 +62,9 @@ - if can? :update, @conference.events.build %li{:class=> active_nav_li(admin_conference_events_path(@conference.short_title))} = link_to 'Events', admin_conference_events_path(@conference.short_title) - - if can? :update, CallForPapers.new(conference_id: @conference.id) - %li{:class=> "#{active_nav_li(admin_conference_callforpapers_path(@conference.short_title))}"} - = link_to 'Call for Papers', admin_conference_callforpapers_path(@conference.short_title) + - if can? :update, CallForPaper.new(conference_id: @conference.id) + %li{:class=> "#{active_nav_li(admin_conference_call_for_paper_path(@conference.short_title))}"} + = link_to 'Call for Papers', admin_conference_call_for_paper_path(@conference.short_title) - if can? :update, @conference.tracks.build %li{:class=> active_nav_li(admin_conference_tracks_path(@conference.short_title))} = link_to 'Tracks', admin_conference_tracks_path(@conference.short_title) diff --git a/app/views/proposal/_proposal_form.html.haml b/app/views/proposal/_proposal_form.html.haml index cc3cd6ff..1d46f079 100644 --- a/app/views/proposal/_proposal_form.html.haml +++ b/app/views/proposal/_proposal_form.html.haml @@ -18,7 +18,7 @@ Event type: #{@event.event_type.title} %br %br - = f.input :difficulty_level, :as => :select, :collection => @conference.difficulty_levels, :include_blank => "(Please select)" if @conference.use_difficulty_levels + = f.input :difficulty_level, :as => :select, :collection => @conference.difficulty_levels, :include_blank => "(Please select)" if @conference.difficulty_levels.any? = f.input :require_registration = f.input :abstract, :input_html => {:rows => 5, :class => "span11"}, :required => true, :label => "Session Abstract" @@ -47,4 +47,4 @@ %span#biography-count #{current_user.biography_word_count} words. Biographies are limited to 150 words. %p.text-right - = f.action :submit, :as => :button, :button_html => {:class => "btn btn-success"} \ No newline at end of file + = f.action :submit, :as => :button, :button_html => {:class => "btn btn-success"} diff --git a/app/views/proposal/new.html.haml b/app/views/proposal/new.html.haml index e004dcb0..70bb36ee 100644 --- a/app/views/proposal/new.html.haml +++ b/app/views/proposal/new.html.haml @@ -1,7 +1,28 @@ .container .row .col-md-12 - = simple_format(@conference.call_for_papers.description) + %p + - if @conference.event_types.any? + You can submit proposals for + = "#{event_types(@conference)}." + - if @conference.tracks.any? + Proposals should fit in one of the + = "#{pluralize(@conference.tracks.count, 'track')}:" + = "#{tracks(@conference)}." + The submission period has begun + %em + = @conference.call_for_paper.start_date.strftime('%A, %B %-d. %Y') + and closes + %em + = @conference.call_for_paper.end_date.strftime('%A, %B %-d. %Y.') + That means you have only + - days = (@conference.call_for_paper.end_date - Date.today).to_i + %b + = pluralize(days, 'days') + left! + Remember + = @conference.short_title + will only be as good as the sessions you present. Submit early, submit often! .row .col-md-12 = render 'proposal_form' diff --git a/config/routes.rb b/config/routes.rb index 2de9a3fd..6ee73635 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -33,20 +33,29 @@ Osem::Application.routes.draw do get '/volunteers' => 'volunteers#index', as: 'volunteers_info' patch '/volunteers' => 'volunteers#update', as: 'volunteers_update' - patch '/registrations/toogle_attended' => 'registrations#toogle_attended' - resources :registrations, except: [:create, :new] + resources :registrations, except: [:create, :new] do + member do + patch :present + patch :absent + end + end + # Singletons + resource :splashpage + resource :call_for_paper + resource :venue resource :registration_period - resource :splashpage - - resource :venue - - resources :difficulty_levels, only: [:show, :update, :index] - + resources :tickets + resources :tracks + resources :event_types + resources :difficulty_levels resources :rooms, except: [:show] - - resources :tracks, only: [:show, :update, :index] + resources :sponsors, except: [:show] + resources :lodgings, except: [:show] + resources :targets, except: [:show] + resources :campaigns, except: [:show] + resources :emails, only: [:show, :update, :index] resources :sponsorship_levels, except: [:show] do member do @@ -55,36 +64,12 @@ Osem::Application.routes.draw do end end - resources :sponsors, only: [:show, :update, :index] - - resources :lodgings - - resources :targets, only: [:update, :index] - - resources :campaigns - - resources :event_types, only: [:show, :index] do + resources :questions do collection do - patch :update + patch :update_conference end end - resources :social_events, only: [:show, :update, :index] - - resources :tickets - - resources :emails, only: [:show, :update, :index] - - resources :callforpapers, only: [:create] do - collection do - patch :update - get :show - end - end - - patch '/questions/update_conference' => 'questions#update_conference' - resources :questions - resources :events do member do post :comment diff --git a/db/migrate/20141120205757_remove_public_from_room.rb b/db/migrate/20141120205757_remove_public_from_room.rb new file mode 100644 index 00000000..fa44e5ac --- /dev/null +++ b/db/migrate/20141120205757_remove_public_from_room.rb @@ -0,0 +1,5 @@ +class RemovePublicFromRoom < ActiveRecord::Migration + def change + remove_column :rooms, :public, :boolean, default: false + end +end diff --git a/db/migrate/20141121102656_remove_description_from_call_for_paper.rb b/db/migrate/20141121102656_remove_description_from_call_for_paper.rb new file mode 100644 index 00000000..89e8cdbb --- /dev/null +++ b/db/migrate/20141121102656_remove_description_from_call_for_paper.rb @@ -0,0 +1,5 @@ +class RemoveDescriptionFromCallForPaper < ActiveRecord::Migration + def change + remove_column :call_for_papers, :description, :text + end +end diff --git a/db/schema.rb b/db/schema.rb index 0f876f1f..ba15d279 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20141118162030) do +ActiveRecord::Schema.define(version: 20141121102656) do create_table "ahoy_events", force: true do |t| t.uuid "visit_id" @@ -32,16 +32,15 @@ ActiveRecord::Schema.define(version: 20141118162030) do end create_table "call_for_papers", force: true do |t| - t.date "start_date", null: false - t.date "end_date", null: false - t.text "description", limit: 16777215, null: false + t.date "start_date", null: false + t.date "end_date", null: false t.integer "conference_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "schedule_changes", default: false - t.integer "rating", default: 3 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "schedule_changes", default: false + t.integer "rating", default: 3 t.boolean "schedule_public" - t.boolean "include_cfp_in_splash", default: false + t.boolean "include_cfp_in_splash", default: false end create_table "campaigns", force: true do |t| @@ -388,11 +387,10 @@ ActiveRecord::Schema.define(version: 20141118162030) do add_index "roles_users", ["user_id", "role_id"], name: "index_roles_users_on_user_id_and_role_id" create_table "rooms", force: true do |t| - t.string "guid", null: false + t.string "guid", null: false t.integer "conference_id" - t.string "name", null: false + t.string "name", null: false t.integer "size" - t.boolean "public", default: false end create_table "social_events", force: true do |t| diff --git a/spec/controllers/admin/conferences_controller_spec.rb b/spec/controllers/admin/conferences_controller_spec.rb index d6a93804..7c6a4989 100644 --- a/spec/controllers/admin/conferences_controller_spec.rb +++ b/spec/controllers/admin/conferences_controller_spec.rb @@ -165,9 +165,9 @@ describe Admin::ConferenceController do it 'assigns cfp_max an array with maximum weeks' do conference date = Date.new(2014, 05, 26) - conference.call_for_papers = create(:call_for_papers, - start_date: date, - end_date: date + 14) + conference.call_for_paper = create(:call_for_paper, + start_date: date, + end_date: date + 14) get :index expect(assigns(:cfp_weeks)).to match_array([1, 2, 3]) end diff --git a/spec/controllers/conference_controller_spec.rb b/spec/controllers/conference_controller_spec.rb index 0dfb8c3e..2b60b544 100644 --- a/spec/controllers/conference_controller_spec.rb +++ b/spec/controllers/conference_controller_spec.rb @@ -22,18 +22,6 @@ describe ConferenceController do expect(response).to render_template :show end end - - context 'gallery photos for splash' do - it 'return conference photos' do - xhr :get, :gallery_photos, id: conference.short_title - expect(assigns(:photos)).to eq conference.photos - end - - it 'renders photos template' do - xhr :get, :gallery_photos, id: conference.short_title - expect(response).to render_template :photos - end - end end describe 'OPTIONS #index' do diff --git a/spec/factories/call_for_papers.rb b/spec/factories/call_for_paper.rb similarity index 66% rename from spec/factories/call_for_papers.rb rename to spec/factories/call_for_paper.rb index 5585a361..ee99aa81 100644 --- a/spec/factories/call_for_papers.rb +++ b/spec/factories/call_for_paper.rb @@ -1,10 +1,8 @@ # Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do - factory :call_for_papers do + factory :call_for_paper do start_date { 1.day.ago } end_date { 7.days.from_now } - description 'We call for papers' - conference end end diff --git a/spec/factories/photos.rb b/spec/factories/photos.rb deleted file mode 100644 index c3e69721..00000000 --- a/spec/factories/photos.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Read about factories at https://github.com/thoughtbot/factory_girl -include ActionDispatch::TestProcess - -FactoryGirl.define do - factory :photo do - picture { fixture_file_upload(Rails.root.join('app', 'assets', 'images', 'rails.png'), 'image/png') } - picture_file_name 'rails.png' - picture_content_type 'image/png' - picture_file_size '1024' - picture_updated_at { DateTime.now } - description 'Lorem Ipsum Dolor' - conference - end -end diff --git a/spec/features/ability_spec.rb b/spec/features/ability_spec.rb index 28b30b70..453321b7 100644 --- a/spec/features/ability_spec.rb +++ b/spec/features/ability_spec.rb @@ -23,7 +23,6 @@ feature 'Has correct abilities' do expect(page).to have_link('Basics', href: "/admin/conference/#{conference1.short_title}/edit") expect(page).to have_link('Contact', href: "/admin/conference/#{conference1.short_title}/contact/edit") expect(page).to have_link('Commercials', href: "/admin/conference/#{conference1.short_title}/commercials") - expect(page).to have_link('Photos', href: "/admin/conference/#{conference1.short_title}/photos") expect(page).to have_link('Events', href: "/admin/conference/#{conference1.short_title}/events") expect(page).to have_link('Registrations', href: "/admin/conference/#{conference1.short_title}/registrations") expect(page).to have_link('Schedule', href: "/admin/conference/#{conference1.short_title}/schedule") @@ -36,7 +35,7 @@ feature 'Has correct abilities' do expect(page).to have_link('Sponsors', href: "/admin/conference/#{conference1.short_title}/sponsors") expect(page).to have_link('Tickets', href: "/admin/conference/#{conference1.short_title}/tickets") expect(page).to have_link('E-Mails', href: "/admin/conference/#{conference1.short_title}/emails") - expect(page).to have_link('Call for Papers', href: "/admin/conference/#{conference1.short_title}/callforpapers") + expect(page).to have_link('Call for Papers', href: "/admin/conference/#{conference1.short_title}/call_for_paper") expect(page).to have_link('Tracks', href: "/admin/conference/#{conference1.short_title}/tracks") expect(page).to have_link('Event Types', href: "/admin/conference/#{conference1.short_title}/event_types") expect(page).to have_link('Difficulty Levels', href: "/admin/conference/#{conference1.short_title}/difficulty_levels") @@ -76,8 +75,8 @@ feature 'Has correct abilities' do visit admin_conference_emails_path(conference1.short_title) expect(current_path).to eq(admin_conference_emails_path(conference1.short_title)) - visit admin_conference_callforpapers_path(conference1.short_title) - expect(current_path).to eq(admin_conference_callforpapers_path(conference1.short_title)) + visit new_admin_conference_call_for_paper_path(conference1.short_title) + expect(current_path).to eq(new_admin_conference_call_for_paper_path(conference1.short_title)) visit admin_conference_questions_path(conference1.short_title) expect(current_path).to eq(admin_conference_questions_path(conference1.short_title)) @@ -94,7 +93,6 @@ feature 'Has correct abilities' do expect(page).to have_link('Basics', href: "/admin/conference/#{conference2.short_title}/edit") 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_not have_link('Photos', href: "/admin/conference/#{conference2.short_title}/photos") expect(page).to have_link('Events', href: "/admin/conference/#{conference2.short_title}/events") expect(page).to_not have_link('Registrations', href: "/admin/conference/#{conference2.short_title}/registrations") expect(page).to have_link('Schedule', href: "/admin/conference/#{conference2.short_title}/schedule") @@ -107,7 +105,7 @@ feature 'Has correct abilities' do expect(page).to_not have_link('Sponsors', href: "/admin/conference/#{conference2.short_title}/sponsors") expect(page).to_not have_link('Supporter Levels', href: "/admin/conference/#{conference2.short_title}/supporter_levels") expect(page).to have_link('E-Mails', href: "/admin/conference/#{conference2.short_title}/emails") - expect(page).to have_link('Call for Papers', href: "/admin/conference/#{conference2.short_title}/callforpapers") + expect(page).to have_link('Call for Papers', href: "/admin/conference/#{conference2.short_title}/call_for_paper") expect(page).to have_link('Tracks', href: "/admin/conference/#{conference2.short_title}/tracks") expect(page).to have_link('Event Types', href: "/admin/conference/#{conference2.short_title}/event_types") expect(page).to have_link('Difficulty Levels', href: "/admin/conference/#{conference2.short_title}/difficulty_levels") @@ -147,8 +145,8 @@ feature 'Has correct abilities' do visit admin_conference_emails_path(conference2.short_title) expect(current_path).to eq(admin_conference_emails_path(conference2.short_title)) - visit admin_conference_callforpapers_path(conference2.short_title) - expect(current_path).to eq(admin_conference_callforpapers_path(conference2.short_title)) + visit new_admin_conference_call_for_paper_path(conference2.short_title) + expect(current_path).to eq(new_admin_conference_call_for_paper_path(conference2.short_title)) visit admin_conference_questions_path(conference2.short_title) expect(current_path).to eq(root_path) @@ -165,7 +163,6 @@ feature 'Has correct abilities' do expect(page).to have_link('Basics', href: "/admin/conference/#{conference3.short_title}/edit") 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('Photos', href: "/admin/conference/#{conference3.short_title}/photos") expect(page).to_not have_link('Events', href: "/admin/conference/#{conference3.short_title}/events") expect(page).to have_link('Registrations', href: "/admin/conference/#{conference3.short_title}/registrations") expect(page).to_not have_link('Schedule', href: "/admin/conference/#{conference3.short_title}/schedule") @@ -178,7 +175,7 @@ feature 'Has correct abilities' do expect(page).to_not have_link('Sponsors', href: "/admin/conference/#{conference3.short_title}/sponsors") expect(page).to_not have_link('Supporter Levels', href: "/admin/conference/#{conference3.short_title}/supporter_levels") expect(page).to_not have_link('E-Mails', href: "/admin/conference/#{conference3.short_title}/emails") - expect(page).to_not have_link('Call for papers', href: "/admin/conference/#{conference3.short_title}/callforpapers") + expect(page).to_not have_link('Call for papers', href: "/admin/conference/#{conference3.short_title}/call_for_paper") expect(page).to_not have_link('Tracks', href: "/admin/conference/#{conference3.short_title}/tracks") expect(page).to_not have_link('Event types', href: "/admin/conference/#{conference3.short_title}/event_types") expect(page).to_not have_link('Difficulty levels', href: "/admin/conference/#{conference3.short_title}/difficulty_levels") @@ -218,7 +215,7 @@ feature 'Has correct abilities' do visit admin_conference_emails_path(conference3.short_title) expect(current_path).to eq(root_path) - visit admin_conference_callforpapers_path(conference3.short_title) + visit new_admin_conference_call_for_paper_path(conference3.short_title) expect(current_path).to eq(root_path) visit admin_conference_questions_path(conference3.short_title) @@ -237,7 +234,6 @@ feature 'Has correct abilities' do expect(page).to have_link('Basics', href: "/admin/conference/#{conference4.short_title}/edit") expect(page).to_not have_link('Contact', href: "/admin/conference/#{conference4.short_title}/contact/edit") expect(page).to have_link('Commercials', href: "/admin/conference/#{conference4.short_title}/commercials") - expect(page).to_not have_link('Photos', href: "/admin/conference/#{conference4.short_title}/photos") expect(page).to_not have_link('Events', href: "/admin/conference/#{conference4.short_title}/events") expect(page).to_not have_link('Registrations', href: "/admin/conference/#{conference4.short_title}/registrations") expect(page).to_not have_link('Schedule', href: "/admin/conference/#{conference4.short_title}/schedule") @@ -250,7 +246,7 @@ feature 'Has correct abilities' do expect(page).to_not have_link('Sponsors', href: "/admin/conference/#{conference4.short_title}/sponsors") expect(page).to_not have_link('Supporter Levels', href: "/admin/conference/#{conference4.short_title}/supporter_levels") expect(page).to_not have_link('E-Mails', href: "/admin/conference/#{conference4.short_title}/emails") - expect(page).to_not have_link('Call for Papers', href: "/admin/conference/#{conference4.short_title}/callforpapers") + expect(page).to_not have_link('Call for Papers', href: "/admin/conference/#{conference4.short_title}/call_for_paper") expect(page).to_not have_link('Tracks', href: "/admin/conference/#{conference4.short_title}/tracks") expect(page).to_not have_link('Event Types', href: "/admin/conference/#{conference4.short_title}/event_types") expect(page).to_not have_link('Difficulty Levels', href: "/admin/conference/#{conference4.short_title}/difficulty_levels") @@ -290,7 +286,7 @@ feature 'Has correct abilities' do visit admin_conference_emails_path(conference4.short_title) expect(current_path).to eq(root_path) - visit admin_conference_callforpapers_path(conference4.short_title) + visit new_admin_conference_call_for_paper_path(conference4.short_title) expect(current_path).to eq(root_path) visit admin_conference_questions_path(conference4.short_title) diff --git a/spec/features/campaign_spec.rb b/spec/features/campaign_spec.rb index 21382655..f95e296e 100644 --- a/spec/features/campaign_spec.rb +++ b/spec/features/campaign_spec.rb @@ -33,10 +33,10 @@ feature Campaign do expect(flash). to eq('Campaign successfully created.') - expect(find('#name_0').text).to eq('Test Campaign') - expect(find('#visits_0').text).to eq('0') - expect(find('#registrations_0').text).to eq('0') - expect(find('#submissions_0').text).to eq('0') + expect(find('#name_1').text).to eq('Test Campaign') + expect(find('#visits_1').text).to eq('0') + expect(find('#registrations_1').text).to eq('0') + expect(find('#submissions_1').text).to eq('0') expect(Campaign.count).to eq(expected_count) diff --git a/spec/features/cfp_spec.rb b/spec/features/cfp_spec.rb index 23f2458a..12f89bb7 100644 --- a/spec/features/cfp_spec.rb +++ b/spec/features/cfp_spec.rb @@ -8,13 +8,13 @@ feature Conference do shared_examples 'add and update cfp' do scenario 'adds a new cfp', feature: true, js: true do - expected_count = CallForPapers.count + 1 + expected_count = CallForPaper.count + 1 sign_in organizer - visit admin_conference_callforpapers_path(conference.short_title) + visit new_admin_conference_call_for_paper_path(conference.short_title) - click_button 'Create Call for papers' + click_button 'Create Call for paper' expect(flash). to eq('Creating the call for papers failed. ' + @@ -26,36 +26,32 @@ feature Conference do page.execute_script( "$('#conference-end-datepicker').val('#{(today + 7).strftime('%d/%m/%Y')}')") - fill_in 'call_for_papers_description', with: 'Cfp description' - fill_in 'call_for_papers_rating', with: '4' + fill_in 'call_for_paper_rating', with: '4' - click_button 'Create Call for papers' + click_button 'Create Call for paper' # Validations expect(flash). - to eq('Call for Papers was successfully created.') - expect(find('#conference-start-datepicker').value). - to eq(today.strftime('%Y-%m-%d')) - expect(find('#conference-end-datepicker').value). - to eq((today + 7).strftime('%Y-%m-%d')) - expect(find('#call_for_papers_description').text). - to eq('Cfp description') - expect(find('#call_for_papers_rating').value).to eq('4') + to eq('Call for papers successfully created.') + expect(find('#start_date').text).to eq(today.strftime('%A, %B %-d. %Y')) + expect(find('#end_date').text).to eq((today + 7).strftime('%A, %B %-d. %Y')) + expect(find('#rating').text).to eq('4') - expect(CallForPapers.count).to eq(expected_count) + expect(CallForPaper.count).to eq(expected_count) end scenario 'update cfp', feature: true, js: true do - conference.call_for_papers = create(:call_for_papers) - expected_count = CallForPapers.count + conference.call_for_paper = create(:call_for_paper) + expected_count = CallForPaper.count sign_in organizer - visit admin_conference_callforpapers_path(conference.short_title) + visit admin_conference_call_for_paper_path(conference.short_title) + click_link 'Edit' # Validate update with empty start date will not saved page.execute_script( "$('#conference-start-datepicker').val('')") - click_button 'Update Call for papers' + click_button 'Update Call for paper' expect(flash). to eq('Updating call for papers failed. ' + "Start date can't be blank.") @@ -67,21 +63,16 @@ feature Conference do page.execute_script( "$('#conference-end-datepicker').val('#{(today + 14).strftime('%d/%m/%Y')}')") - fill_in 'call_for_papers_description', with: 'Updated description' - fill_in 'call_for_papers_rating', with: '0' - click_button 'Update Call for papers' + fill_in 'call_for_paper_rating', with: '0' + click_button 'Update Call for paper' # Validations expect(flash). - to eq('Call for Papers was successfully updated.') - expect(find('#conference-start-datepicker').value). - to eq(today.strftime('%Y-%m-%d')) - expect(find('#conference-end-datepicker').value). - to eq((today + 14).strftime('%Y-%m-%d')) - expect(find('#call_for_papers_description').text). - to eq('Updated description') - expect(find('#call_for_papers_rating').value).to eq('0') - expect(CallForPapers.count).to eq(expected_count) + to eq('Call for papers successfully updated.') + expect(find('#start_date').text).to eq(today.strftime('%A, %B %-d. %Y')) + expect(find('#end_date').text).to eq((today + 14).strftime('%A, %B %-d. %Y')) + expect(find('#rating').text).to eq('0') + expect(CallForPaper.count).to eq(expected_count) end end diff --git a/spec/features/commercials_spec.rb b/spec/features/commercials_spec.rb index 9c77b771..57d9a59b 100644 --- a/spec/features/commercials_spec.rb +++ b/spec/features/commercials_spec.rb @@ -14,7 +14,7 @@ feature Commercial do sign_in organizer visit admin_conference_commercials_path(conference.short_title) - click_link 'New Commercial' + click_link 'Add Commercial' # Create without an commercial id select('SlideShare', from: 'commercial_commercial_type') diff --git a/spec/features/conference_spec.rb b/spec/features/conference_spec.rb index 45456b63..2aa49733 100644 --- a/spec/features/conference_spec.rb +++ b/spec/features/conference_spec.rb @@ -39,9 +39,8 @@ feature Conference do expected_count = Conference.count sign_in organizer - visit edit_admin_conference_path(conference.short_title) - click_link 'Edit' + fill_in 'conference_title', with: 'New Con' fill_in 'conference_short_title', with: '' @@ -49,9 +48,9 @@ feature Conference do expect(flash). to eq("Updating conference failed. Short title can't be blank.") - click_link 'Edit' fill_in 'conference_title', with: 'New Con' fill_in 'conference_short_title', with: 'NewCon' + day = Date.today + 10 page. execute_script("$('#conference-start-datepicker').val('" + diff --git a/spec/features/contact_spec.rb b/spec/features/contact_spec.rb index 2054e6d9..c5612c60 100644 --- a/spec/features/contact_spec.rb +++ b/spec/features/contact_spec.rb @@ -14,7 +14,7 @@ feature Contact do sign_in organizer visit edit_admin_conference_contact_path(conference.short_title) - click_link 'Edit' + fill_in 'contact_email', with: 'example@example.com' fill_in 'contact_sponsor_email', with: 'sponsor@example.com' fill_in 'contact_social_tag', with: 'example' @@ -24,9 +24,9 @@ feature Contact do fill_in 'contact_googleplus', with: 'http:\\www.google.com' click_button 'Update Contact' + expect(flash). to eq('Contact details were successfully updated.') - contact.reload expect(contact.email).to eq('example@example.com') expect(contact.sponsor_email).to eq('sponsor@example.com') diff --git a/spec/features/difficulty_levels_spec.rb b/spec/features/difficulty_levels_spec.rb index b81f9d00..d23f3979 100644 --- a/spec/features/difficulty_levels_spec.rb +++ b/spec/features/difficulty_levels_spec.rb @@ -6,47 +6,47 @@ feature DifficultyLevel do let!(:organizer) { create(:user, role_ids: [organizer_role.id]) } shared_examples 'difficulty levels' do - scenario 'adds and updates difficulty level', feature: true, js: true do + scenario 'adds difficulty level', feature: true, js: true do sign_in organizer visit admin_conference_difficulty_levels_path( conference_id: conference.short_title) # Add difficulty level - click_link 'Add difficulty_level' - expect(page.all('div.nested-fields').count == 1).to be true + click_link 'Add Difficulty Level' - page. - find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) input'). - set('Example difficulty level') - page. - find('div.nested-fields:nth-of-type(1) div:nth-of-type(2) textarea'). - set('Example difficulty level description') - page. - find('div.nested-fields:nth-of-type(1) div:nth-of-type(3) input'). - set('#ff0000') + fill_in 'difficulty_level_title', with: 'Hard' + fill_in 'difficulty_level_description', with: 'Life is the hardest' + page.find('#difficulty_level_color').set('#ff0000') - click_button 'Update Conference' + click_button 'Create Difficulty level' # Validations - expect(flash).to eq('Difficulty Levels were successfully updated.') - expect( - find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) input'). - value).to eq('Example difficulty level') - expect( - find('div.nested-fields:nth-of-type(1) div:nth-of-type(2) textarea'). - value).to eq('Example difficulty level description') - expect( - find('div.nested-fields:nth-of-type(1) div:nth-of-type(3) input'). - value).to eq('#ff0000') + expect(flash).to eq('Difficulty level successfully created.') + within('table#difficulty_levels') do + expect(page.has_content?('Hard')).to be true + expect(page.has_content?('Life is the hardest')).to be true + expect(page.assert_selector('tr', count: 2)).to be true + end + end + + scenario 'updates difficulty level', feature: true, js: true do + + conference.difficulty_levels << create(:difficulty_level) + sign_in organizer + visit admin_conference_difficulty_levels_path( + conference_id: conference.short_title) # Remove difficulty level - click_link 'Remove difficulty_level' - expect(page.all('div.nested-fields').count == 0).to be true - click_button 'Update Conference' - expect(flash).to eq('Difficulty Levels were successfully updated.') - expect(page.all('div.nested-fields').count == 0).to be true + click_link 'Delete' + + # Validations + expect(flash).to eq('Difficulty level successfully deleted.') + within('table#difficulty_levels') do + expect(page.assert_selector('tr', count: 1)).to be true + end end + end describe 'organizer' do diff --git a/spec/features/event_types_spec.rb b/spec/features/event_types_spec.rb index 425aab75..b47cb73e 100644 --- a/spec/features/event_types_spec.rb +++ b/spec/features/event_types_spec.rb @@ -12,45 +12,40 @@ feature EventType do visit admin_conference_event_types_path( conference_id: conference.short_title) - expect(page.all('div.nested-fields').count == 2).to be true + within('table#event_types') do + expect(page.assert_selector('tr', count: 3)).to be true + end + # Add event type - click_link 'Add event_type' - expect(page.all('div.nested-fields').count == 3).to be true + click_link 'Add Event Type' - page. - find('div.nested-fields:nth-of-type(3) div:nth-of-type(1) input'). - set('Example event type') - page. - find('div.nested-fields:nth-of-type(3) div:nth-of-type(2) input'). - set('60') - page. - find('div.nested-fields:nth-of-type(3) div:nth-of-type(3) input'). - set('0') - page. - find('div.nested-fields:nth-of-type(3) div:nth-of-type(4) input'). - set('300') + fill_in 'event_type_title', with: 'Party' + fill_in 'event_type_length', with: '240' + fill_in 'event_type_minimum_abstract_length', with: '0' + fill_in 'event_type_maximum_abstract_length', with: '13042' + page.find('#event_type_color').set('#e4e4e4') - click_button 'Update Conference' + click_button 'Create Event type' # Validations - expect(flash).to eq('Event types were successfully updated.') - expect(find('div.nested-fields:nth-of-type(3) div:nth-of-type(1) input'). - value).to eq('Example event type') - expect(find('div.nested-fields:nth-of-type(3) div:nth-of-type(2) input'). - value).to eq('60') - expect(find('div.nested-fields:nth-of-type(3) div:nth-of-type(3) input'). - value).to eq('0') - expect(find('div.nested-fields:nth-of-type(3) div:nth-of-type(4) input'). - value).to eq('300') + expect(flash).to eq('Event type successfully created.') + within('table#event_types') do + expect(page.has_content?('Party')).to be true + expect(page.has_content?('13042')).to be true + expect(page.has_content?('#e4e4e4')).to be true + expect(page.assert_selector('tr', count: 4)).to be true + end # Remove event type - within('div.nested-fields:nth-of-type(3)') do - click_link 'Remove event_type' + within('tr', text: 'Party') do + click_link 'Delete' + end + expect(flash).to eq('Event type successfully deleted.') + + within('table#event_types') do + expect(page.assert_selector('tr', count: 3)).to be true + expect(page.has_content?('Party')).to be false end - expect(page.all('div.nested-fields').count == 2).to be true - click_button 'Update Conference' - expect(flash).to eq('Event types were successfully updated.') - expect(page.all('div.nested-fields').count == 2).to be true end end diff --git a/spec/features/lodgings_spec.rb b/spec/features/lodgings_spec.rb index 44ec0fad..be6359a8 100644 --- a/spec/features/lodgings_spec.rb +++ b/spec/features/lodgings_spec.rb @@ -38,7 +38,6 @@ feature Lodging do expect(page.has_content?('Example Hotel')).to be true # Add lodging - click_link 'Example Hotel' click_link 'Edit' fill_in 'lodging_name', with: 'New lodging' diff --git a/spec/features/photo_spec.rb b/spec/features/photo_spec.rb deleted file mode 100644 index b803eaeb..00000000 --- a/spec/features/photo_spec.rb +++ /dev/null @@ -1,68 +0,0 @@ -require 'spec_helper' - -feature Photo do - - let!(:conference) { create(:conference) } - let!(:organizer_role) { create(:organizer_role, resource: conference) } - let!(:organizer) { create(:user, email: 'admin@example.com', role_ids: [organizer_role.id]) } - - shared_examples 'add and update photo' do - scenario 'adds a new photo', feature: true, js: true do - expected_count = Photo.count + 1 - - sign_in organizer - - visit new_admin_conference_photo_path(conference.short_title) - - file_path = Rails.root.join('app', 'assets', 'images', 'rails.png') - attach_file('photo_picture', file_path) - fill_in 'photo_description', with: 'Lorem ipsum dolorem...' - - click_button 'Save Photo' - - expect(flash). - to eq('Photo was successfully created.') - expect(Photo.count).to eq(expected_count) - end - - scenario 'updates a photo', feature: true, js: true do - expected_count = Photo.count + 1 - photo = create(:photo, conference_id: conference.id) - sign_in organizer - - visit edit_admin_conference_photo_path(conference.short_title, photo.id) - - file_path = Rails.root.join('app', 'assets', 'images', 'person_large.png') - attach_file('photo_picture', file_path) - fill_in 'photo_description', with: 'Lorem ipsum dolorem...' - - click_button 'Save Photo' - - expect(flash). - to eq('Photo was successfully updated.') - expect(Photo.count).to eq(expected_count) - end - - scenario 'adds a text file', feature: true, js: true do - expected_count = Photo.count - sign_in organizer - - visit new_admin_conference_photo_path(conference.short_title) - - file_path = Rails.root + 'spec/fixtures/test.txt' - attach_file('photo_picture', file_path) - fill_in 'photo_description', with: 'Lorem ipsum dolorem...' - - click_button 'Save Photo' - - expect(flash). - to eq('A error prohibited this Photo from being saved: Picture content type is invalid. Picture is invalid.') - expect(Photo.count).to eq(expected_count) - end - end - - describe 'organizer' do - it_behaves_like 'add and update photo' - end - -end diff --git a/spec/features/proposal_spec.rb b/spec/features/proposal_spec.rb index 0f389650..2ee700b3 100644 --- a/spec/features/proposal_spec.rb +++ b/spec/features/proposal_spec.rb @@ -8,7 +8,7 @@ feature Event do let!(:participant_without_bio) { create(:user, biography: '') } before(:each) do - conference.call_for_papers = create(:call_for_papers) + conference.call_for_paper = create(:call_for_paper) conference.event_types = [create(:event_type)] @options = {} diff --git a/spec/features/rooms_spec.rb b/spec/features/rooms_spec.rb index f725ce5b..96480351 100644 --- a/spec/features/rooms_spec.rb +++ b/spec/features/rooms_spec.rb @@ -14,7 +14,7 @@ feature Room do expect(page.has_no_table?('#rooms')).to be true # Add room - click_link 'New Room' + click_link 'Add Room' fill_in 'room_name', with: 'Auditorium' fill_in 'room_size', with: '100' diff --git a/spec/features/sponsor_spec.rb b/spec/features/sponsor_spec.rb index 79d3fcf0..eca5297a 100644 --- a/spec/features/sponsor_spec.rb +++ b/spec/features/sponsor_spec.rb @@ -15,58 +15,30 @@ feature Sponsor do visit admin_conference_sponsors_path( conference_id: conference.short_title) # Add sponsors - click_link 'Add sponsor' - - expect(page.all('div.nested-fields').count == 1).to be true - - page. - find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) input'). - set('Example sponsor') - - page. - find('div.nested-fields:nth-of-type(1) div:nth-of-type(2) textarea'). - set('Lorem Ipsum') + click_link 'Add Sponsor' + fill_in 'sponsor_name', with: 'SUSE' + fill_in 'sponsor_description', with: 'The original provider of the enterprise Linux distribution' attach_file 'Logo', path + fill_in 'sponsor_website_url', with: 'http://www.suse.com' + select('Platin', from: 'sponsor_sponsorship_level_id') - page. - find('div.nested-fields:nth-of-type(1) div:nth-of-type(4) input'). - set('http://www.example.com') + click_button 'Create Sponsor' - find(:css, "select[id^='conference_sponsors_attributes_']"\ - "[id$='_sponsorship_level_id']"). - find(:option, 'Platin').select_option - - click_button 'Update Conference' - - expect(flash).to eq('Sponsorships were successfully updated.') - - expect(find('div.nested-fields:nth-of-type(1)'\ - ' div:nth-of-type(1) input'). - value).to eq('Example sponsor') - - expect(find('div.nested-fields:nth-of-type(1)'\ - ' div:nth-of-type(2) textarea'). - value).to eq('Lorem Ipsum') - - expect(page).to have_selector("img[src*='rails.png']") - - expect(find('div.nested-fields:nth-of-type(1)'\ - ' div:nth-of-type(4) input'). - value).to eq('http://www.example.com') - - expect(find('div.nested-fields:nth-of-type(1)'\ - ' div:nth-of-type(5) select:nth-of-type(1)').find('option[selected]'). - text).to eq('Platin') + expect(flash).to eq('Sponsor successfully created.') + within('table#sponsors') do + expect(page.has_content?('SUSE')).to be true + expect(page.has_content?('The original provider')).to be true + expect(page.has_content?('http://www.suse.com')).to be true + expect(page.has_content?('Platin')).to be true + expect(page).to have_selector("img[src*='rails.png']") + expect(page.assert_selector('tr', count: 2)).to be true + end # Remove sponsor - click_link 'Remove sponsor' - expect(page.all('div.nested-fields').count == 0).to be true - - find('button', text: 'Update Conference').trigger('click') - - expect(flash).to eq('Sponsorships were successfully updated.') - expect(page.all('div.nested-fields').count == 0).to be true + click_link 'Delete' + expect(flash).to eq('Sponsor successfully deleted.') + expect(page).to_not have_selector('table#sponsors') end end diff --git a/spec/features/tracks_spec.rb b/spec/features/tracks_spec.rb index 3d2949e2..ecaf0789 100644 --- a/spec/features/tracks_spec.rb +++ b/spec/features/tracks_spec.rb @@ -6,47 +6,60 @@ feature Track do let!(:organizer) { create(:user, role_ids: [organizer_role.id]) } shared_examples 'tracks' do - scenario 'adds and updates tracks', feature: true, js: true do + scenario 'adds a track', feature: true, js: true do sign_in organizer - visit admin_conference_tracks_path( - conference_id: conference.short_title) + visit admin_conference_tracks_path(conference_id: conference.short_title) + click_link 'New Track' - # Add track - click_link 'Add track' - expect(page.all('div.nested-fields').count == 1).to be true + fill_in 'track_name', with: 'Distribution' + page.find('#track_color').set('#B94D4D') + fill_in 'track_description', with: 'Events about our Linux distribution' + click_button 'Create Track' - page. - find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) input'). - set('Example track') - page. - find('div.nested-fields:nth-of-type(1) div:nth-of-type(2) input'). - set('#ff0000') - page. - find('div.nested-fields:nth-of-type(1) div:nth-of-type(3) textarea'). - set('Example room description') + expect(flash).to eq('Track successfully created.') + within('table#tracks') do + expect(page.has_content?('Distribution')).to be true + expect(page.has_content?('Events about our Linux')).to be true + expect(page.assert_selector('tr', count: 2)).to be true + end + end - click_button 'Update Conference' + scenario 'deletes a track', feature: true, js: true do + track = create(:track, conference_id: conference.id) + sign_in organizer - # Validations - expect(flash).to eq('Tracks were successfully updated.') - expect( - find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) input'). - value).to eq('Example track') - expect( - find('div.nested-fields:nth-of-type(1) div:nth-of-type(2) input'). - value).to eq('#ff0000') - expect( - find('div.nested-fields:nth-of-type(1) div:nth-of-type(3) textarea'). - value).to eq('Example room description') + visit admin_conference_tracks_path(conference_id: conference.short_title) - # Remove track - click_link 'Remove track' - expect(page.all('div.nested-fields').count == 0).to be true - click_button 'Update Conference' - expect(flash).to eq('Tracks were successfully updated.') - expect(page.all('div.nested-fields').count == 0).to be true + click_link 'Delete' + + expect(flash).to eq('Track successfully deleted.') + 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 + end + end + + scenario 'updates a track', feature: true, js: true do + create(:track, conference_id: conference.id) + sign_in organizer + + visit admin_conference_tracks_path(conference_id: conference.short_title) + click_link 'Edit' + + fill_in 'track_name', with: 'Distribution' + page.find('#track_color').set('#B94D4D') + fill_in 'track_description', with: 'Events about our Linux distribution' + click_button 'Update Track' + + expect(flash).to eq('Track successfully updated.') + within('table#tracks') do + expect(page.has_content?('Distribution')).to be true + expect(page.has_content?('Events about our Linux')).to be true + expect(page.assert_selector('tr', count: 2)).to be true + end end end diff --git a/spec/models/ability_spec.rb b/spec/models/ability_spec.rb index 161ee60e..ceac8876 100644 --- a/spec/models/ability_spec.rb +++ b/spec/models/ability_spec.rb @@ -94,7 +94,7 @@ describe 'User' do let(:user) { create(:user, role_ids: role.id) } let(:event) { create(:event, conference_id: conference1.id) } let(:someevent) { create(:event, conference_id: conference2.id) } - let(:cfp) { create(:call_for_papers, conference: conference1) } + let(:cfp) { create(:call_for_paper, conference: conference1) } it{ should_not be_able_to(:manage, conference1) } it{ should_not be_able_to(:manage, conference2) } diff --git a/spec/models/conference_spec.rb b/spec/models/conference_spec.rb index 6c06ff1a..5bb680ff 100644 --- a/spec/models/conference_spec.rb +++ b/spec/models/conference_spec.rb @@ -48,7 +48,7 @@ describe Conference do subject.start_date = Date.today + 6.weeks subject.end_date = Date.today + 7.weeks subject.save - subject.call_for_papers = create(:call_for_papers, start_date: Date.today - 3.weeks) + subject.call_for_paper = create(:call_for_paper, start_date: Date.today - 3.weeks) create(:event, conference: subject, created_at: Date.today) options = {} @@ -115,7 +115,7 @@ describe Conference do } subject.events_per_week = db_data subject.save - subject.call_for_papers = create(:call_for_papers, start_date: Date.today - 3.weeks) + subject.call_for_paper = create(:call_for_paper, start_date: Date.today - 3.weeks) create(:event, conference: subject, created_at: Date.today) unconfirmed = create(:event, conference: subject) @@ -186,7 +186,7 @@ describe Conference do subject.events_per_week = db_data subject.save - subject.call_for_papers = create(:call_for_papers, start_date: Date.today - 2.weeks) + subject.call_for_paper = create(:call_for_paper, start_date: Date.today - 2.weeks) create(:event, conference: subject, created_at: Date.today - 2.weeks) @@ -203,7 +203,7 @@ describe Conference do subject.start_date = Date.today + 6.weeks subject.end_date = Date.today + 7.weeks subject.save - subject.call_for_papers = create(:call_for_papers, start_date: Date.today) + subject.call_for_paper = create(:call_for_paper, start_date: Date.today) create(:event, conference: subject) result = { @@ -220,7 +220,7 @@ describe Conference do subject.start_date = Date.today + 6.weeks subject.end_date = Date.today + 7.weeks subject.save - subject.call_for_papers = create(:call_for_papers, start_date: Date.today - 3.weeks) + subject.call_for_paper = create(:call_for_paper, start_date: Date.today - 3.weeks) create(:event, conference: subject, created_at: Date.today) unconfirmed = create(:event, conference: subject) @@ -258,7 +258,7 @@ describe Conference do subject.events_per_week = db_data subject.save - subject.call_for_papers = create(:call_for_papers, start_date: Date.today - 3.weeks) + subject.call_for_paper = create(:call_for_paper, start_date: Date.today - 3.weeks) create(:event, conference: subject, created_at: Date.today - 3.weeks) @@ -964,7 +964,7 @@ describe Conference do end it 'calculates correct for new conference' do - subject.call_for_papers = nil + subject.call_for_paper = nil subject.venue = nil subject.rooms = [] subject.tracks = [] @@ -979,7 +979,7 @@ describe Conference do subject.registration_period = create(:registration_period, start_date: Date.today, end_date: Date.today + 14) - subject.call_for_papers = nil + subject.call_for_paper = nil subject.venue = nil subject.rooms = [] subject.tracks = [] @@ -997,7 +997,7 @@ describe Conference do subject.registration_period = create(:registration_period, start_date: Date.today, end_date: Date.today + 14) - subject.call_for_papers = create(:call_for_papers) + subject.call_for_paper = create(:call_for_paper) subject.venue = nil subject.rooms = [] subject.tracks = [] @@ -1016,7 +1016,7 @@ describe Conference do subject.registration_period = create(:registration_period, start_date: Date.today, end_date: Date.today + 14) - subject.call_for_papers = create(:call_for_papers) + subject.call_for_paper = create(:call_for_paper) subject.venue = create(:venue) subject.rooms = [] subject.tracks = [] @@ -1037,7 +1037,7 @@ describe Conference do subject.registration_period = create(:registration_period, start_date: Date.today, end_date: Date.today + 14) - subject.call_for_papers = create(:call_for_papers) + subject.call_for_paper = create(:call_for_paper) subject.venue = create(:venue) subject.tracks = [] subject.event_types = [] @@ -1059,7 +1059,7 @@ describe Conference do subject.registration_period = create(:registration_period, start_date: Date.today, end_date: Date.today + 14) - subject.call_for_papers = create(:call_for_papers) + subject.call_for_paper = create(:call_for_paper) subject.venue = create(:venue) subject.event_types = [] subject.difficulty_levels = [] @@ -1083,7 +1083,7 @@ describe Conference do subject.registration_period = create(:registration_period, start_date: Date.today, end_date: Date.today + 14) - subject.call_for_papers = create(:call_for_papers) + subject.call_for_paper = create(:call_for_paper) subject.venue = create(:venue) subject.difficulty_levels = [] subject.splashpage = create(:splashpage, public: false) @@ -1108,7 +1108,7 @@ describe Conference do start_date: Date.today, end_date: Date.today + 14) subject.venue = create(:venue) - subject.call_for_papers = create(:call_for_papers) + subject.call_for_paper = create(:call_for_paper) subject.venue = create(:venue) subject.splashpage = create(:splashpage, public: true) @@ -1150,34 +1150,34 @@ describe Conference do describe '#cfp_weeks' do it 'calculates new year' do - cfp = create(:call_for_papers) + cfp = create(:call_for_paper) cfp.start_date = Date.new(2013, 12, 30) cfp.end_date = Date.new(2013, 12, 30) + 6 - subject.call_for_papers = cfp + subject.call_for_paper = cfp expect(subject.cfp_weeks).to eq(1) end it 'is one if start and end are 6 days apart' do - cfp = create(:call_for_papers) + cfp = create(:call_for_paper) cfp.start_date = Date.new(2014, 05, 26) cfp.end_date = Date.new(2014, 05, 26) + 6 - subject.call_for_papers = cfp + subject.call_for_paper = cfp expect(subject.cfp_weeks).to eq(1) end it 'is one if start and end are the same date' do - cfp = create(:call_for_papers) + cfp = create(:call_for_paper) cfp.start_date = Date.new(2014, 05, 26) cfp.end_date = Date.new(2014, 05, 26) - subject.call_for_papers = cfp + subject.call_for_paper = cfp expect(subject.cfp_weeks).to eq(1) end it 'is two if start and end are 10 days apart' do - cfp = create(:call_for_papers) + cfp = create(:call_for_paper) cfp.start_date = Date.new(2014, 05, 26) cfp.end_date = Date.new(2014, 05, 26) + 10 - subject.call_for_papers = cfp + subject.call_for_paper = cfp expect(subject.cfp_weeks).to eq(2) end end @@ -1185,36 +1185,36 @@ describe Conference do describe '#get_submissions_per_week' do it 'does calculate correct if cfp start date is altered' do - cfp = create(:call_for_papers) + cfp = create(:call_for_paper) cfp.start_date = Date.new(2014, 05, 26) cfp.end_date = Date.new(2014, 05, 26) + 21 - subject.call_for_papers = cfp + subject.call_for_paper = cfp subject.events += [create(:event, created_at: Date.new(2014, 05, 26) - 7)] expect(subject.get_submissions_per_week).to eq([1, 1, 1, 1, 1]) end it 'does calculate correct if cfp end date is altered' do - cfp = create(:call_for_papers) + cfp = create(:call_for_paper) cfp.start_date = Date.new(2014, 05, 26) cfp.end_date = Date.new(2014, 05, 26) + 21 - subject.call_for_papers = cfp + subject.call_for_paper = cfp subject.events += [create(:event, created_at: Date.new(2014, 05, 26) + 28)] expect(subject.get_submissions_per_week).to eq([0, 0, 0, 0, 1]) end it 'pads with zeros if there are no submissions' do - cfp = create(:call_for_papers) + cfp = create(:call_for_paper) cfp.start_date = Date.new(2014, 05, 26) cfp.end_date = Date.new(2014, 05, 26) + 21 - subject.call_for_papers = cfp + subject.call_for_paper = cfp expect(subject.get_submissions_per_week).to eq([0, 0, 0, 0]) end it 'summarized correct if there are no submissions in one week' do - cfp = create(:call_for_papers) + cfp = create(:call_for_paper) cfp.start_date = Date.new(2014, 05, 26) cfp.end_date = Date.new(2014, 05, 26) + 28 - subject.call_for_papers = cfp + subject.call_for_paper = cfp subject.events += [create(:event, created_at: Date.new(2014, 05, 26) + 7)] subject.events += [create(:event, created_at: Date.new(2014, 05, 26) + 14)] subject.events += [create(:event, created_at: Date.new(2014, 05, 26) + 28)] @@ -1222,20 +1222,20 @@ describe Conference do end it 'summarized correct if there are submissions every week except the first' do - cfp = create(:call_for_papers) + cfp = create(:call_for_paper) cfp.start_date = Date.new(2014, 05, 26) cfp.end_date = Date.new(2014, 05, 26) + 21 - subject.call_for_papers = cfp + subject.call_for_paper = cfp subject.events += [create(:event, created_at: Date.new(2014, 05, 26) + 7)] subject.events += [create(:event, created_at: Date.new(2014, 05, 26) + 14)] expect(subject.get_submissions_per_week).to eq([0, 1, 2, 2]) end it 'summarized correct if there are submissions every week' do - cfp = create(:call_for_papers) + cfp = create(:call_for_paper) cfp.start_date = Date.new(2014, 05, 26) cfp.end_date = Date.new(2014, 05, 26) + 21 - subject.call_for_papers = cfp + subject.call_for_paper = cfp subject.events += [create(:event, created_at: Date.new(2014, 05, 26))] subject.events += [create(:event, created_at: Date.new(2014, 05, 26) + 7)] subject.events += [create(:event, created_at: Date.new(2014, 05, 26) + 14)] @@ -1243,29 +1243,29 @@ describe Conference do end it 'pads left' do - cfp = create(:call_for_papers) + cfp = create(:call_for_paper) cfp.start_date = Date.new(2014, 05, 26) cfp.end_date = Date.new(2014, 05, 26) + 21 - subject.call_for_papers = cfp + subject.call_for_paper = cfp subject.events += [create(:event, created_at: Date.new(2014, 05, 26) + 21)] expect(subject.get_submissions_per_week).to eq([0, 0, 0, 1]) end it 'pads middle' do - cfp = create(:call_for_papers) + cfp = create(:call_for_paper) cfp.start_date = Date.new(2014, 05, 26) cfp.end_date = Date.new(2014, 05, 26) + 21 - subject.call_for_papers = cfp + subject.call_for_paper = cfp subject.events += [create(:event, created_at: Date.new(2014, 05, 26))] subject.events += [create(:event, created_at: Date.new(2014, 05, 26) + 21)] expect(subject.get_submissions_per_week).to eq([1, 1, 1, 2]) end it 'pads right' do - cfp = create(:call_for_papers) + cfp = create(:call_for_paper) cfp.start_date = Date.new(2014, 05, 26) cfp.end_date = Date.new(2014, 05, 26) + 21 - subject.call_for_papers = cfp + subject.call_for_paper = cfp subject.events += [create(:event, created_at: Date.new(2014, 05, 26))] expect(subject.get_submissions_per_week).to eq([1, 1, 1, 1]) end @@ -1433,7 +1433,7 @@ describe Conference do context 'open cfp' do before do - subject.call_for_papers = create(:call_for_papers) + subject.call_for_paper = create(:call_for_paper) end it '#registration_open? is true' do diff --git a/spec/models/photo_spec.rb b/spec/models/photo_spec.rb deleted file mode 100644 index cf70fc7c..00000000 --- a/spec/models/photo_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'spec_helper' - -describe Photo do - describe 'validations' do - - it 'has a valid factory' do - expect(build(:photo)).to be_valid - end - - it 'is not valid without a picture' do - should validate_presence_of(:picture) - end - end -end diff --git a/spec/views/admin/call_for_papers/show.html.haml_spec.rb b/spec/views/admin/call_for_papers/show.html.haml_spec.rb new file mode 100644 index 00000000..48b45bd8 --- /dev/null +++ b/spec/views/admin/call_for_papers/show.html.haml_spec.rb @@ -0,0 +1,13 @@ +require 'spec_helper' + +describe 'admin/call_for_papers/show' do + + it 'renders call for papers details' do + assign :conference, create(:conference) + assign :call_for_paper, create(:call_for_paper) + render + expect(rendered).to include(1.day.ago.strftime('%A, %B %-d. %Y')) + expect(rendered).to include(7.days.from_now.strftime('%A, %B %-d. %Y')) + end + +end diff --git a/spec/views/admin/callforpapers/show.html.haml_spec.rb b/spec/views/admin/callforpapers/show.html.haml_spec.rb deleted file mode 100644 index 8d747e36..00000000 --- a/spec/views/admin/callforpapers/show.html.haml_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'spec_helper' - -describe 'admin/callforpapers/show' do - - it 'renders callforpapers details' do - assign :conference, create(:conference) - assign :cfp, create(:call_for_papers) - render - expect(rendered).to include(1.day.ago.strftime('%Y-%m-%d')) - expect(rendered).to include(7.days.from_now.strftime('%Y-%m-%d')) - expect(rendered).to include('We call for papers') - end - -end diff --git a/spec/views/admin/social_events/index.html.haml_spec.rb b/spec/views/admin/social_events/index.html.haml_spec.rb deleted file mode 100644 index a95ec30e..00000000 --- a/spec/views/admin/social_events/index.html.haml_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -describe 'admin/social_events/index' do - - it 'renders social events' do - @social_event = create(:social_event) - assign :conference, @social_event.conference - render - expect(rendered).to include('Example Social Event') - expect(rendered).to include('Lorem Ipsum Dolsum') - expect(rendered).to include("#{Date.today.strftime('%Y')}") - expect(rendered).to include("#{Date.today.strftime('%B')}") - expect(rendered).to include("#{Date.today.strftime('%-d')}") - end -end diff --git a/spec/views/conference/show.html.haml_spec.rb b/spec/views/conference/show.html.haml_spec.rb index 0b705fd3..39003be6 100644 --- a/spec/views/conference/show.html.haml_spec.rb +++ b/spec/views/conference/show.html.haml_spec.rb @@ -24,8 +24,8 @@ describe 'conference/show.html.haml' do start_date: Date.yesterday, end_date: Date.tomorrow) - @conference.call_for_papers = create(:call_for_papers, conference: @conference, - include_cfp_in_splash: true) + @conference.call_for_paper = create(:call_for_paper, conference: @conference, + include_cfp_in_splash: true) @conference.sponsorship_levels << create(:sponsorship_level, conference: @conference) @sponsorship_level = @conference.sponsorship_levels.first @@ -50,7 +50,7 @@ describe 'conference/show.html.haml' do expect(view).to render_template(partial: 'conference/_registration') end - it 'renders call_for_papers partial' do + it 'renders call_for_paper partial' do expect(rendered).to match(/We are ready to accept your proposals for sessions!/) end