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

67 lines
1.8 KiB
Text
Raw Normal View History

2014-02-23 14:56:09 +02:00
%table.table#myrating
2018-02-09 17:19:33 -08:00
- if show_votes
2016-07-05 16:44:53 +03:00
%tr
%td.col-md-2
%b Rating
%td
2018-02-09 17:19:33 -08:00
#{event.average_rating}/#{max_rating}
= rating_stars(event.average_rating, max_rating, avgrate: true )
2016-07-05 16:44:53 +03:00
%tr
%td
%b Voters
%td
2018-02-09 17:19:33 -08:00
= votes.length
- unless votes.blank?
2016-07-05 16:44:53 +03:00
(
2018-02-09 17:19:33 -08:00
= votes.collect(&:name).to_sentence
2016-07-05 16:44:53 +03:00
)
2013-08-16 12:46:49 +03:00
%tr
2015-03-01 17:15:57 +02:00
%td.col-md-2
2016-07-05 16:44:53 +03:00
%b Your vote
2013-08-16 12:46:49 +03:00
%td
2018-02-09 17:19:33 -08:00
- if voting_period
- max_rating.times do |counter|
- if event.user_rating(current_user) > counter
= link_to '',
vote_admin_conference_program_event_path(conference_id,
event, rating: counter + 1),
remote: true,
id: "label#{counter + 1}",
class: 'rating myrating bright',
voted: true
2016-07-05 16:44:53 +03:00
- else
2018-02-09 17:19:33 -08:00
= link_to '',
vote_admin_conference_program_event_path(conference_id,
event, rating: counter + 1),
remote: true,
id: "label#{counter + 1}",
class: 'rating myrating'
2014-02-23 14:56:09 +02:00
- else
2018-02-09 17:19:33 -08:00
= rating_stars(event.user_rating(current_user), max_rating, voted: true)
2018-02-23 11:52:27 +02:00
(Voting period is closed)
2014-02-23 14:56:09 +02:00
2018-02-09 17:19:33 -08:00
- if show_votes
- unless votes.blank?
- votes.each do |vote|
- unless vote.user_id == current_user.id
2016-07-05 16:44:53 +03:00
%tr
%td
2018-02-09 17:19:33 -08:00
= vote.name
2016-07-05 16:44:53 +03:00
%td
= rating_stars(vote.rating, max_rating )
2013-08-16 12:46:49 +03:00
2014-06-23 19:07:50 +03:00
:javascript
2013-08-16 12:46:49 +03:00
$(".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
});