Permalink
Browse files

Add admin button for approving new items

  • Loading branch information...
1 parent bc6502e commit 1b4d4c2e3c84bdf99ab38e10671d5378375735c9 @cubehouse cubehouse committed Sep 10, 2013
Showing with 32 additions and 0 deletions.
  1. +32 −0 js/admin.js
View
@@ -261,6 +261,38 @@ define(["config", "popup", "api", "msg", "items", "forms", "jquery", "jqueryui/s
);
}
+ // moderate add items
+ if (_config.settings.database_admin && list.type=="cat" && data && data.items && data.items.length) {
+ var isMods = false;
+ for(var ij=0; ij<data.items.length; ij++) {
+ if (data.items[ij].hidden) isMods = true;
+ }
+ if (isMods) {
+ menus.push(
+ {
+ name: "Approve new items",
+ func: function() {
+ // send new order to server automagically upon dropping an item
+ api.post("admin/moderate/add_items", {
+ cat_id: data.id
+ }, function(response) {
+ // show error/success message
+ if (response.error) {
+ msg.error(response.error);
+ } else {
+ msg.success(response.success);
+ }
+
+ // reload list
+ if (list.reload) list.reload();
+ });
+ return false;
+ }
+ }
+ );
+ }
+ }
+
// reorder items
if (_config.settings.database_scan && list.type=="cat" && data && data.items && data.cats && (data.items.length || data.cats.length) ) {
menus.push(

0 comments on commit 1b4d4c2

Please sign in to comment.