some little updates

This commit is contained in:
Martin Donnelly 2016-03-21 13:47:26 +00:00
parent 01fa7b4495
commit 7564136a67
4 changed files with 302 additions and 278 deletions

View File

@ -56,6 +56,8 @@ var Keeper = (function () {
var html = new EJS({url: 'partials/view.ejs'}).render(vdata);
$bodyContents.empty();
$bodyContents.scrollTop(0);
$bodyContents.append(html);
$('#redo').on('click', function () {

View File

@ -6,7 +6,7 @@
<span id="visualTabs">
<span class="lnr lnr-tag"></span>
<% for(var i=0; i<data.tags.list.length; i++) {%>
<a class="mui--text-dark mui--text-button" href="#?<%=data.tags.list[i]%>"><%=data.tags.list[i]%></a>
<a class="mui--text-dark-secondary mui--text-button" href="#?<%=data.tags.list[i]%>"><%=data.tags.list[i]%></a>
<% } %>
<span class="lnr lnr-pencil" id="tageditmode"></span>
</span>

View File

@ -28,8 +28,8 @@ gulp.task('scripts', function() {
.pipe(concat('main.js'))
/*.pipe(gulp.dest('dist/js'))*/
/*.pipe(rename({suffix: '.min'}))*/
/* .pipe(uglify())*/
.pipe(concat('app.js'))
.pipe(uglify({mangle: false}))
.pipe(gulp.dest('dist/js'))
.pipe(notify({ message: 'Scripts task complete' }));
});

View File

@ -89,36 +89,48 @@ function updateBookmark(obj, _id, _rev) {
return;
} else {
logger.info('I think we updated ok...');
busEmitter.emit("updateTagsDB");
}
});
logger.debug('Update done..');
}
var doInsertBookmark = (obj) => {
var doInsertBookmark = (obj) =>
{
// logger.info('sendSocket: ' + JSON.stringify(obj));
insertBookmark(obj);
};
var doUpdateBookmark = (obj, _id, _rev) => {
var doUpdateBookmark = (obj, _id, _rev) =>
{
// logger.info('sendSocket: ' + JSON.stringify(obj));
updateBookmark(obj, _id, _rev);
};
var doGetBookmark = (obj) => {
var doGetBookmark = (obj) =>
{
// logger.info('sendSocket: ' + JSON.stringify(obj));
genericGrab(obj);
};
var doGetBookmarkRedo = (obj) => {
var doGetBookmarkRedo = (obj) =>
{
// logger.info('sendSocket: ' + JSON.stringify(obj));
genericGrab(obj);
};
var doGetBookmarkRes = (url, res) => {
var doGetBookmarkRes = (url, res) =>
{
logger.debug('doGetBookmarkRes');
// logger.info('sendSocket: ' + JSON.stringify(obj));
genericGrab(url, res);
};
var doUpdateTagsDB = () =>
{
logger.debug('Update the tags database...');
}
// Events
busEmitter.on('saveBookmarkData', doInsertBookmark);
busEmitter.on('updateBookmarkData', doUpdateBookmark);
@ -126,6 +138,8 @@ busEmitter.on('getBookmark', doGetBookmark);
busEmitter.on('getBookmarkRes', doGetBookmarkRes);
busEmitter.on('getBookmarkRedo', doGetBookmarkRedo);
busEmitter.on('updateTagsDB', doUpdateTagsDB);
function processBody(body, url, _id, _rev) {
@ -340,11 +354,22 @@ router.post('/tags', function(req,res) {
obj.title = body.title;
obj.tags = req.body.tags;
logger.debug(util.inspect(obj));
logger.info('Updating...');
busEmitter.emit("updateBookmarkData", obj, body._id, body._rev);
busEmitter.emit("updateBookmarkData", obj, body._id, body._rev, res);
var outJSON = {};
outJSON._id = body._id;
outJSON._rev = body._rev;
outJSON.title = body.title;
outJSON.reduced = body.reduced;
outJSON.url = body.url;
outJSON.tags = req.body.tags;
//logger.debug(util.inspect(body));
res.writeHead(200, {"ContentType": "application/json"});
res.end(JSON.stringify(outJSON));
}
else {
res.writeHead(500, {"ContentType": "application/json"});
@ -352,11 +377,8 @@ router.post('/tags', function(req,res) {
}
});
});
router.post('/redo', function (req, res) {
logger.debug('redoing entry..');