annotate app/views/pastes/show.html.erb @ 442:1fc5ddcde386

Some refactors
author nanaya <me@myconan.net>
date Thu, 10 Nov 2016 21:58:25 +0900
parents b2991317d4d7
children 68231013b01b
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
398
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
3 <div class="row"><div class="col-xs-12">
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
4 <ul class="nav nav-tabs" role="tablist">
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
5 <% [
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
6 { :title => t(".plain"), :target => "pl", :active => true },
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
7 { :title => t(".highlight"), :target => "hl" },
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
8 { :title => t(".markdown"), :target => "md" }
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
9 ].each do |el| %>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
10 <li role="presentation" class="<%= "active" if el[:active] %>">
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
11 <%= link_to el[:title], "##{el[:target]}",
442
1fc5ddcde386 Some refactors
nanaya <me@myconan.net>
parents: 434
diff changeset
12 :data => {
1fc5ddcde386 Some refactors
nanaya <me@myconan.net>
parents: 434
diff changeset
13 :mode => el[:target],
1fc5ddcde386 Some refactors
nanaya <me@myconan.net>
parents: 434
diff changeset
14 :toggle => "tab"
1fc5ddcde386 Some refactors
nanaya <me@myconan.net>
parents: 434
diff changeset
15 },
398
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
16 :aria => { :controls => el[:target] },
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
17 :role => "tab",
442
1fc5ddcde386 Some refactors
nanaya <me@myconan.net>
parents: 434
diff changeset
18 :class => "js-show-tab"
398
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
19 %>
395
26f8c634052c Complete rework.
nanaya <me@myconan.net>
parents: 390
diff changeset
20 </li>
26f8c634052c Complete rework.
nanaya <me@myconan.net>
parents: 390
diff changeset
21 <% end %>
398
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
22 </ul>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
23 </div></div>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
24
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
25 <div class="row js-showing-paste"><div class="col-xs-12"><div class="paste-show">
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
26 <div class="tab-content">
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
27 <div role="tabpanel" class="tab-pane active" id="pl">
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
28 <pre class="paste-show__content"><code class="js-paste-pl"><%= @paste.paste %></code></pre>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
29 </div>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
30
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
31 <div role="tabpanel" class="tab-pane" id="hl">
420
bec47da9052a Prevent explosion on nil language
nanaya <me@myconan.net>
parents: 418
diff changeset
32 <pre class="paste-show__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
33 </div>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
34
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
35 <div role="tabpanel" class="tab-pane" id="md">
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
36 <div class="js-paste-md"></div>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
37 </div>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
38 </div>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
39 </div></div></div>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
40
424
967233b26404 Fix styling for md size
nanaya <me@myconan.net>
parents: 420
diff changeset
41 <div class="row"><div class="col-xs-12">
398
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
42 <%= form_for @paste, :method => :delete, :authenticity_token => false do |f| %>
424
967233b26404 Fix styling for md size
nanaya <me@myconan.net>
parents: 420
diff changeset
43 <div class="form-group form-group--narrow <%= error_class f.object, :key %>">
398
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
44 <div class="input-group">
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
45 <%= f.text_field :key,
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
46 :value => nil,
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
47 :placeholder => t("pastes.new.deletion_key"),
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
48 :autofocus => f.object.errors.any?,
434
b2991317d4d7 Disable deletion key autocomplete
nanaya <me@myconan.net>
parents: 424
diff changeset
49 :autocomplete => "off",
398
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
50 :class => "form-control"
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
51 %>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
52
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
53 <span class="input-group-btn">
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
54 <%= f.button t(".delete"), :class => "btn btn-danger" %>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
55 </span>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
56 </div>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
57 </div>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
58 <% end %>
424
967233b26404 Fix styling for md size
nanaya <me@myconan.net>
parents: 420
diff changeset
59 </div></div>
2
42de15334db1 Added the pastes.
Edho Arief <edho@myconan.net>
parents:
diff changeset
60
412
634366b67312 Add extra padding so the links aren't stuck to bottom.
nanaya <me@myconan.net>
parents: 400
diff changeset
61 <ul class="nav nav-pills paste-show__footer">
398
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
62 <li role="presentation">
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
63 <%= link_to t(".raw"), paste_path(@paste, :txt) %>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
64 </li>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
65 <li role="presentation">
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
66 <%= link_to t(".derive"), root_path(:base => @paste) %>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
67 </li>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
68 <li role="presentation">
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
69 <%= link_to t(".more"), root_path %>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
70 </li>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
71 </ul>