|
| 1 | +<div class="container mt-4"> |
| 2 | + <div class="d-flex justify-content-center mb-4"> |
| 3 | + <%= link_to 'Back to Dashboard', dashboard_index_path, class: 'btn btn-secondary' %> |
| 4 | + </div> |
| 5 | + <div class="row mb-4"> |
| 6 | + <div class="col-md-4"> |
| 7 | + <div class="card"> |
| 8 | + <div class="card-body text-center"> |
| 9 | + <h3 class="card-title"><%= @user.username %></h3> |
| 10 | + <% if @user.profile_picture.attached? %> |
| 11 | + <%= image_tag @user.profile_picture, class: "img-fluid rounded-circle", alt: "Profile picture of #{@user.username}", style: "width: 150px; height: 150px; object-fit: cover;" %> |
| 12 | + <% else %> |
| 13 | + <%= image_tag 'default.png', class: "img-fluid rounded-circle", alt: "Default profile picture" %> |
| 14 | + <% end %> |
| 15 | + </div> |
| 16 | + </div> |
| 17 | + </div> |
| 18 | + |
| 19 | + <div class="col-md-8"> |
| 20 | + <div class="card"> |
| 21 | + <div class="card-body"> |
| 22 | + <h4>Bio</h4> |
| 23 | + <p><%= @user.bio.present? ? @user.bio : "No bio yet" %></p> |
| 24 | + </div> |
| 25 | + </div> |
| 26 | + </div> |
| 27 | + </div> |
| 28 | + |
| 29 | + <div class="row"> |
| 30 | + <div class="col-md-4"> |
| 31 | + <div class="card"> |
| 32 | + <div class="card-body"> |
| 33 | + <h4>Friends</h4> |
| 34 | + <div class="list-group"> |
| 35 | + <% @user.friends.each do |friend| %> |
| 36 | + <a href="<%= friend_profile_path(friend) %>" class="list-group-item list-group-item-action"> |
| 37 | + <%= image_tag(friend.profile_picture, class: 'img-thumbnail mr-2', alt: friend.username) if friend.profile_picture.attached? %> |
| 38 | + <%= friend.username %> |
| 39 | + </a> |
| 40 | + <% end %> |
| 41 | + </div> |
| 42 | + </div> |
| 43 | + </div> |
| 44 | + </div> |
| 45 | + |
| 46 | + <div class="col-md-8"> |
| 47 | + <div class="card"> |
| 48 | + <div class="card-body"> |
| 49 | + <h4 class="mt-4">Entries</h4> |
| 50 | + <% @user.entries.each do |entry| %> |
| 51 | + <div class="card mb-3"> |
| 52 | + <div class="card-body"> |
| 53 | + <p><%= entry.text %></p> |
| 54 | + <small><%= entry.created_at.strftime("%B %d, %Y") %></small> |
| 55 | + |
| 56 | + <div class="comments-section mt-3"> |
| 57 | + <h5>Comments</h5> |
| 58 | + <div class="comments-container" style="max-height: 200px; overflow-y: auto;"> |
| 59 | + <% entry.comments.each do |comment| %> |
| 60 | + <div class="comment"> |
| 61 | + <div class="d-flex mb-2"> |
| 62 | + <%= image_tag(comment.user.profile_picture, class: 'img-thumbnail mr-2', alt: comment.user.username) if comment.user.profile_picture.attached? %> |
| 63 | + <div> |
| 64 | + <strong><%= comment.user.username %></strong> |
| 65 | + <p><%= comment.text %></p> |
| 66 | + </div> |
| 67 | + </div> |
| 68 | + </div> |
| 69 | + <% end %> |
| 70 | + </div> |
| 71 | + |
| 72 | + <%= form_with model: [entry, Comment.new], local: true do |f| %> |
| 73 | + <div class="form-group"> |
| 74 | + <%= f.text_area :text, class: 'form-control', placeholder: 'Add a comment...' %> |
| 75 | + </div> |
| 76 | + <%= f.submit 'Post Comment', class: 'btn btn-primary btn-sm' %> |
| 77 | + <% end %> |
| 78 | + </div> |
| 79 | + </div> |
| 80 | + </div> |
| 81 | + <% end %> |
| 82 | + </div> |
| 83 | + </div> |
| 84 | + </div> |
| 85 | + </div> |
| 86 | +</div> |
0 commit comments