couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxepal <...@git.apache.org>
Subject [GitHub] couchdb pull request: CouchDB- 2128 Config Section dropdown
Date Fri, 14 Mar 2014 01:37:46 GMT
Github user kxepal commented on a diff in the pull request:

    https://github.com/apache/couchdb/pull/178#discussion_r10594277
  
    --- Diff: src/fauxton/app/addons/config/views.js ---
    @@ -111,34 +168,58 @@ function (app, FauxtonAPI, Config) {
             });
           }
     
    -      this.$("#add-section-modal").modal('hide');
    -      this.render();
    -    },
    +      this.hide();
    +      Views.Events.trigger("newSection");
     
    -    addSection: function (event) {
    +    },
    +    isNew: function(collection){
    +      var sectionName = this.$('input[name="section"]').val(),
    +          name = this.$('input[name="name"]').val();
    +          var section = _.findWhere(collection.toJSON(), {"section":sectionName});
    +          var options = _.findWhere(section.options, {name: name});
    +          
    +          return options;
    +    },
    +    isSection: function(){
    +      var section = this.$('input[name="section"]').val();
    +      return _.find(this.sourceArray, function(item){ return item === section; });
    +    },
    +    validate: function (event){
           event.preventDefault();
    -      this.$("#add-section-modal").modal({show:true});
    +      var section = this.$('input[name="section"]').val(),
    +          name = this.$('input[name="name"]').val(),
    +          value = this.$('input[name="value"]').val(),
    +          collection = this.collection;
    +
    +      if(!this.isSection()){
    +         this.errorMessage("You need to use an existing section.");
    +      } else if (!name) {
    +        this.errorMessage("Add a name.");
    +      } else if (!value) {
    +        this.errorMessage("Add a value");
    --- End diff --
    
    `Add a name.`, but `Add a value`. May be get rid all trailing dots or set them to all
messages for consistency?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message