Moved AngularJS and Underscore to Resources.

This commit is contained in:
Sipke Schoorstra 2015-11-20 18:36:25 +01:00
parent febdc19e81
commit 8258bb3589
29 changed files with 28956 additions and 28868 deletions

View File

@ -20,16 +20,6 @@
],
"output": "Styles/LayoutEditor.css"
},
{
"inputs": [
"Assets/JavaScript/Lib/underscore.js",
"Assets/JavaScript/Lib/angular.js",
"Assets/JavaScript/Lib/angular-sanitize.js",
"Assets/JavaScript/Lib/angular-resource.js",
"Assets/JavaScript/Lib/sortable.js"
],
"output": "Scripts/Lib.js"
},
{
"inputs": [
"Assets/JavaScript/LayoutEditor/Module.js",

View File

@ -10,7 +10,7 @@ Features:
Orchard.Layouts:
Name: Layouts
Description: Provides tools to create layouts.
Dependencies: Common, Orchard.Resources.jQuery, Orchard.Forms, Orchard.Tokens, Orchard.MediaLibrary, Orchard.Conditions
Dependencies: Common, Orchard.Resources.jQuery, Orchard.Resources.AngularJs, Orchard.Resources.Underscore, Orchard.Forms, Orchard.Tokens, Orchard.MediaLibrary, Orchard.Conditions
Category: Layout
Orchard.Layouts.Snippets:
Name: Layout Snippets

View File

@ -110,13 +110,6 @@
<Content Include="Assets\JavaScript\LayoutEditor\Module.js" />
<Content Include="Assets\JavaScript\LayoutEditor\Services\Clipboard.js" />
<Content Include="Assets\JavaScript\LayoutEditor\Services\ScopeConfigurator.js" />
<Content Include="Scripts\Lib.js" />
<Content Include="Scripts\Lib.min.js" />
<Content Include="Assets\JavaScript\Lib\angular-resource.js" />
<Content Include="Assets\JavaScript\Lib\angular-sanitize.js" />
<Content Include="Assets\JavaScript\Lib\angular.js" />
<Content Include="Assets\JavaScript\Lib\sortable.js" />
<Content Include="Assets\JavaScript\Lib\underscore.js" />
<Content Include="Scripts\Models.js" />
<Content Include="Scripts\Models.min.js" />
<Content Include="Assets\JavaScript\Models\Canvas.js" />

View File

@ -4,7 +4,7 @@ namespace Orchard.Layouts {
public class ResourceManifest : IResourceManifestProvider {
public void BuildManifests(ResourceManifestBuilder builder) {
var manifest = builder.Add();
manifest.DefineScript("Layouts.Lib").SetUrl("Lib.min.js", "Lib.js").SetDependencies("jQuery");
manifest.DefineScript("Layouts.Lib").SetDependencies("jQuery", "AngularJs_Full", "Underscore");
manifest.DefineScript("Layouts.Models").SetUrl("Models.min.js", "Models.js").SetDependencies("jQuery", "Layouts.Lib");
manifest.DefineScript("Layouts.LayoutEditor").SetUrl("LayoutEditor.min.js", "LayoutEditor.js").SetDependencies("jQuery", "Layouts.Lib", "Layouts.Models");
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,17 @@
using Orchard.Environment.Extensions;
using Orchard.UI.Resources;
namespace Orchard.Resources {
[OrchardFeature("Orchard.Resources.AngularJs")]
public class AngularJs : IResourceManifestProvider {
public void BuildManifests(ResourceManifestBuilder builder) {
var manifest = builder.Add();
manifest.DefineScript("AngularJs").SetUrl("angular.min.js", "angular.js").SetVersion("1.3.3");
manifest.DefineScript("AngularJs_Sanitize").SetUrl("angular-sanitize.min.js", "angular-sanitize.js").SetVersion("1.3.3").SetDependencies("AngularJs");
manifest.DefineScript("AngularJs_Resource").SetUrl("angular-resource.min.js", "angular-resource.js").SetVersion("1.3.3").SetDependencies("AngularJs");
manifest.DefineScript("AngularJs_Sortable").SetUrl("angular-sortable.min.js", "angular-sortable.js").SetDependencies("AngularJs", "jQueryUI_Sortable");
manifest.DefineScript("AngularJs_Full").SetDependencies("AngularJs", "AngularJs_Sanitize", "AngularJs_Resource", "AngularJs_Sortable");
}
}
}

View File

@ -220,5 +220,25 @@
{
"inputs": [ "Assets/Js/Colorbox/jquery.colorbox.js" ],
"output": "Scripts/jquery.colorbox.js"
},
{
"inputs": [ "Assets/Js/AngularJs/angular.js" ],
"output": "Scripts/angular.js"
},
{
"inputs": [ "Assets/Js/AngularJs/angular-sanitize.js" ],
"output": "Scripts/angular-sanitize.js"
},
{
"inputs": [ "Assets/Js/AngularJs/angular-resource.js" ],
"output": "Scripts/angular-resource.js"
},
{
"inputs": [ "Assets/Js/AngularJs/sortable.js" ],
"output": "Scripts/angular-sortable.js"
},
{
"inputs": [ "Assets/Js/Underscore/underscore.js" ],
"output": "Scripts/underscore.js"
}
]

View File

@ -14,4 +14,14 @@ Features:
Name: jQuery
Description: Provides the jQuery and jQuery related libraries.
Category: Core
Dependencies: Orchard.Resources
Orchard.Resources.AngularJs:
Name: AngularJs
Description: Provides the AngularJs and related libraries.
Category: Core
Dependencies: Orchard.Resources, Orchard.Resources.jQuery
Orchard.Resources.Underscore:
Name: Underscore
Description: Provides the Underscore script library.
Category: Core
Dependencies: Orchard.Resources

View File

@ -77,6 +77,10 @@
<Content Include="Assets\Css\jQueryUI\jquery-ui.structure.css" />
<Content Include="Assets\Css\jQueryUI\jquery-ui.theme.css" />
<Content Include="Assets\Css\TimeEntry\jquery.timeentry.css" />
<Content Include="Assets\Js\AngularJs\angular-resource.js" />
<Content Include="Assets\Js\AngularJs\angular-sanitize.js" />
<Content Include="Assets\Js\AngularJs\angular.js" />
<Content Include="Assets\Js\AngularJs\sortable.js" />
<Content Include="Assets\Js\Calendars\jquery.calendars-af.js" />
<Content Include="Assets\Js\Calendars\jquery.calendars-am.js" />
<Content Include="Assets\Js\Calendars\jquery.calendars-ar-DZ.js" />
@ -450,6 +454,15 @@
<Content Include="Assets\Js\TimeEntry\jquery.timeentry-zh-CN.js" />
<Content Include="Assets\Js\TimeEntry\jquery.timeentry-zh-TW.js" />
<Content Include="Assets\Js\TimeEntry\jquery.timeentry.js" />
<Content Include="Assets\Js\Underscore\underscore.js" />
<Content Include="Scripts\angular-resource.js" />
<Content Include="Scripts\angular-resource.min.js" />
<Content Include="Scripts\angular-sanitize.js" />
<Content Include="Scripts\angular-sanitize.min.js" />
<Content Include="Scripts\angular-sortable.js" />
<Content Include="Scripts\angular-sortable.min.js" />
<Content Include="Scripts\angular.js" />
<Content Include="Scripts\angular.min.js" />
<Content Include="Scripts\jquery-ui-effects.js" />
<Content Include="Scripts\jquery-ui-effects.min.js" />
<Content Include="Scripts\jquery-ui-interaction.js" />
@ -514,6 +527,8 @@
<Content Include="Scripts\ui\tabs.min.js" />
<Content Include="Scripts\ui\tooltip.js" />
<Content Include="Scripts\ui\tooltip.min.js" />
<Content Include="Scripts\underscore.js" />
<Content Include="Scripts\underscore.min.js" />
<Content Include="Styles\Images\calendar-blue.gif" />
<Content Include="Styles\Images\calendar-green.gif" />
<Content Include="Styles\Images\calendar.gif" />
@ -567,12 +582,15 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Assets\Js\KnockoutJs\" />
<Folder Include="Assets\Less\" />
<Folder Include="Controllers\" />
<Folder Include="Models\" />
<Folder Include="Views\" />
</ItemGroup>
<ItemGroup>
<Compile Include="Underscore.cs" />
<Compile Include="AngularJs.cs" />
<Compile Include="jQuery.cs" />
</ItemGroup>
<PropertyGroup>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
!function(r,e,t){"use strict";function n(r){return null!=r&&""!==r&&"hasOwnProperty"!==r&&s.test("."+r)}function a(r,e){if(!n(e))throw i("badmember",'Dotted member path "@{0}" is invalid.',e);for(var a=e.split("."),o=0,s=a.length;s>o&&r!==t;o++){var c=a[o];r=null!==r?r[c]:t}return r}function o(r,t){t=t||{},e.forEach(t,function(r,e){delete t[e]});for(var n in r)!r.hasOwnProperty(n)||"$"===n.charAt(0)&&"$"===n.charAt(1)||(t[n]=r[n]);return t}var i=e.$$minErr("$resource"),s=/^(\.[a-zA-Z_$][0-9a-zA-Z_$]*)+$/;e.module("ngResource",["ng"]).provider("$resource",function(){var r=this;this.defaults={stripTrailingSlashes:!0,actions:{get:{method:"GET"},save:{method:"POST"},query:{method:"GET",isArray:!0},remove:{method:"DELETE"},"delete":{method:"DELETE"}}},this.$get=["$http","$q",function(n,s){function c(r){return u(r,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function u(r,e){return encodeURIComponent(r).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,e?"%20":"+")}function p(e,t){this.template=e,this.defaults=d({},r.defaults,t),this.urlParams={}}function l(c,u,$,v){function w(r,e){var t={};return e=d({},u,e),h(e,function(e,n){g(e)&&(e=e()),t[n]=e&&e.charAt&&"@"==e.charAt(0)?a(r,e.substr(1)):e}),t}function y(r){return r.resource}function E(r){o(r||{},this)}var A=new p(c,v);return $=d({},r.defaults.actions,$),E.prototype.toJSON=function(){var r=d({},this);return delete r.$promise,delete r.$resolved,r},h($,function(r,a){var c=/^(POST|PUT|PATCH)$/i.test(r.method);E[a]=function(u,p,l,$){var v,b,P,T={};switch(arguments.length){case 4:P=$,b=l;case 3:case 2:if(!g(p)){T=u,v=p,b=l;break}if(g(u)){b=u,P=p;break}b=p,P=l;case 1:g(u)?b=u:c?v=u:T=u;break;case 0:break;default:throw i("badargs","Expected up to 4 arguments [params, data, success, error], got {0} arguments",arguments.length)}var O=this instanceof E,x=O?v:r.isArray?[]:new E(v),R={},D=r.interceptor&&r.interceptor.response||y,S=r.interceptor&&r.interceptor.responseError||t;h(r,function(r,e){"params"!=e&&"isArray"!=e&&"interceptor"!=e&&(R[e]=m(r))}),c&&(R.data=v),A.setUrlParams(R,d({},w(v,r.params||{}),T),r.url);var j=n(R).then(function(t){var n=t.data,s=x.$promise;if(n){if(e.isArray(n)!==!!r.isArray)throw i("badcfg","Error in resource configuration for action `{0}`. Expected response to contain an {1} but got an {2}",a,r.isArray?"array":"object",e.isArray(n)?"array":"object");r.isArray?(x.length=0,h(n,function(r){"object"==typeof r?x.push(new E(r)):x.push(r)})):(o(n,x),x.$promise=s)}return x.$resolved=!0,t.resource=x,t},function(r){return x.$resolved=!0,(P||f)(r),s.reject(r)});return j=j.then(function(r){var e=D(r);return(b||f)(e,r.headers),e},S),O?j:(x.$promise=j,x.$resolved=!1,x)},E.prototype["$"+a]=function(r,e,t){g(r)&&(t=e,e=r,r={});var n=E[a].call(this,r,this,e,t);return n.$promise||n}}),E.bind=function(r){return l(c,d({},u,r),$)},E}var f=e.noop,h=e.forEach,d=e.extend,m=e.copy,g=e.isFunction;return p.prototype={setUrlParams:function(r,t,n){var a,o,s=this,u=n||s.template,p=s.urlParams={};h(u.split(/\W/),function(r){if("hasOwnProperty"===r)throw i("badname","hasOwnProperty is not a valid parameter name.");!new RegExp("^\\d+$").test(r)&&r&&new RegExp("(^|[^\\\\]):"+r+"(\\W|$)").test(u)&&(p[r]=!0)}),u=u.replace(/\\:/g,":"),t=t||{},h(s.urlParams,function(r,n){a=t.hasOwnProperty(n)?t[n]:s.defaults[n],e.isDefined(a)&&null!==a?(o=c(a),u=u.replace(new RegExp(":"+n+"(\\W|$)","g"),function(r,e){return o+e})):u=u.replace(new RegExp("(/?):"+n+"(\\W|$)","g"),function(r,e,t){return"/"==t.charAt(0)?t:e+t})}),s.defaults.stripTrailingSlashes&&(u=u.replace(/\/+$/,"")||"/"),u=u.replace(/\/\.(?=\w+($|\?))/,"."),r.url=u.replace(/\/\\\./,"/."),h(t,function(e,t){s.urlParams[t]||(r.params=r.params||{},r.params[t]=e)})}},l}]})}(window,window.angular);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
angular.module("ui.sortable",[]).value("uiSortableConfig",{}).directive("uiSortable",["uiSortableConfig","$timeout","$log",function(e,t,o){return{require:"?ngModel",link:function(n,i,l,a){function r(e,t){return t&&"function"==typeof t?function(o,n){e(o,n),t(o,n)}:e}function s(e,t){var o=e.sortable("option","helper");return"clone"===o||"function"==typeof o&&t.item.sortable.isCustomHelperUsed()}function u(e){return/left|right/.test(e.css("float"))||/inline|table-cell/.test(e.css("display"))}function d(e,t){t.item.sortable._destroy()}var c,m={},f={"ui-floating":void 0},b={receive:null,remove:null,start:null,stop:null,update:null},p={helper:null};return angular.extend(m,f,e,n.$eval(l.uiSortable)),angular.element.fn&&angular.element.fn.jquery?(a?(n.$watch(l.ngModel+".length",function(){t(function(){i.data("ui-sortable")&&i.sortable("refresh")},0,!1)}),b.start=function(e,t){if("auto"===m["ui-floating"]){var o=t.item.siblings();angular.element(e.target).data("ui-sortable").floating=u(o)}t.item.sortable={model:a.$modelValue[t.item.index()],index:t.item.index(),source:t.item.parent(),sourceModel:a.$modelValue,cancel:function(){t.item.sortable._isCanceled=!0},isCanceled:function(){return t.item.sortable._isCanceled},isCustomHelperUsed:function(){return!!t.item.sortable._isCustomHelperUsed},_isCanceled:!1,_isCustomHelperUsed:t.item.sortable._isCustomHelperUsed,_destroy:function(){angular.forEach(t.item.sortable,function(e,o){t.item.sortable[o]=void 0})}}},b.activate=function(){c=i.contents();var e=i.sortable("option","placeholder");if(e&&e.element&&"function"==typeof e.element){var t=e.element();t=angular.element(t);var o=i.find('[class="'+t.attr("class")+'"]');c=c.not(o)}},b.update=function(e,t){if(!t.item.sortable.received){t.item.sortable.dropindex=t.item.index();var o=t.item.parent();t.item.sortable.droptarget=o;var l=o.attr("ng-model")||o.attr("data-ng-model");t.item.sortable.droptargetModel=o.scope().$eval(l),i.sortable("cancel")}s(i,t)&&!t.item.sortable.received&&"parent"===i.sortable("option","appendTo")&&(c=c.not(c.last())),c.appendTo(i),t.item.sortable.received&&(c=null),t.item.sortable.received&&!t.item.sortable.isCanceled()&&n.$apply(function(){a.$modelValue.splice(t.item.sortable.dropindex,0,t.item.sortable.moved)})},b.stop=function(e,t){!t.item.sortable.received&&"dropindex"in t.item.sortable&&!t.item.sortable.isCanceled()?n.$apply(function(){a.$modelValue.splice(t.item.sortable.dropindex,0,a.$modelValue.splice(t.item.sortable.index,1)[0])}):"dropindex"in t.item.sortable&&!t.item.sortable.isCanceled()||s(i,t)||c.appendTo(i),c=null},b.receive=function(e,t){t.item.sortable.received=!0},b.remove=function(e,t){"dropindex"in t.item.sortable||(i.sortable("cancel"),t.item.sortable.cancel()),t.item.sortable.isCanceled()||n.$apply(function(){t.item.sortable.moved=a.$modelValue.splice(t.item.sortable.index,1)[0]})},p.helper=function(e){return e&&"function"==typeof e?function(t,o){var n=e(t,o);return o.sortable._isCustomHelperUsed=o!==n,n}:e},n.$watch(l.uiSortable,function(e){i.data("ui-sortable")&&angular.forEach(e,function(e,t){return t in f?("ui-floating"!==t||e!==!1&&e!==!0||(i.data("ui-sortable").floating=e),void(m[t]=e)):(b[t]?("stop"===t&&(e=r(e,function(){n.$apply()}),e=r(e,d)),e=r(b[t],e)):p[t]&&(e=p[t](e)),m[t]=e,void i.sortable("option",t,e))})},!0),angular.forEach(b,function(e,t){m[t]=r(e,m[t]),"stop"===t&&(m[t]=r(m[t],d))})):o.info("ui.sortable: ngModel not provided!",i),void i.sortable(m)):void o.error("ui.sortable: jQuery should be included before AngularJS!")}}}]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,12 @@
using Orchard.Environment.Extensions;
using Orchard.UI.Resources;
namespace Orchard.Resources {
[OrchardFeature("Orchard.Resources.Underscore")]
public class Underscore : IResourceManifestProvider {
public void BuildManifests(ResourceManifestBuilder builder) {
var manifest = builder.Add();
manifest.DefineScript("Underscore").SetUrl("underscore.min.js", "underscore.js").SetVersion("1.7.0");
}
}
}