annotate app/views/pastes/show.html.erb @ 418:a69dd2d37950

Prevent adding unrelated classes and funny characters
author nanaya <me@myconan.net>
date Thu, 17 Sep 2015 01:13:14 +0900
parents 080dd141898c
children bec47da9052a
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]}",
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
12 :data => { :toggle => "tab" },
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
13 :aria => { :controls => el[:target] },
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
14 :role => "tab",
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
15 :class => "js-show-tab-#{el[:target]}"
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
16 %>
395
26f8c634052c Complete rework.
nanaya <me@myconan.net>
parents: 390
diff changeset
17 </li>
26f8c634052c Complete rework.
nanaya <me@myconan.net>
parents: 390
diff changeset
18 <% end %>
398
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
19 </ul>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
20 </div></div>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
21
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
22 <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
23 <div class="tab-content">
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
24 <div role="tabpanel" class="tab-pane active" id="pl">
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
25 <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
26 </div>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
27
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
28 <div role="tabpanel" class="tab-pane" id="hl">
418
a69dd2d37950 Prevent adding unrelated classes and funny characters
nanaya <me@myconan.net>
parents: 417
diff changeset
29 <pre class="paste-show__content"><code class="js-paste-hl zp-hl lang-<%= @paste.language.parameterize %>"></code></pre>
398
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
30 </div>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
31
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
32 <div role="tabpanel" class="tab-pane" id="md">
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
33 <div class="js-paste-md"></div>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
34 </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></div></div>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
37
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
38 <div class="row">
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
39 <%= form_for @paste, :method => :delete, :authenticity_token => false do |f| %>
400
d647e79136d8 Add missing translations.
nanaya <me@myconan.net>
parents: 398
diff changeset
40 <div class="form-group <%= error_class f.object, :key %> col-sm-6">
398
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
41 <div class="input-group">
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
42 <%= f.text_field :key,
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
43 :value => nil,
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
44 :placeholder => t("pastes.new.deletion_key"),
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
45 :autofocus => f.object.errors.any?,
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
46 :class => "form-control"
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
47 %>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
48
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
49 <span class="input-group-btn">
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
50 <%= f.button t(".delete"), :class => "btn btn-danger" %>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
51 </span>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
52 </div>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
53 </div>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
54 <% end %>
100
90b59418828a Three times more fun with tabs (added plain and markdown tab).
Edho Arief <edho@myconan.net>
parents: 98
diff changeset
55 </div>
2
42de15334db1 Added the pastes.
Edho Arief <edho@myconan.net>
parents:
diff changeset
56
412
634366b67312 Add extra padding so the links aren't stuck to bottom.
nanaya <me@myconan.net>
parents: 400
diff changeset
57 <ul class="nav nav-pills paste-show__footer">
398
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
58 <li role="presentation">
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
59 <%= link_to t(".raw"), paste_path(@paste, :txt) %>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
60 </li>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
61 <li role="presentation">
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
62 <%= link_to t(".derive"), root_path(:base => @paste) %>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
63 </li>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
64 <li role="presentation">
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
65 <%= link_to t(".more"), root_path %>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
66 </li>
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 395
diff changeset
67 </ul>