| 1 | <% content_for :meta_head do %> |
| 2 | <title><%= @meta_title %></title> |
| 3 | <meta name="description" content="<%= @meta_description %>"> |
| 4 | <meta property="og:title" content="<%= @meta_title %>" /> |
| 5 | <meta property="og:description" content="<%= @meta_description %>" /> |
| 6 | <meta property="og:url" content="<%= @meta_url %>" /> |
| 7 | <% end %> |
| 8 | <main> |
| 9 | <div class="row g-5"> |
| 10 | <div class="col-md-12"> |
| 11 | <h1><%= @page_title %> / History</h1> |
| 12 | </div> |
| 13 | </div> |
| 14 | <div class="row g-5"> |
| 15 | <div class="col-sm-1"> |
| 16 | <div class="position-sticky" style="top: 1rem;"> |
| 17 | <div class="text-center mt-4"> |
| 18 | <%= link_to( |
| 19 | "<i class='bi bi-music-note-list text-primary' style='font-size: 1.5rem;'></i>".html_safe, |
| 20 | guitar_chord_detail_path(@chord.slug), |
| 21 | title: "Back to chord" |
| 22 | ) %> |
| 23 | </div> |
| 24 | <div class="text-center mt-4"> |
| 25 | <% if user_signed_in? && @chord.users.include?(current_user) %> |
| 26 | <%= link_to( |
| 27 | '<i class="bi bi-heart-fill"></i>'.html_safe, |
| 28 | chord_unvote_path(id: @chord.id), |
| 29 | remote: true, |
| 30 | method: :delete, |
| 31 | :id => "ajax_trigger" |
| 32 | ) |
| 33 | %> |
| 34 | <% else %> |
| 35 | <%= link_to( |
| 36 | '<i class="bi bi-heart"></i>'.html_safe, |
| 37 | chord_vote_path(id: @chord.id), |
| 38 | remote: true, |
| 39 | method: :post, |
| 40 | title: t('somebody_to_love'), |
| 41 | :id => "ajax_trigger" |
| 42 | ) |
| 43 | %> |
| 44 | <% end %> |
| 45 | <span class="badge rounded-pill bg-warning text-dark"><%= @chord.users.count %></span> |
| 46 | </div> |
| 47 | <div class="text-center mt-4"> |
| 48 | <i class="bi bi-graph-up-arrow"></i> |
| 49 | <span class="badge rounded-pill bg-warning text-dark"><%= @chord.views_count %></span> |
| 50 | </div> |
| 51 | </div> |
| 52 | </div> |
| 53 | <div class="col-sm-11"> |
| 54 | <ul class="list-group mt-5"> |
| 55 | <% @chord_histories.each_with_index do |history, index| %> |
| 56 | <li class="list-group-item d-flex justify-content-between align-items-center"> |
| 57 | <div class="ms-2 me-auto"> |
| 58 | <div class="fw-bold fst-italic"> |
| 59 | <%= link_to( |
| 60 | "@#{history.user.username_or_id}", |
| 61 | profile_path(history.user.username_or_id), |
| 62 | title: "Author: @#{history.user}" |
| 63 | ) %> |
| 64 | </div> |
| 65 | <%= history.name %> |
| 66 | </div> |
| 67 | <span class="badge bg-primary rounded-pill fst-italic fw-light"><%= (index == @chord_histories.size - 1 ? @chord.created_at : history.updated_at).strftime("%B %-d, %Y") %></span> |
| 68 | </li> |
| 69 | <% end %> |
| 70 | </ul> |
| 71 | </div> |
| 72 | </div> |
| 73 | <%= render 'shared/partial_breadcrumbs' do %> |
| 74 | <li class="breadcrumb-item"> |
| 75 | <%= link_to( |
| 76 | t('guitar_chord_link', slug: @chord.link_title), |
| 77 | guitar_chord_detail_path(@chord.slug) |
| 78 | ) %> |
| 79 | </li> |
| 80 | <li class="breadcrumb-item"> |
| 81 | <%= link_to( |
| 82 | t('guitar_chord_history'), |
| 83 | guitar_chord_history_path |
| 84 | ) %> |
| 85 | </li> |
| 86 | <% end %> |
| 87 | </main> |