diff --git a/lib/controllers/translate.js b/lib/controllers/translate.js index 854c101..0d5b9d0 100644 --- a/lib/controllers/translate.js +++ b/lib/controllers/translate.js @@ -139,5 +139,20 @@ module.exports = function (DIALECT_HTTP) { res.end('you are not authorized to perform that operation'); } }); + + app.post("/:locale/delete", authenticate, function (req, res) { + if (app.dynamicViewHelpers.can_approve(req, res)) { + dialect.store.collection.remove( + {_id: ObjectID.createFromHexString(req.param('id'))}, + function () { + res.writeHead(200); + res.end('ok'); + } + ); + } else { + res.writeHead(403); + res.end('you are not authorized to perform that operation'); + } + }); }; diff --git a/lib/public/css/global.css b/lib/public/css/global.css index 51114f1..ecae0c7 100644 --- a/lib/public/css/global.css +++ b/lib/public/css/global.css @@ -152,7 +152,7 @@ form { float:left; border: 1px solid #bbb; width: 938px; - height: 94px; + height: 110px; -moz-box-shadow: inset 1px 1px 0px #fff; -webkit-box-shadow:inset 1px 1px 0px #fff; box-shadow: inset 1px 1px 0px #fff; diff --git a/lib/public/js/global.js b/lib/public/js/global.js index 82964f6..cf3343a 100644 --- a/lib/public/js/global.js +++ b/lib/public/js/global.js @@ -105,6 +105,53 @@ $(function () { updateBars($text_bar, total, ok, pending, missing); updateLastStatus($textarea); }; + + deleteTranslation = function ($textarea, approve) { + var $form = $textarea.parent(), + $text_bar = $('h1.bars'), + parts = $text_bar.text().match(/[0-9]+/g), + ok, pending, missing, total; + + total = parts[0]; + ok = parts[1]; + pending = parts[2]; + missing = parts[3]; + + $.ajax({ + type: 'POST', + url: '/' + current_locale + '/delete/', + data: { + id: $textarea.prevAll('input').val() + }, + success: function () { + $textarea.busy('hide'); + $form.remove(); + }, + dataType: 'text' + }); + + $textarea.busy({title: 'saving...'}); + + total--; + classes = $form.attr('class').split(' '); + for (var i = 0; i