Implement Event Ratings
This commit is contained in:
parent
5be1ad52ee
commit
20f4853487
67 changed files with 1298 additions and 378 deletions
|
|
@ -168,8 +168,8 @@
|
|||
%b Description
|
||||
%td= simple_format(@event.description)
|
||||
|
||||
- if @conference.program && @conference.program.rating && @conference.program.rating > 0
|
||||
= render partial: 'voting'
|
||||
- if @votable_fields.present?
|
||||
= render partial: 'voting'
|
||||
|
||||
.row
|
||||
= link_to "Comments (#{@comment_count})", '#', id: 'event-comment-link'
|
||||
|
|
|
|||
|
|
@ -1,80 +1,32 @@
|
|||
%table.table#myrating
|
||||
- if @program.show_voting?
|
||||
%tr
|
||||
%td.col-md-2
|
||||
%b Rating
|
||||
%td
|
||||
- if @event.average_rating.to_f > 0
|
||||
#{@event.average_rating}/#{@program.rating}
|
||||
- else
|
||||
Rating: 0/#{@program.rating}
|
||||
|
||||
- @program.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'
|
||||
%tr
|
||||
%td
|
||||
%b Voters
|
||||
%td
|
||||
= @event.voters.length
|
||||
- if @event.voters.length > 0
|
||||
(
|
||||
= @ratings.map {|x| "#{x.name}"}.join ', '
|
||||
)
|
||||
%tr
|
||||
%td.col-md-2
|
||||
%b Your vote
|
||||
%td
|
||||
- if @program.voting_period?
|
||||
- @program.rating.times do |counter|
|
||||
- if @event.voted?(current_user) && @event.user_rating(current_user) == counter + 1
|
||||
= link_to '', vote_admin_conference_program_event_path(@conference.short_title, @event, rating: counter + 1), remote: true, id: "label#{counter + 1}", class: 'myrating', voted: true
|
||||
- else
|
||||
= link_to '', vote_admin_conference_program_event_path(@conference.short_title, @event, rating: counter + 1), remote: true, id: "label#{counter + 1}", class: 'myrating'
|
||||
%br
|
||||
- else
|
||||
- @conference.program.rating.times do |counter|
|
||||
- if @event.voted?(current_user) && @event.user_rating(current_user) == counter + 1
|
||||
= label_tag "label#{counter + 1}", '', class: 'othersrating', voted: true
|
||||
= javascript_tag "$('label[voted=true]').prevAll().andSelf().addClass('bright');"
|
||||
- else
|
||||
= label_tag "label#{counter + 1}", '', class: 'othersrating'
|
||||
(#{voting_open_or_close(@program)})
|
||||
|
||||
- if @program.show_voting?
|
||||
- if @ratings.length > 0
|
||||
- @ratings.each do |rate|
|
||||
- unless rate.user_id == current_user.id
|
||||
%hr
|
||||
- if @program.rating_enabled
|
||||
- if @program.voting_period?
|
||||
- if @program.show_voting?
|
||||
%table.table
|
||||
%thead
|
||||
%td.col-md-2
|
||||
%b Overall Votes
|
||||
- @votable_fields.each do |field|
|
||||
%tr
|
||||
%td.col-md-2
|
||||
= field.title
|
||||
%td
|
||||
= rating_for @event, field.title, disable: true, star: field.stars
|
||||
%tr
|
||||
%td
|
||||
= rate.name
|
||||
Voters
|
||||
%td
|
||||
- @conference.program.rating.times do |counter|
|
||||
|
||||
- if @event.voted?(rate.user) && @event.user_rating(rate.user) == counter + 1
|
||||
= label_tag "label#{counter + 1}", "", class: 'othersrating', voted: true
|
||||
= javascript_tag "$('label[voted=true]').prevAll().andSelf().addClass('bright');"
|
||||
- else
|
||||
= label_tag "label#{counter + 1}", "", class: 'othersrating'
|
||||
:javascript
|
||||
$(function () {
|
||||
var checkedId = $("a[voted='true']").attr('id');
|
||||
$('a[id=' + checkedId + ']').prevAll().andSelf().addClass('bright');
|
||||
});
|
||||
|
||||
$(".myrating").hover(
|
||||
function() { // mouseover
|
||||
$(this).prevAll().andSelf().addClass('glow');
|
||||
},
|
||||
function() { // mouseout
|
||||
$(this).siblings().andSelf().removeClass('glow');
|
||||
}
|
||||
);
|
||||
|
||||
$(".myrating").click(function() {
|
||||
$(this).siblings().removeClass("bright");
|
||||
$(this).prevAll().andSelf().addClass("bright");
|
||||
});
|
||||
= raters(@votable_fields)
|
||||
%table.table
|
||||
%thead
|
||||
%td.col-md-2
|
||||
%b Your Votes
|
||||
- @votable_fields.each do |field|
|
||||
%tr
|
||||
%td.col-md-2
|
||||
= field.title
|
||||
%td
|
||||
= rating_for_user @event, current_user, field.title, star: field.stars
|
||||
- else
|
||||
%b
|
||||
= voting_open_or_close(@program)
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
- if @program.show_voting?
|
||||
#{event.average_rating}/#{@program.rating}
|
||||
%br
|
||||
#{pluralize(event.voters.length, 'voter')}
|
||||
%br
|
||||
- @program.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'
|
||||
%br
|
||||
|
||||
- if event.voted?(current_user)
|
||||
%span.label.label-success
|
||||
Your rating: #{ event.user_rating(current_user) }
|
||||
- else
|
||||
%span.label.label-danger
|
||||
Not rated
|
||||
|
|
@ -50,9 +50,6 @@
|
|||
%b ID
|
||||
%th
|
||||
%b Title
|
||||
- if @program.rating_enabled?
|
||||
%th
|
||||
%b Rating
|
||||
%th
|
||||
%b Submitter
|
||||
%th
|
||||
|
|
@ -80,11 +77,6 @@
|
|||
= event.id
|
||||
%td
|
||||
= link_to event.title, admin_conference_program_event_path(@conference.short_title, event)
|
||||
|
||||
- if @program.rating_enabled?
|
||||
%td.col-md-1{ 'data-order' => "#{event.average_rating}" }
|
||||
= render partial: 'voting_index', locals: { event: event }
|
||||
|
||||
- if event.submitter && event.submitter.registrations && event.submitter.registrations.count < 1
|
||||
- bgcolor = '#F7819F'
|
||||
- else
|
||||
|
|
|
|||
|
|
@ -36,10 +36,6 @@
|
|||
= event_change_description(version)
|
||||
= "event #{@event.title}"
|
||||
|
||||
- elsif version.item_type == 'Vote'
|
||||
= vote_change_description(version)
|
||||
= "event #{@event.title}"
|
||||
|
||||
- else
|
||||
= general_change_description(version)
|
||||
= link_to 'commercial',
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
$('table#myrating').replaceWith("<%= escape_javascript(render :partial => 'voting') %>");
|
||||
Loading…
Add table
Add a link
Reference in a new issue