couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gar...@apache.org
Subject [05/13] fauxton commit: updated refs/heads/backbone.layout-upgrade to 755eb7a
Date Tue, 12 Aug 2014 14:56:13 GMT
Configure zeroclipboard for deployment

Move zeroclipboard into its own component. Handle the location of
zeroclipboard for Fauxton deployment and Also allow the moviepath to
be overriddern for custom deployment locations.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/285d32e7
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/285d32e7
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/285d32e7

Branch: refs/heads/backbone.layout-upgrade
Commit: 285d32e7d31dcffa586df5e8c354c80fa4c8682b
Parents: 25e74fa
Author: Garren Smith <garren.smith@gmail.com>
Authored: Wed Aug 6 15:30:01 2014 +0200
Committer: Garren Smith <garren.smith@gmail.com>
Committed: Wed Aug 6 15:30:01 2014 +0200

----------------------------------------------------------------------
 Gruntfile.js                          | 10 ++++++++--
 app/addons/documents/views-changes.js | 10 ++++------
 app/addons/fauxton/base.js            |  9 ++++++---
 app/addons/fauxton/components.js      | 27 +++++++++++++++++++++++++--
 tasks/couchserver.js                  |  2 ++
 5 files changed, 45 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/285d32e7/Gruntfile.js
----------------------------------------------------------------------
diff --git a/Gruntfile.js b/Gruntfile.js
index dbcdd2c..f6d2347 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -346,6 +346,12 @@ module.exports = function(grunt) {
         ]
       },
 
