diff options
Diffstat (limited to 'templates/layout.html')
-rw-r--r-- | templates/layout.html | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/templates/layout.html b/templates/layout.html new file mode 100644 index 0000000..0545347 --- /dev/null +++ b/templates/layout.html @@ -0,0 +1,128 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8" /> + <link rel="stylesheet" href="http://960.gs/css/reset.css" /> + <link rel="stylesheet" href="http://960.gs/css/text.css" /> + <link rel="stylesheet" href="http://960.gs/css/960.css" /> + <link rel="stylesheet" type="text/css" media="all" href="{{url_for('static', filename='style.css')}}" /> + + <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> + <script type="text/javascript" src="{{url_for('static',filename='plupload/js/plupload.full.js')}}"></script> + + + <title>Fit</title> + </head> + <body> + <div id="header"> + <h1><a href="/">Fit</a></h1> + <p>git clone {{url_for('static', filename='fit.git', _external=True)}}</p> + + <form action="{{url_for('search')}}" method="get"> + <input type="text" name="search" placeholder="Search for tags" /> + <input type="submit" value="Search" /> + </form> + </div> + + <div id="content"> + <ul class="flashes"> + {% with messages = get_flashed_messages() %} + {% for message in messages %} + <li>{{ message }}</li> + {% endfor %} + {% endwith %} + </ul> + + <div id="container"> + <h2>Upload</h2> + <form id="upload-form" method="POST" enctype="multipart/form-data" action="/"> + <input type="file" name="file" /> + <input type="text" name="tags" /> + <input type="submit" /> + </form> + + <ul id="filelist"><li>No runtime found.</li></ul> + </div> + + {% block body %}{% endblock %} + + </div> + </body> +</html> + + +<script type="text/javascript"> +// Custom example logic +$(function() { + var uploader = new plupload.Uploader({ + runtimes : 'html5,flash,html4,silverlight', + browse_button : 'pickfiles', + container : 'container', + max_file_size : '10mb', + url : '{{url_for('index')}}', + flash_swf_url : '{{url_for('static',filename='plupload/js/plupload.flash.swf')}}', + silverlight_xap_url : '{{url_for('static',filename='plupload/js/plupload.silverlight.xap')}}', + multipart_params: {}, + filters : [ + {title : "Image files", extensions : "jpg,gif,png"}, + {title : "Zip files", extensions : "zip"} + ], + }); + + uploader.bind('Init', function(up, params) { + console.log("using runtime: " + params.runtime); + $('#upload-form').html('<p id="modern-form">'+ + ' <a id="pickfiles" href="#">Add files</a>|'+ + ' <a id="uploadfiles" href="#">Upload</a>'+ + '</p>'); + $('#filelist').html('<li id="no-files">No Files Added</li>'); + + }); + + $('#uploadfiles').live('click', function(e) { + uploader.start(); + e.preventDefault(); + }); + + uploader.init(); + + uploader.bind('BeforeUpload', function(up, file) { + uploader.settings.multipart_params.tags = $('input[name='+file.id +']').val(); + }); + + uploader.bind('FilesAdded', function(up, files) { + $('#no-files').remove() + $.each(files, function(i, file) { + $('#filelist').append( + '<li id="' + file.id + '">' + + '<label for="">' + + file.name + ' (' + plupload.formatSize(file.size) + ')' + + '</label>' + + '<input type="text" placeholder="Tag" name="'+file.id+'" />' + + '<b></b>' + + '</li>'); + }); + + up.refresh(); // Reposition Flash/Silverlight + }); + + uploader.bind('UploadProgress', function(up, file) { + $('#' + file.id + " input").attr('disabled', true); + $('#' + file.id + " b").html(file.percent + "%"); + }); + + uploader.bind('Error', function(up, err) { + $('#filelist').append("<div>Error: " + err.code + + ", Message: " + err.message + + (err.file ? ", File: " + err.file.name : "") + + "</div>" + ); + + up.refresh(); // Reposition Flash/Silverlight + }); + + uploader.bind('FileUploaded', function(up, file) { + console.log(file); + }); +}); +</script> |