comparison app/views/pastes/show.html.erb @ 469:68231013b01b bootstrap-4

Now with more bootstrap than ever
author nanaya <me@nanaya.pro>
date Sun, 23 Feb 2020 22:25:50 +0900
parents 1fc5ddcde386
children
comparison
equal deleted inserted replaced
468:802dcd44188e 469:68231013b01b
1 <% provide :title, "Paste ##{@paste.id}" %> 1 <% provide :title, "Paste ##{@paste.id}" %>
2 2
3 <div class="row"><div class="col-xs-12"> 3 <ul class="nav nav-tabs" role="tablist">
4 <ul class="nav nav-tabs" role="tablist"> 4 <% [
5 <% [ 5 { title: t(".plain"), target: 'pl', active: true },
6 { :title => t(".plain"), :target => "pl", :active => true }, 6 { title: t(".highlight"), target: 'hl' },
7 { :title => t(".highlight"), :target => "hl" }, 7 { title: t(".markdown"), target: 'md' }
8 { :title => t(".markdown"), :target => "md" } 8 ].each do |el| %>
9 ].each do |el| %> 9 <li class="nav-item">
10 <li role="presentation" class="<%= "active" if el[:active] %>"> 10 <%= link_to el[:title], "##{el[:target]}",
11 <%= link_to el[:title], "##{el[:target]}", 11 data: {
12 :data => { 12 mode: el[:target],
13 :mode => el[:target], 13 toggle: 'tab',
14 :toggle => "tab" 14 },
15 }, 15 aria: { controls: el[:target] },
16 :aria => { :controls => el[:target] }, 16 role: 'tab',
17 :role => "tab", 17 class: "nav-link #{"active" if el[:active]} js-show-tab"
18 :class => "js-show-tab" 18 %>
19 %> 19 </li>
20 </li> 20 <% end %>
21 <% end %> 21 </ul>
22 </ul>
23 </div></div>
24 22
25 <div class="row js-showing-paste"><div class="col-xs-12"><div class="paste-show"> 23 <div class="js-showing-paste paste-show">
26 <div class="tab-content"> 24 <div class="tab-content">
27 <div role="tabpanel" class="tab-pane active" id="pl"> 25 <div role="tabpanel" class="tab-pane active" id="pl">
28 <pre class="paste-show__content"><code class="js-paste-pl"><%= @paste.paste %></code></pre> 26 <pre class="paste-content"><code class="js-paste-pl"><%= @paste.paste %></code></pre>
29 </div> 27 </div>
30 28
31 <div role="tabpanel" class="tab-pane" id="hl"> 29 <div role="tabpanel" class="tab-pane" id="hl">
32 <pre class="paste-show__content"><code class="js-paste-hl zp-hl lang-<%= @paste.language.try(:parameterize) %>"></code></pre> 30 <pre class="paste-content"><code class="js-paste-hl zp-hl lang-<%= @paste.language.try(:parameterize) %>"></code></pre>
33 </div> 31 </div>
34 32
35 <div role="tabpanel" class="tab-pane" id="md"> 33 <div role="tabpanel" class="tab-pane" id="md">
36 <div class="js-paste-md"></div> 34 <div class="js-paste-md"></div>
37 </div> 35 </div>
38 </div> 36 </div>
39 </div></div></div> 37 </div>
40 38
41 <div class="row"><div class="col-xs-12"> 39 <%= form_for @paste, method: :delete, authenticity_token: false, html: { class: 'form-row' } do |f| %>
42 <%= form_for @paste, :method => :delete, :authenticity_token => false do |f| %> 40 <div class="col-auto my-1">
43 <div class="form-group form-group--narrow <%= error_class f.object, :key %>"> 41 <%= f.text_field :key,
44 <div class="input-group"> 42 value: nil,
45 <%= f.text_field :key, 43 placeholder: t('pastes.new.deletion_key'),
46 :value => nil, 44 autofocus: f.object.errors.any?,
47 :placeholder => t("pastes.new.deletion_key"), 45 autocomplete: 'off',
48 :autofocus => f.object.errors.any?, 46 class: "form-control w-auto #{error_class f.object, :key}"
49 :autocomplete => "off", 47 %>
50 :class => "form-control" 48 </div>
51 %>
52 49
53 <span class="input-group-btn"> 50 <div class="col-auto my-1">
54 <%= f.button t(".delete"), :class => "btn btn-danger" %> 51 <%= f.button t(".delete"), class: 'btn btn-danger' %>
55 </span> 52 </div>
53 <% end %>
54
55 <div class="row mt-4">
56 <% [
57 [t('.raw'), paste_path(@paste, :txt)],
58 [t('.derive'), root_path(:base => @paste)],
59 [t('.more'), root_path],
60 ].each do |label, url| %>
61 <div class="col-auto">
62 <%= link_to label, url %>
56 </div> 63 </div>
57 </div> 64 <% end %>
58 <% end %> 65 </div>
59 </div></div>
60
61 <ul class="nav nav-pills paste-show__footer">
62 <li role="presentation">
63 <%= link_to t(".raw"), paste_path(@paste, :txt) %>
64 </li>
65 <li role="presentation">
66 <%= link_to t(".derive"), root_path(:base => @paste) %>
67 </li>
68 <li role="presentation">
69 <%= link_to t(".more"), root_path %>
70 </li>
71 </ul>