feature/share-libs
erb 165 lines 5.97 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": "<%= album_url %>",
25 "name": "<%= t("nav_albums") %>"
26 }
27 },{
28 "@type": "ListItem",
29 "position": 2,
30 "item": {
31 "@id": "<%= artist_url %>",
32 "name": "<%= t("nav_artists") %>"
33 }
34 },{
35 "@type": "ListItem",
36 "position": 3,
37 "item": {
38 "@id": "<%= artist_detail_url(@album.artists.first&.name || "NaN") %>",
39 "name": "<%= @album.artists.first&.name || "NaN" %>"
40 }
41 },{
42 "@type": "ListItem",
43 "position": 4,
44 "item": {
45 "@id": "<%= album_detail_url %>",
46 "name": "<%= @album.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 <%= render('shared/flash_message', object: flash) %>
57 </div>
58 </div>
59 <div class="row g-5">
60 <div class="col-sm-3">
61 <div class="position-sticky" style="top: 1rem;">
62 <div class="text-center mt-4 mb-4">
63 <%= image_pack_tag(
64 "image-placeholder-#{rand(0...3)}.jpg",
65 alt:"#{@album.name} image",
66 class: "img-thumbnail rounded"
67 ) %>
68 </div>
69 <%= render('partial_meta', id: @album.id, users: @album.users, author: @album.user, counter: @album.views_count) %>
70 </div>
71 </div>
72 <div class="col-sm-9">
73 <div class="row mb-3">
74 <div class="col-md-12">
75 <%= raw @album.description %>
76 </div>
77 </div>
78 <div class="row mb-3">
79 <div class="col-md-12">
80 <h2><%= @page_title_artist %></h1>
81 <div class="row mb-3">
82 <% @album.artists.each_with_index do |artist, index| %>
83 <div class="col-6 col-sm-3 col-md-2 text-center">
84 <div class="mt-4 mb-4">
85 <%= image_pack_tag(
86 "image-placeholder-#{rand(0...3)}.jpg",
87 alt:"#{artist.name} image",
88 class: "img-thumbnail rounded-circle"
89 ) %>
90 </div>
91 <%= link_to(
92 artist.name,
93 artist_detail_path(artist.name.downcase.parameterize + "-" + artist.id.to_s),
94 class: 'badge rounded-pill bg-warning text-dark fst-italic '
95 ) %>
96 </div>
97 <% end %>
98 </div>
99 </div>
100 </div>
101 <div class="row">
102 <div class="col-md-12">
103 <h2><%= @page_title_songs %></h1>
104 <ul class="list-group">
105 <% @album.songs.each_with_index do |song, index| %>
106 <li class="list-group-item <%= index % 2 == 0 ? 'list-group-item-primary' : ' list-group-item-warning' %>">
107 <%= index + 1 %>.
108 <%= link_to(
109 song.name,
110 song_detail_path(song.slug)
111 ) %>
112 <span class="p-2">
113 <i class='bi bi-graph-up-arrow'></i>
114 <span class='badge rounded-pill bg-warning text-dark'><%= song.views_count %></span>
115 </span>
116 <%= link_to(
117 '<i class="bi bi-info-circle"></i>'.html_safe,
118 song_detail_path(song.slug),
119 title: t('song_menu_aside_info'),
120 class: 'float-end p-1'
121 ) %>
122 <%= link_to(
123 '<i class="bi bi-music-note-list"></i>'.html_safe,
124 song_chords_path(song.slug),
125 title: t('song_menu_aside_chords'),
126 class: 'float-end p-1'
127 ) %>
128 <%= link_to(
129 '<i class="bi bi-music-note-beamed"></i>'.html_safe,
130 song_chords_path(song.slug),
131 title: t('song_menu_aside_audio'),
132 class: 'float-end p-1'
133 ) %>
134 </li>
135 <% end %>
136 </ul>
137 </div>
138 </div>
139 <div class="row">
140 <div class="col-md-12">
141 <div class="row mt-3">
142 <h3 id="discussion"><%= t('discussion') %></h3>
143 <%= render "shared/flash_message", object: flash %>
144 <div class="mb-3">
145 <%= form_for [@album, Comment.new] do |f| %>
146 <%= f.text_area :body, placeholder: t('discussion_comment_placeholder'), rows: "4" , cols: "50%" %><br/>
147 <%= f.hidden_field :user_id, value: current_user.id if user_signed_in? %>
148 <%= f.submit t('discussion_comment_button'), class: "btn btn-primary" %>
149 <% end %>
150 </div>
151 <%= render(partial: 'comments/comment', collection: @album.comments) %>
152 </div>
153 </div>
154 </div>
155 </div>
156 </div>
157 <%= render 'shared/partial_breadcrumbs' do %>
158 <li class="breadcrumb-item"><%= link_to t("nav_albums"), album_path %></li>
159 <li class="breadcrumb-item"><%= link_to t("nav_artists"), artist_path %></li>
160 <% if @album.artists.first.present? %>
161 <li class="breadcrumb-item"><%= link_to @album.artists[0].name, artist_detail_path(artist_friendly_url(@album.artists[0])) %></li>
162 <% end %>
163 <li class="breadcrumb-item"><%= link_to @album.name, album_detail_path %></li>
164 <% end %>
165 </main>