feature/share-libs
erb 115 lines 4.41 KB
Raw
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 %></h1>
12 <%= render "shared/flash_message", object: flash %>
13 </div>
14 </div>
15 <% if @chord %>
16 <div class="row g-5">
17 <div class="col-sm-1">
18 <div class="position-sticky" style="top: 1rem;">
19 <div class="text-center mt-4">
20 <%= link_to(
21 "<i class='bi #{@chord.status_symbol} #{@chord.status_color}' style='font-size: 1.5rem;'></i>".html_safe,
22 guitar_chord_history_path,
23 title: "Status: #{@chord.status}"
24 ) %>
25 </div>
26 <div class="text-center mt-4">
27 <% if user_signed_in? && @chord.users.include?(current_user) %>
28 <%= link_to(
29 '<i class="bi bi-heart-fill"></i>'.html_safe,
30 chord_unvote_path(id: @chord.id),
31 remote: true,
32 method: :delete,
33 :id => "ajax_trigger"
34 )
35 %>
36 <% else %>
37 <%= link_to(
38 '<i class="bi bi-heart"></i>'.html_safe,
39 chord_vote_path(id: @chord.id),
40 remote: true,
41 method: :post,
42 title: t('somebody_to_love'),
43 :id => "ajax_trigger"
44 )
45 %>
46 <% end %>
47 <span class="badge rounded-pill bg-warning text-dark"><%= @chord.users.count %></span>
48 </div>
49 <div class="text-center mt-4">
50 <i class="bi bi-graph-up-arrow"></i>
51 <span class="badge rounded-pill bg-warning text-dark"><%= @chord.views_count %></span>
52 </div>
53 </div>
54 </div>
55 <div class="col-sm-11">
56 <div class="row mb-3">
57 <div class="col-sm-4 fw-bold fst-italic d-inline-flex">
58 <%= link_to(
59 "@#{@author}",
60 profile_path(@author),
61 title: "Author: @#{@author}"
62 ) %>
63 </div>
64 <div class="col-sm-4 fw-bold fst-italic">
65 <%= link_to(
66 t('song_detail'),
67 song_bridge_path(@song.slug),
68 title: "#{@chord.song_provider.name}"
69 ) if @chord.song_provider.present? %>
70 </div>
71 <div class="col-sm-4 fw-bold fst-italic">
72 <span class="badge bg-primary rounded-pill fst-italic fw-light float-end">
73 <%= @chord.created_at.strftime("%B %-d, %Y") %>
74 </span>
75 </div>
76 </div>
77 <%=
78 "<div class='mb-5'>
79 #{link_to('Review chord!', guitar_chord_review_path, class: 'btn btn-warning btn-lg px-4')}
80 </div>".html_safe if @chord.pending?
81 %>
82 <%= @chord_content.html_safe %>
83 <div class="row mt-3">
84 <h3 id="discussion"><%= t('discussion') %></h3>
85 <%= render "shared/flash_message", object: flash %>
86 <div class="mb-3">
87 <%= form_for [@chord, Comment.new] do |f| %>
88 <%= f.text_area :body, placeholder: t('discussion_comment_placeholder'), rows: "4" , cols: "50%" %><br/>
89 <%= f.hidden_field :user_id, value: current_user.id if user_signed_in? %>
90 <%= f.submit t('discussion_comment_button'), class: "btn btn-primary" %>
91 <% end %>
92 </div>
93 <%= render(partial: 'comments/comment', collection: @chord.comments) %>
94 </div>
95 </div>
96 </div>
97 <%= render 'shared/partial_breadcrumbs' do %>
98 <li class="breadcrumb-item">
99 <%= link_to(
100 t('guitar_chord_link', slug: @chord.link_title),
101 guitar_chord_detail_path(@chord.slug)
102 ) %>
103 </li>
104 <% end %>
105 <% else %>
106 <div class="row g-5 mb-5">
107 <div class="col-sm-4">
108 <%= link_to('Share chord!', guitar_chord_add_path, class: 'btn btn-primary btn-lg px-4') %>
109 </div>
110 <div class="col-sm-8">
111 The chord you are looking for is not available. Please add it.
112 </div>
113 </div>
114 <% end %>
115 </main>