couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From deathb...@apache.org
Subject couchdb commit: updated refs/heads/2128-autocomplete-section-name to 35b3011
Date Wed, 05 Mar 2014 22:11:43 GMT
Repository: couchdb
Updated Branches:
  refs/heads/2128-autocomplete-section-name 9482eed3b -> 35b3011d2


Added Validation so that the config name is unique.


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

Branch: refs/heads/2128-autocomplete-section-name
Commit: 35b3011d22e9df0f4b4fa1dc3276a47894b3a5ad
Parents: 9482eed
Author: suelockwood <deathbear@apache.org>
Authored: Wed Mar 5 17:11:38 2014 -0500
Committer: suelockwood <deathbear@apache.org>
Committed: Wed Mar 5 17:11:38 2014 -0500

----------------------------------------------------------------------
 src/fauxton/app/addons/config/resources.js |  4 ++--
 src/fauxton/app/addons/config/views.js     | 28 ++++++++++++++++---------
 2 files changed, 20 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/35b3011d/src/fauxton/app/addons/config/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/config/resources.js b/src/fauxton/app/addons/config/resources.js
index 275867d..4ee46c5 100644
--- a/src/fauxton/app/addons/config/resources.js
+++ b/src/fauxton/app/addons/config/resources.js
@@ -13,10 +13,10 @@
 define([
   "app",
   "api",
-  "addons/fauxton/components"
+
 ],
 
-function (app, FauxtonAPI, Components) {
+function (app, FauxtonAPI) {
 
   var Config = FauxtonAPI.addon();
   var Events = {};

http://git-wip-us.apache.org/repos/asf/couchdb/blob/35b3011d/src/fauxton/app/addons/config/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/config/views.js b/src/fauxton/app/addons/config/views.js
index a7d0499..19670ff 100644
--- a/src/fauxton/app/addons/config/views.js
+++ b/src/fauxton/app/addons/config/views.js
@@ -13,10 +13,11 @@
 define([
   "app",
   "api",
-  "addons/config/resources"
+  "addons/config/resources",
+  "addons/fauxton/components"
 
 ],
-function(app, FauxtonAPI, Config) {
+function(app, FauxtonAPI, Config, Components) {
   var Views ={};
 
 
@@ -147,12 +148,13 @@ function(app, FauxtonAPI, Config) {
       Config.Events.trigger("newSection");
 
     },
-    isNew: function(){
+    isNew: function(collection){
       var section = this.$('input[name="section"]').val(),
-          name = this.$('input[name="name"]').val(),
-          sectionFilter = _.find(this.sourceArray, function(item){ return item === section;
});
-          console.log(sectionFilter);
-          return false;
+          name = this.$('input[name="name"]').val()
+          var section = _.findWhere(collection.toJSON(), {"section":section});
+          var options = _.findWhere(section.options, {name: name});
+          
+          return options;
     },
     isSection: function(){
       var section = this.$('input[name="section"]').val();
@@ -162,7 +164,8 @@ function(app, FauxtonAPI, Config) {
       event.preventDefault();
       var section = this.$('input[name="section"]').val(),
           name = this.$('input[name="name"]').val(),
-          value = this.$('input[name="value"]').val();
+          value = this.$('input[name="value"]').val(),
+          collection = this.collection;
 
       if(!this.isSection()){
         FauxtonAPI.addNotification({
@@ -185,8 +188,13 @@ function(app, FauxtonAPI, Config) {
           clear: true,
           selector: ".form-error-config"
         });
-      } else if (this.isNew()){
-        console.log("nooo");
+      } else if (this.isNew(collection)){
+        FauxtonAPI.addNotification({
+          msg: "Must have a unique name",
+          type: "error",
+          clear: true,
+          selector: ".form-error-config"
+        });
       } else {
         this.submitForm();
       }


Mime
View raw message