osem-fcy/app/views/admin/events/_voting.html.haml

71 lines
2.5 KiB
Text
Raw Normal View History

2014-02-23 14:56:09 +02:00
%table.table#myrating
2013-08-16 12:46:49 +03:00
%tr
%td{:style => "width:15%"}
2014-02-23 14:56:09 +02:00
%b Rating
2013-08-16 12:46:49 +03:00
%td
2014-06-23 19:07:50 +03:00
- if @event.average_rating.to_f > 0
2014-02-23 14:56:09 +02:00
#{@event.average_rating}/#{@conference.call_for_papers.rating}
- else
Rating: 0/#{@conference.call_for_papers.rating}
2014-02-23 14:56:09 +02:00
- @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
2014-06-23 19:07:50 +03:00
%td
2014-02-23 14:56:09 +02:00
%b Voters
%td
= @event.voters.length
- if @event.voters.length > 0
(
2014-06-23 19:07:50 +03:00
= @ratings.map {|x| "#{x.name}"}.join ', '
)
2014-02-23 14:56:09 +02:00
%tr
2014-06-23 19:07:50 +03:00
%td
%b Your vote
2013-08-16 12:46:49 +03:00
%td
- @conference.call_for_papers.rating.times do |counter|
2014-06-23 19:07:50 +03:00
- voted = @event.voted?(@event, current_user)
2013-08-16 12:46:49 +03:00
- 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|
2014-06-23 19:07:50 +03:00
- unless rate.user_id == current_user.id
2013-08-16 12:46:49 +03:00
%tr
%td
= rate.name
2013-08-16 12:46:49 +03:00
%td
- @conference.call_for_papers.rating.times do |counter|
2014-06-23 19:07:50 +03:00
- voted = @event.voted?(@event, rate.user)
2013-08-16 12:46:49 +03:00
- 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"
2014-06-23 19:07:50 +03:00
:javascript
2013-08-16 12:46:49 +03:00
$(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");
2014-06-23 19:07:50 +03:00
});