annotate app/views/pastes/show.html.erb @ 506:b5c6fd96100b default tip

Readd the field error proc config
author nanaya <me@nanaya.net>
date Mon, 16 Dec 2024 01:46:09 +0900
parents 68231013b01b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
98
58aa32120b54 Added paste id to title.
Edho Arief <edho@myconan.net>
parents: 90
diff changeset
1 <% provide :title, "Paste ##{@paste.id}" %>
190
d4682cea8e58 Fun with alerts.
Edho Arief <edho@myconan.net>
parents: 189
diff changeset
2
469
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
3 <ul class="nav nav-tabs" role="tablist">
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
4 <% [
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
5 { title: t(".plain"), target: 'pl', active: true },
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
6 { title: t(".highlight"), target: 'hl' },
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
7 { title: t(".markdown"), target: 'md' }
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
8 ].each do |el| %>
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
9 <li class="nav-item">
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
10 <%= link_to el[:title], "##{el[:target]}",
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
11 data: {
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
12 mode: el[:target],
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
13 toggle: 'tab',
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
14 },
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
15 aria: { controls: el[:target] },
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
16 role: 'tab',
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
17 class: "nav-link #{"active" if el[:active]} js-show-tab"
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
18 %>
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
19 </li>
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
20 <% end %>
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
21 </ul>
398
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
22
469
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
23 <div class="js-showing-paste paste-show">
398
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
24 <div class="tab-content">
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
25 <div role="tabpanel" class="tab-pane active" id="pl">
469
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
26 <pre class="paste-content"><code class="js-paste-pl"><%= @paste.paste %></code></pre>
398
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
27 </div>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
28
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
29 <div role="tabpanel" class="tab-pane" id="hl">
469
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
30 <pre class="paste-content"><code class="js-paste-hl zp-hl lang-<%= @paste.language.try(:parameterize) %>"></code></pre>
398
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
31 </div>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
32
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
33 <div role="tabpanel" class="tab-pane" id="md">
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
34 <div class="js-paste-md"></div>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
35 </div>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
36 </div>
469
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
37 </div>
398
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
38
469
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
39 <%= form_for @paste, method: :delete, authenticity_token: false, html: { class: 'form-row' } do |f| %>
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
40 <div class="col-auto my-1">
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
41 <%= f.text_field :key,
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
42 value: nil,
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
43 placeholder: t('pastes.new.deletion_key'),
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
44 autofocus: f.object.errors.any?,
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
45 autocomplete: 'off',
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
46 class: "form-control w-auto #{error_class f.object, :key}"
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
47 %>
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
48 </div>
398
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
49
469
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
50 <div class="col-auto my-1">
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
51 <%= f.button t(".delete"), class: 'btn btn-danger' %>
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
52 </div>
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
53 <% end %>
2
42de15334db1 Added the pastes.
Edho Arief <edho@myconan.net>
parents:
diff changeset
54
469
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
55 <div class="row mt-4">
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
56 <% [
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
57 [t('.raw'), paste_path(@paste, :txt)],
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
58 [t('.derive'), root_path(:base => @paste)],
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
59 [t('.more'), root_path],
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
60 ].each do |label, url| %>
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
61 <div class="col-auto">
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
62 <%= link_to label, url %>
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
63 </div>
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
64 <% end %>
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 442
diff changeset
65 </div>