Skip to content

Commit

Permalink
Revert "Develop 0.2.0"
Browse files Browse the repository at this point in the history
  • Loading branch information
martinavagyan authored Mar 27, 2017
1 parent 378cdc4 commit ccedbd8
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 74 deletions.
8 changes: 2 additions & 6 deletions public/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ html {
}

.unselectable {
-webkit-user-select: none; /* Chrome/Safari */
-webkit-user-select: none; /* Chrome/Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+ */
/* Rules below not implemented in browsers yet */
Expand Down Expand Up @@ -109,8 +109,4 @@ body {

.page-header {
margin-top: 0;
}

#creatorFormLoading {
margin-left: 200px;
}
}
Binary file removed public/img/loading.gif
Binary file not shown.
3 changes: 0 additions & 3 deletions public/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,5 @@ requirejs.config({
'jspdf': 'lib/jspdf.min',
'pdfmake': 'lib/pdfmake.min',
'vfs_fonts': 'lib/vfs_fonts',
},
shim: {
'vfs_fonts': ['pdfmake']
}
});
29 changes: 4 additions & 25 deletions public/js/medid/creator.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ define(['jquery'], function($) {
},
downloadMethod: function (downloadFnc) {
this.downloadPDF = downloadFnc;
},
message: $('#message')
}
}

// Retrieval method for the field data
Expand Down Expand Up @@ -47,17 +46,6 @@ define(['jquery'], function($) {
});
}

creator.flashSaveSuccess = function () {
creator.message.hide();
creator.message.text("Data successfully stored");
creator.message.fadeIn();
setTimeout(function () {
creator.message.fadeOut(function () {
creator.message.val("");
});
}, 1000);
}

// Button listeners
$('.downloadPDF').on('click', function () {
// Call the function provided by the document-specific engine to download
Expand Down Expand Up @@ -92,17 +80,10 @@ define(['jquery'], function($) {
type: 'POST',
data: JSON.stringify(creator.fields()),
contentType: 'application/json',
url: creator.saveEndpoint,
success: function(data) {
if (data.status == "success") {
creator.flashSaveSuccess();
}
}
url: creator.saveEndpoint
});
});



/* This method must be called by the document-specific
* controller when it is initialized itself.
* This method checks for any user data.
Expand All @@ -112,13 +93,11 @@ define(['jquery'], function($) {
console.log("Error: no endpoint found for saving this document!")
} else {
$.getJSON(creator.saveEndpoint, function(data) {
console.log(data);
creator.table.html("") // Empty table to insert user fields
for (i = 0; i < data.length; i++) {
creator.addField(data[i].label, data[i].field);
}
/* Only show the form once it is loaded */
$('#creatorFormLoading').fadeOut(function () {
$('#creatorForm').slideDown();
});
});
}
}
Expand Down
9 changes: 4 additions & 5 deletions routes/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ router.post('/card', function(req, res){
if(err) throw err;
});
// req.flash('success_msg', 'Data successfully stored');
// console.log(req.user); // for testing
res.json({status: "success"});
console.log(req.user); // for testing
res.end();
});

router.post('/document', function(req, res){
Expand All @@ -22,13 +22,12 @@ router.post('/document', function(req, res){
if(err) throw err;
});
// req.flash('success_msg', 'Data successfully stored');
// console.log(req.user); // for testing
res.json({status: "success"});
console.log(req.user); // for testing
res.end();
});

router.get('/document', function(req, res) {
if (req.user) {
console.log(req.user.document);
res.json(req.user.document);
} else {
res.sendFile('json/guestDocument.json', {root: __dirname + '/../public/'});
Expand Down
30 changes: 13 additions & 17 deletions views/create/card.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,20 @@
{{/unless}}
<p>Click 'Create' to view how the card will look. You will have the option to return and make changes, or download the card.</p>
<p>For the emergency contacts, you may leave the name blank. For optimal results, please do fill in all other fields.</p>
<img src='/img/loading.gif' id='creatorFormLoading' /><br />
<div id='creatorForm' style='display: none' >
<table id='fields'>
<thead>
<tr><td>Label</td><td>Text</td></tr>
</thead>
<tbody>
<table id='fields'>
<thead>
<tr><td>Label</td><td>Text</td></tr>
</thead>
<tbody>

</tbody>
</table>
<p>
<input type='button' value='Create' class="showPDF"/>
{{#if user}}
<input type='button' value='Save' class="save"/>
{{/if}}
<span id='message'></span>
</p>
</div>
</tbody>
</table>
<p>
<input type='button' value='Create' class="showPDF"/>
{{#if user}}
<input type='button' value='Save' class="save"/>
{{/if}}
</p>
</div>
</div>
</div>
Expand Down
30 changes: 12 additions & 18 deletions views/create/document.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,19 @@
{{/unless}}
<p>Click 'Create' to view how the document will look. You will have the option to return and make changes, or download the document.</p>
<p>To create a field without a label, keep the label blank. Be concise in the labels, the maximum length for labels is 15 characters. The maximum length for text is 200 characters.</p>
<img src='/img/loading.gif' id='creatorFormLoading' /><br />
<div id='creatorForm' style='display: none' >
<table id='fields'>
<thead>
<tr><td>Label</td><td>Text</td></tr>
</thead>
<tbody>
<table id='fields'>
<thead>
<tr><td>Label</td><td>Text</td></tr>
</thead>
<tbody>

</tbody>
</table><br />
<p>
<input type='button' value='Add field' class='addField' />
<input type='button' value='Create' class='showPDF' />
{{#if user}}
<input type='button' value='Save' class="save"/>
{{/if}}
<span id='message' style='color: green'></span>
</p>
</div>
</tbody>
</table><br />
<input type='button' value='Add field' class='addField' />
<input type='button' value='Create' class='showPDF' />
{{#if user}}
<input type='button' value='Save' class="save"/>
{{/if}}
</div>
</div>
</div>
Expand Down

0 comments on commit ccedbd8

Please sign in to comment.