From e89a32d5c6a09f535096479f8dbc30e58ee014d8 Mon Sep 17 00:00:00 2001 From: muzaffaryousaf Date: Tue, 5 Apr 2016 16:38:38 +0500 Subject: [PATCH] Upgrade backbone via npm. TNL-4335 --- cms/static/cms/js/require-config.js | 2 +- cms/static/coffee/spec/main.coffee | 2 +- cms/static/coffee/spec/main_squire.coffee | 2 +- cms/static/js_test.yml | 2 +- cms/static/js_test_squire.yml | 2 +- common/djangoapps/pipeline_mako/tests/test_render.py | 4 ++-- common/lib/xmodule/xmodule/js/js_test.yml | 2 +- common/static/common/js/spec/main_requirejs.js | 2 +- common/static/js/vendor/backbone-min.js | 1 - common/static/js_test.yml | 2 +- common/static/js_test_requirejs.yml | 2 +- lms/envs/common.py | 2 +- lms/static/js/spec/main.js | 2 +- lms/static/js_test.yml | 2 +- lms/static/lms/js/require-config.js | 2 +- lms/templates/ccx/schedule.html | 2 +- package.json | 3 ++- pavelib/assets.py | 3 ++- 18 files changed, 20 insertions(+), 19 deletions(-) delete mode 100644 common/static/js/vendor/backbone-min.js diff --git a/cms/static/cms/js/require-config.js b/cms/static/cms/js/require-config.js index c4f9092123..18f86f355c 100644 --- a/cms/static/cms/js/require-config.js +++ b/cms/static/cms/js/require-config.js @@ -52,7 +52,7 @@ "text": 'js/vendor/requirejs/text', "underscore": "common/js/vendor/underscore", "underscore.string": "common/js/vendor/underscore.string", - "backbone": "js/vendor/backbone-min", + "backbone": "common/js/vendor/backbone-min", "backbone-relational" : "js/vendor/backbone-relational.min", "backbone.associations": "js/vendor/backbone-associations-min", "backbone.paginator": "js/vendor/backbone.paginator.min", diff --git a/cms/static/coffee/spec/main.coffee b/cms/static/coffee/spec/main.coffee index 0aa0e96687..a3b8eb237c 100644 --- a/cms/static/coffee/spec/main.coffee +++ b/cms/static/coffee/spec/main.coffee @@ -29,7 +29,7 @@ requirejs.config({ "text": "xmodule_js/common_static/js/vendor/requirejs/text", "underscore": "xmodule_js/common_static/common/js/vendor/underscore", "underscore.string": "xmodule_js/common_static/common/js/vendor/underscore.string", - "backbone": "xmodule_js/common_static/js/vendor/backbone-min", + "backbone": "xmodule_js/common_static/common/js/vendor/backbone-min", "backbone.associations": "xmodule_js/common_static/js/vendor/backbone-associations-min", "backbone.paginator": "xmodule_js/common_static/js/vendor/backbone.paginator.min", "backbone-relational": "xmodule_js/common_static/js/vendor/backbone-relational.min", diff --git a/cms/static/coffee/spec/main_squire.coffee b/cms/static/coffee/spec/main_squire.coffee index 1a537b4d64..b155a0e667 100644 --- a/cms/static/coffee/spec/main_squire.coffee +++ b/cms/static/coffee/spec/main_squire.coffee @@ -26,7 +26,7 @@ requirejs.config({ "text": "xmodule_js/common_static/js/vendor/requirejs/text", "underscore": "common/js/vendor/underscore", "underscore.string": "common/js/vendor/underscore.string", - "backbone": "xmodule_js/common_static/js/vendor/backbone-min", + "backbone": "xmodule_js/common_static/common/js/vendor/backbone-min", "backbone.associations": "xmodule_js/common_static/js/vendor/backbone-associations-min", "backbone.paginator": "xmodule_js/common_static/js/vendor/backbone.paginator.min", "tinymce": "xmodule_js/common_static/js/vendor/tinymce/js/tinymce/tinymce.full.min", diff --git a/cms/static/js_test.yml b/cms/static/js_test.yml index 22a4e5685f..ed014993eb 100644 --- a/cms/static/js_test.yml +++ b/cms/static/js_test.yml @@ -37,7 +37,7 @@ lib_paths: - xmodule_js/common_static/js/vendor/jquery.simulate.js - xmodule_js/common_static/common/js/vendor/underscore.js - xmodule_js/common_static/common/js/vendor/underscore.string.js - - xmodule_js/common_static/js/vendor/backbone-min.js + - xmodule_js/common_static/common/js/vendor/backbone-min.js - xmodule_js/common_static/js/vendor/backbone-associations-min.js - xmodule_js/common_static/js/vendor/backbone.paginator.min.js - xmodule_js/common_static/js/vendor/backbone-relational.min.js diff --git a/cms/static/js_test_squire.yml b/cms/static/js_test_squire.yml index d65f44e30f..eca7ae1d34 100644 --- a/cms/static/js_test_squire.yml +++ b/cms/static/js_test_squire.yml @@ -36,7 +36,7 @@ lib_paths: - xmodule_js/common_static/js/vendor/jquery.cookie.js - xmodule_js/common_static/common/js/vendor/underscore.js - xmodule_js/common_static/common/js/vendor/underscore.string.js - - xmodule_js/common_static/js/vendor/backbone-min.js + - xmodule_js/common_static/common/js/vendor/backbone-min.js - xmodule_js/common_static/js/vendor/backbone-associations-min.js - xmodule_js/common_static/js/vendor/backbone.paginator.min.js - xmodule_js/common_static/js/vendor/timepicker/jquery.timepicker.js diff --git a/common/djangoapps/pipeline_mako/tests/test_render.py b/common/djangoapps/pipeline_mako/tests/test_render.py index d505cee33c..d99d337572 100644 --- a/common/djangoapps/pipeline_mako/tests/test_render.py +++ b/common/djangoapps/pipeline_mako/tests/test_render.py @@ -15,7 +15,7 @@ class RequireJSPathOverridesTest(TestCase): OVERRIDES = { 'jquery': 'js/vendor/jquery.min.js', - 'backbone': 'js/vendor/backbone-min.js', + 'backbone': 'common/js/vendor/backbone-min.js', 'text': 'js/vendor/text.js' } @@ -26,7 +26,7 @@ class RequireJSPathOverridesTest(TestCase): "paths: {", "'jquery': 'js/vendor/jquery.min',", "'text': 'js/vendor/text',", - "'backbone': 'js/vendor/backbone-min'", + "'backbone': 'common/js/vendor/backbone-min'", "}", "});", "}).call(this, require || RequireJS.require);", diff --git a/common/lib/xmodule/xmodule/js/js_test.yml b/common/lib/xmodule/xmodule/js/js_test.yml index 73403b619b..515101ab03 100644 --- a/common/lib/xmodule/xmodule/js/js_test.yml +++ b/common/lib/xmodule/xmodule/js/js_test.yml @@ -46,7 +46,7 @@ lib_paths: - common_static/js/vendor/jquery.cookie.js - common_static/js/vendor/json2.js - common_static/common/js/vendor/underscore.js - - common_static/js/vendor/backbone-min.js + - common_static/common/js/vendor/backbone-min.js - common_static/js/vendor/jquery.leanModal.js - common_static/js/vendor/CodeMirror/codemirror.js - common_static/js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js diff --git a/common/static/common/js/spec/main_requirejs.js b/common/static/common/js/spec/main_requirejs.js index 1601d8a0a0..c6fb079f91 100644 --- a/common/static/common/js/spec/main_requirejs.js +++ b/common/static/common/js/spec/main_requirejs.js @@ -25,7 +25,7 @@ 'text': 'js/vendor/requirejs/text', 'underscore': 'common/js/vendor/underscore', 'underscore.string': 'common/js/vendor/underscore.string', - 'backbone': 'js/vendor/backbone-min', + 'backbone': 'common/js/vendor/backbone-min', 'backbone.associations': 'js/vendor/backbone-associations-min', 'backbone.paginator': 'js/vendor/backbone.paginator.min', 'backbone-super': 'js/vendor/backbone-super', diff --git a/common/static/js/vendor/backbone-min.js b/common/static/js/vendor/backbone-min.js deleted file mode 100644 index bce4fbc1b1..0000000000 --- a/common/static/js/vendor/backbone-min.js +++ /dev/null @@ -1 +0,0 @@ -(function(){var t=this;var e=t.Backbone;var i=[];var r=i.push;var s=i.slice;var n=i.splice;var a;if(typeof exports!=="undefined"){a=exports}else{a=t.Backbone={}}a.VERSION="1.0.0";var h=t._;if(!h&&typeof require!=="undefined")h=require("underscore");a.$=t.jQuery||t.Zepto||t.ender||t.$;a.noConflict=function(){t.Backbone=e;return this};a.emulateHTTP=false;a.emulateJSON=false;var o=a.Events={on:function(t,e,i){if(!l(this,"on",t,[e,i])||!e)return this;this._events||(this._events={});var r=this._events[t]||(this._events[t]=[]);r.push({callback:e,context:i,ctx:i||this});return this},once:function(t,e,i){if(!l(this,"once",t,[e,i])||!e)return this;var r=this;var s=h.once(function(){r.off(t,s);e.apply(this,arguments)});s._callback=e;return this.on(t,s,i)},off:function(t,e,i){var r,s,n,a,o,u,c,f;if(!this._events||!l(this,"off",t,[e,i]))return this;if(!t&&!e&&!i){this._events={};return this}a=t?[t]:h.keys(this._events);for(o=0,u=a.length;o").attr(t);this.setElement(e,false)}else{this.setElement(h.result(this,"el"),false)}}});a.sync=function(t,e,i){var r=k[t];h.defaults(i||(i={}),{emulateHTTP:a.emulateHTTP,emulateJSON:a.emulateJSON});var s={type:r,dataType:"json"};if(!i.url){s.url=h.result(e,"url")||U()}if(i.data==null&&e&&(t==="create"||t==="update"||t==="patch")){s.contentType="application/json";s.data=JSON.stringify(i.attrs||e.toJSON(i))}if(i.emulateJSON){s.contentType="application/x-www-form-urlencoded";s.data=s.data?{model:s.data}:{}}if(i.emulateHTTP&&(r==="PUT"||r==="DELETE"||r==="PATCH")){s.type="POST";if(i.emulateJSON)s.data._method=r;var n=i.beforeSend;i.beforeSend=function(t){t.setRequestHeader("X-HTTP-Method-Override",r);if(n)return n.apply(this,arguments)}}if(s.type!=="GET"&&!i.emulateJSON){s.processData=false}if(s.type==="PATCH"&&window.ActiveXObject&&!(window.external&&window.external.msActiveXFilteringEnabled)){s.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")}}var o=i.xhr=a.ajax(h.extend(s,i));e.trigger("request",e,o,i);return o};var k={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};a.ajax=function(){return a.$.ajax.apply(a.$,arguments)};var S=a.Router=function(t){t||(t={});if(t.routes)this.routes=t.routes;this._bindRoutes();this.initialize.apply(this,arguments)};var $=/\((.*?)\)/g;var T=/(\(\?)?:\w+/g;var H=/\*\w+/g;var A=/[\-{}\[\]+?.,\\\^$|#\s]/g;h.extend(S.prototype,o,{initialize:function(){},route:function(t,e,i){if(!h.isRegExp(t))t=this._routeToRegExp(t);if(h.isFunction(e)){i=e;e=""}if(!i)i=this[e];var r=this;a.history.route(t,function(s){var n=r._extractParameters(t,s);i&&i.apply(r,n);r.trigger.apply(r,["route:"+e].concat(n));r.trigger("route",e,n);a.history.trigger("route",r,e,n)});return this},navigate:function(t,e){a.history.navigate(t,e);return this},_bindRoutes:function(){if(!this.routes)return;this.routes=h.result(this,"routes");var t,e=h.keys(this.routes);while((t=e.pop())!=null){this.route(t,this.routes[t])}},_routeToRegExp:function(t){t=t.replace(A,"\\$&").replace($,"(?:$1)?").replace(T,function(t,e){return e?t:"([^/]+)"}).replace(H,"(.*?)");return new RegExp("^"+t+"$")},_extractParameters:function(t,e){var i=t.exec(e).slice(1);return h.map(i,function(t){return t?decodeURIComponent(t):null})}});var I=a.History=function(){this.handlers=[];h.bindAll(this,"checkUrl");if(typeof window!=="undefined"){this.location=window.location;this.history=window.history}};var N=/^[#\/]|\s+$/g;var P=/^\/+|\/+$/g;var O=/msie [\w.]+/;var C=/\/$/;I.started=false;h.extend(I.prototype,o,{interval:50,getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getFragment:function(t,e){if(t==null){if(this._hasPushState||!this._wantsHashChange||e){t=this.location.pathname;var i=this.root.replace(C,"");if(!t.indexOf(i))t=t.substr(i.length)}else{t=this.getHash()}}return t.replace(N,"")},start:function(t){if(I.started)throw new Error("Backbone.history has already been started");I.started=true;this.options=h.extend({},{root:"/"},this.options,t);this.root=this.options.root;this._wantsHashChange=this.options.hashChange!==false;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var e=this.getFragment();var i=document.documentMode;var r=O.exec(navigator.userAgent.toLowerCase())&&(!i||i<=7);this.root=("/"+this.root+"/").replace(P,"/");if(r&&this._wantsHashChange){this.iframe=a.$('