UNPKG

casbah

Version:

Contract Administration Site * Be Architecural Heroes *

136 lines (107 loc) 3.61 kB
<!doctype html> <style> .picBox{ max-height:400px; max-width:100%;} .columns2{column-count:2;} .columns4{column-count:4;} .checklistArch{column-count:4; line-height: 120%;font-size:10pt;} .topMarginZero{margin-top:0;} @media print { div.panel, div.panel-default { page-break-after: always !important; } } .segoe, h1, h2, h3, h4{font-family:segoe UI, sans-serif;} </style> <script type='text/javascript'> //ensure project number set. What about empty uploads folder ie. uninitialized if (typeof localStorage.getItem("project_number")=="undefined") { var pnum=prompt("Project number"); if (pnum!=="" && pnum!=null) {localStorage.getItem("project_number", pnum)} } //handlebars template engine setup Handlebars.registerHelper("chop_extension", function(str, options){ str=str.substring(0,str.indexOf(".")); str=str.substring(str.lastIndexOf("\\")+1); return str; }); Handlebars.registerHelper("collection_item_head", function(str, options){ return collection.item_head; }); Handlebars.registerHelper("collection_item_title", function(str, options){ return collection.item_title; }); Handlebars.registerHelper("collection_comment", function(str, options){ return collection.item_comment; }); Handlebars.registerHelper("plusOne", function(val,options){return parseInt(val)+1;}); //////////////////////////////// var collection={}; collection.item_comment=$("#collection_item_comment").html(); collection.item_head=$("#collection_item_head").html(); collection.item_title=$("#collection_item_title").html(); collection.refresh=function(){ //get images for deficiencySheets then //refresh with success function()... $.ajax({ contentType: "application/x-www-form-urlencoded; charset=UTF-8", data: jQuery.param({ command:"IMAGES", collection_name:localStorage("collection_name") }), error:function(err){console.log("Error getting collection:",err);}, success:function(result){ if(typeof result.images=="undefined") result.images=[]; var html=collection.template(result); $("#collection_placeholder").html(html); }, type: "POST", url: "/gallery" }); }; collection.template=Handlebars.compile($("#collection_template").html()); //render page collection.refresh(); </script> <div id="collection_placeholder"></div> <template id="collection_template" type="text/x-handlebars-template"> <div class="container"> {{#each images}} <div class="panel panel-default page"> {{{collection_head}}} <div class="panel-heading"><h4>{{{chop_extension this}}}</h4></div> <div class="panel-body"> {{{collection_item_title}}} {{{collection_item_comment}}} <h3 class="topMarginZero">Plan</h3> <div class="col-xs-10"><img class="picBox" src="{{this}}" ></img></div> </div> <!-- div class="panel-footer"></div--> </div> {{/each}} </div> </template> <template id="collection_item_head" type="text/x-handlebars-template"> <div class="row"> <div class="col-xs-9"><img src="/uploads/logo.png"></div> <div class="col-xs-3"><h2 class="topMarginZero segoe">Collection</h2></div> </div> </template> <template id="collection_item_title" type="text/x-handlebars-template"> <div class="row"> <span class="col-xs-3"> </span> <span class="col-xs-3"> </span> <span class="col-xs-3"> </span> <span class="col-xs-3"> </span> </div> </template> <template id="collection_item_comment" type="text/x-handlebars-template"> <h3 class="topMarginZero">Comment</h3> <hr> <hr> <hr> <hr> <hr> <hr> <hr> <hr> </template>