changeset 261:f057e8c78e50

Fix /show.
author edogawaconan <me@myconan.net>
date Tue, 15 Oct 2013 22:40:08 +0900
parents c4aba8990c5e
children 45bd94c70896
files app/assets/javascripts/boot.js app/assets/javascripts/zp.emul_radio.js app/assets/javascripts/zp.viewer_width.js app/assets/stylesheets/pastes.css app/views/pastes/show.html.erb
diffstat 5 files changed, 49 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/app/assets/javascripts/boot.js	Tue Oct 15 21:52:08 2013 +0900
+++ b/app/assets/javascripts/boot.js	Tue Oct 15 22:40:08 2013 +0900
@@ -1,9 +1,11 @@
 //= require zp.init
+//= require zp.emul_radio
 //= require zp.formatter
 //= require zp.viewer_width
 //= require zp.hash_magic
 //= require zp.new
 $(document).ready(function() {
+  zp.emul_radio.init()
   zp.formatter.init()
   zp.viewer_width.init()
   zp.hash_magic.init()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/assets/javascripts/zp.emul_radio.js	Tue Oct 15 22:40:08 2013 +0900
@@ -0,0 +1,10 @@
+(function($) {
+  window.zp.emul_radio = {
+    do_switch: function(e) {
+      $(e.target).siblings().removeClass("active")
+    },
+    init: function() {
+      $(".emul-radio > a").click(this.do_switch)
+    }
+  }
+})(jQuery)
--- a/app/assets/javascripts/zp.viewer_width.js	Tue Oct 15 21:52:08 2013 +0900
+++ b/app/assets/javascripts/zp.viewer_width.js	Tue Oct 15 22:40:08 2013 +0900
@@ -6,7 +6,8 @@
       var
         paste = $("#paste"),
         title = $("#paste-resize .btn")
-      title.text(title.data("base").replace(":size:", width))
+        title_span = $("#width-text")
+      title_span.text(title.data("base").replace(":size:", width))
       this.current = width
       if (width == "auto") {
         paste.css("width", "")
--- a/app/assets/stylesheets/pastes.css	Tue Oct 15 21:52:08 2013 +0900
+++ b/app/assets/stylesheets/pastes.css	Tue Oct 15 22:40:08 2013 +0900
@@ -9,3 +9,7 @@
 #pl > pre {
   word-break: normal;
 }
+
+.row {
+  margin-bottom: 20px;
+}
--- a/app/views/pastes/show.html.erb	Tue Oct 15 21:52:08 2013 +0900
+++ b/app/views/pastes/show.html.erb	Tue Oct 15 22:40:08 2013 +0900
@@ -10,27 +10,29 @@
   <h1><%= content_for :title %></h1>
 </div>
 
-<div id="paste-show" class="tabbable" data-id="<%= @paste.id %>">
-  <div class="btn-toolbar">
-    <div id="paste-mode" class="btn-group" data-toggle="buttons-radio">
-      <%= link_to 'Plain', '#pl', :data => { :toggle => 'tab' }, :class => 'btn active' %>
-      <%= link_to 'Highlight', '#hl', :data => { :toggle => 'tab' }, :class => 'btn' %>
-      <%= link_to 'Markdown', '#md', :data => { :toggle => 'tab' }, :class => 'btn' %>
+<div id="paste-show" data-id="<%= @paste.id %>">
+  <div class="row"><div class="col-lg-12">
+    <div class="btn-toolbar">
+      <div id="paste-mode" class="btn-group emul-radio" data-toggle="buttons">
+        <%= link_to 'Plain', '#pl', :data => { :toggle => 'tab' }, :class => 'btn btn-default active' %>
+        <%= link_to 'Highlight', '#hl', :data => { :toggle => 'tab' }, :class => 'btn btn-default' %>
+        <%= link_to 'Markdown', '#md', :data => { :toggle => 'tab' }, :class => 'btn btn-default' %>
+      </div>
+      <div class="btn-group" id="paste-resize">
+        <a class="btn btn-default dropdown-toggle" data-toggle="dropdown" data-base="Width: :size:" href="#">
+          <span id="width-text">Width: auto</span>
+          <span class="caret"></span>
+        </a>
+        <ul class="dropdown-menu">
+          <li><a href="#">auto</a></li>
+          <li><a href="#">560px</a></li>
+          <li><a href="#">760px</a></li>
+          <li><a href="#">960px</a></li>
+        </ul>
+      </div>
     </div>
-    <div class="btn-group" id="paste-resize">
-      <a class="btn dropdown-toggle" data-toggle="dropdown" data-base="Width: :size:" href="#">
-        Width: auto
-        <span class="caret"></span>
-      </a>
-      <ul class="dropdown-menu">
-        <li><a href="#">auto</a></li>
-        <li><a href="#">560px</a></li>
-        <li><a href="#">760px</a></li>
-        <li><a href="#">960px</a></li>
-      </ul>
-    </div>
-  </div>
-  <div id="paste" class="tab-content">
+  </div></div>
+  <div class="row"><div id="paste" class="col-lg-12 tab-content">
     <div class="tab-pane active" id="pl">
       <pre><%= @paste.paste %></pre>
     </div>
@@ -40,15 +42,19 @@
     <div class="tab-pane" id="md">
       <div class="well"></div>
     </div>
-  </div>
+  </div></div>
 </div>
 
-<div class="input-append">
+<div class="row"><div class="col-md-4">
   <%= form_for @paste, :method => :delete do |f| %>
-    <%= f.text_field :key, :value => nil, :placeholder => 'Deletion key', :autofocus => !flash[:error].blank? %>
-    <%= f.submit 'Delete this paste', :class => 'btn btn-danger' %>
+    <div class="input-group">
+      <%= f.text_field :key, :value => nil, :placeholder => 'Deletion key', :class => "form-control", :autofocus => !flash[:error].blank? %>
+      <span class="input-group-btn">
+        <%= f.submit 'Delete this paste', :class => 'btn btn-danger' %>
+      </span>
+    </div>
   <% end %>
-</div>
+</div></div>
 
 <div>
   <ul class="nav nav-pills">