File tree Expand file tree Collapse file tree 4 files changed +7
-6
lines changed
Expand file tree Collapse file tree 4 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ def initialize(user)
3030 end
3131 elsif user . role == 'user'
3232 can :read , Exercise
33- can :create , Rating
33+ can :read , Rating
3434 can :read , Comment
3535 can :manage , User do |_user |
3636 _user == user
Original file line number Diff line number Diff line change 2727 < td > <%= comment . text %> </ td >
2828 <% if !comment . user %>
2929 < td > <%= 'User undefined' %> </ td >
30- <% elsif comment . user . first_name . nil? %>
30+ <% elsif comment . user . first_name . nil? || current_user . role === 'user' %>
3131 < td > <%= "User#{ comment . user . id } " %> </ td >
3232 <% else %>
3333 < td > <%= comment . user . name %> </ td >
Original file line number Diff line number Diff line change 1616 < dt > <%= 'Created by' %> :</ dt >
1717 <% if !@exercise . user %>
1818 < dd > <%= 'User undefined' %> </ dd >
19- <% elsif @exercise . user . first_name . nil? %>
19+ <% elsif @exercise . user . first_name . nil? || current_user . role === 'user' %>
2020 < dd > <%= "User#{ @exercise . user . id } " %> </ dd >
2121 <% else %>
2222 < dd > <%= @exercise . user . name %> </ dd >
Original file line number Diff line number Diff line change 44 < h3 class ="panel-title "> < span > <%= link_to exercise . title , exercise_path ( exercise ) %> </ span >
55 < span class ="star-rating pull-right ">
66 <% [ *1 ..5 ] . each do |i | %>
7- < a href ="/exercises/<%= exercise . id %> /ratings?rating[rating]= <%= i %> " data-method ="post ">
7+ <% if can? :create , Rating %>
8+ < a href ="/exercises/<%= exercise . id %> /ratings?rating[rating]= <%= i %> " data-method ="post ">
9+ <% end %>
810 <% if exercise . round_avg_rating >= i %>
911 < span class ="fa fa-star " data-rating ="<%= i %> "> </ span >
1012 <% elsif ( exercise . round_avg_rating + 0.5 ) >= i %>
1517 </ a >
1618 <% end %>
1719 < small > <%= exercise . ratings . count %> ratings</ small >
18- < input type ="hidden " name ="whatever " class ="rating-value " value ="3 ">
1920 </ span >
2021 </ h3 >
2122 </ div >
2728 </ div >
2829
2930 < div class ="btn-group-vertical pull-right " role ="group " aria-label ="... ">
30- <%= link_to 'Select ' , exercise_path ( exercise ) , class :'btn btn-default' %>
31+ <%= link_to 'View ' , exercise_path ( exercise ) , class :'btn btn-default' %>
3132 <%= link_to 'Show Comments' , exercise_comments_path ( exercise ) , class :'btn btn-default' %>
3233 <% if can? :create , exercise %>
3334 <%= link_to 'Duplicate' , duplicate_exercise_path ( exercise ) , class :'btn btn-default' %>
You can’t perform that action at this time.
0 commit comments