diff options
Diffstat (limited to 'share/www/script')
-rw-r--r-- | share/www/script/futon.browse.js | 15 | ||||
-rw-r--r-- | share/www/script/jquery.couch.js | 10 |
2 files changed, 25 insertions, 0 deletions
diff --git a/share/www/script/futon.browse.js b/share/www/script/futon.browse.js index 39f38365..e962ee9c 100644 --- a/share/www/script/futon.browse.js +++ b/share/www/script/futon.browse.js @@ -138,6 +138,20 @@ }); } + this.compactView = function() { + var groupname = page.viewName.substring(8, + page.viewName.indexOf('/_view')); + $.showDialog("dialog/_compact_view.html", { + submit: function(data, callback) { + db.compactView(groupname, { + success: function(resp) { + callback(); + } + }); + } + }); + } + this.deleteDatabase = function() { $.showDialog("dialog/_delete_database.html", { submit: function(data, callback) { @@ -638,6 +652,7 @@ options.endkey = options.descending ? "_design" : "_design0"; db.allDocs(options); } else { + $("button.compactview").show(); $("#viewcode").show(); var currentMapCode = $("#viewcode_map").val(); var currentReduceCode = $.trim($("#viewcode_reduce").val()) || null; diff --git a/share/www/script/jquery.couch.js b/share/www/script/jquery.couch.js index ab1a7a00..05b3af79 100644 --- a/share/www/script/jquery.couch.js +++ b/share/www/script/jquery.couch.js @@ -111,6 +111,16 @@ "The database could not be compacted" ); }, + compactView: function(groupname, options) { + $.extend(options, {successStatus: 202}); + ajax({ + type: "POST", url: this.uri + "_compact/" + groupname, + data: "", processData: false + }, + options, + "The view could not be compacted" + ); + }, create: function(options) { $.extend(options, {successStatus: 201}); ajax({ |