feature/share-libs
erb 91 lines 3.13 KB
Raw
1 <% content_for :meta_head do %>
2 <%= render('shared/partial_meta_tag', title: @meta_title, description: @meta_description) %>
3 <% end %>
4 <% content_for :breadcrumb do %>
5 <%= render 'shared/partial_breadcrumbs_schema' do %>
6 {
7 "@type": "ListItem",
8 "position": 2,
9 "item": {
10 "@id": "<%= artist_url %>",
11 "name": "<%= t("nav_artists") %>"
12 }
13 },
14 <% if @song.artists.first.present? %>
15 {
16 "@type": "ListItem",
17 "position": 3,
18 "item": {
19 "@id": "<%= artist_detail_url(@song.artists.first&.slug || 'NaN') %>",
20 "name": "<%= @song.artists.first&.name || 'NaN' %>"
21 }
22 },
23 <% end %>
24 {
25 "@type": "ListItem",
26 "position": 4,
27 "item": {
28 "@id": "<%= album_detail_url(@song.album.slug) %>",
29 "name": "<%= @song.album.name %>"
30 }
31 },{
32 "@type": "ListItem",
33 "position": 5,
34 "item": {
35 "@id": "<%= lyric_detail_url(@lyric.slug) %>",
36 "name": "<%= t("song_lyric") + @song.name %>"
37 }
38 }
39 <% end %>
40 <% end %>
41 <main>
42 <div class="row g-5">
43 <div class="col-md-12">
44 <h1><%= @page_title %></h1>
45 </div>
46 </div>
47 <div class="row g-5">
48 <div class="col-sm-1">
49 <div class="position-sticky" style="top: 1rem;">
50 <div class="text-center mt-4">
51 <%= "<i class='bi #{@lyric.status_symbol} #{@lyric.status_color}' style='font-size: 1.5rem;'></i>".html_safe %>
52 </div>
53 <div class="text-center mt-4">
54 <i class="bi bi-graph-up-arrow"></i>
55 <span class="badge rounded-pill bg-warning text-dark"><%= @lyric.views_count %></span>
56 </div>
57 </div>
58 </div>
59 <div class="col-sm-8">
60 <%= raw @lyric_shown %>
61 <div class="row mt-3">
62 <h3 id="discussion"><%= t('discussion') %></h3>
63 <%= render "shared/flash_message", object: flash %>
64 <div class="mb-3">
65 <%= form_for [@lyric, Comment.new] do |f| %>
66 <%= f.text_area :body, placeholder: t('discussion_comment_placeholder'), rows: "4" , cols: "50%" %><br/>
67 <%= f.hidden_field :user_id, value: current_user.id if user_signed_in? %>
68 <%= f.submit t('discussion_comment_button'), class: "btn btn-primary" %>
69 <% end %>
70 </div>
71 <%= render(partial: 'comments/comment', collection: @lyric.comments) %>
72 </div>
73 </div>
74 <div class="col-sm-3">
75 <%= render "partial_aside.html", song: @song do |song| %>
76 <%= link_to(
77 song.name,
78 song_detail_path(song.slug)
79 ) %>
80 <% end %>
81 </div>
82 </div>
83 <%= render "shared/partial_breadcrumbs" do %>
84 <li class="breadcrumb-item"><%= link_to t("nav_artists"), artist_url %></li>
85 <% if @song.artists.first.present? %>
86 <li class="breadcrumb-item"><%= link_to @song.artists.first&.name || 'NaN', artist_detail_url(@song.artists.first&.slug || 'NaN') %></li>
87 <% end %>
88 <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>
89 <li class="breadcrumb-item"><%= link_to @song.name, lyric_detail_path(@lyric.slug) %></li>
90 <% end %>
91 </main>