Sha256: 86ddf0657a733b95c9a8ae663e3fe335702344cb5ce914a2a4e354201d253a93

Contents?: true

Size: 1.57 KB

Versions: 1

Compression:

Stored size: 1.57 KB

Contents

script src="/lib/markdown/markdown.js"
script src="http://proger.i-forge.net/filedrop-min.js"

javascript:
  $(function(){
    var updatePreview = function(){
      $("#preview").html(markdown.toHTML($("#text-input").val()));
    };
    $(document).ready(updatePreview());
    $("#text-input").on("keyup", function(event){
      updatePreview();
    });

    var options = {iframe: {url: '/upload'}};
    var zone = new FileDrop('zone', options);
    zone.on.send.push(function(files){
      var unix_t = parseInt(new Date / 1000);
      for(var i=0; i<files.length;++i){
        name = unix_t + "." + files[i].name.split('.').pop().toLowerCase();
        files[i].name = name
        files[i].on.done.push(function(xhr,e){
          var input = $("#text-input").val() + "\n![" + name + "](/#{UPLOAD}/" + name + ")\n";
          $("#text-input").val(input);
          updatePreview();
        });
        files[i].on.error.push(function(e, xhr){
          alert(xhr.response);
        });
        files[i].SendTo('/upload');
      }
    });
  });

== slim :header

div.row-fluid
  div.span6
    form action="/edit" method="post" style="margin-top:20px;"
      div.row-fluid
        input type="text" name="name" value="#{@name}" class="span12 input" style="font-size: 24px;"
      fieldset#zone.row-fluid
        textarea name="body" id="text-input" style="border:0; box-shadow: none; height: 500px;" class="span12" #{@body}
      div.row-fluid
        input type="submit" value="作成/更新" class="btn btn-primary"
  div.span6#preview.well style="background: #fdfdfd; margin-top: 20px;"

== slim :tab_edit

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trahald-0.0.5 lib/views/edit.slim