Skip to content

Commit

Permalink
if exercise or comment is from yourself, show user yourself
Browse files Browse the repository at this point in the history
  • Loading branch information
Theresa committed Feb 15, 2016
1 parent e8d7a52 commit fe96ace
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/views/comments/comments_all.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
<td><%= comment.text %></td>
<% if !comment.user %>
<td> <%= 'User undefined' %> </td>
<% elsif @exercise.user == current_user %>
<td><%= 'yourself' %></td>
<% elsif comment.user.first_name.nil?%>
<td><%= link_to "User#{comment.user.id}", user_path(comment.user)%></td>
<% else %>
Expand Down
2 changes: 2 additions & 0 deletions app/views/comments/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
<td><%= comment.text %></td>
<% if !comment.user %>
<td> <%= 'User undefined' %> </td>
<% elsif @exercise.user == current_user %>
<td><%= 'yourself' %></td>
<% elsif comment.user.first_name.nil? || current_user.role === 'user'%>
<td><%= "User#{comment.user.id}"%></td>
<% else %>
Expand Down
2 changes: 2 additions & 0 deletions app/views/exercises/exercises_all.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<td><%= link_to exercise.title, exercise %></td>
<% if !exercise.user %>
<td> <%= 'User undefined' %> </td>
<% elsif @exercise.user == current_user %>
<td><%= 'yourself' %></td>
<% elsif exercise.user.first_name.nil?%>
<td><%= link_to "User#{exercise.user.id}", user_path(exercise.user)%></td>
<% else %>
Expand Down
2 changes: 2 additions & 0 deletions app/views/exercises/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<dt><%= 'Created by' %>:</dt>
<% if !@exercise.user %>
<dd><%= 'User undefined' %></dd>
<% elsif @exercise.user == current_user %>
<dd><%= 'yourself' %></dd>
<% elsif @exercise.user.first_name.nil? || current_user.role === 'user'%>
<dd><%= "User#{@exercise.user.id}"%></dd>
<% else %>
Expand Down

0 comments on commit fe96ace

Please sign in to comment.