From 1a068d2d2427c893f56c389c15c23b3c6027fda7 Mon Sep 17 00:00:00 2001 From: William Hale Date: Thu, 6 Aug 2015 23:19:09 -0700 Subject: [PATCH 1/5] added Voted? column to admin/events view --- app/views/admin/events/index.html.haml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/views/admin/events/index.html.haml b/app/views/admin/events/index.html.haml index b796da61..0d1d7cf1 100644 --- a/app/views/admin/events/index.html.haml +++ b/app/views/admin/events/index.html.haml @@ -34,6 +34,8 @@ %b Difficulty %th %b State + %th + %b Voted? - @events.each do |event| %tr %td @@ -147,3 +149,14 @@ %span.caret %ul.dropdown-menu{:role=>"menu"} = render 'change_state_dropdown', event: event + + - if event.voted?(event, current_user) + - bgcolor = "" + - else + - bgcolor = "#F7819F" + %td{:style=>"background-color: #{bgcolor}"} + - if event.voted?(event, current_user) + Yes + - else + Not yet + From 49b38da18804e1072a417acbc5cd5770aa065afb Mon Sep 17 00:00:00 2001 From: Stella Rouzi Date: Thu, 6 Aug 2015 07:41:20 +0300 Subject: [PATCH 2/5] Fix ordering for event.average_voting in events#index --- app/models/event.rb | 2 +- app/views/admin/events/index.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/event.rb b/app/models/event.rb index 7f5d9aa8..7cd75a89 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -77,7 +77,7 @@ class Event < ActiveRecord::Base @total_rating = @total_rating + vote.rating end @total = votes.size - number_with_precision(@total_rating / @total.to_f, precision: 2, strip_insignificant_zeros: true) + @total_rating > 0 ? number_with_precision(@total_rating / @total.to_f, precision: 2, strip_insignificant_zeros: true) : 0 end def submitter diff --git a/app/views/admin/events/index.html.haml b/app/views/admin/events/index.html.haml index 0d1d7cf1..76604e95 100644 --- a/app/views/admin/events/index.html.haml +++ b/app/views/admin/events/index.html.haml @@ -44,7 +44,7 @@ =link_to event.title, admin_conference_event_path(@conference.short_title, event) - if @conference.call_for_paper && @conference.call_for_paper.rating && @conference.call_for_paper.rating > 0 - %td.col-md-1 + %td.col-md-1{'data-order' => "#{event.average_rating}"} - if event.average_rating.to_f > 0 #{event.average_rating}/#{@conference.call_for_paper.rating} %br From 1b8ec36bc1146d43c00f7aaa03202c7784ac19f5 Mon Sep 17 00:00:00 2001 From: William Hale Date: Tue, 11 Aug 2015 00:34:22 -0700 Subject: [PATCH 3/5] Removed Voted? column and added information to Rating column. --- app/views/admin/events/index.html.haml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/app/views/admin/events/index.html.haml b/app/views/admin/events/index.html.haml index 76604e95..b6a80ec7 100644 --- a/app/views/admin/events/index.html.haml +++ b/app/views/admin/events/index.html.haml @@ -56,6 +56,12 @@ = javascript_tag "$('label[avgrate=true]').prevAll().andSelf().addClass('bright');" - else = label_tag "label_rating", "", :class => "avgrating" + %br + - voted = event.voted?(event, current_user) + - if voted + Your rating: #{voted.rating} + - else + Not rated - else 0/#{@conference.call_for_paper.rating} %br @@ -149,14 +155,3 @@ %span.caret %ul.dropdown-menu{:role=>"menu"} = render 'change_state_dropdown', event: event - - - if event.voted?(event, current_user) - - bgcolor = "" - - else - - bgcolor = "#F7819F" - %td{:style=>"background-color: #{bgcolor}"} - - if event.voted?(event, current_user) - Yes - - else - Not yet - From 4af7eef954148a2375d91fa2aa86c8f856a486f4 Mon Sep 17 00:00:00 2001 From: William Hale Date: Tue, 11 Aug 2015 00:34:22 -0700 Subject: [PATCH 4/5] Removed Voted? column and added information to Rating column. --- app/views/admin/events/index.html.haml | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/app/views/admin/events/index.html.haml b/app/views/admin/events/index.html.haml index 76604e95..5edf4d81 100644 --- a/app/views/admin/events/index.html.haml +++ b/app/views/admin/events/index.html.haml @@ -34,8 +34,6 @@ %b Difficulty %th %b State - %th - %b Voted? - @events.each do |event| %tr %td @@ -56,6 +54,12 @@ = javascript_tag "$('label[avgrate=true]').prevAll().andSelf().addClass('bright');" - else = label_tag "label_rating", "", :class => "avgrating" + %br + - voted = event.voted?(event, current_user) + - if voted + Your rating: #{voted.rating} + - else + Not rated - else 0/#{@conference.call_for_paper.rating} %br @@ -149,14 +153,3 @@ %span.caret %ul.dropdown-menu{:role=>"menu"} = render 'change_state_dropdown', event: event - - - if event.voted?(event, current_user) - - bgcolor = "" - - else - - bgcolor = "#F7819F" - %td{:style=>"background-color: #{bgcolor}"} - - if event.voted?(event, current_user) - Yes - - else - Not yet - From a0ffab098beddde336bf05875573462469bb268f Mon Sep 17 00:00:00 2001 From: William Hale Date: Tue, 11 Aug 2015 06:23:41 -0700 Subject: [PATCH 5/5] Wrapped voted? notification in label to promote visibility. --- app/views/admin/events/index.html.haml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/admin/events/index.html.haml b/app/views/admin/events/index.html.haml index 5edf4d81..10a99f6d 100644 --- a/app/views/admin/events/index.html.haml +++ b/app/views/admin/events/index.html.haml @@ -57,9 +57,11 @@ %br - voted = event.voted?(event, current_user) - if voted - Your rating: #{voted.rating} + %span.label.label-success + Your rating: #{voted.rating} - else - Not rated + %span.label.label-danger + Not rated - else 0/#{@conference.call_for_paper.rating} %br