Github user garrensmith commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/33#discussion_r16406921
--- Diff: app/addons/documents/views.js ---
@@ -38,6 +38,159 @@ function(app, FauxtonAPI, Components, Documents,
Databases, Views, QueryOptions,
});
}
+ //Header for alldocs with search, Query options,& api bar
+ Views.RightAllDocsHeader = FauxtonAPI.View.extend({
+ className: "header-right",
+ template: "addons/documents/templates/header_alldocs",
+ events: {
+ 'click .toggle-select-menu': 'selectAllMenu'
+ },
+
+ initialize: function(options){
+ //adding the database to the object
+ this.database = options.database;
+ _.bindAll(this);
+ this.selectVisible = false;
+ FauxtonAPI.Events.on('advancedOptions:updateView',
this.updateAllDocs);
+ FauxtonAPI.Events.on('success:bulkDelete', this.selectAllMenu);
+ },
+
+ selectAllMenu: function(e){
+ FauxtonAPI.triggerRouteEvent("toggleSelectHeader");
+
FauxtonAPI.Events.trigger("documents:show-select-all",this.selectVisible);
+ },
+
+ addAllDocsMenu: function(){
+ //search docs
+ this.headerSearch = this.insertView("#header-search", new
Views.JumpToDoc({
+ database: this.database,
+ collection: this.database.allDocs
+ }));
+ //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.queryOptions = this.insertView("#query-options", new
QueryOptions.AdvancedOptions({
+ database: this.database,
+ hasReduce: false,
+ showPreview: false,
+ }));
+
+ //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({}));
+
+ this.apiBar.render();
+ this.queryOptions.render();
+ this.headerSearch.render();
+ },
+
+ 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);
+ },
+
+ serialize: function() {
+ //basically if you want something in a template, You can define it
here
+ return {
+ database: this.database.get('id')
+ };
+ },
+
+ beforeRender:function(){
+ this.addAllDocsMenu();
+ },
+
+ //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');
--- End diff --
Is this line still relevant?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---