Design doc selector fix pagination fix
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/566ac349 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/566ac349 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/566ac349 Branch: refs/heads/secondary-indexes Commit: 566ac349d8e57767c88df69755c0aef6cf0b0348 Parents: 45f082a Author: deathbearbrown <[email protected]> Authored: Sun Aug 24 16:33:43 2014 +0200 Committer: deathbearbrown <[email protected]> Committed: Mon Aug 25 09:37:36 2014 -0400 ---------------------------------------------------------------------- app/addons/fauxton/components.js | 1 + app/addons/fauxton/templates/pagination.html | 29 ++++++++++---------- .../indexes/templates/design_doc_selector.html | 16 +++++------ app/addons/indexes/templates/show_editor.html | 2 +- app/addons/indexes/templates/view_editor.html | 2 +- app/addons/indexes/views.js | 3 ++ 6 files changed, 27 insertions(+), 26 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/566ac349/app/addons/fauxton/components.js ---------------------------------------------------------------------- diff --git a/app/addons/fauxton/components.js b/app/addons/fauxton/components.js index d225cd9..28a9070 100644 --- a/app/addons/fauxton/components.js +++ b/app/addons/fauxton/components.js @@ -154,6 +154,7 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { Components.Pagination = FauxtonAPI.View.extend({ + tagName: "ul", className: "pagination pagination-centered", template: "addons/fauxton/templates/pagination", http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/566ac349/app/addons/fauxton/templates/pagination.html ---------------------------------------------------------------------- diff --git a/app/addons/fauxton/templates/pagination.html b/app/addons/fauxton/templates/pagination.html index 614fd06..3958f63 100644 --- a/app/addons/fauxton/templates/pagination.html +++ b/app/addons/fauxton/templates/pagination.html @@ -11,18 +11,17 @@ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - <ul> - <% if (page > 1) { %> - <li> <a href="<%- urlFun(page-1) %>">«</a></li> - <% } else { %> - <li class="disabled"> <a href="<%- urlFun(page) %>">«</a></li> - <% } %> - <% _.each(_.range(1, totalPages+1), function(i) { %> - <li <% if (page == i) { %>class="active"<% } %>> <a href="<%- urlFun(i) %>"><%- i %></a></li> - <% }) %> - <% if (page < totalPages) { %> - <li><a href="<%- urlFun(page+1) %>">»</a></li> - <% } else { %> - <li class="disabled"> <a href="<%- urlFun(page) %>">»</a></li> - <% } %> - </ul> +<% if (page > 1) { %> +<li> <a href="<%- urlFun(page-1) %>">«</a></li> +<% } else { %> + <li class="disabled"> <a href="<%- urlFun(page) %>">«</a></li> +<% } %> +<% _.each(_.range(1, totalPages+1), function(i) { %> + <li <% if (page == i) { %>class="active"<% } %>> <a href="<%- urlFun(i) %>"><%- i %></a></li> +<% }) %> +<% if (page < totalPages) { %> + <li><a href="<%- urlFun(page+1) %>">»</a></li> +<% } else { %> + <li class="disabled"> <a href="<%- urlFun(page) %>">»</a></li> +<% } %> + http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/566ac349/app/addons/indexes/templates/design_doc_selector.html ---------------------------------------------------------------------- diff --git a/app/addons/indexes/templates/design_doc_selector.html b/app/addons/indexes/templates/design_doc_selector.html index 7d58116..2cad6af 100644 --- a/app/addons/indexes/templates/design_doc_selector.html +++ b/app/addons/indexes/templates/design_doc_selector.html @@ -16,21 +16,19 @@ the License. <div class="select-wrapper span5"> <select id="ddoc"> <optgroup label="Select a document"> - <option value="new-doc">New document</option> + <option value="new-doc" <% if(newView){ %>selected="selected" <%}%> >New document</option> <% ddocs.each(function(ddoc) { %> - <%= ddoc.id %> - <%= ddocName %> - <% if (ddoc.id === ddocName) { %> - <option selected="selected" value="<%- ddoc.id %>"><%- ddoc.id %></option> - <% } else { %> - <option value="<%- ddoc.id %>"><%- ddoc.id %></option> - <% } %> + <% if (ddoc.id === ddocName && !newView) { %> + <option selected="selected" value="<%- ddoc.id %>"><%- ddoc.id %></option> + <% } else { %> + <option value="<%- ddoc.id %>"><%- ddoc.id %></option> + <% } %> <% }); %> </optgroup> </select> <i></i> </div> - <input type="text" id="new-ddoc" class="span7" style="display:none" placeholder="Enter a design doc name" /> + <input type="text" id="new-ddoc" class="span7" <% if(!newView){ %> style="display:none"<% } %> placeholder="Enter a design doc name" /> </div> http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/566ac349/app/addons/indexes/templates/show_editor.html ---------------------------------------------------------------------- diff --git a/app/addons/indexes/templates/show_editor.html b/app/addons/indexes/templates/show_editor.html index 9afa2bf..ef36110 100644 --- a/app/addons/indexes/templates/show_editor.html +++ b/app/addons/indexes/templates/show_editor.html @@ -17,7 +17,7 @@ the License. <div class="errors-container"></div> <form class="form-horizontal view-query-save"> <div class="control-group"> - <p>Views are the primary tool used for querying and reporting on CouchDB databases.</p> + <p>Views are the primary tool used for querying and reporting.</p> </div> <div class="control-group design-doc-group"> http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/566ac349/app/addons/indexes/templates/view_editor.html ---------------------------------------------------------------------- diff --git a/app/addons/indexes/templates/view_editor.html b/app/addons/indexes/templates/view_editor.html index f33d3f9..2b8c540 100644 --- a/app/addons/indexes/templates/view_editor.html +++ b/app/addons/indexes/templates/view_editor.html @@ -16,7 +16,7 @@ the License. <div class="errors-container"></div> <form class="form-horizontal view-query-save"> <div class="control-group"> - <p>Views are the primary tool used for querying and reporting on CouchDB databases.</p> + <p>Views are the primary tool used for querying and reporting.</p> </div> http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/566ac349/app/addons/indexes/views.js ---------------------------------------------------------------------- diff --git a/app/addons/indexes/views.js b/app/addons/indexes/views.js index fa84708..51f37fa 100644 --- a/app/addons/indexes/views.js +++ b/app/addons/indexes/views.js @@ -580,6 +580,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, this.designDocSelector = this.setView('.design-doc-group', new Views.DesignDocSelector({ collection: designDocs, + newView: this.newView, ddocName: this.currentDdoc || this.model.id, database: this.database })); @@ -646,6 +647,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, }, initialize: function (options) { + this.newView = options.newView; this.ddocName = options.ddocName; this.database = options.database; this.listenTo(this.collection, 'add', this.ddocAdded); @@ -659,6 +661,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, serialize: function () { return { + newView: this.newView, ddocName: this.ddocName, ddocs: this.collection };
