osem-fcy/app/views/admin/events/_voting.html.haml
2014-02-23 14:56:09 +02:00

69 lines
No EOL
2.5 KiB
Text

%table.table#myrating
%tr
%td{:style => "width:20%"}
%b Rating
%td
- if @event.average_rating.to_f > 0
#{@event.average_rating}/#{@conference.call_for_papers.rating}
- else
Rating: (0/#{@conference.call_for_papers.rating})
- @conference.call_for_papers.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
(
= @ratings.map {|x| "#{x.first_name} #{x.last_name}"}.join ', '
)
%tr
%td Your vote
%td
- @conference.call_for_papers.rating.times do |counter|
- voted = @event.voted?(@event, current_user.person)
- 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
- else
= link_to "", vote_admin_conference_event_path(@conference.short_title, @event, :rating => counter+1), :remote => true, :id =>"label#{counter+1}", :class => "myrating"
%br
- if @ratings.length > 0
- @ratings.each do |rate|
- unless rate.person_id == current_user.person.id
%tr
%td
= rate.first_name
= rate.last_name
%td
- @conference.call_for_papers.rating.times do |counter|
- voted = @event.voted?(@event, rate.person)
- if voted && voted.rating == 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");
});