+      zeroclip: {
+        files: [
+          {src: "assets/js/plugins/zeroclipboard/ZeroClipboard.swf", dest: "dist/release/js/zeroclipboard/ZeroClipboard.swf"},
+        ]
+      },
+
       dist:{
         files:[
           {src: "dist/debug/index.html", dest: "dist/release/index.html"},
@@ -466,8 +472,8 @@ module.exports = function(grunt) {
 
   grunt.registerTask('watchRun', ['clean:watch', 'dependencies', 'jshint']);
   // build a release
-  grunt.registerTask('release', ['clean' ,'dependencies', "gen_initialize:release", 'jshint',
'build', 'minify', 'copy:dist', 'copy:ace']);
-  grunt.registerTask('couchapp_release', ['clean' ,'dependencies', "gen_initialize:couchapp",
'jshint', 'build', 'minify', 'copy:dist', 'copy:ace']);
+  grunt.registerTask('release', ['clean' ,'dependencies', "gen_initialize:release", 'jshint',
'build', 'minify', 'copy:dist', 'copy:ace', 'copy:zeroclip']);
+  grunt.registerTask('couchapp_release', ['clean' ,'dependencies', "gen_initialize:couchapp",
'jshint', 'build', 'minify', 'copy:dist', 'copy:ace', 'copy:zeroclip']);
 
   /*
    * Install into CouchDB in either debug, release, or couchapp mode

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/285d32e7/app/addons/documents/views-changes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views-changes.js b/app/addons/documents/views-changes.js
index 3404346..fad88b9 100644
--- a/app/addons/documents/views-changes.js
+++ b/app/addons/documents/views-changes.js
@@ -19,10 +19,7 @@ define([
        "addons/fauxton/components",
 
        // Plugins
-       "plugins/prettify",
-       // this should never be global available:
-       // https://github.com/zeroclipboard/zeroclipboard/blob/master/docs/security.md
-       "plugins/zeroclipboard/ZeroClipboard"
+       "plugins/prettify"
 ],
 
 function(app, FauxtonAPI, resizeColumns, Components, prettify, ZeroClipboard) {
@@ -118,8 +115,9 @@ function(app, FauxtonAPI, resizeColumns, Components, prettify, ZeroClipboard)
{
 
     afterRender: function(){
       prettyPrint();
-      ZeroClipboard.config({ moviePath: "/assets/js/plugins/zeroclipboard/ZeroClipboard.swf"
});
-      var client = new ZeroClipboard(this.$(".js-copy"));
+      var client = new Components.Clipboard({
+        $el: this.$('.js-copy')
+      });
     }
   });
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/285d32e7/app/addons/fauxton/base.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/base.js b/app/addons/fauxton/base.js
index 7a3ab8f..00f73a7 100644
--- a/app/addons/fauxton/base.js
+++ b/app/addons/fauxton/base.js
@@ -14,10 +14,11 @@ define([
   "app",
   "api",
   "addons/fauxton/resizeColumns",
+  "addons/fauxton/components",
   "plugins/zeroclipboard/ZeroClipboard"
 ],
 
-function(app, FauxtonAPI, resizeColumns, ZeroClipboard) {
+function(app, FauxtonAPI, resizeColumns, Components, ZeroClipboard) {
 
   var Fauxton = FauxtonAPI.addon();
   FauxtonAPI.addNotification = function (options) {
@@ -298,8 +299,10 @@ function(app, FauxtonAPI, resizeColumns, ZeroClipboard) {
       this.render();
     },
     afterRender: function(){
-      ZeroClipboard.config({ moviePath: "/assets/js/plugins/zeroclipboard/ZeroClipboard.swf"
});
-      var client = new ZeroClipboard(this.$(".copy-url"));
+      var client = new Components.Clipboard({
+        $el: this.$('.copy-url')
+      });
+
       client.on("load", function(e){
         var $apiInput = $('#api-navbar input');
         var copyURLTimer;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/285d32e7/app/addons/fauxton/components.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/components.js b/app/addons/fauxton/components.js
index d77af4a..c863ba7 100644
--- a/app/addons/fauxton/components.js
+++ b/app/addons/fauxton/components.js
@@ -25,10 +25,13 @@ define([
   // Libs
   "api",
   "ace_configuration",
-  "spin"
+  "spin",
+  // this should never be global available:
+  // https://github.com/zeroclipboard/zeroclipboard/blob/master/docs/security.md
+  "plugins/zeroclipboard/ZeroClipboard"
 ],
 
-function(app, FauxtonAPI, ace, spin) {
+function(app, FauxtonAPI, ace, spin, ZeroClipboard) {
   var Components = FauxtonAPI.addon();
 
   Components.Pagination = FauxtonAPI.View.extend({
@@ -630,6 +633,25 @@ function(app, FauxtonAPI, ace, spin) {
     }
   });
 
+  Components.Clipboard = FauxtonAPI.View.extend({
+    initialize: function (options) {
+      this.$el = options.$el;
+      this.moviePath = FauxtonAPI.getExtensions('zeroclipboard:movielist')[0];
+
+      if (_.isUndefined(this.moviePath)) {
+       this.moviePath = app.host + app.root + "js/zeroclipboard/ZeroClipboard.swf";
+      }
+
+      ZeroClipboard.config({ moviePath: this.moviePath });
+      this.client = new ZeroClipboard(this.$el);
+    },
+
+    on: function () {
+      return this.client.on.apply(this.client, arguments);
+    }
+
+  });
+
 
   //need to make this into a backbone view...
   var routeObjectSpinner;
@@ -710,6 +732,7 @@ function(app, FauxtonAPI, ace, spin) {
     removeRouteObjectSpinner();
   });
 
+
   return Components;
 });
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/285d32e7/tasks/couchserver.js
----------------------------------------------------------------------
diff --git a/tasks/couchserver.js b/tasks/couchserver.js
index 45a4f9c..e576219 100644
--- a/tasks/couchserver.js
+++ b/tasks/couchserver.js
@@ -67,6 +67,8 @@ module.exports = function (grunt) {
       } else if (!!url.match(/\.js$|\.html$/)) {
         // server js from app directory
         filePath = path.join(app_dir, url.replace('/_utils/fauxton/',''));
+      } else if (!!url.match(/ZeroClipboard/)) {
+        filePath = "./assets/js/plugins/zeroclipboard/ZeroClipboard.swf"
       } else if (!!url.match(/testrunner/)) {
         var testSetup = grunt.util.spawn({cmd: 'grunt', grunt: true, args: ['test_inline']},
function (error, result, code) {/* log.writeln(String(result));*/ });
         testSetup.stdout.pipe(process.stdout);


Mime
View raw message