Sha256: 9acdb69ce2295a623537843eafb2a8c269a035528c84176d4a08ce3be5d22812

Contents?: true

Size: 1.59 KB

Versions: 31

Compression:

Stored size: 1.59 KB

Contents

require 'rubygems'
require 'sinatra'
require 'json'
require File.dirname(__FILE__) + '/../lib/diffy'

blk = proc do
  Diffy::Diff.default_options.merge! JSON.parse(params[:options]) rescue {}
  haml "- d = Diffy::Diff.new(params[:one].to_s, params[:two].to_s)\n%div= d.to_s(:html)\n%pre= d.to_s"
end
post '/', &blk
get '/', &blk
__END__

@@ layout
%html
  %head
    :css
      .diff{overflow:auto;}
      .diff ul{background:#fff;overflow:auto;font-size:13px;list-style:none;margin:0;padding:0;display:table;width:100%;}
      .diff del, .diff ins{display:block;text-decoration:none;}
      .diff li{padding:0; display:table-row;margin: 0;height:1em;}
      .diff li.ins{background:#dfd; color:#080}
      .diff li.del{background:#fee; color:#b00}
      .diff li:hover{background:#ffc}
      .diff del, .diff ins, .diff span{white-space:pre-wrap;font-family:courier;}
      .diff del strong{font-weight:normal;background:#fcc;}
      .diff ins strong{font-weight:normal;background:#9f9;}
      .diff li.diff-comment { display: none; }
      .diff li.diff-block-info { background: none repeat scroll 0 0 gray; }
    %body
      = yield
      %form{:action => '', :method => 'post'}
        %label JSON diff options
        %textarea{:name => 'options', :style => 'width:100%;height:250px;'}= params[:options]
        %label One
        %textarea{:name => 'one', :style => 'width:100%;height:250px;'}= params[:one]
        %br/
        %label Two
        %textarea{:name => 'two', :style => 'width:100%;height:250px;'}= params[:two]
        %br/
        %input{:type => 'submit'}
        %br/

@@ index
%div.title Hello world!!!!!

Version data entries

31 entries across 31 versions & 3 rubygems

Version Path
diffy-3.4.3 spec/demo_app.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/diffy-3.4.2/spec/demo_app.rb
ydiffy-0.0.5 spec/demo_app.rb
ydiffy-0.0.4 spec/demo_app.rb
ydiffy-0.0.3 spec/demo_app.rb
diffy-3.4.2 spec/demo_app.rb
diffy-3.4.1 spec/demo_app.rb
diffy-3.4.0 spec/demo_app.rb
diffy-3.3.0 spec/demo_app.rb
diffy-3.2.1 spec/demo_app.rb
ydiffy-0.0.2 spec/demo_app.rb
diffy-3.2.0 spec/demo_app.rb
diffy-3.1.0 spec/demo_app.rb
diffy-3.0.7 spec/demo_app.rb
diffy-3.0.6 spec/demo_app.rb
diffy-3.0.5 spec/demo_app.rb
diffy-3.0.4 spec/demo_app.rb
diffy-3.0.3 spec/demo_app.rb
diffy-3.0.2 spec/demo_app.rb
diffy-3.0.1 spec/demo_app.rb