You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by de...@apache.org on 2014/08/06 22:12:21 UTC
fauxton commit: updated refs/heads/secondary-indexes to 056c78c
Repository: couchdb-fauxton
Updated Branches:
refs/heads/secondary-indexes 7a446d864 -> 056c78c5e
Changes header (not styled)
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/056c78c5
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/056c78c5
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/056c78c5
Branch: refs/heads/secondary-indexes
Commit: 056c78c5e1f8e74601fac9c3cd5de3e0479ef470
Parents: 7a446d8
Author: deathbearbrown <de...@gmail.com>
Authored: Wed Aug 6 16:12:26 2014 -0400
Committer: deathbearbrown <de...@gmail.com>
Committed: Wed Aug 6 16:12:26 2014 -0400
----------------------------------------------------------------------
app/addons/documents/assets/less/changes.less | 3 -
app/addons/documents/routes.js | 161 +++++++++++++++------
app/addons/documents/templates/changes.html | 4 +-
app/addons/documents/views-changes.js | 26 ++--
app/addons/fauxton/components.js | 4 +-
5 files changed, 138 insertions(+), 60 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/056c78c5/app/addons/documents/assets/less/changes.less
----------------------------------------------------------------------
diff --git a/app/addons/documents/assets/less/changes.less b/app/addons/documents/assets/less/changes.less
index ebd395a..4bd86b7 100644
--- a/app/addons/documents/assets/less/changes.less
+++ b/app/addons/documents/assets/less/changes.less
@@ -19,9 +19,6 @@
right: 15px;
}
-.changes-view {
- padding-top: 70px;
-}
.change-wrapper {
margin-top: 20px;
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/056c78c5/app/addons/documents/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes.js b/app/addons/documents/routes.js
index ccb5d71..c7179ca 100644
--- a/app/addons/documents/routes.js
+++ b/app/addons/documents/routes.js
@@ -26,8 +26,10 @@ define([
"addons/fauxton/components"
],
-function(app, FauxtonAPI, Components, Documents, Changes, DocEditor, Databases, Resources) {
-
+function(app, FauxtonAPI, Components, Documents, Changes, DocEditor, Databases, Resources, Components) {
+ /* --------------------------------------------------
+ DOCUMENT EDITOR ROUTE OBJECT
+ ----------------------------------------------------*/
var DocEditorRouteObject = FauxtonAPI.RouteObject.extend({
layout: "one_pane",
disableLoader: true,
@@ -102,6 +104,10 @@ function(app, FauxtonAPI, Components, Documents, Changes, DocEditor, Databases,
}
});
+ /* --------------------------------------------------
+ NEW DOCUMENT EDITOR ROUTE OBJECT (for new documents)
+ ----------------------------------------------------*/
+
var NewDocEditorRouteObject = DocEditorRouteObject.extend({
initialize: function (route, masterLayout, options) {
var databaseName = options[0];
@@ -126,6 +132,10 @@ function(app, FauxtonAPI, Components, Documents, Changes, DocEditor, Databases,
});
+
+ /* --------------------------------------------------
+ ALL DOCS, METADATA AND CHANGES ROUTE OBJECT
+ ----------------------------------------------------*/
var DocumentsRouteObject = FauxtonAPI.RouteObject.extend({
layout: "with_tabs_sidebar",
selectedHeader: "Databases",
@@ -154,11 +164,14 @@ function(app, FauxtonAPI, Components, Documents, Changes, DocEditor, Databases,
initialize: function (route, masterLayout, options) {
this.databaseName = options[0];
-
+ /* --------------------------------------------------
+ Set up Resources for the current database
+ &
+ get all design docs
+ ----------------------------------------------------*/
this.data = {
database: new Databases.Model({id:this.databaseName})
};
-
this.data.designDocs = new Documents.AllDocs(null, {
database: this.data.database,
paging: {
@@ -171,11 +184,18 @@ function(app, FauxtonAPI, Components, Documents, Changes, DocEditor, Databases,
limit: 500
}
});
- //The header has 2 parts now
- //the right side will have api bar, search, query options etc
- this.headerRight = this.setView("#api-navbar", new Documents.Views.RightAllDocsHeader({
- database: this.data.database
- }));
+
+
+ /* --------------------------------------------------
+ Show right header for all docs that includes:
+ query options, api bar, search and select
+ ----------------------------------------------------*/
+ this.changesHeader = true;
+ this.setAllDocsHeader();
+
+ /* --------------------------------------------------
+ Show the sidebar
+ ----------------------------------------------------*/
this.sidebar = this.setView("#sidebar-content", new Documents.Views.Sidebar({
collection: this.data.designDocs,
@@ -183,25 +203,33 @@ function(app, FauxtonAPI, Components, Documents, Changes, DocEditor, Databases,
}));
},
- designDocMetadata: function(database, ddoc){
- this.viewEditor && this.viewEditor.remove();
+ setAllDocsHeader: function(){
+ if (this.changesHeader){
+ this.headerRight = this.setView("#api-navbar", new Documents.Views.RightAllDocsHeader({
+ database: this.data.database
+ }));
+ this.changesHeader = false;
+ }
+ },
+ designDocMetadata: function(database, ddoc){
var designDocInfo = new Resources.DdocInfo({_id: "_design/"+ddoc},{database: this.data.database });
+ /* --------------------------------------------------
+ Show design doc metadata
+ ----------------------------------------------------*/
this.setView("#dashboard-lower-content", new Documents.Views.DdocInfo({
ddocName: ddoc,
model: designDocInfo
}));
-
+ /* --------------------------------------------------
+ Set selected tab
+ ----------------------------------------------------*/
this.sidebar.setSelectedTab(app.utils.removeSpecialCharacters(ddoc)+"_metadata");
- this.crumbs = function () {
- return [
- {"name": "", "className": "fonticon-left-open", "link": "/_all_dbs"},
- {"name": this.data.database.id, "link": Databases.databaseUrl(this.data.database)},
- ];
- };
-
+ /* --------------------------------------------------
+ Update the apiUrl
+ ----------------------------------------------------*/
this.headerRight.updateApiUrl([designDocInfo.url('apiurl'), designDocInfo.documentation()]);
},
@@ -235,18 +263,59 @@ function(app, FauxtonAPI, Components, Documents, Changes, DocEditor, Databases,
return;
}
+
+ /* --------------------------------------------------
+ Set up breadcrumb header
+ ----------------------------------------------------*/
+ var crumbs = [
+ {"name": "", "className": "fonticon-left-open", "link": "/_all_dbs"},
+ {"name": this.data.database.id, "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
+ }));
+
+ /*--------------------------------------------------
+ reset header if you have to
+ ----------------------------------------------------*/
+ this.setAllDocsHeader();
+
+ /* --------------------------------------------------
+ Build all docs
+ ----------------------------------------------------*/
+
this.data.database.buildAllDocs(docParams);
+ /* --------------------------------------------------
+ Set sidebar highlight to all docs or design docs
+ ----------------------------------------------------*/
if (docParams.startkey && docParams.startkey.indexOf('_design') > -1) {
this.sidebar.setSelectedTab('design-docs');
} else {
this.sidebar.setSelectedTab('all-docs');
}
- this.viewEditor && this.viewEditor.remove();
+ /* --------------------------------------------------
+ Set page size
+ ----------------------------------------------------*/
this.data.database.allDocs.paging.pageSize = this.getDocPerPageLimit(urlParams, parseInt(docParams.limit, 10));
+ /* --------------------------------------------------
+ Show all docs
+ ----------------------------------------------------*/
this.documentsView = this.setView("#dashboard-lower-content", new Documents.Views.AllDocsList({
database: this.data.database,
collection: this.data.database.allDocs,
@@ -255,13 +324,9 @@ function(app, FauxtonAPI, Components, Documents, Changes, DocEditor, Databases,
bulkDeleteDocsCollection: new Documents.BulkDeleteDocCollection([], {databaseId: this.data.database.get('id')})
}));
- this.crumbs = [
- {"name": "", "className": "fonticon-left-open", "link": "/_all_dbs"},
- {"name": this.data.database.id, "link": Databases.databaseUrl(this.data.database)}
- ];
-
-
- //needs to be added back
+ /* --------------------------------------------------
+ update the api url
+ ----------------------------------------------------*/
this.headerRight.updateApiUrl([this.data.database.allDocs.urlRef("apiurl", urlParams), this.data.database.allDocs.documentation()]);
},
@@ -368,34 +433,48 @@ function(app, FauxtonAPI, Components, Documents, Changes, DocEditor, Databases,
changes: function (event) {
var docParams = app.getParams();
this.data.database.buildChanges(docParams);
+ /* --------------------------------------------------
+ Set changes view
+ ----------------------------------------------------*/
this.changesView = this.setView("#dashboard-lower-content", new Changes.Changes({
model: this.data.database
}));
+ /* --------------------------------------------------
+ Set up right header
+ ----------------------------------------------------*/
+
this.filterView = new Components.FilterView({
eventNamespace: "changes"
});
- this.headerView = this.setView("#dashboard-upper-content", new Changes.ChangesHeader({
- filterView: this.filterView
+
+ this.headerView = this.setView("#api-navbar", new Changes.ChangesHeader({
+ filterView: this.filterView,
+ endpoint: this.data.database.url("apiurl"),
+ documentation: this.data.database.documentation()
}));
+ this.changesHeader = true;
- this.viewEditor && this.viewEditor.remove();
+ /* --------------------------------------------------
+ Set sidebar highlight
+ ----------------------------------------------------*/
this.sidebar.setSelectedTab('changes');
- this.crumbs = function () {
- return [
- {"name": "", "className": "fonticon-left-open", "link": "/_all_dbs"},
- {"name": this.data.database.id, "link": Databases.databaseUrl(this.data.database)},
- {"name": "_changes", "link": "/_changes"}
- ];
- };
-
- this.apiUrl = function() {
- return [this.data.database.url("apiurl"), this.data.database.documentation()];
- };
+ /* --------------------------------------------------
+ Set up breadcrumb header
+ ----------------------------------------------------*/
+ var crumbs = [
+ {"name": "", "className": "fonticon-left-open", "link": "/_all_dbs"},
+ {"name": this.data.database.id, "link": Databases.databaseUrl(this.data.database)},
+ {"name": "_changes", "link": "/_changes"}
+ ];
+ /* Set up breadcrumb header */
+ this.leftheader = this.setView("#breadcrumbs", new Components.LeftHeader({
+ crumbs: crumbs
+ }));
},
addFilter: function (filter) {
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/056c78c5/app/addons/documents/templates/changes.html
----------------------------------------------------------------------
diff --git a/app/addons/documents/templates/changes.html b/app/addons/documents/templates/changes.html
index a9bfbaf..15330c9 100644
--- a/app/addons/documents/templates/changes.html
+++ b/app/addons/documents/templates/changes.html
@@ -11,7 +11,7 @@ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
-->
-<div class="changes-view">
+
<% _.each(changes, function (change) { %>
<div class="change-wrapper">
<div class="change-box">
@@ -66,4 +66,4 @@ the License.
</div>
</div>
<% }); %>
-</div>
+
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/056c78c5/app/addons/documents/views-changes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views-changes.js b/app/addons/documents/views-changes.js
index fad88b9..d63a825 100644
--- a/app/addons/documents/views-changes.js
+++ b/app/addons/documents/views-changes.js
@@ -27,25 +27,27 @@ function(app, FauxtonAPI, resizeColumns, Components, prettify, ZeroClipboard) {
var Views = {};
Views.ChangesHeader = FauxtonAPI.View.extend({
- template: "addons/documents/templates/changes_header",
+ template: "addons/documents/templates/header_alldocs",
+ initialize: function (options) {
+ this.filterView = options.filterView;
+ this.endpoint = options.endpoint;
+ this.documentation = options.documentation;
- events: {
- 'click .js-toggle-filter': "toggleQuery"
- },
-
- toggleQuery: function (event) {
- $('#dashboard-content').scrollTop(0);
- this.$('#query').toggle('slow');
},
-
- initialize: function () {
- this.setView(".js-filter", this.filterView);
+ beforeRender: function(){
+ this.setView("#header-search", this.filterView);
+
+ //Moved the apibar view into the components file so you can include it in your views
+ this.apiBar = this.insertView("#header-api-bar", new Components.ApiBar({
+ endpoint: this.endpoint,
+ documentation: this.documentation
+ }));
}
});
Views.Changes = Components.FilteredView.extend({
+ className: "changes-view",
template: "addons/documents/templates/changes",
-
initialize: function () {
this.listenTo(this.model.changes, 'sync', this.render);
this.listenTo(this.model.changes, 'cachesync', this.render);
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/056c78c5/app/addons/fauxton/components.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/components.js b/app/addons/fauxton/components.js
index 0ef9503..18ea5b8 100644
--- a/app/addons/fauxton/components.js
+++ b/app/addons/fauxton/components.js
@@ -44,10 +44,10 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) {
this.crumbs = options.crumbs || [];
},
updateCrumbs: function(crumbs){
- this.breadcrumbs.update(crumbs);
+ this.breadcrumbs && this.breadcrumbs.update(crumbs);
},
updateDropdown: function(menuLinks){
- this.dropdown.update(menuLinks);
+ this.dropdown && this.dropdown.update(menuLinks);
},
beforeRender: function(){
this.setUpCrumbs();