osem-fcy/app/views/admin/events/_voting.html.haml
Henne Vogelsang 28063129c7 Implement consistent admin interface
* Consistent route/model/controller/view layout
* Get rid of unused photos, speakers, dietchoices, social_events controllers
* Drop unused :public from Rooms and :description from CallForPapers
2014-11-25 10:47:18 +01:00

70 lines
2.5 KiB
Text

%table.table#myrating
%tr
%td{:style => "width:15%"}
%b Rating
%td
- if @event.average_rating.to_f > 0
#{@event.average_rating}/#{@conference.call_for_paper.rating}
- else
Rating: 0/#{@conference.call_for_paper.rating}
- @conference.call_for_paper.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
%b Your vote
%td
- @conference.call_for_paper.rating.times do |counter|
- voted = @event.voted?(@event, current_user)
- 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.user_id == current_user.id
%tr
%td
= rate.name
%td
- @conference.call_for_paper.rating.times do |counter|
- voted = @event.voted?(@event, rate.user)
- 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");
});