feature/share-libs
erb 116 lines 4.5 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 <% content_for :breadcrumb do %>
9 <script type="application/ld+json">
10 {
11 "@context": "http://schema.org",
12 "@type": "BreadcrumbList",
13 "itemListElement": [{
14 "@type": "ListItem",
15 "position": 1,
16 "item": {
17 "@id": "<%= root_url %>",
18 "name": "<%= t("site_name") %>"
19 }
20 },{
21 "@type": "ListItem",
22 "position": 2,
23 "item": {
24 "@id": "<%= artist_url %>",
25 "name": "<%= t("nav_artists") %>"
26 }
27 },{
28 "@type": "ListItem",
29 "position": 3,
30 "item": {
31 "@id": "<%= request.base_url %>/artis/<%= @song.album.artists[0].name.downcase.parameterize %>-<%= @song.album.artists[0].id %>",
32 "name": "<%= @song.album.artists[0].name %>"
33 }
34 },{
35 "@type": "ListItem",
36 "position": 4,
37 "item": {
38 "@id": "<%= request.base_url %>/album/<%= @song.album.name.downcase.parameterize + '-' + @song.album.artists[0].name.downcase.parameterize %>-<%= @song.album.id %>",
39 "name": "<%= @song.album.name %>"
40 }
41 },{
42 "@type": "ListItem",
43 "position": 5,
44 "item": {
45 "@id": "<%= request.url %>",
46 "name": "<%= @song.name %>"
47 }
48 }]
49 }
50 </script>
51 <% end %>
52 <main>
53 <div class="row g-5">
54 <div class="col-md-12">
55 <h1><%= @page_title %></h1>
56 </div>
57 </div>
58 <div class="row g-5">
59 <div class="col-sm-1">
60 <div class="position-sticky" style="top: 1rem;">
61 <div class="text-center mt-3">
62 <% if user_signed_in? && @song.users.include?(current_user) %>
63 <%= link_to(
64 '<i class="bi bi-heart-fill"></i>'.html_safe,
65 song_chord_pleas_unloved_path(id: @song.id),
66 remote: true,
67 method: :delete,
68 :id => "ajax_trigger"
69 )
70 %>
71 <% else %>
72 <%= link_to(
73 '<i class="bi bi-heart"></i>'.html_safe,
74 song_chord_pleas_loved_path(id: @song.id),
75 remote: true,
76 method: :post,
77 :id => "ajax_trigger"
78 )
79 %>
80 <% end %>
81 <span class="badge rounded-pill bg-warning text-dark"><%= @song.users.count %></span>
82 </div>
83 <div class="text-center mt-4">
84 <i class="bi bi-graph-up-arrow"></i>
85 <span class="badge rounded-pill bg-warning text-dark"><%= @song.views_count %></span>
86 </div>
87 </div>
88 </div>
89 <div class="col-sm-9">
90 <%= render('shared/partial_meta_top', author: @author, created_at: @song.created_at) %>
91 <%= @song.description.html_safe %>
92 <%= render('partial_meta_bottom', artist: @song.artists, album: @song.album) %>
93 <div class="row mt-3">
94 <h3 id="discussion"><%= t('discussion') %></h3>
95 <%= render "shared/flash_message", object: flash %>
96 <div class="mb-3">
97 <%= form_for [@song, Comment.new] do |f| %>
98 <%= f.text_area :body, placeholder: t('discussion_comment_placeholder'), rows: "4" , cols: "50%" %><br/>
99 <%= f.hidden_field :user_id, value: current_user.id if user_signed_in? %>
100 <%= f.submit t('discussion_comment_button'), class: "btn btn-primary" %>
101 <% end %>
102 </div>
103 <%= render(partial: 'comments/comment', collection: @song.comments) %>
104 </div>
105 </div>
106 <div class="col-sm-2">
107 <%= render('partial_menus_aside', active_menu: 'info') %>
108 </div>
109 </div>
110 <%= render "shared/partial_breadcrumbs" do %>
111 <li class="breadcrumb-item"><%= link_to t("nav_artists"), artist_url %></li>
112 <li class="breadcrumb-item"><%= link_to @song.album.artists[0].name, artist_detail_url(@song.album.artists[0].name.downcase.parameterize + "-" + @song.album.artists[0].id.to_s) %></li>
113 <li class="breadcrumb-item"><%= link_to @song.album.name, album_detail_url(@song.album.name.downcase.parameterize + '-' + @song.album.artists[0].name.downcase.parameterize + "-" + @song.album.id.to_s) %></li>
114 <li class="breadcrumb-item"><%= link_to @song.name, song_detail_path(@song.slug) %></li>
115 <% end %>
116 </main>