From ee27a080ad7e7fa17cb7f26ed688195ff1e64ce6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Sede=C3=B1o?= Date: Thu, 14 Apr 2016 22:41:13 +0200 Subject: [PATCH] Show how many people has registered to events in the list and view event in admin page. fix #958 --- app/views/admin/events/_proposal.html.haml | 12 +++++++++++- app/views/admin/events/index.html.haml | 6 +++++- spec/views/admin/events/index.html.haml_spec.rb | 11 ++++++----- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/app/views/admin/events/_proposal.html.haml b/app/views/admin/events/_proposal.html.haml index 5c66f543..a83b6c95 100644 --- a/app/views/admin/events/_proposal.html.haml +++ b/app/views/admin/events/_proposal.html.haml @@ -94,13 +94,23 @@ off_color: 'warning', on_text: 'Yes', off_text: 'No' } - + - if @event.require_registration + %tr + %td + %b Registrations + %td + = @event.registrations.size - if !@event.room.nil? %tr %td %b Room %td = @event.room.name + %tr + %td + %b Room size + %td + = @event.room.size - if !@event.start_time.nil? %tr %td diff --git a/app/views/admin/events/index.html.haml b/app/views/admin/events/index.html.haml index 6eea977f..d0684827 100644 --- a/app/views/admin/events/index.html.haml +++ b/app/views/admin/events/index.html.haml @@ -24,6 +24,8 @@ %b Speaker %th %b Pre-registration + %th + %b Registrations %th %b Highlight %th @@ -90,7 +92,9 @@ off_color: 'warning', on_text: 'Yes', off_text: 'No' } - + %td + - if event.require_registration + = event.registrations.size %td{'data-order' => "#{event.is_highlight}"} = check_box_tag @conference.short_title, event.id, event.is_highlight, method: :patch, url: "/admin/conference/#{@conference.short_title}/program/events/#{event.id}?event[is_highlight]=", diff --git a/spec/views/admin/events/index.html.haml_spec.rb b/spec/views/admin/events/index.html.haml_spec.rb index 07b9fd11..c715622e 100644 --- a/spec/views/admin/events/index.html.haml_spec.rb +++ b/spec/views/admin/events/index.html.haml_spec.rb @@ -21,11 +21,12 @@ describe 'admin/events/index' do expect(rendered).to have_selector('table thead th:nth-of-type(3)', text: 'Submitter') expect(rendered).to have_selector('table thead th:nth-of-type(4)', text: 'Speaker') expect(rendered).to have_selector('table thead th:nth-of-type(5)', text: 'Pre-registration') - expect(rendered).to have_selector('table thead th:nth-of-type(6)', text: 'Highlight') - expect(rendered).to have_selector('table thead th:nth-of-type(7)', text: 'Type') - expect(rendered).to have_selector('table thead th:nth-of-type(8)', text: 'Track') - expect(rendered).to have_selector('table thead th:nth-of-type(9)', text: 'Difficulty') - expect(rendered).to have_selector('table thead th:nth-of-type(10)', text: 'State') + expect(rendered).to have_selector('table thead th:nth-of-type(6)', text: 'Registrations') + expect(rendered).to have_selector('table thead th:nth-of-type(7)', text: 'Highlight') + expect(rendered).to have_selector('table thead th:nth-of-type(8)', text: 'Type') + expect(rendered).to have_selector('table thead th:nth-of-type(9)', text: 'Track') + expect(rendered).to have_selector('table thead th:nth-of-type(10)', text: 'Difficulty') + expect(rendered).to have_selector('table thead th:nth-of-type(11)', text: 'State') expect(conference.program.events.count).to eq 2 expect(rendered).to have_selector('table tr:nth-of-type(1) td:nth-of-type(1)', text: event1.id)