Skip to content

Commit fe96ace

Browse files
author
Theresa
committed
if exercise or comment is from yourself, show user yourself
1 parent e8d7a52 commit fe96ace

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

app/views/comments/comments_all.html.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
<td><%= comment.text %></td>
2323
<% if !comment.user %>
2424
<td> <%= 'User undefined' %> </td>
25+
<% elsif @exercise.user == current_user %>
26+
<td><%= 'yourself' %></td>
2527
<% elsif comment.user.first_name.nil?%>
2628
<td><%= link_to "User#{comment.user.id}", user_path(comment.user)%></td>
2729
<% else %>

app/views/comments/index.html.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
<td><%= comment.text %></td>
2828
<% if !comment.user %>
2929
<td> <%= 'User undefined' %> </td>
30+
<% elsif @exercise.user == current_user %>
31+
<td><%= 'yourself' %></td>
3032
<% elsif comment.user.first_name.nil? || current_user.role === 'user'%>
3133
<td><%= "User#{comment.user.id}"%></td>
3234
<% else %>

app/views/exercises/exercises_all.html.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
<td><%= link_to exercise.title, exercise %></td>
1818
<% if !exercise.user %>
1919
<td> <%= 'User undefined' %> </td>
20+
<% elsif @exercise.user == current_user %>
21+
<td><%= 'yourself' %></td>
2022
<% elsif exercise.user.first_name.nil?%>
2123
<td><%= link_to "User#{exercise.user.id}", user_path(exercise.user)%></td>
2224
<% else %>

app/views/exercises/show.html.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
<dt><%= 'Created by' %>:</dt>
1717
<% if !@exercise.user %>
1818
<dd><%= 'User undefined' %></dd>
19+
<% elsif @exercise.user == current_user %>
20+
<dd><%= 'yourself' %></dd>
1921
<% elsif @exercise.user.first_name.nil? || current_user.role === 'user'%>
2022
<dd><%= "User#{@exercise.user.id}"%></dd>
2123
<% else %>

0 commit comments

Comments
 (0)