Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9A5C9110B7 for ; Wed, 6 Aug 2014 19:31:11 +0000 (UTC) Received: (qmail 60043 invoked by uid 500); 6 Aug 2014 19:31:10 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 59922 invoked by uid 500); 6 Aug 2014 19:31:10 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 58929 invoked by uid 99); 6 Aug 2014 19:31:09 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Aug 2014 19:31:09 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 66933924DF3; Wed, 6 Aug 2014 19:31:09 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: deathbear@apache.org To: commits@couchdb.apache.org Date: Wed, 06 Aug 2014 19:31:33 -0000 Message-Id: <1bf6068a670844ffa5691ef107b3c1db@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [26/26] fauxton commit: updated refs/heads/secondary-indexes to 7a446d8 Left header is now a reusable component Header stuff placeholder graphic Messed up folders Fix design doc selector Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/7a446d86 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/7a446d86 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/7a446d86 Branch: refs/heads/secondary-indexes Commit: 7a446d864065043d8b0c444087e79e13bae7b776 Parents: 6e343fa Author: deathbearbrown Authored: Wed Aug 6 15:25:15 2014 -0400 Committer: deathbearbrown Committed: Wed Aug 6 15:31:04 2014 -0400 ---------------------------------------------------------------------- app/addons/documents/assets/less/documents.less | 1 - app/addons/documents/assets/less/headers.less | 6 +- app/addons/documents/views-sidebar.js | 2 +- app/addons/fauxton/components.js | 53 ++++- app/addons/fauxton/templates/header_left.html | 17 ++ .../assets/less/new-index-placeholder.less | 2 +- app/addons/indexes/less/indexes.less | 13 -- .../indexes/less/new-index-placeholder.less | 3 - app/addons/indexes/routes-list.js | 65 ++++-- app/addons/indexes/routes-show.js | 69 ++++-- app/addons/indexes/routes-viewindexes.js | 75 ++++-- .../indexes/templates/design_doc_selector.html | 44 ++-- app/addons/indexes/templates/header_left.html | 17 -- app/addons/indexes/templates/header_right.html | 6 +- app/addons/indexes/templates/index_header.html | 28 --- .../indexes/templates/preview_screen.html | 2 + app/addons/indexes/views.js | 227 +++++++++---------- assets/less/fauxton.less | 1 + assets/less/headers.less | 116 ++++++++++ assets/less/templates.less | 100 -------- 20 files changed, 484 insertions(+), 363 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7a446d86/app/addons/documents/assets/less/documents.less ---------------------------------------------------------------------- diff --git a/app/addons/documents/assets/less/documents.less b/app/addons/documents/assets/less/documents.less index 26e3ffa..5a39fab 100644 --- a/app/addons/documents/assets/less/documents.less +++ b/app/addons/documents/assets/less/documents.less @@ -17,7 +17,6 @@ @import "advancedOptions.less"; @import "changes.less"; @import "sidenav.less"; -@import "headers.less"; tr.all-docs-item { border: none; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7a446d86/app/addons/documents/assets/less/headers.less ---------------------------------------------------------------------- diff --git a/app/addons/documents/assets/less/headers.less b/app/addons/documents/assets/less/headers.less index 3df552c..31faef1 100644 --- a/app/addons/documents/assets/less/headers.less +++ b/app/addons/documents/assets/less/headers.less @@ -1,7 +1,3 @@ -.header-left { - width: 300px; - float: left; -} .header-right { .searchbox-container { position: relative; @@ -22,4 +18,4 @@ color: #999; } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7a446d86/app/addons/documents/views-sidebar.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/views-sidebar.js b/app/addons/documents/views-sidebar.js index 7ebe99a..72a383f 100644 --- a/app/addons/documents/views-sidebar.js +++ b/app/addons/documents/views-sidebar.js @@ -175,7 +175,7 @@ function(app, FauxtonAPI, Components, Documents, Databases) { menuLinks.push({ title: link.title, - url: "#" + database.url('app') + "/_design/" + docSafe + "/" + link.url, + url: "#" + database.url('app')+ "/" + link.url + "/" + docSafe, icon: 'fonticon-plus-circled' }); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7a446d86/app/addons/fauxton/components.js ---------------------------------------------------------------------- diff --git a/app/addons/fauxton/components.js b/app/addons/fauxton/components.js index c92a7ce..0ef9503 100644 --- a/app/addons/fauxton/components.js +++ b/app/addons/fauxton/components.js @@ -35,6 +35,40 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { var Components = FauxtonAPI.addon(); + //setting up the left header with the backbutton used in Views and All docs + Components.LeftHeader = FauxtonAPI.View.extend({ + className: "header-left", + template: "addons/fauxton/templates/header_left", + initialize:function(options){ + this.dropdownMenuLinks = options.dropdownMenu; + this.crumbs = options.crumbs || []; + }, + updateCrumbs: function(crumbs){ + this.breadcrumbs.update(crumbs); + }, + updateDropdown: function(menuLinks){ + this.dropdown.update(menuLinks); + }, + beforeRender: function(){ + this.setUpCrumbs(); + this.setUpDropDownMenu(); + }, + setUpCrumbs: function(){ + this.breadcrumbs = this.insertView("#header-breadcrumbs", new Components.Breadcrumbs({ + crumbs: this.crumbs + })); + }, + setUpDropDownMenu: function(){ + if (this.dropdownMenuLinks){ + this.dropdown = this.insertView("#header-dropdown-menu", new Components.MenuDropDown({ + icon: 'fonticon-cog', + links: this.dropdownMenuLinks, + })); + } + } + }); + + Components.Breadcrumbs = FauxtonAPI.View.extend({ className: "breadcrumb pull-left", tagName: "ul", @@ -45,7 +79,10 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { crumbs: crumbs }; }, - + update: function(crumbs) { + this.crumbs = crumbs; + this.render(); + }, initialize: function(options) { this.crumbs = options.crumbs; } @@ -53,14 +90,16 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { Components.ApiBar = FauxtonAPI.View.extend({ template: "addons/fauxton/templates/api_bar", - endpoint: '_all_docs', - - documentation: 'docs', - events: { "click .api-url-btn" : "toggleAPIbar" }, + initialize: function(options){ + var _options = options || {}; + this.endpoint = _options.endpoint || '_all_docs'; + this.documentation = _options.documentation || 'docs'; + }, + toggleAPIbar: function(e){ var $currentTarget = $(e.currentTarget).find('span'); if ($currentTarget.hasClass("fonticon-plus")){ @@ -703,6 +742,10 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { this.links = options.links; this.icon = options.icon || "fonticon-plus-circled2"; }, + update: function(links){ + this.links = links; + this.render(); + }, serialize: function(){ return { links: this.links, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7a446d86/app/addons/fauxton/templates/header_left.html ---------------------------------------------------------------------- diff --git a/app/addons/fauxton/templates/header_left.html b/app/addons/fauxton/templates/header_left.html new file mode 100644 index 0000000..13bea60 --- /dev/null +++ b/app/addons/fauxton/templates/header_left.html @@ -0,0 +1,17 @@ + + +
+ +
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7a446d86/app/addons/indexes/assets/less/new-index-placeholder.less ---------------------------------------------------------------------- diff --git a/app/addons/indexes/assets/less/new-index-placeholder.less b/app/addons/indexes/assets/less/new-index-placeholder.less index 6336771..ade1d3a 100644 --- a/app/addons/indexes/assets/less/new-index-placeholder.less +++ b/app/addons/indexes/assets/less/new-index-placeholder.less @@ -12,7 +12,7 @@ .watermark-logo { background: transparent url('../img/couchWatermark.png') no-repeat 50% 50%; min-height: 400px; - padding-top: 80%; + padding-top: 60%; text-align: center; h3 { border-bottom: 1px solid #ccc; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7a446d86/app/addons/indexes/less/indexes.less ---------------------------------------------------------------------- diff --git a/app/addons/indexes/less/indexes.less b/app/addons/indexes/less/indexes.less deleted file mode 100644 index d526ee9..0000000 --- a/app/addons/indexes/less/indexes.less +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed under the Apache License, Version 2.0 (the "License"); you may not -// use this file except in compliance with the License. You may obtain a copy of -// the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. - -@import "new-index-placeholder.less"; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7a446d86/app/addons/indexes/less/new-index-placeholder.less ---------------------------------------------------------------------- diff --git a/app/addons/indexes/less/new-index-placeholder.less b/app/addons/indexes/less/new-index-placeholder.less deleted file mode 100644 index 3f5db0e..0000000 --- a/app/addons/indexes/less/new-index-placeholder.less +++ /dev/null @@ -1,3 +0,0 @@ -.watermark-logo { - background: transparent url(../img/couchWatermark.png') no-repeat 0 0; -} http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7a446d86/app/addons/indexes/routes-list.js ---------------------------------------------------------------------- diff --git a/app/addons/indexes/routes-list.js b/app/addons/indexes/routes-list.js index 1245c24..437cef6 100644 --- a/app/addons/indexes/routes-list.js +++ b/app/addons/indexes/routes-list.js @@ -16,10 +16,11 @@ define([ "addons/indexes/views", "addons/documents/views", "addons/indexes/resources", - "addons/indexes/routes-core" + "addons/indexes/routes-core", + "addons/fauxton/components" ], -function (app, FauxtonAPI, Databases, Views, Documents, Resources, RouteCore) { +function (app, FauxtonAPI, Databases, Views, Documents, Resources, RouteCore, Components) { var ListIndexes = RouteCore.extend({ routes: { @@ -39,6 +40,9 @@ function (app, FauxtonAPI, Databases, Views, Documents, Resources, RouteCore) { newListsEditor: function (database, designDoc) { var params = app.getParams(); + /* -------------------------------------------------- + Insert View Editor for new list + ----------------------------------------------------*/ this.setView("#left-content", new Views.ListEditor({ model: this.data.database, currentddoc: designDoc ? "_design/"+designDoc : "", @@ -47,23 +51,56 @@ function (app, FauxtonAPI, Databases, Views, Documents, Resources, RouteCore) { database: this.data.database, newView: true })); - + /* -------------------------------------------------- + Insert Preview Screen View + ----------------------------------------------------*/ this.setView("#right-content", new Views.PreviewScreen({})); - this.crumbs = function () { - return [ - {"name": "Create List Index", "link": Databases.databaseUrl(this.data.database)}, - ]; - }; + + /* -------------------------------------------------- + Set up & Insert breadcrumb header + ----------------------------------------------------*/ + var crumbs = [ + {"name": "", "className": "fonticon-left-open", "link": Databases.databaseUrl(this.data.database)}, + {"name": "Create a List Index", "link": Databases.databaseUrl(this.data.database)} + ]; + this.leftheader = this.setView("#breadcrumbs", new Components.LeftHeader({ + crumbs: crumbs + })); }, - tempFn: function(databaseName, ddoc, fn){ + tempFn: function(databaseName, ddoc, view){ + /* -------------------------------------------------- + Set up breadcrumb header + ----------------------------------------------------*/ + var crumbs = [ + {"name": "", "className": "fonticon-left-open", "link": Databases.databaseUrl(this.data.database)}, + {"name": view, "link": Databases.databaseUrl(this.data.database)} + ]; + + var dropdown = [{ + links: [{ + title: 'Duplicate Index', + icon: 'fonticon-documents' + },{ + title: 'Delete', + icon: 'fonticon-trash' + }] + }]; + + this.leftheader = this.setView("#breadcrumbs", new Components.LeftHeader({ + crumbs: crumbs, + dropdownMenu: dropdown + })); + + + /* -------------------------------------------------- + Insert List Editor + ----------------------------------------------------*/ this.setView("#left-content", new Views.ListEditor({})); + /* -------------------------------------------------- + Insert Preview Screen View + ----------------------------------------------------*/ this.setView("#right-content", new Views.PreviewScreen({})); - this.crumbs = function () { - return [ - {"name": this.data.database.id, "link": Databases.databaseUrl(this.data.database)}, - ]; - }; } }); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7a446d86/app/addons/indexes/routes-show.js ---------------------------------------------------------------------- diff --git a/app/addons/indexes/routes-show.js b/app/addons/indexes/routes-show.js index 10a3a56..73f52d1 100644 --- a/app/addons/indexes/routes-show.js +++ b/app/addons/indexes/routes-show.js @@ -16,10 +16,11 @@ define([ "addons/indexes/views", "addons/documents/views", "addons/indexes/resources", - "addons/indexes/routes-core" + "addons/indexes/routes-core", + "addons/fauxton/components" ], -function (app, FauxtonAPI, Databases, Views, Documents, Resources, RouteCore) { +function (app, FauxtonAPI, Databases, Views, Documents, Resources, RouteCore, Components) { var ShowIndexes = RouteCore.extend({ routes: { @@ -33,7 +34,9 @@ function (app, FauxtonAPI, Databases, Views, Documents, Resources, RouteCore) { newShowEditor: function (database, designDoc) { var params = app.getParams(); - + /* -------------------------------------------------- + Insert View Editor for new view + ----------------------------------------------------*/ this.setView("#left-content", new Views.ShowEditor({ model: this.data.database, currentddoc: designDoc ? "_design/"+designDoc : "", @@ -43,28 +46,56 @@ function (app, FauxtonAPI, Databases, Views, Documents, Resources, RouteCore) { newView: true })); + /* -------------------------------------------------- + Insert Preview Screen View + ----------------------------------------------------*/ this.setView("#right-content", new Views.PreviewScreen({})); - this.crumbs = function () { - return [ - {"name": "Create Show Index", "link": Databases.databaseUrl(this.data.database)}, - ]; - }; - }, - apiUrl: function() { - //TODO: Hook up proper API urls - return ''; + /* -------------------------------------------------- + Set up & Insert breadcrumb header + ----------------------------------------------------*/ + var crumbs = [ + {"name": "", "className": "fonticon-left-open", "link": Databases.databaseUrl(this.data.database)}, + {"name": "Create a Show Index", "link": Databases.databaseUrl(this.data.database)} + ]; + this.leftheader = this.setView("#breadcrumbs", new Components.LeftHeader({ + crumbs: crumbs + })); }, + tempFn: function(databaseName, ddoc, view){ + /* -------------------------------------------------- + Set up breadcrumb header + ----------------------------------------------------*/ + var crumbs = [ + {"name": "", "className": "fonticon-left-open", "link": Databases.databaseUrl(this.data.database)}, + {"name": view, "link": Databases.databaseUrl(this.data.database)} + ]; + + var dropdown = [{ + links: [{ + title: 'Duplicate Index', + icon: 'fonticon-documents' + },{ + title: 'Delete', + icon: 'fonticon-trash' + }] + }]; + + this.leftheader = this.setView("#breadcrumbs", new Components.LeftHeader({ + crumbs: crumbs, + dropdownMenu: dropdown + })); + - tempFn: function(databaseName, ddoc, fn){ - this.setView("#left-content", new Views.ShowEditor({})); + /* -------------------------------------------------- + Insert Show Editor + ----------------------------------------------------*/ + this.setView("#left-content", new Views.ListEditor({})); + /* -------------------------------------------------- + Insert Preview Screen View + ----------------------------------------------------*/ this.setView("#right-content", new Views.PreviewScreen({})); - this.crumbs = function () { - return [ - {"name": this.data.database.id, "link": Databases.databaseUrl(this.data.database)}, - ]; - }; } }); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7a446d86/app/addons/indexes/routes-viewindexes.js ---------------------------------------------------------------------- diff --git a/app/addons/indexes/routes-viewindexes.js b/app/addons/indexes/routes-viewindexes.js index de53981..7330d04 100644 --- a/app/addons/indexes/routes-viewindexes.js +++ b/app/addons/indexes/routes-viewindexes.js @@ -16,10 +16,11 @@ define([ "addons/indexes/views", "addons/documents/views", "addons/indexes/resources", - "addons/indexes/routes-core" + "addons/indexes/routes-core", + "addons/fauxton/components" ], -function (app, FauxtonAPI, Databases, Views, Documents, Resources, RouteCore) { +function (app, FauxtonAPI, Databases, Views, Documents, Resources, RouteCore, Components) { var ViewIndexes = RouteCore.extend({ routes: { @@ -33,10 +34,19 @@ function (app, FauxtonAPI, Databases, Views, Documents, Resources, RouteCore) { newViewEditor: function (database, designDoc) { var params = app.getParams(); + /* -------------------------------------------------- + remove right header + ----------------------------------------------------*/ this.rightheader && this.rightheader.remove(); + /* -------------------------------------------------- + Insert Preview Screen View + ----------------------------------------------------*/ this.setView("#right-content", new Views.PreviewScreen({})); + /* -------------------------------------------------- + Insert View Editor for new view + ----------------------------------------------------*/ this.viewEditor = this.setView("#left-content", new Views.ViewEditor({ model: this.data.database, currentddoc: designDoc ? "_design/"+designDoc : "", @@ -46,9 +56,15 @@ function (app, FauxtonAPI, Databases, Views, Documents, Resources, RouteCore) { newView: true })); - this.leftheader = this.setView("#breadcrumbs", new Views.LeftHeader({ - title:"Create a View Index", - database: this.data.database + /* -------------------------------------------------- + Set up & Insert breadcrumb header + ----------------------------------------------------*/ + var crumbs = [ + {"name": "", "className": "fonticon-left-open", "link": Databases.databaseUrl(this.data.database)}, + {"name": "Create a View Index", "link": Databases.databaseUrl(this.data.database)} + ]; + this.leftheader = this.setView("#breadcrumbs", new Components.LeftHeader({ + crumbs: crumbs })); }, @@ -60,15 +76,32 @@ function (app, FauxtonAPI, Databases, Views, Documents, Resources, RouteCore) { decodeDdoc = decodeURIComponent(ddoc); view = view.replace(/\?.*$/,''); - this.leftheader = this.setView("#breadcrumbs", new Views.LeftHeader({ - title: view, - database: this.data.database - })); + /* -------------------------------------------------- + Set up breadcrumb header + ----------------------------------------------------*/ + var crumbs = [ + {"name": "", "className": "fonticon-left-open", "link": Databases.databaseUrl(this.data.database)}, + {"name": view, "link": Databases.databaseUrl(this.data.database)} + ]; + + var dropdown = [{ + links: [{ + title: 'Duplicate Index', + icon: 'fonticon-documents' + },{ + title: 'Delete', + icon: 'fonticon-trash' + }] + }]; - this.rightheader = this.setView("#api-bar", new Views.RightHeader({ - database: this.data.database + this.leftheader = this.setView("#breadcrumbs", new Components.LeftHeader({ + crumbs: crumbs, + dropdownMenu: dropdown })); + /* -------------------------------------------------- + Set up Index Collection + ----------------------------------------------------*/ this.data.indexedDocs = new Resources.IndexCollection(null, { database: this.data.database, design: decodeDdoc, @@ -79,6 +112,21 @@ function (app, FauxtonAPI, Databases, Views, Documents, Resources, RouteCore) { } }); + + /* -------------------------------------------------- + Set up right header + ----------------------------------------------------*/ + + this.rightheader = this.setView("#api-navbar", new Views.RightHeader({ + database: this.data.database, + model: this.data.database, + endpoint: this.data.indexedDocs.urlRef("apiurl", urlParams), + documentation: "docs" + })); + + /* -------------------------------------------------- + Insert View Editor + ----------------------------------------------------*/ this.viewEditor = this.setView("#left-content", new Views.ViewEditor({ model: this.data.database, ddocs: this.data.designDocs, @@ -89,6 +137,9 @@ function (app, FauxtonAPI, Databases, Views, Documents, Resources, RouteCore) { ddocInfo: this.ddocInfo(decodeDdoc, this.data.designDocs, view) })); + /* -------------------------------------------------- + Insert Docs returned from view + ----------------------------------------------------*/ this.documentsView = this.createViewDocumentsView({ designDoc: decodeDdoc, docParams: docParams, @@ -98,8 +149,6 @@ function (app, FauxtonAPI, Databases, Views, Documents, Resources, RouteCore) { designDocs: this.data.designDocs, view: view }); - - this.apiUrl = [this.data.indexedDocs.urlRef("apiurl", urlParams), "docs"]; } }); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7a446d86/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 98abc46..7d58116 100644 --- a/app/addons/indexes/templates/design_doc_selector.html +++ b/app/addons/indexes/templates/design_doc_selector.html @@ -11,28 +11,26 @@ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> -
- - + + - <% ddocs.each(function(ddoc) { %> - <%= ddoc.id %> - <%= ddocName %> - <% if (ddoc.id === ddocName) { %> - - <% } else { %> - - <% } %> - <% }); %> - - -
- - \ No newline at end of file + + + http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7a446d86/app/addons/indexes/templates/header_left.html ---------------------------------------------------------------------- diff --git a/app/addons/indexes/templates/header_left.html b/app/addons/indexes/templates/header_left.html deleted file mode 100644 index 13bea60..0000000 --- a/app/addons/indexes/templates/header_left.html +++ /dev/null @@ -1,17 +0,0 @@ - - -
- -
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7a446d86/app/addons/indexes/templates/header_right.html ---------------------------------------------------------------------- diff --git a/app/addons/indexes/templates/header_right.html b/app/addons/indexes/templates/header_right.html index 90828d2..8279bf6 100644 --- a/app/addons/indexes/templates/header_right.html +++ b/app/addons/indexes/templates/header_right.html @@ -11,8 +11,12 @@ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - +
+ Select +
+ +
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7a446d86/app/addons/indexes/templates/index_header.html ---------------------------------------------------------------------- diff --git a/app/addons/indexes/templates/index_header.html b/app/addons/indexes/templates/index_header.html deleted file mode 100644 index ac8ac56..0000000 --- a/app/addons/indexes/templates/index_header.html +++ /dev/null @@ -1,28 +0,0 @@ - - -
- - - - - - -
- - -
- - -
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7a446d86/app/addons/indexes/templates/preview_screen.html ---------------------------------------------------------------------- diff --git a/app/addons/indexes/templates/preview_screen.html b/app/addons/indexes/templates/preview_screen.html index 1fcf6d9..a7de45b 100644 --- a/app/addons/indexes/templates/preview_screen.html +++ b/app/addons/indexes/templates/preview_screen.html @@ -13,4 +13,6 @@ the License. -->

No Index Created Yet!

+ http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7a446d86/app/addons/indexes/views.js ---------------------------------------------------------------------- diff --git a/app/addons/indexes/views.js b/app/addons/indexes/views.js index 80e6a40..bfe209e 100644 --- a/app/addons/indexes/views.js +++ b/app/addons/indexes/views.js @@ -34,41 +34,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, var Views = {}; -//left header - Views.LeftHeader = FauxtonAPI.View.extend({ - className: "header-left", - template: "addons/indexes/templates/header_left", - initialize:function(options){ - this.database = options.database; - this.title = options.title; - }, - beforeRender: function(){ - var crumbs = [ - {"name": "", "className": "fonticon-left-open", "link": Databases.databaseUrl(this.database)}, - {"name": this.title, "link": Databases.databaseUrl(this.database)} - ]; - this.insertView("#header-breadcrumbs", new Components.Breadcrumbs({ - crumbs: crumbs - })); - this.dropDownMenu(); - }, - dropDownMenu: function(){ - var newLinks = [{ - links: [{ - title: 'Table', - icon: 'fonticon-table' - },{ - title: 'JSON', - icon: 'fonticon-json' - }] - }]; - - this.insertView("#header-dropdown-menu", new Components.MenuDropDown({ - icon: 'fonticon-cog', - links: newLinks, - })); - } - }); //right header Views.RightHeader = FauxtonAPI.View.extend({ @@ -77,9 +42,116 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, initialize:function(options){ this.database = options.database; this.title = options.title; + this.api = options.api; + this.endpoint = options.endpoint; + this.documentation = options.documentation; + this.eventer = _.extend({}, Backbone.Events); + }, + updateApiUrl: function(api){ + //this will update the api bar when the route changes + //you can find the method that updates it in components.js Components.ApiBar() + this.apiBar && this.apiBar.update(api); }, beforeRender: function(){ - this.insertView(".header-api-bar", new Components.ApiBar({})); + + this.apiBar = this.insertView("#header-api-bar", new Components.ApiBar({ + endpoint: this.endpoint, + documentation: this.documentation + })); + + this.advancedOptions = this.insertView('#header-query-options', new QueryOptions.AdvancedOptions({ + updateViewFn: this.updateView, + previewFn: this.previewView, + database: this.database, + viewName: this.viewName, + ddocName: this.model.id, + hasReduce: this.hasReduce(), + eventer: this.eventer, + showStale: true + })); + }, + hasReduce: function(){ + + }, + updateView: function(event, paramInfo) { + event.preventDefault(); + + var errorParams = paramInfo.errorParams, + params = paramInfo.params; + + if (_.any(errorParams)) { + _.map(errorParams, function(param) { + + // TODO: Where to add this error? + // bootstrap wants the error on a control-group div, but we're not using that + //$('form.view-query-update input[name='+param+'], form.view-query-update select[name='+param+']').addClass('error'); + return FauxtonAPI.addNotification({ + msg: "JSON Parse Error on field: "+param.name, + type: "error", + selector: ".advanced-options .errors-container", + clear: true + }); + }); + FauxtonAPI.addNotification({ + msg: "Make sure that strings are properly quoted and any other values are valid JSON structures", + type: "warning", + selector: ".advanced-options .errors-container", + clear: true + }); + + return false; + } + + var fragment = window.location.hash.replace(/\?.*$/, ''); + if (!_.isEmpty(params)) { + fragment = fragment + '?' + $.param(params); + } + + FauxtonAPI.navigate(fragment, {trigger: false}); + FauxtonAPI.triggerRouteEvent('updateAllDocs', {ddoc: this.ddocID, view: this.viewName}); + }, + + + previewView: function(event, paramsInfo) { + event.preventDefault(); + var that = this, + mapVal = this.mapVal(), + reduceVal = this.reduceVal(), + paramsArr = []; + + if (paramsInfo && paramsInfo.params) { + paramsArr = paramsInfo.params; + } + + var params = _.reduce(paramsArr, function (params, param) { + params[param.name] = param.value; + return params; + }, {reduce: false}); + + FauxtonAPI.addNotification({ + msg: "Warning! Preview executes the Map/Reduce functions in your browser, and may behave differently from CouchDB.", + type: "warning", + selector: ".advanced-options .errors-container", + fade: true, + escape: false // beware of possible XSS when the message changes + }); + + var promise = FauxtonAPI.Deferred(); + + if (!this.database.allDocs || this.database.allDocs.params.include_docs !== true) { + this.database.buildAllDocs({limit: Databases.DocLimit.toString(), include_docs: true}); + promise = this.database.allDocs.fetch(); + } else { + promise.resolve(); + } + + promise.then(function () { + params.docs = that.database.allDocs.map(function (model) { return model.get('doc');}); + var queryPromise = pouchdb.runViewQuery({map: mapVal, reduce: reduceVal}, params); + queryPromise.then(function (results) { + FauxtonAPI.triggerRouteEvent('updatePreviewDocs', {rows: results.rows, ddoc: that.getCurrentDesignDoc().id, view: that.viewName}); + }); + }); } }); @@ -396,89 +468,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, FauxtonAPI.triggerRouteEvent('updateAllDocs', {ddoc: ddocName, view: viewName}); }, - updateView: function(event, paramInfo) { - event.preventDefault(); - - if (this.newView) { return alert('Please save this new view before querying it.'); } - - var errorParams = paramInfo.errorParams, - params = paramInfo.params; - - if (_.any(errorParams)) { - _.map(errorParams, function(param) { - - // TODO: Where to add this error? - // bootstrap wants the error on a control-group div, but we're not using that - //$('form.view-query-update input[name='+param+'], form.view-query-update select[name='+param+']').addClass('error'); - return FauxtonAPI.addNotification({ - msg: "JSON Parse Error on field: "+param.name, - type: "error", - selector: ".advanced-options .errors-container", - clear: true - }); - }); - FauxtonAPI.addNotification({ - msg: "Make sure that strings are properly quoted and any other values are valid JSON structures", - type: "warning", - selector: ".advanced-options .errors-container", - clear: true - }); - - return false; - } - - var fragment = window.location.hash.replace(/\?.*$/, ''); - if (!_.isEmpty(params)) { - fragment = fragment + '?' + $.param(params); - } - - FauxtonAPI.navigate(fragment, {trigger: false}); - FauxtonAPI.triggerRouteEvent('updateAllDocs', {ddoc: this.ddocID, view: this.viewName}); - }, - - - previewView: function(event, paramsInfo) { - event.preventDefault(); - var that = this, - mapVal = this.mapVal(), - reduceVal = this.reduceVal(), - paramsArr = []; - - if (paramsInfo && paramsInfo.params) { - paramsArr = paramsInfo.params; - } - - var params = _.reduce(paramsArr, function (params, param) { - params[param.name] = param.value; - return params; - }, {reduce: false}); - - FauxtonAPI.addNotification({ - msg: "Warning! Preview executes the Map/Reduce functions in your browser, and may behave differently from CouchDB.", - type: "warning", - selector: ".advanced-options .errors-container", - fade: true, - escape: false // beware of possible XSS when the message changes - }); - - var promise = FauxtonAPI.Deferred(); - - if (!this.database.allDocs || this.database.allDocs.params.include_docs !== true) { - this.database.buildAllDocs({limit: Databases.DocLimit.toString(), include_docs: true}); - promise = this.database.allDocs.fetch(); - } else { - promise.resolve(); - } - - promise.then(function () { - params.docs = that.database.allDocs.map(function (model) { return model.get('doc');}); - var queryPromise = pouchdb.runViewQuery({map: mapVal, reduce: reduceVal}, params); - queryPromise.then(function (results) { - FauxtonAPI.triggerRouteEvent('updatePreviewDocs', {rows: results.rows, ddoc: that.getCurrentDesignDoc().id, view: that.viewName}); - }); - }); - }, - getCurrentDesignDoc: function () { return this.designDocSelector.getCurrentDesignDoc(); }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7a446d86/assets/less/fauxton.less ---------------------------------------------------------------------- diff --git a/assets/less/fauxton.less b/assets/less/fauxton.less index 31678a3..6467923 100644 --- a/assets/less/fauxton.less +++ b/assets/less/fauxton.less @@ -23,6 +23,7 @@ @import "prettyprint.less"; @import "icons.less"; @import "templates.less"; +@import "headers.less"; @import "formstyles.less"; /** * HTML-wide overrides http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7a446d86/assets/less/headers.less ---------------------------------------------------------------------- diff --git a/assets/less/headers.less b/assets/less/headers.less new file mode 100644 index 0000000..c80a88f --- /dev/null +++ b/assets/less/headers.less @@ -0,0 +1,116 @@ +.fixed-header{ + height: 60px; + background-color: @breadcrumbBG; + position: fixed; + top: 0; + right: 0; + left: @navWidth; + .closeMenu & { + left: @collapsedNavWidth; + } + z-index: 100; + .two-pane & { + border: none; + } + .two-pane &, + .with-sidebar & { + #api-navbar{ + > div { + .bottom-shadow-border; + height: 60px; + } + .left-shadow-border; + } + #breadcrumbs{ + .bottom-shadow-border; + } + } + .one-pane & { + #breadcrumbs{ + width: 90%; + } + position: relative; + border: none; + .box-shadow(none); + left: auto; + } + /* these styles are for the new header*/ + > div { + display:inline-block; + vertical-align: top; + } +} + +#api-navbar{ + height: 60px; + position: relative; + /* these styles are for the new header*/ + .right-header{ + } +} + +#breadcrumbs { + height: 60px; + &.sidebar{ + width: @sidebarWidth - 4; + } + /* these styles are for the new header*/ + .header-left{ + > div{ + display:inline-block; + } + } + .breadcrumb { + margin-bottom: 0; + background-color: transparent; + padding: 0; + li { + padding:15px 10px; + height: 60px; + vertical-align: top; + &:first-child { + font-size: 30px; + .with-sidebar &, + .two-pane & { + padding:20px 10px; + font-size: 19px; + border-right: 1px solid #ccc; + } + } + color: @breadcrumbText; + font-size: 18px; + text-shadow: none; + &.active{ + color: #333; + } + a{ + text-decoration: none; + color: @breadcrumbText; + } + } + } +} + +.header-left{ + position: relative; + #header-dropdown-menu { + position: absolute; + right: 0; + top: 0; + a { + text-decoration: none; + } + .dropdown { + border-left: 1px solid #ccc; + padding: 20px; + } + .dropdown-menu { + left: -105px; + top: 56px; + } + } +} + + + + http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7a446d86/assets/less/templates.less ---------------------------------------------------------------------- diff --git a/assets/less/templates.less b/assets/less/templates.less index a6f1a78..5c877b4 100644 --- a/assets/less/templates.less +++ b/assets/less/templates.less @@ -297,104 +297,6 @@ } } -.fixed-header{ - height: 60px; - background-color: @breadcrumbBG; - position: fixed; - top: 0; - right: 0; - left: @navWidth; - .closeMenu & { - left: @collapsedNavWidth; - } - z-index: 100; - .two-pane & { - border: none; - } - .two-pane &, - .with-sidebar & { - #api-navbar{ - > div { - .bottom-shadow-border; - height: 60px; - } - .left-shadow-border; - } - #breadcrumbs{ - .bottom-shadow-border; - } - } - .one-pane & { - #breadcrumbs{ - width: 90%; - } - position: relative; - border: none; - .box-shadow(none); - left: auto; - } - /* these styles are for the new header*/ - > div { - display:inline-block; - vertical-align: top; - } -} - -#api-navbar{ - height: 60px; - position: relative; - /* these styles are for the new header*/ - .right-header{ - } -} - -#breadcrumbs { - height: 60px; - &.sidebar{ - width: @sidebarWidth - 4; - } - /* these styles are for the new header*/ - .header-left{ - > div{ - display:inline-block; - } - } - .breadcrumb { - margin-bottom: 0; - background-color: transparent; - padding: 0; - li { - padding:15px 10px; - height: 60px; - vertical-align: top; - &:first-child { - font-size: 30px; - .with-sidebar &, - .two-pane & { - padding:20px 10px; - font-size: 19px; - border-right: 1px solid #ccc; - } - } - color: @breadcrumbText; - font-size: 18px; - text-shadow: none; - &.active{ - color: #333; - } - a{ - text-decoration: none; - color: @breadcrumbText; - } - } - } -} - - - - - - /* SIDEBAR-CONTENT & DASHBOARD-CONTENT LAYOUTS: @@ -449,8 +351,6 @@ } } - - #dashboard-content{ &.row-fluid, &.window-resizeable{