view app/views/pastes/show.html.erb @ 425:9369ad2f2ce8

Simplify logic
author nanaya <me@myconan.net>
date Mon, 26 Oct 2015 14:09:13 +0900
parents 967233b26404
children b2991317d4d7
line wrap: on
line source

<% provide :title, "Paste ##{@paste.id}" %>

<div class="row"><div class="col-xs-12">
  <ul class="nav nav-tabs" role="tablist">
    <% [
        { :title => t(".plain"), :target => "pl", :active => true },
        { :title => t(".highlight"), :target => "hl" },
        { :title => t(".markdown"), :target => "md" }
    ].each do |el| %>
      <li role="presentation" class="<%= "active" if el[:active] %>">
        <%= link_to el[:title], "##{el[:target]}",
            :data => { :toggle => "tab" },
            :aria => { :controls => el[:target] },
            :role => "tab",
            :class => "js-show-tab-#{el[:target]}"
        %>
      </li>
    <% end %>
  </ul>
</div></div>

<div class="row js-showing-paste"><div class="col-xs-12"><div class="paste-show">
  <div class="tab-content">
    <div role="tabpanel" class="tab-pane active" id="pl">
      <pre class="paste-show__content"><code class="js-paste-pl"><%= @paste.paste %></code></pre>
    </div>

    <div role="tabpanel" class="tab-pane" id="hl">
      <pre class="paste-show__content"><code class="js-paste-hl zp-hl lang-<%= @paste.language.try(:parameterize) %>"></code></pre>
    </div>

    <div role="tabpanel" class="tab-pane" id="md">
      <div class="js-paste-md"></div>
    </div>
  </div>
</div></div></div>

<div class="row"><div class="col-xs-12">
  <%= form_for @paste, :method => :delete, :authenticity_token => false do |f| %>
    <div class="form-group form-group--narrow <%= error_class f.object, :key %>">
      <div class="input-group">
        <%= f.text_field :key,
            :value => nil,
            :placeholder => t("pastes.new.deletion_key"),
            :autofocus => f.object.errors.any?,
            :class => "form-control"
        %>

        <span class="input-group-btn">
          <%= f.button t(".delete"), :class => "btn btn-danger" %>
        </span>
      </div>
    </div>
  <% end %>
</div></div>

<ul class="nav nav-pills paste-show__footer">
    <li role="presentation">
      <%= link_to t(".raw"), paste_path(@paste, :txt) %>
    </li>
    <li role="presentation">
      <%= link_to t(".derive"), root_path(:base => @paste) %>
    </li>
    <li role="presentation">
      <%= link_to t(".more"), root_path %>
    </li>
</ul>