couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject [2/2] fauxton commit: updated refs/heads/master to e1edbb4
Date Sat, 04 Oct 2014 13:41:36 GMT
Fix missing section name if deleting the first item

  - refetch collection and rerender view after a delete
  - use global Eventbus for config

closes COUCHDB-2321


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/e1edbb40
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/e1edbb40
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/e1edbb40

Branch: refs/heads/master
Commit: e1edbb402617aaa14178460c765ba975fed72bdc
Parents: 89c0dca
Author: Robert Kowalski <rok@kowalski.gd>
Authored: Mon Sep 8 15:41:34 2014 +0200
Committer: Robert Kowalski <rok@kowalski.gd>
Committed: Sat Oct 4 01:58:55 2014 +0200

----------------------------------------------------------------------
 app/addons/config/views.js | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e1edbb40/app/addons/config/views.js
----------------------------------------------------------------------
diff --git a/app/addons/config/views.js b/app/addons/config/views.js
index d6d9518..c59425c 100644
--- a/app/addons/config/views.js
+++ b/app/addons/config/views.js
@@ -17,10 +17,7 @@ define([
   "addons/fauxton/components"
 ],
 function(app, FauxtonAPI, Config, Components) {
-  var Views ={},
-      Events = {};
-
-  Views.Events = _.extend(Events, Backbone.Events);
+  var Views = {};
 
   Views.TableRow = FauxtonAPI.View.extend({
     tagName: "tr",
@@ -35,12 +32,18 @@ function(app, FauxtonAPI, Config, Components) {
       "keyup .js-value-input": "processKeyEvents"
     },
 
-    deleteValue: function (event) {
-      var result = confirm("Are you sure you want to delete this configuration value?");
+    deleteValue: function () {
+      var collection = this.collection,
+          result = confirm("Are you sure you want to delete this configuration value?");
 
       if (!result) { return; }
 
-      this.model.destroy();
+      this.model.destroy().done(function () {
+        collection.fetch({reset: true}).done(function () {
+          FauxtonAPI.Events.trigger("config:rerender");
+        });
+      });
+
       this.remove();
     },
 
@@ -113,7 +116,8 @@ function(app, FauxtonAPI, Config, Components) {
     },
 
     initialize: function(){
-      this.listenTo(Views.Events, "newSection", this.render);
+      this.listenTo(FauxtonAPI.Events, "config:newSection", this.render);
+      this.listenTo(FauxtonAPI.Events, "config:rerender", this.render);
     },
 
     addSection: function (event) {
@@ -195,8 +199,7 @@ function(app, FauxtonAPI, Config, Components) {
       }
 
       this.hide();
-      Views.Events.trigger("newSection");
-
+      FauxtonAPI.Events.trigger("config:newSection");
     },
 
     isUniqueEntryInSection: function (collection) {


Mime
View raw message