Clean up rating partials
This commit is contained in:
parent
73c5c3c97a
commit
9e10678542
10 changed files with 131 additions and 92 deletions
|
|
@ -1,70 +1,56 @@
|
|||
%table.table#myrating
|
||||
- if @program.show_voting?
|
||||
- if show_votes
|
||||
%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'
|
||||
#{event.average_rating}/#{max_rating}
|
||||
= rating_stars(event.average_rating, max_rating, avgrate: true )
|
||||
%tr
|
||||
%td
|
||||
%b Voters
|
||||
%td
|
||||
= @event.voters.length
|
||||
- if @event.voters.length > 0
|
||||
= votes.length
|
||||
- unless votes.blank?
|
||||
(
|
||||
= @ratings.map {|x| "#{x.name}"}.join ', '
|
||||
= votes.collect(&:name).to_sentence
|
||||
)
|
||||
%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
|
||||
- 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
|
||||
- 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
|
||||
= link_to '',
|
||||
vote_admin_conference_program_event_path(conference_id,
|
||||
event, rating: counter + 1),
|
||||
remote: true,
|
||||
id: "label#{counter + 1}",
|
||||
class: 'rating myrating'
|
||||
- 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)})
|
||||
= rating_stars(event.user_rating(current_user), max_rating, voted: true)
|
||||
= (Voting period is closed)
|
||||
|
||||
- if @program.show_voting?
|
||||
- if @ratings.length > 0
|
||||
- @ratings.each do |rate|
|
||||
- unless rate.user_id == current_user.id
|
||||
- if show_votes
|
||||
- unless votes.blank?
|
||||
- votes.each do |vote|
|
||||
- unless vote.user_id == current_user.id
|
||||
%tr
|
||||
%td
|
||||
= rate.name
|
||||
= vote.name
|
||||
%td
|
||||
- @conference.program.rating.times do |counter|
|
||||
= rating_stars(vote, max_rating )
|
||||
|
||||
- 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');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue