couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From deathb...@apache.org
Subject [14/26] fauxton commit: updated refs/heads/secondary-indexes to 7a446d8
Date Wed, 06 Aug 2014 19:31:21 GMT
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/13d3c59e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/13d3c59e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/13d3c59e

Branch: refs/heads/secondary-indexes
Commit: 13d3c59ea25925bd846d5940a7c39cc7ad8bad99
Parents: 1f1fd74
Author: Jenn Schiffer <jenn@pancaketheorem.com>
Authored: Thu Jul 31 14:01:04 2014 -0400
Committer: deathbearbrown <deathbearbrown@gmail.com>
Committed: Wed Aug 6 12:24:46 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/13d3c59e/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/13d3c59e/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/13d3c59e/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/13d3c59e/app/addons/documents/views.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views.js b/app/addons/documents/views.js
index ff1e5b3..98e3f38 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();
     }
 
   });
@@ -435,7 +468,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));


Mime
View raw message