Rename mixins to utils, add app.host to urls
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/3465b04d Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/3465b04d Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/3465b04d Branch: refs/heads/master Commit: 3465b04d696c8d47f4a5ab9ef748bcc93f1c53d8 Parents: 89810cc Author: Garren Smith <garren.sm...@gmail.com> Authored: Mon Jan 13 11:09:19 2014 +0200 Committer: Garren Smith <garren.sm...@gmail.com> Committed: Mon Jan 13 11:09:19 2014 +0200 ---------------------------------------------------------------------- src/fauxton/app/addons/auth/resources.js | 6 +- .../app/addons/config/assets/less/config.less | 44 ++++ .../app/addons/config/templates/item.html | 2 +- .../addons/databases/assets/less/databases.less | 247 +++++++++++++++++++ src/fauxton/app/addons/databases/base.js | 2 +- src/fauxton/app/addons/databases/resources.js | 6 +- src/fauxton/app/addons/databases/views.js | 8 +- src/fauxton/app/addons/documents/resources.js | 14 +- src/fauxton/app/addons/documents/routes.js | 4 +- src/fauxton/app/addons/documents/views.js | 20 +- .../app/addons/logs/assets/less/logs.less | 24 ++ src/fauxton/app/addons/permissions/resources.js | 2 +- .../app/addons/verifyinstall/resources.js | 7 +- src/fauxton/app/api.js | 2 +- src/fauxton/app/app.js | 6 +- src/fauxton/app/helpers.js | 3 +- src/fauxton/app/mixins.js | 66 ----- src/fauxton/app/resizeColumns.js | 10 +- src/fauxton/app/utils.js | 66 +++++ src/fauxton/assets/less/config.less | 46 ---- src/fauxton/assets/less/database.less | 245 ------------------ src/fauxton/assets/less/fauxton.less | 3 - src/fauxton/assets/less/logs.less | 24 -- 23 files changed, 425 insertions(+), 432 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/3465b04d/src/fauxton/app/addons/auth/resources.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/auth/resources.js b/src/fauxton/app/addons/auth/resources.js index b1d40cc..970d55b 100644 --- a/src/fauxton/app/addons/auth/resources.js +++ b/src/fauxton/app/addons/auth/resources.js @@ -47,7 +47,7 @@ function (app, FauxtonAPI) { }); Auth.Session = FauxtonAPI.Session.extend({ - url: '/_session', + url: app.host + '/_session', initialize: function (options) { if (!options) { options = {}; } @@ -155,7 +155,7 @@ function (app, FauxtonAPI) { return $.ajax({ cache: false, type: "POST", - url: "/_session", + url: app.host + "/_session", dataType: "json", data: {name: username, password: password} }).then(function () { @@ -168,7 +168,7 @@ function (app, FauxtonAPI) { return $.ajax({ type: "DELETE", - url: "/_session", + url: app.host + "/_session", dataType: "json", username : "_", password : "_" http://git-wip-us.apache.org/repos/asf/couchdb/blob/3465b04d/src/fauxton/app/addons/config/assets/less/config.less ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/config/assets/less/config.less b/src/fauxton/app/addons/config/assets/less/config.less index 86d9bf1..8495b69 100644 --- a/src/fauxton/app/addons/config/assets/less/config.less +++ b/src/fauxton/app/addons/config/assets/less/config.less @@ -1,3 +1,47 @@ +/* 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +.config-item { + height: 41px; + + .edit-button { + float: right; + .btn; + .btn-mini; + display:none; + } + + td:hover .edit-button { + display: block; + } + + .value-input { + width: 98%; + } + + #delete-value { + cursor: pointer; + } +} + +.button-margin { + margin-bottom: 15px; +} + +#add-section-modal { + width: 400px; +} + table.config { #config-trash { width: 5%; http://git-wip-us.apache.org/repos/asf/couchdb/blob/3465b04d/src/fauxton/app/addons/config/templates/item.html ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/config/templates/item.html b/src/fauxton/app/addons/config/templates/item.html index 3e6e4ee..1c808b9 100644 --- a/src/fauxton/app/addons/config/templates/item.html +++ b/src/fauxton/app/addons/config/templates/item.html @@ -20,7 +20,7 @@ the License. <td> <%= option.name %> </td> <td> <div id="show-value"> - <%= option.value %> <button class="edit-button"> Edit </button> + <%= option.value %> <button class="edit-button btn-mini btn"> Edit </button> </div> <div id="edit-value-form" style="display:none"> <input class="value-input" type="text" value="<%= option.value %>" /> http://git-wip-us.apache.org/repos/asf/couchdb/blob/3465b04d/src/fauxton/app/addons/databases/assets/less/databases.less ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/databases/assets/less/databases.less b/src/fauxton/app/addons/databases/assets/less/databases.less new file mode 100644 index 0000000..3d86d81 --- /dev/null +++ b/src/fauxton/app/addons/databases/assets/less/databases.less @@ -0,0 +1,247 @@ +/* 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +/* =database + ---------------------------------------------------------------------- */ +@import "../../../../../assets/less/bootstrap/variables.less"; +@import "../../../../../assets/less/bootstrap/mixins.less"; +#db-tools { + position: absolute; + top: -7px; + right: 0; + width: 390px; + + .btn-group { + position: absolute; + left: 0; + top: 6px; + } + + form { + position: absolute; + right: 0; + top: 0; + } +} + +.tools .nav { + margin-bottom: 10px; +} + +#sidenav { + padding-top: 10px; + + h3 { + margin: 10px 0; + } + + li a span.divider { + background: none; + color: #ccc; + padding: 0 2px; + } + + li.nav-header a { + display: inline + } + + div.btn-group { + display: inline-block; + } + + li.nav-header, #sidenav li a { + padding-left: 4px; + } + + li.active a { + background-color: #ddd; + color: #333; + text-shadow: none; + } +} + +.edit { + display: none; + + form { + margin-bottom: 0; + } + + h3 { + border-bottom: 1px solid #ccc; + font-size: 100%; + line-height: 1; + margin-bottom: 18px; + } + + textarea { + height: 100px; + width: 95%; + } + + .btn-toolbar { + margin-bottom: 0; + } + + .preview { + width: 100px; + } + + .save { + } +} + +#new-view-index { + .confirm { + display: none; + } + + .confirm .progress { + display: none; + margin: 20px; + } + + textarea { + height: 100px; + width: 95%; + } +} + +.view { + display: none; + + .result-tools { + float: left; + width: 100%; + margin-bottom: 10px; + } + + table td div { + position: relative; + } + + table td div div { + display: none; + line-height: 1; + position: absolute; + right: 4px; + top: 4px; + } + + table td div:hover div a.edits { + padding-left: 16px; + padding-right: 16px; + } + + table td div:hover div { + display: block; + } + +} +.view.show { + display: block; +} +.view.show.hidden-by-params { + display: none; +} +#database .view table tr td { + padding: 0; +} + +.loading {display: none;} + +.view-request-duration { + padding-right: 10px; + float: right; +} + +table.active-tasks{ + th { + cursor: pointer; + } +} + +.well{ + .row-fluid{ + margin: 0; + } + .row-fluid .row-fluid:last-child .well-item { + border: none; + } + .well-item{ + color: #666; + font-size: 12px; + border-bottom: 1px solid #e5e5e5; + padding: 8px 4px; + strong { + font-size: 16px; + } + } +} + + +#doc { + .dropdown-menu{ + width: auto; + } +} +// #tabs { +// height: 40px; +// } + +.databases{ + a.db-actions, + a.db-actions:visited{ + color: @red; + border: 1px solid #e3e3e3; + padding: 5px 7px; + .border-radius(6px); + text-decoration: none; + font-size: 19px; + } +} +.btn-group{ + ul.dropdown-menu li a:before{ + margin-right: 10px; + } +} + +.design-doc-group{ + .span3 { margin: 0;} + #new-ddoc-section { + margin-top: 10px; + label{ width: 100px} + .controls{ + margin-left: 100px; + } + } +} +table#changes-table { + + #changes { + width: 50%; + } + + #seq, #deleted { + width: 5%; + } + +} + +.doc-editor-buttons { + margin-bottom: 15px; + a.button.btn-large.gray { + padding: 9px 10px; + vertical-align: middle; + } +} http://git-wip-us.apache.org/repos/asf/couchdb/blob/3465b04d/src/fauxton/app/addons/databases/base.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/databases/base.js b/src/fauxton/app/addons/databases/base.js index 1a3dc66..ea1719c 100644 --- a/src/fauxton/app/addons/databases/base.js +++ b/src/fauxton/app/addons/databases/base.js @@ -28,7 +28,7 @@ function(app, FauxtonAPI, Databases, Views) { // Utility functions Databases.databaseUrl = function(database) { var name = _.isObject(database) ? database.id : database, - dbname = app.mixins.safeURLName(name); + dbname = app.utils.safeURLName(name); return ["/database/", dbname, "/_all_docs?limit=" + Databases.DocLimit].join(''); }; http://git-wip-us.apache.org/repos/asf/couchdb/blob/3465b04d/src/fauxton/app/addons/databases/resources.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/databases/resources.js b/src/fauxton/app/addons/databases/resources.js index b6d6536..3510154 100644 --- a/src/fauxton/app/addons/databases/resources.js +++ b/src/fauxton/app/addons/databases/resources.js @@ -67,10 +67,10 @@ function(app, FauxtonAPI, Documents) { } }, safeName: function(){ - return app.mixins.safeURLName(this.get("name")); + return app.utils.safeURLName(this.get("name")); }, safeID: function() { - return app.mixins.safeURLName(this.id); + return app.utils.safeURLName(this.id); }, buildChanges: function (params) { this.changes = new Databases.Changes({ @@ -182,7 +182,7 @@ function(app, FauxtonAPI, Documents) { // TODO: pagination! return _.map(resp, function(database) { return { - id: app.mixins.safeURLName(database), + id: app.utils.safeURLName(database), name: database }; }); http://git-wip-us.apache.org/repos/asf/couchdb/blob/3465b04d/src/fauxton/app/addons/databases/views.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/databases/views.js b/src/fauxton/app/addons/databases/views.js index 80d64ed..0068305 100644 --- a/src/fauxton/app/addons/databases/views.js +++ b/src/fauxton/app/addons/databases/views.js @@ -29,7 +29,7 @@ function(app, Components, FauxtonAPI, Databases) { }, serialize: function() { return { - encoded: app.mixins.safeURLName(this.model.get("name")), + encoded: app.utils.safeURLName(this.model.get("name")), database: this.model, docLimit: Databases.DocLimit }; @@ -77,11 +77,11 @@ function(app, Components, FauxtonAPI, Databases) { dbname = selectedName; } - if (dbname && this.collection.where({"id":app.mixins.safeURLName(dbname)}).length > 0){ + if (dbname && this.collection.where({"id":app.utils.safeURLName(dbname)}).length > 0){ // TODO: switch to using a model, or Databases.databaseUrl() // Neither of which are in scope right now // var db = new Database.Model({id: dbname}); - var url = ["/database/", app.mixins.safeURLName(dbname), "/_all_docs?limit=" + Databases.DocLimit].join(''); + var url = ["/database/", app.utils.safeURLName(dbname), "/_all_docs?limit=" + Databases.DocLimit].join(''); FauxtonAPI.navigate(url); } else { FauxtonAPI.addNotification({ @@ -173,7 +173,7 @@ function(app, Components, FauxtonAPI, Databases) { type: "success", clear: true }); - var route = "#/database/" + app.mixins.safeURLName(name) + "/_all_docs?limit=" + Databases.DocLimit; + var route = "#/database/" + app.utils.safeURLName(name) + "/_all_docs?limit=" + Databases.DocLimit; app.router.navigate(route, { trigger: true }); } ).error(function(xhr) { http://git-wip-us.apache.org/repos/asf/couchdb/blob/3465b04d/src/fauxton/app/addons/documents/resources.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/documents/resources.js b/src/fauxton/app/addons/documents/resources.js index 5254302..5e10ded 100644 --- a/src/fauxton/app/addons/documents/resources.js +++ b/src/fauxton/app/addons/documents/resources.js @@ -27,7 +27,7 @@ function(app, FauxtonAPI) { if (context === "app") { return this.getDatabase().url("app") + "/" + this.safeID(); } else if (context === "web-index") { - return this.getDatabase().url("app") + "/" + app.mixins.safeURLName(this.id); + return this.getDatabase().url("app") + "/" + app.utils.safeURLName(this.id); } else if (context === "apiurl"){ return window.location.origin + "/" + this.getDatabase().safeID() + "/" + this.safeID(); } else { @@ -143,9 +143,9 @@ function(app, FauxtonAPI) { safeID: function() { if (this.isDdoc()){ var ddoc = this.id.replace(/^_design\//,""); - return "_design/"+app.mixins.safeURLName(ddoc); + return "_design/"+app.utils.safeURLName(ddoc); }else{ - return app.mixins.safeURLName(this.id); + return app.utils.safeURLName(this.id); } }, @@ -219,7 +219,7 @@ function(app, FauxtonAPI) { // json editor for docs, or into a ddoc specific page. safeID: function() { var ddoc = this.id.replace(/^_design\//,""); - return "_design/"+app.mixins.safeURLName(ddoc); + return "_design/"+app.utils.safeURLName(ddoc); } }); @@ -247,7 +247,7 @@ function(app, FauxtonAPI) { return this.docType() != "reduction"; }, safeID: function() { - return app.mixins.safeURLName(this.id); + return app.utils.safeURLName(this.id); }, prettyJSON: function() { @@ -423,8 +423,8 @@ function(app, FauxtonAPI) { } else if (context === "apiurl"){ startOfUrl = window.location.origin; } - var design = app.mixins.safeURLName(this.design), - view = app.mixins.safeURLName(this.view); + var design = app.utils.safeURLName(this.design), + view = app.utils.safeURLName(this.view); var url = [startOfUrl, this.database.safeID(), "_design", design, this.idxType, view]; return url.join("/") + query; http://git-wip-us.apache.org/repos/asf/couchdb/blob/3465b04d/src/fauxton/app/addons/documents/routes.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/documents/routes.js b/src/fauxton/app/addons/documents/routes.js index d120feb..6786edf 100644 --- a/src/fauxton/app/addons/documents/routes.js +++ b/src/fauxton/app/addons/documents/routes.js @@ -92,7 +92,7 @@ function(app, FauxtonAPI, Documents, Databases) { doc.copy(newId).then(function () { doc.set({_id: newId}); docView.forceRender(); - FauxtonAPI.navigate('/database/' + database.safeID() + '/' + app.mixins.safeURLName(newId), {trigger: true}); + FauxtonAPI.navigate('/database/' + database.safeID() + '/' + app.utils.safeURLName(newId), {trigger: true}); FauxtonAPI.addNotification({ msg: "Document has been duplicated." }); @@ -259,7 +259,7 @@ function(app, FauxtonAPI, Documents, Databases) { ddocInfo: ddocInfo })); - this.sidebar.setSelectedTab(app.mixins.removeSpecialCharacters(ddoc) + '_' + app.mixins.removeSpecialCharacters(view)); + this.sidebar.setSelectedTab(app.utils.removeSpecialCharacters(ddoc) + '_' + app.utils.removeSpecialCharacters(view)); this.crumbs = function () { return [ http://git-wip-us.apache.org/repos/asf/couchdb/blob/3465b04d/src/fauxton/app/addons/documents/views.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/documents/views.js b/src/fauxton/app/addons/documents/views.js index 97d58e3..80c0d87 100644 --- a/src/fauxton/app/addons/documents/views.js +++ b/src/fauxton/app/addons/documents/views.js @@ -241,7 +241,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum duplicate: function (event) { event.preventDefault(); var newId = this.$('#dup-id').val(), - encodedID = app.mixins.safeURLName(newId); + encodedID = app.utils.safeURLName(newId); this.hideModal(); FauxtonAPI.triggerRouteEvent('duplicateDoc', encodedID); @@ -423,11 +423,11 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum index: this.index, ddoc: this.ddoc, database: this.database, - index_clean: app.mixins.removeSpecialCharacters(this.index), - ddoc_clean: app.mixins.removeSpecialCharacters(this.ddoc), - index_encoded: app.mixins.safeURLName(this.index), - ddoc_encoded: app.mixins.safeURLName(this.ddoc), - database_encoded: app.mixins.safeURLName(this.database), + index_clean: app.utils.removeSpecialCharacters(this.index), + ddoc_clean: app.utils.removeSpecialCharacters(this.ddoc), + index_encoded: app.utils.safeURLName(this.index), + ddoc_encoded: app.utils.safeURLName(this.ddoc), + database_encoded: app.utils.safeURLName(this.database), selected: this.selected }; }, @@ -470,7 +470,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum } return { - database: app.mixins.safeURLName(this.collection.database.id), + database: app.utils.safeURLName(this.collection.database.id), updateSeq: updateSeq, offset: recordStart, totalRows: totalRows, @@ -1365,7 +1365,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum }); if (that.newView) { - var fragment = '/database/' + that.database.safeID() +'/' + ddoc.safeID() + '/_view/' + app.mixins.safeURLName(viewName); + var fragment = '/database/' + that.database.safeID() +'/' + ddoc.safeID() + '/_view/' + app.utils.safeURLName(viewName); FauxtonAPI.navigate(fragment, {trigger: false}); that.newView = false; @@ -1375,7 +1375,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum that.showIndex = true; that.render(); FauxtonAPI.triggerRouteEvent('reloadDesignDocs', { - selectedTab: app.mixins.removeSpecialCharacters(ddocName.replace(/_design\//,'')) + '_' + app.mixins.removeSpecialCharacters(viewName) + selectedTab: app.utils.removeSpecialCharacters(ddocName.replace(/_design\//,'')) + '_' + app.utils.removeSpecialCharacters(viewName) }); } @@ -1675,7 +1675,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum jumpToDoc: function (event) { event.preventDefault(); var docId = this.$('#jump-to-doc-id').val().trim(); - FauxtonAPI.navigate('/database/' + app.mixins.safeURLName(this.database.id) +'/' + app.mixins.safeURLName(docId), {trigger: true}); + FauxtonAPI.navigate('/database/' + app.utils.safeURLName(this.database.id) +'/' + app.utils.safeURLName(docId), {trigger: true}); }, afterRender: function () { http://git-wip-us.apache.org/repos/asf/couchdb/blob/3465b04d/src/fauxton/app/addons/logs/assets/less/logs.less ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/logs/assets/less/logs.less b/src/fauxton/app/addons/logs/assets/less/logs.less new file mode 100644 index 0000000..e50f903 --- /dev/null +++ b/src/fauxton/app/addons/logs/assets/less/logs.less @@ -0,0 +1,24 @@ +/* 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +#log-sidebar { + + ul { + margin-left: 0px; + list-style: none; + } + + .remove-filter { + opacity: 0.2; + } +} http://git-wip-us.apache.org/repos/asf/couchdb/blob/3465b04d/src/fauxton/app/addons/permissions/resources.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/permissions/resources.js b/src/fauxton/app/addons/permissions/resources.js index 66eaffd..8acaddd 100644 --- a/src/fauxton/app/addons/permissions/resources.js +++ b/src/fauxton/app/addons/permissions/resources.js @@ -39,7 +39,7 @@ function (app, FauxtonAPI ) { }, url: function () { - return this.database.id + '/_security'; + return app.host + this.database.id + '/_security'; }, addItem: function (value, type, section) { http://git-wip-us.apache.org/repos/asf/couchdb/blob/3465b04d/src/fauxton/app/addons/verifyinstall/resources.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/verifyinstall/resources.js b/src/fauxton/app/addons/verifyinstall/resources.js index 8a98883..aa08997 100644 --- a/src/fauxton/app/addons/verifyinstall/resources.js +++ b/src/fauxton/app/addons/verifyinstall/resources.js @@ -130,7 +130,7 @@ function (app, FauxtonAPI, Databases, Documents) { setupReplicate: function () { return $.ajax({ - url: '/_replicate', + url: app.host + '/_replicate', contentType: 'application/json', type: 'POST', dataType: 'json', @@ -145,11 +145,6 @@ function (app, FauxtonAPI, Databases, Documents) { testReplicate: function () { var deferred = FauxtonAPI.Deferred(); - /*var dbReplicate = new Databases.Model({ - id: 'verifytestdb_replicate', - name: 'verifytestdb_replicate' - });*/ - var promise = dbReplicate.fetch(); promise.then(function () { http://git-wip-us.apache.org/repos/asf/couchdb/blob/3465b04d/src/fauxton/app/api.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/api.js b/src/fauxton/app/api.js index c9d08bf..f423ef5 100644 --- a/src/fauxton/app/api.js +++ b/src/fauxton/app/api.js @@ -132,7 +132,7 @@ function(app, Fauxton) { }); FauxtonAPI.Session = Backbone.Model.extend({ - url: '/_session', + url: app.host + '/_session', user: function () { var userCtx = this.get('userCtx'); http://git-wip-us.apache.org/repos/asf/couchdb/blob/3465b04d/src/fauxton/app/app.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/app.js b/src/fauxton/app/app.js index 9ac5bc2..5325f77 100644 --- a/src/fauxton/app/app.js +++ b/src/fauxton/app/app.js @@ -21,7 +21,7 @@ define([ "bootstrap", "helpers", - "mixins", + "utils", // Modules "resizeColumns", @@ -31,7 +31,7 @@ define([ ], -function(app, $, _, Backbone, Bootstrap, Helpers, Mixins, resizeColumns) { +function(app, $, _, Backbone, Bootstrap, Helpers, Utils, resizeColumns) { // Make sure we have a console.log if (typeof console == "undefined") { @@ -43,7 +43,7 @@ function(app, $, _, Backbone, Bootstrap, Helpers, Mixins, resizeColumns) { // Provide a global location to place configuration settings and module // creation also mix in Backbone.Events _.extend(app, Backbone.Events, { - mixins: Mixins, + utils: Utils, renderView: function(baseView, selector, view, options, callback) { baseView.setView(selector, new view(options)).render().then(callback); http://git-wip-us.apache.org/repos/asf/couchdb/blob/3465b04d/src/fauxton/app/helpers.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/helpers.js b/src/fauxton/app/helpers.js index 73a37ca..d4836b9 100644 --- a/src/fauxton/app/helpers.js +++ b/src/fauxton/app/helpers.js @@ -48,7 +48,8 @@ function() { "_active_tasks": "http://docs.couchdb.org/en/latest/api/server/common.html?highlight=stats#active-tasks", "log": "http://docs.couchdb.org/en/latest/api/server/common.html?highlight=stats#log", "config": "http://docs.couchdb.org/en/latest/config/index.html", - "views": "http://docs.couchdb.org/en/latest/intro/overview.html#views" + "views": "http://docs.couchdb.org/en/latest/intro/overview.html#views", + "changes": "http://docs.couchdb.org/en/latest/api/database/changes.html?highlight=changes#post--db-_changes" }; Helpers.getDocUrl = function(docKey){ http://git-wip-us.apache.org/repos/asf/couchdb/blob/3465b04d/src/fauxton/app/mixins.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/mixins.js b/src/fauxton/app/mixins.js deleted file mode 100644 index 3679ec1..0000000 --- a/src/fauxton/app/mixins.js +++ /dev/null @@ -1,66 +0,0 @@ -// 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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. - - -// This file creates a set of helper functions that will be loaded for all html -// templates. These functions should be self contained and not rely on any -// external dependencies as they are loaded prior to the application. We may -// want to change this later, but for now this should be thought of as a -// "purely functional" helper system. - - -define([ - "jquery", - "lodash" -], - -function($, _ ) { - - var mixins = {}; - - var onWindowResize = {}; - - mixins.addWindowResize = function(fun, key){ - onWindowResize[key]=fun; - // You shouldn't need to call it here. Just define it at startup and each time it will loop - // through all the functions in the hash. - //app.initWindowResize(); - }; - - mixins.removeWindowResize = function(key){ - delete onWindowResize[key]; - mixins.initWindowResize(); - }; - - mixins.initWindowResize = function(){ - //when calling this it should be overriding what was called previously - window.onresize = function(e) { - // could do this instead of the above for loop - _.each(onWindowResize, function (fn) { - fn(); - }); - }; - }; - - mixins.removeSpecialCharacters = function(name){ - return name.replace(/[^\w\s]/gi,""); - }; - - mixins.safeURLName = function(name){ - var testName = name || ""; - var checkforBad = testName.match(/[\$\-/_,+-]/g); - return (checkforBad !== null)?encodeURIComponent(name):name; - }; - - return mixins; -}); - http://git-wip-us.apache.org/repos/asf/couchdb/blob/3465b04d/src/fauxton/app/resizeColumns.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/resizeColumns.js b/src/fauxton/app/resizeColumns.js index 9cf7115..bb50767 100644 --- a/src/fauxton/app/resizeColumns.js +++ b/src/fauxton/app/resizeColumns.js @@ -18,10 +18,10 @@ // "purely functional" helper system. define([ - "mixins" + "utils" ], -function(mixins) { +function(utils) { var Resize = function(options){ this.options = options; @@ -42,8 +42,8 @@ function(mixins) { var that = this; //add throttler :) this.lazyLayout = _.debounce(that.onResizeHandler, 300).bind(this); - mixins.addWindowResize(this.lazyLayout,"animation"); - mixins.initWindowResize(); + utils.addWindowResize(this.lazyLayout,"animation"); + utils.initWindowResize(); this.onResizeHandler(); }, updateOptions:function(options){ @@ -52,7 +52,7 @@ function(mixins) { this.options.selectorElements = options.selectorElements || ".window-resizeable"; }, turnOff:function(){ - mixins.removeWindowResize("animation"); + utils.removeWindowResize("animation"); }, cleanupCallback: function(){ this.callback = null; http://git-wip-us.apache.org/repos/asf/couchdb/blob/3465b04d/src/fauxton/app/utils.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/utils.js b/src/fauxton/app/utils.js new file mode 100644 index 0000000..ded7dac --- /dev/null +++ b/src/fauxton/app/utils.js @@ -0,0 +1,66 @@ +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations under +// the License. + + +// This file creates a set of helper functions that will be loaded for all html +// templates. These functions should be self contained and not rely on any +// external dependencies as they are loaded prior to the application. We may +// want to change this later, but for now this should be thought of as a +// "purely functional" helper system. + + +define([ + "jquery", + "lodash" +], + +function($, _ ) { + + var utils = {}; + + var onWindowResize = {}; + + utils.addWindowResize = function(fun, key){ + onWindowResize[key]=fun; + // You shouldn't need to call it here. Just define it at startup and each time it will loop + // through all the functions in the hash. + //app.initWindowResize(); + }; + + utils.removeWindowResize = function(key){ + delete onWindowResize[key]; + utils.initWindowResize(); + }; + + utils.initWindowResize = function(){ + //when calling this it should be overriding what was called previously + window.onresize = function(e) { + // could do this instead of the above for loop + _.each(onWindowResize, function (fn) { + fn(); + }); + }; + }; + + utils.removeSpecialCharacters = function(name){ + return name.replace(/[^\w\s]/gi,""); + }; + + utils.safeURLName = function(name){ + var testName = name || ""; + var checkforBad = testName.match(/[\$\-/_,+-]/g); + return (checkforBad !== null)?encodeURIComponent(name):name; + }; + + return utils; +}); + http://git-wip-us.apache.org/repos/asf/couchdb/blob/3465b04d/src/fauxton/assets/less/config.less ---------------------------------------------------------------------- diff --git a/src/fauxton/assets/less/config.less b/src/fauxton/assets/less/config.less deleted file mode 100644 index fe03796..0000000 --- a/src/fauxton/assets/less/config.less +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -.config-item { - height: 41px; - - .edit-button { - float: right; - .btn; - .btn-mini; - display:none; - } - - td:hover .edit-button { - display: block; - } - - .value-input { - width: 98%; - } - - #delete-value { - cursor: pointer; - } -} - -.button-margin { - margin-bottom: 15px; -} - -#add-section-modal { - width: 400px; -} - - - http://git-wip-us.apache.org/repos/asf/couchdb/blob/3465b04d/src/fauxton/assets/less/database.less ---------------------------------------------------------------------- diff --git a/src/fauxton/assets/less/database.less b/src/fauxton/assets/less/database.less deleted file mode 100644 index 377b136..0000000 --- a/src/fauxton/assets/less/database.less +++ /dev/null @@ -1,245 +0,0 @@ -/* 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -/* =database - ---------------------------------------------------------------------- */ -#db-tools { - position: absolute; - top: -7px; - right: 0; - width: 390px; - - .btn-group { - position: absolute; - left: 0; - top: 6px; - } - - form { - position: absolute; - right: 0; - top: 0; - } -} - -.tools .nav { - margin-bottom: 10px; -} - -#sidenav { - padding-top: 10px; - - h3 { - margin: 10px 0; - } - - li a span.divider { - background: none; - color: #ccc; - padding: 0 2px; - } - - li.nav-header a { - display: inline - } - - div.btn-group { - display: inline-block; - } - - li.nav-header, #sidenav li a { - padding-left: 4px; - } - - li.active a { - background-color: #ddd; - color: #333; - text-shadow: none; - } -} - -.edit { - display: none; - - form { - margin-bottom: 0; - } - - h3 { - border-bottom: 1px solid #ccc; - font-size: 100%; - line-height: 1; - margin-bottom: 18px; - } - - textarea { - height: 100px; - width: 95%; - } - - .btn-toolbar { - margin-bottom: 0; - } - - .preview { - width: 100px; - } - - .save { - } -} - -#new-view-index { - .confirm { - display: none; - } - - .confirm .progress { - display: none; - margin: 20px; - } - - textarea { - height: 100px; - width: 95%; - } -} - -.view { - display: none; - - .result-tools { - float: left; - width: 100%; - margin-bottom: 10px; - } - - table td div { - position: relative; - } - - table td div div { - display: none; - line-height: 1; - position: absolute; - right: 4px; - top: 4px; - } - - table td div:hover div a.edits { - padding-left: 16px; - padding-right: 16px; - } - - table td div:hover div { - display: block; - } - -} -.view.show { - display: block; -} -.view.show.hidden-by-params { - display: none; -} -#database .view table tr td { - padding: 0; -} - -.loading {display: none;} - -.view-request-duration { - padding-right: 10px; - float: right; -} - -table.active-tasks{ - th { - cursor: pointer; - } -} - -.well{ - .row-fluid{ - margin: 0; - } - .row-fluid .row-fluid:last-child .well-item { - border: none; - } - .well-item{ - color: #666; - font-size: 12px; - border-bottom: 1px solid #e5e5e5; - padding: 8px 4px; - strong { - font-size: 16px; - } - } -} - - -#doc { - .dropdown-menu{ - width: auto; - } -} -// #tabs { -// height: 40px; -// } - -.databases{ - a.db-actions, - a.db-actions:visited{ - color: @red; - border: 1px solid #e3e3e3; - padding: 5px 7px; - .border-radius(6px); - text-decoration: none; - font-size: 19px; - } -} -.btn-group{ - ul.dropdown-menu li a:before{ - margin-right: 10px; - } -} - -.design-doc-group{ - .span3 { margin: 0;} - #new-ddoc-section { - margin-top: 10px; - label{ width: 100px} - .controls{ - margin-left: 100px; - } - } -} -table#changes-table { - - #changes { - width: 50%; - } - - #seq, #deleted { - width: 5%; - } - -} - -.doc-editor-buttons { - margin-bottom: 15px; - a.button.btn-large.gray { - padding: 9px 10px; - vertical-align: middle; - } -} http://git-wip-us.apache.org/repos/asf/couchdb/blob/3465b04d/src/fauxton/assets/less/fauxton.less ---------------------------------------------------------------------- diff --git a/src/fauxton/assets/less/fauxton.less b/src/fauxton/assets/less/fauxton.less index 510c3c1..d41780a 100644 --- a/src/fauxton/assets/less/fauxton.less +++ b/src/fauxton/assets/less/fauxton.less @@ -19,10 +19,7 @@ @import "bootstrap/bootstrap.less"; @import "bootstrap/mixins.less"; @import "variables.less"; -@import "config.less"; -@import "logs.less"; @import "prettyprint.less"; -@import "database.less"; @import "icons.less"; http://git-wip-us.apache.org/repos/asf/couchdb/blob/3465b04d/src/fauxton/assets/less/logs.less ---------------------------------------------------------------------- diff --git a/src/fauxton/assets/less/logs.less b/src/fauxton/assets/less/logs.less deleted file mode 100644 index e50f903..0000000 --- a/src/fauxton/assets/less/logs.less +++ /dev/null @@ -1,24 +0,0 @@ -/* 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -#log-sidebar { - - ul { - margin-left: 0px; - list-style: none; - } - - .remove-filter { - opacity: 0.2; - } -}