Panel will allow an empty doc name, leading to saving "_design"
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/84cf21ab Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/84cf21ab Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/84cf21ab Branch: refs/heads/1960-paginate-all_dbs Commit: 84cf21ab5e8852bd6bae5f2e49797a5d960910d3 Parents: 2996574 Author: suelockwood <[email protected]> Authored: Thu Dec 19 13:46:59 2013 -0500 Committer: suelockwood <[email protected]> Committed: Thu Dec 19 13:46:59 2013 -0500 ---------------------------------------------------------------------- src/fauxton/app/modules/documents/routes.js | 2 +- src/fauxton/app/modules/documents/views.js | 9 ++++++--- .../app/templates/documents/design_doc_selector.html | 6 +++--- src/fauxton/assets/less/fauxton.less | 7 +++++-- 4 files changed, 15 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/84cf21ab/src/fauxton/app/modules/documents/routes.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/modules/documents/routes.js b/src/fauxton/app/modules/documents/routes.js index 9a4c4ee..b8b74b6 100644 --- a/src/fauxton/app/modules/documents/routes.js +++ b/src/fauxton/app/modules/documents/routes.js @@ -47,7 +47,7 @@ function(app, FauxtonAPI, Documents, Databases) { routes: { // We are hiding the field_editor for this first release - //"database/:database/:doc/field_editor": "field_editor", + // "database/:database/:doc/field_editor": "field_editor", "database/:database/:doc/code_editor": "code_editor", "database/:database/:doc": "code_editor" }, http://git-wip-us.apache.org/repos/asf/couchdb/blob/84cf21ab/src/fauxton/app/modules/documents/views.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/modules/documents/views.js b/src/fauxton/app/modules/documents/views.js index 44cf484..9f95686 100644 --- a/src/fauxton/app/modules/documents/views.js +++ b/src/fauxton/app/modules/documents/views.js @@ -1148,7 +1148,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum }, updateDesignDoc: function () { - if (this.$('#ddoc :selected').prop('id') === 'new-doc') { + if (this.newDesignDoc()) { this.$('#new-ddoc-section').show(); } else { this.$('#new-ddoc-section').hide(); @@ -1156,9 +1156,12 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum }, newDesignDoc: function () { - return this.$('#ddoc :selected').prop('id') === 'new-doc'; + return this.$('#ddoc').val() === 'new-doc'; }, + newDocValidation: function(){ + return this.newDesignDoc() && this.$('#new-ddoc').val()===""; + }, getCurrentDesignDoc: function () { if (this.newDesignDoc()) { var doc = { @@ -1169,7 +1172,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum var ddoc = new this.DocModel(doc, {database: this.database}); this.collection.add(ddoc); return ddoc; - } else { + } else if ( !this.newDesignDoc() ) { var ddocName = this.$('#ddoc').val(); return this.collection.find(function (ddoc) { return ddoc.id === ddocName; http://git-wip-us.apache.org/repos/asf/couchdb/blob/84cf21ab/src/fauxton/app/templates/documents/design_doc_selector.html ---------------------------------------------------------------------- diff --git a/src/fauxton/app/templates/documents/design_doc_selector.html b/src/fauxton/app/templates/documents/design_doc_selector.html index 457b76c..7bbe310 100644 --- a/src/fauxton/app/templates/documents/design_doc_selector.html +++ b/src/fauxton/app/templates/documents/design_doc_selector.html @@ -15,12 +15,12 @@ the License. <label for="ddoc">Save to Design Document <a href="<%=getDocUrl('design_doc')%>" target="_blank"><i class="icon-question-sign"></i></a></label> <select id="ddoc"> <optgroup label="Select a document"> - <option id="new-doc">New document</option> + <option value="new-doc">New document</option> <% ddocs.each(function(ddoc) { %> <% if (ddoc.id === ddocName) { %> - <option selected="selected"><%= ddoc.id %></option> + <option selected="selected" value="<%= ddoc.id %>"><%= ddoc.id %></option> <% } else { %> - <option><%= ddoc.id %></option> + <option value="<%= ddoc.id %>"><%= ddoc.id %></option> <% } %> <% }); %> </optgroup> http://git-wip-us.apache.org/repos/asf/couchdb/blob/84cf21ab/src/fauxton/assets/less/fauxton.less ---------------------------------------------------------------------- diff --git a/src/fauxton/assets/less/fauxton.less b/src/fauxton/assets/less/fauxton.less index 0cf7bc2..d220abc 100644 --- a/src/fauxton/assets/less/fauxton.less +++ b/src/fauxton/assets/less/fauxton.less @@ -717,9 +717,7 @@ input[type=text], input[type=password], } -input[type=checkbox]{ -} label.fonticon-search { .box-sizing(content-box); position: relative; @@ -795,6 +793,11 @@ label{ .help-block{ font-size: 12px; } + +input[type=text].error{ + border: red 1px solid; +} + .custom-inputs{ input[type=radio],
