# HG changeset patch # User Edho Arief # Date 1352698059 -25200 # Node ID a949b71c9afb8ea8fadd2965c517224cf879de46 # Parent c6af63fc16ab435688613c3709446f1d51a9a003 Allows paste content width resize. diff -r c6af63fc16ab -r a949b71c9afb app/assets/javascripts/application.js --- a/app/assets/javascripts/application.js Mon Nov 12 11:42:26 2012 +0700 +++ b/app/assets/javascripts/application.js Mon Nov 12 12:27:39 2012 +0700 @@ -13,6 +13,7 @@ //= require jquery //= require jquery_ujs //= require twitter/bootstrap/tab +//= require twitter/bootstrap/dropdown //= require prettify //= require marked //= require jquery.autosize diff -r c6af63fc16ab -r a949b71c9afb app/assets/javascripts/init.tabs.js --- a/app/assets/javascripts/init.tabs.js Mon Nov 12 11:42:26 2012 +0700 +++ b/app/assets/javascripts/init.tabs.js Mon Nov 12 12:27:39 2012 +0700 @@ -9,4 +9,16 @@ mode = window.location.hash.substr(1); if (mode == 'highlight') { $('#paste-tabs li:eq(1) a').click(); } else if (mode == 'markdown') { $('#paste-tabs li:eq(2) a').click(); } + + $('#tab-resize ul a').click(function() { + var size = $(this).data('size'), + paste = $('#paste'), + title = $('#tab-resize a.btn'); + title.html(title.html().replace(/(Width: ).*\n/, '$1' + size + '\n')); + if (size == 'full') { + paste.css('width', ''); + } else { + paste.css('width', size); + } + }); }); diff -r c6af63fc16ab -r a949b71c9afb app/views/pastes/show.html.erb --- a/app/views/pastes/show.html.erb Mon Nov 12 11:42:26 2012 +0700 +++ b/app/views/pastes/show.html.erb Mon Nov 12 12:27:39 2012 +0700 @@ -9,8 +9,22 @@
  • <%= link_to 'Plain', '#plain', :data => { :toggle => 'tab' } %>
  • <%= link_to 'Highlight', '#highlight', :data => { :toggle => 'tab' } %>
  • <%= link_to 'Markdown', '#markdown', :data => { :toggle => 'tab' } %>
  • +
  • + +
  • -
    +
    <%= @paste.paste %>