16d2f67a by Jeff Balicki

commit

1 parent 262fa897
1 // var pluginUrl = "http://localhost:8888/Forms"; 1 //var pluginUrl = "http://localhost:8888/Forms";
2 // var pdf_customizer = "http://localhost:8888/pdf-customizer/public"; 2 //var pdf_customizer = "http://localhost:8888/pdf-customizer/public";
3 3
4 4
5 var pluginUrl = "http://contact.gotenzing.com"; 5 var pluginUrl = "http://contact.gotenzing.com";
...@@ -101,21 +101,23 @@ function ShowBox(pheight, pwidth, up, right, height, width, count, example) { ...@@ -101,21 +101,23 @@ function ShowBox(pheight, pwidth, up, right, height, width, count, example) {
101 function HideBox() { 101 function HideBox() {
102 jQuery(document).ready(function($) { 102 jQuery(document).ready(function($) {
103 $('span').hide(); 103 $('span').hide();
104 console.log('hide');
105 var Qc = document.getElementById("Canvas");
106 var Qctx = Qc.getContext("2d");
107 Qctx.clearRect(0, 0, Qc.width, Qc.height);
108 Qctx.restore();
104 109
105 var cnv = document.getElementById("Canvas");
106 var ctx = cnv.getContext('2d'); // gets reference to canvas context
107 ctx.beginPath(); // clear existing drawing paths
108 ctx.save(); // store the current transformation matrix
109 }); 110 });
110 111
111 } 112 }
112 113
113 function HideBoxwithdate() { 114 function HideBoxwithdate() {
114 jQuery(document).ready(function($) { 115 jQuery(document).ready(function($) {
115 var cnv = document.getElementById("Canvas"); 116 var Qc = document.getElementById("Canvas");
116 var ctx = cnv.getContext('2d'); // gets reference to canvas context 117 var Qctx = Qc.getContext("2d");
117 ctx.beginPath(); // clear existing drawing paths 118 Qctx.clearRect(0, 0, Qc.width, Qc.height);
118 ctx.save(); // store the current transformation matrix 119 Qctx.restore();
120
119 }); 121 });
120 122
121 } 123 }
...@@ -180,7 +182,16 @@ function changePdfOptions(json) { ...@@ -180,7 +182,16 @@ function changePdfOptions(json) {
180 // '$(this)' refers to '$("#datepicker")' 182 // '$(this)' refers to '$("#datepicker")'
181 }); 183 });
182 184
183 $("#changes").validate(); 185 $("#changes").validate({
186 errorPlacement: function(error, element) {
187 var isFile = $(element).attr('type') == 'file';
188 if(isFile) {
189 error.insertAfter($(element).parent('label'));
190 } else {
191 error.insertAfter(element);
192 }
193 }
194 });
184 }); 195 });
185 196
186 var strVar2 = ""; 197 var strVar2 = "";
...@@ -188,9 +199,9 @@ function changePdfOptions(json) { ...@@ -188,9 +199,9 @@ function changePdfOptions(json) {
188 var pdfChange = ""; 199 var pdfChange = "";
189 var f = 0; 200 var f = 0;
190 201
191 var scaleImage = 400 / json[0].pwidth; 202 var scaleImage = 350 / json[0].pwidth;
192 var imageHeight = json[0].pheight * scaleImage; 203 var imageHeight = json[0].pheight * scaleImage;
193 var imageWidth = 400; 204 var imageWidth = 350;
194 console.log(json[0].pheight, scaleImage, imageHeight); 205 console.log(json[0].pheight, scaleImage, imageHeight);
195 206
196 pdflist += '<div id="pdfPreview" class="column">'; 207 pdflist += '<div id="pdfPreview" class="column">';
...@@ -295,9 +306,14 @@ function changePdfOptions(json) { ...@@ -295,9 +306,14 @@ function changePdfOptions(json) {
295 } else { 306 } else {
296 $(target).parent('label').find('.file-name').text(''); 307 $(target).parent('label').find('.file-name').text('');
297 } 308 }
309 $(target).parent('label').trigger('focus');
298 }); 310 });
299 311
300 312 $('.custom-file-input').keypress(function(event) {
313 if(event.which == 13) {
314 $(this).trigger('click');
315 }
316 });
301 $("#changes").submit(function(e) { 317 $("#changes").submit(function(e) {
302 e.preventDefault(); 318 e.preventDefault();
303 319
......