summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsuelockwood <deathbear@apache.org>2014-01-28 10:39:05 -0500
committersuelockwood <deathbear@apache.org>2014-01-28 11:31:37 -0500
commit6d171cbecc3338f11d72c5aa3218d791d6e2363a (patch)
treece45c5687c54e3cd55a60db56616dd0ffd1e0ed9
parentbcb6e04af75da7a31696981aef67d72b8d3f62b1 (diff)
downloadcouchdb-6d171cbecc3338f11d72c5aa3218d791d6e2363a.tar.gz
Fix for beautify to work with require.js
-rw-r--r--src/fauxton/app/addons/documents/templates/view_editor.html4
-rw-r--r--src/fauxton/app/addons/documents/views.js4
-rw-r--r--src/fauxton/assets/js/plugins/beautify.js17
3 files changed, 8 insertions, 17 deletions
diff --git a/src/fauxton/app/addons/documents/templates/view_editor.html b/src/fauxton/app/addons/documents/templates/view_editor.html
index bf31ba2f6..d02971e38 100644
--- a/src/fauxton/app/addons/documents/templates/view_editor.html
+++ b/src/fauxton/app/addons/documents/templates/view_editor.html
@@ -41,7 +41,7 @@ the License.
<div class="js-editor" id="map-function"><%= langTemplates.map %></div>
<% } else { %>
<div class="js-editor" id="map-function"><%- ddoc.get('views')[viewName].map %></div>
- <button class="beautify beautify_map button hidden beautify-tooltip" type="button" data-toggle="tooltip" title="Reformat your minified code to make edits to it.">beautify this code</button>
+ <button class="beautify beautify_map button hide beautify-tooltip" type="button" data-toggle="tooltip" title="Reformat your minified code to make edits to it.">beautify this code</button>
<% } %>
</div>
@@ -64,7 +64,7 @@ the License.
<div class="js-editor" id="reduce-function"><%= langTemplates.reduce %></div>
<% } else { %>
<div class="js-editor" id="reduce-function"><%- ddoc.get('views')[viewName].reduce %></div>
- <button class="beautify beautify_reduce button hidden beautify-tooltip" type="button" data-toggle="tooltip" title="Reformat your minified code to make edits to it.">beautify this code</button>
+ <button class="beautify beautify_reduce button hide beautify-tooltip" type="button" data-toggle="tooltip" title="Reformat your minified code to make edits to it.">beautify this code</button>
<% } %>
</div>
diff --git a/src/fauxton/app/addons/documents/views.js b/src/fauxton/app/addons/documents/views.js
index e2f557871..95163557a 100644
--- a/src/fauxton/app/addons/documents/views.js
+++ b/src/fauxton/app/addons/documents/views.js
@@ -1630,7 +1630,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum
this.reduceEditor.render();
if (this.reduceEditor.getLines() === 1){
- this.$('.beautify_reduce').removeClass("hidden");
+ this.$('.beautify_reduce').removeClass("hide");
$('.beautify-tooltip').tooltip();
}
},
@@ -1709,7 +1709,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum
this.reduceEditor && this.reduceEditor.editSaved();
if (this.mapEditor.getLines() === 1){
- this.$('.beautify_map').removeClass("hidden");
+ this.$('.beautify_map').removeClass("hide");
$('.beautify-tooltip').tooltip();
}
},
diff --git a/src/fauxton/assets/js/plugins/beautify.js b/src/fauxton/assets/js/plugins/beautify.js
index e934fe3e3..07b661706 100644
--- a/src/fauxton/assets/js/plugins/beautify.js
+++ b/src/fauxton/assets/js/plugins/beautify.js
@@ -1611,19 +1611,10 @@
}
- if (typeof define === "function") {
- // Add support for require.js
- if (typeof define.amd === "undefined") {
- define(function(require, exports, module) {
- exports.js_beautify = js_beautify;
- });
- } else {
- // if is AMD ( https://github.com/amdjs/amdjs-api/wiki/AMD#defineamd-property- )
- define([], function() {
- return js_beautify;
- });
- }
-
+ if (typeof define === "function" && define.amd) {
+ define([], function() {
+ return js_beautify;
+ });
} else if (typeof exports !== "undefined") {
// Add support for CommonJS. Just put this file somewhere on your require.paths
// and you will be able to `var js_beautify = require("beautify").js_beautify`.