feature/share-libs
erb 137 lines 5.33 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 <div class="mb-3 mt-3">
92 <%= link_to('Share lyric!', add_lyric_path(@song), class: 'btn btn-primary btn-lg px-4') %>
93 </div>
94 <ol class="list-group list-group-numbered">
95 <% @lyrics.each do |lyric| %>
96 <li class="list-group-item d-flex justify-content-between align-items-start">
97 <div class="ms-2 me-auto">
98 <div class="fw-bold">
99 <%= link_to(
100 t('song_lyric_detail', title: lyric.title_link),
101 lyric_detail_path(lyric.slug)
102 ) %>
103 </div>
104 <%= link_to(
105 "@#{lyric.user_or_nowhereman.username_or_id}",
106 profile_path(lyric.user_or_nowhereman.username_or_id),
107 class: 'fst-italic fw-light'
108 ) %>
109 </div>
110 <span class="badge bg-warning rounded-pill text-dark"><%= lyric.views_count %></span>
111 &nbsp;
112 <i class="bi bi-graph-up-arrow"></i>
113 </li>
114 <% end %>
115 </ol>
116 <h2 class="mb-2 mb-2 mt-5">Kamu pikir kamu punya lirik yang lebih akurat?</h2>
117 <%= render "shared/flash_message", object: flash %>
118 <div class="mb-3">
119 <%= form_for [@song, Comment.new] do |f| %>
120 <%= f.text_area :body, placeholder: "Add a comment", rows: "4" , cols: "50%" %><br/>
121 <%= f.hidden_field :user_id, value: current_user.id if user_signed_in? %>
122 <%= f.submit "Add Comment", class: "btn btn-primary" %>
123 <% end %>
124 </div>
125 <%= render(partial: 'comments/comment', collection: @song.comments) %>
126 </div>
127 <div class="col-sm-2">
128 <%= render('partial_menus_aside', active_menu: 'lyric') %>
129 </div>
130 </div>
131 <%= render "shared/partial_breadcrumbs" do %>
132 <li class="breadcrumb-item"><%= link_to t("nav_artists"), artist_url %></li>
133 <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>
134 <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>
135 <li class="breadcrumb-item"><%= link_to @song.name, song_detail_path(@song.slug) %></li>
136 <% end %>
137 </main>