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/25 15:40:01 UTC
[21/48] fauxton commit: updated refs/heads/secondary-indexes to
8688d16
style query options now it is inside header
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/a6d6ff84
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/a6d6ff84
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/a6d6ff84
Branch: refs/heads/secondary-indexes
Commit: a6d6ff847c98c5d1815da0e02c7d6d68c2b20da2
Parents: 6e29869
Author: Jenn Schiffer <je...@pancaketheorem.com>
Authored: Sun Aug 24 16:33:43 2014 +0200
Committer: deathbearbrown <de...@gmail.com>
Committed: Mon Aug 25 09:35:09 2014 -0400
----------------------------------------------------------------------
.../documents/assets/less/advancedOptions.less | 4 +-
app/addons/documents/assets/less/documents.less | 2 +-
.../documents/templates/header_alldocs.html | 41 +++---
app/addons/documents/views.js | 127 ++++++++++++-------
4 files changed, 104 insertions(+), 70 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a6d6ff84/app/addons/documents/assets/less/advancedOptions.less
----------------------------------------------------------------------
diff --git a/app/addons/documents/assets/less/advancedOptions.less b/app/addons/documents/assets/less/advancedOptions.less
index b68dfd5..a932559 100644
--- a/app/addons/documents/assets/less/advancedOptions.less
+++ b/app/addons/documents/assets/less/advancedOptions.less
@@ -12,7 +12,7 @@
/*ALL DOCS TABLE*/
/*for advanced options css*/
-#query {
+#query-options {
.border-radius(5px);
width: 490px;
position: absolute;
@@ -78,7 +78,7 @@
}
}
}
-#query:before {
+#query-options:before {
content: '';
position: absolute;
top: -25px;
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a6d6ff84/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 b52e54f..647e847 100644
--- a/app/addons/documents/assets/less/documents.less
+++ b/app/addons/documents/assets/less/documents.less
@@ -42,7 +42,7 @@ button.beautify {
}
-#query div.controls-group.well{
+#query-options div.controls-group.well{
height: 180px;
margin-right: 17px;
}
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a6d6ff84/app/addons/documents/templates/header_alldocs.html
----------------------------------------------------------------------
diff --git a/app/addons/documents/templates/header_alldocs.html b/app/addons/documents/templates/header_alldocs.html
index 72d49ad..6312a47 100644
--- a/app/addons/documents/templates/header_alldocs.html
+++ b/app/addons/documents/templates/header_alldocs.html
@@ -13,31 +13,32 @@ the License.
-->
<div class="header-left">
-<!--back arrow-->
-
-<!--title with dropdown DB search-->
-
-
-<!-- Menu gear-->
-
+ <!--back arrow-->
+
+ <!--title with dropdown DB search-->
+ <h2><%-database%></h2>
+
+ <!-- Menu gear-->
</div>
-
-
+
+
<div class="header-right">
<!-- Select all -->
-
+
<!-- search (jump to doc)-->
<div id="header-search" class="js-search searchbox-container"></div>
-
+
<!-- Query Options-->
- <a id="toggle-query" href="#query" data-bypass="true" data-toggle="tab">
- <i class="fonticon fonticon-plus"></i>
- Query Options
- </a>
-
- <div class="tab-content">
- <div class="tab-pane" id="query">
+ <div class="header-query-options">
+ <a id="toggle-query" href="#query-options" data-bypass="true" data-toggle="tab">
+ <i class="fonticon fonticon-plus"></i>
+ Query Options
+ </a>
+ <!-- Insert the query options here :) -->
+ <div id="query-options">
+ </div>
</div>
+
</div>
-
- <!--right margin for api bar-->
\ No newline at end of file
+
+<!--right margin for api bar-->
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a6d6ff84/app/addons/documents/views.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views.js b/app/addons/documents/views.js
index 50c9c77..0d8993c 100644
--- a/app/addons/documents/views.js
+++ b/app/addons/documents/views.js
@@ -1,3 +1,4 @@
+
// 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
@@ -45,11 +46,18 @@ function(app, FauxtonAPI, Components, Documents, Databases, Views, QueryOptions,
'select .selectAllDocs': 'selectAllDocs'
},
initialize: function(options){
-
+ //adding the database to the object
+ this.database = options.database;
},
selectAllDocs: function(){
//trigger event to select all in other view
},
+ serialize: function() {
+ //basically if you want something in a template, You can define it here
+ return {
+ database: this.database.get('id')
+ };
+ },
beforeRender:function(){
//insert DB search dropdown
@@ -62,7 +70,75 @@ function(app, FauxtonAPI, Components, Documents, Databases, Views, QueryOptions,
}));
//insert queryoptions
+ //that file is included in require() above and the argument is QueryOptions
+ // and it wants all these params:
+ /* Sooooo I searched this file for where Advanced options was originally inserted to see what the hell
+ is happening. and it's in AllDocsLayout. So I'm going to move some of those functions over here
+
+ These are required:
+ this.database = options.database;
+ this.updateViewFn = options.updateViewFn;
+ this.previewFn = options.previewFn;
+
+ these are booleans:
+ this.showStale = _.isUndefined(options.showStale) ? false : options.showStale;
+ this.hasReduce = _.isUndefined(options.hasReduce) ? true : options.hasReduce;
+
+ these you only need for view indexes, not all docs because they are about
+ specific views and design docs (ddocs, also views live inside a ddoc):
+ this.viewName = options.viewName;
+ this.ddocName = options.ddocName;
+ */
+ this.setView("#query-options", new QueryOptions.AdvancedOptions({
+ updateViewFn: this.updateAllDocs,
+ previewFn: this.previewView,
+ database: this.database,
+ hasReduce: false,
+ showPreview: false,
+ }));
+
+ },
+ //moved from alldocs layout
+ updateAllDocs: 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', {allDocs: true});
+ },
+ previewView: function (event) {
+ event.preventDefault();
}
});
@@ -297,7 +373,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, Views, QueryOptions,
toggleQuery: function (event) {
$('#dashboard-content').scrollTop(0);
- this.$('#query').toggle();
+ this.$('#query-options').toggle();
},
beforeRender: function () {
@@ -312,56 +388,13 @@ function(app, FauxtonAPI, Components, Documents, Databases, Views, QueryOptions,
this.toolsView = this.setView(".js-search", new Views.JumpToDoc({
database: this.database,
collection: this.database.allDocs
- }));
+ }));
},
afterRender: function () {
if (this.params) {
this.advancedOptions.updateFromParams(this.params);
}
- },
-
- updateAllDocs: 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', {allDocs: true});
- },
-
- previewView: function (event) {
- event.preventDefault();
}
});
@@ -434,7 +467,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, Views, QueryOptions,
rev = this.collection.get(docId).get('_rev'),
data = {_id: docId, _rev: rev, _deleted: true};
- if (!$row.hasClass('js-to-delete')) {
+ if (!$row.hasClass('js-to-delete')) {
this.bulkDeleteDocsCollection.add(data);
} else {
this.bulkDeleteDocsCollection.remove(this.bulkDeleteDocsCollection.get(docId));