Github user garrensmith commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/33#discussion_r16408704
--- Diff: app/addons/indexes/views.js ---
@@ -34,8 +34,241 @@ function(app, FauxtonAPI, Components, Documents,
Databases, pouchdb,
var Views = {};
+
+//right header
+ Views.RightHeader = FauxtonAPI.View.extend({
+ className: "header-right",
+ template: "addons/indexes/templates/header_right",
+ initialize:function(options){
+ _.bindAll(this);
+ 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);
+ FauxtonAPI.Events.on('advancedOptions:updateView', this.updateView);
+ },
+ 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.apiBar = this.insertView("#header-api-bar", new
Components.ApiBar({
+ endpoint: this.endpoint,
+ documentation: this.documentation
+ }));
+
+ this.advancedOptions = this.insertView('#query-options', new
QueryOptions.AdvancedOptions({
+ 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",
+ clear: true
+ });
+ });
+ FauxtonAPI.addNotification({
+ msg: "Make sure that strings are properly quoted and any other
values are valid JSON structures",
+ type: "warning",
+ 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) {
--- End diff --
Lets remove `previewView` until we redesign and add back in.
---
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.
---