feature/share-libs
erb 149 lines 5.44 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="<%= javanese_gending_detail_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": "<%= javanese_gamelan_url %>",
25 "name": "<%= t("nav_javanese_gamelan") %>"
26 }
27 },{
28 "@type": "ListItem",
29 "position": 3,
30 "item": {
31 "@id": "<%= javanese_gending_detail_url %>",
32 "name": "<%= t("gending_notation") + @gending.name %>"
33 }
34 }]
35 }
36 </script>
37 <% end %>
38 <main>
39 <div class="row g-5">
40 <div class="col-12">
41 <div class="lead p-3">
42 <%=
43 t(
44 'gending_add_explanation',
45 href: link_to(
46 t('gending_add'),
47 add_gending_path,
48 class: 'btn btn-primary'
49 ),
50 bach_link: link_to("<span class='badge bg-warning text-dark'>€BACH</span>".html_safe, bach_path)
51 ).html_safe
52 %>
53 </div>
54 </div>
55 </div>
56 <div class="row g-5">
57 <div class="col-md-12">
58 <h1><%= @page_title %></h1>
59 </div>
60 </div>
61 <div class="row g-5">
62 <div class="col-sm-1">
63 <div class="position-sticky" style="top: 1rem;">
64 <div class="text-center mt-3">
65 <% if user_signed_in? && @gending.users.include?(current_user) %>
66 <%= link_to(
67 '<i class="bi bi-heart-fill"></i>'.html_safe,
68 javanese_gending_unvote_path(id: @gending.id),
69 remote: true,
70 method: :delete,
71 :id => "ajax_trigger"
72 )
73 %>
74 <% else %>
75 <%= link_to(
76 '<i class="bi bi-heart"></i>'.html_safe,
77 javanese_gending_vote_path(id: @gending.id),
78 remote: true,
79 method: :post,
80 :id => "ajax_trigger"
81 )
82 %>
83 <% end %>
84 <span class="badge rounded-pill bg-warning text-dark"><%= @gending.gending_vote.count %></span>
85 </div>
86 <div class="text-center mt-4">
87 <i class="bi bi-graph-up-arrow"></i>
88 <span class="badge rounded-pill bg-warning text-dark"><%= @gending.views_count %></span>
89 </div>
90 </div>
91 </div>
92 <div class="col-sm-11">
93 <%= render('shared/partial_meta_top', author: @author, created_at: @gending.created_at) %>
94 <%= raw @gending.description %>
95 <div class="row">
96 <div class="col-12">
97 <table class="table table-striped">
98 <thead>
99 <tr>
100 <th scope="col">#</th>
101 <th scope="col"><%= t("gending_notation") %></th>
102 <th scope="col"><%= t("added_by") %></th>
103 </tr>
104 </thead>
105 <tbody>
106 <% @gending.javanese_gending_notation.each_with_index do |gending, index| %>
107 <tr>
108 <th scope="row"><%= index + 1 %></th>
109 <td>
110 <%= link_to(
111 gending.name,
112 gending.rich_format.nil? ? javanese_gending_gamelan_notation_detail_path(gending.slug)
113 : javanese_gending_gamelan_notation_detail_new_path(gending.slug),
114 class: "more-link"
115 ) %>
116 <% if gending.users.count > 0 %>
117 <%= render('partial_like_this', users: gending.users) %>
118 <% end %>
119 </td>
120 <td>
121 <%= link_to("@#{gending.user_or_nowhereman.username_or_id}", profile_path(gending.user_or_nowhereman.username_or_id), title: "Author: @#{gending.user_or_nowhereman.username_or_id}") %>
122 </td>
123 </tr>
124 <% end %>
125 </tbody>
126 </table>
127 </div>
128 </div>
129 <div class="row">
130 <div class="col-12">
131 <h3 id="discussion"><%= t('discussion') %></h3>
132 <%= render "shared/flash_message", object: flash %>
133 <div class="mb-3">
134 <%= form_for [@gending, Comment.new] do |f| %>
135 <%= f.text_area :body, placeholder: "Add a comment", rows: "4" , cols: "50%" %><br/>
136 <%= f.hidden_field :user_id, value: current_user.id if user_signed_in? %>
137 <%= f.submit "Add Comment", class: "btn btn-primary" %>
138 <% end %>
139 </div>
140 <%= render(partial: 'comments/comment', collection: @gending.comments) %>
141 </div>
142 </div>
143 </div>
144 </div>
145 <%= render "shared/partial_breadcrumbs" do %>
146 <li class="breadcrumb-item"><%= link_to t("nav_javanese_gamelan"), javanese_gamelan_path %></li>
147 <li class="breadcrumb-item"><%= link_to t("gending_notation") + @gending.name, javanese_gending_detail_path %></li>
148 <% end %>
149 </main>