rails-angular-strap 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +21 -0
- data/lib/rails-angular-strap.rb +11 -0
- data/lib/rails-angular-strap/engine.rb +4 -0
- data/lib/rails-angular-strap/version.rb +4 -0
- data/vendor/assets/javascripts/angular-strap.js +2 -0
- data/vendor/assets/javascripts/angular-strap.min.js +2 -0
- data/vendor/assets/javascripts/angular-strap/angular-strap.js +5014 -0
- data/vendor/assets/javascripts/angular-strap/angular-strap.min.js +11 -0
- data/vendor/assets/javascripts/angular-strap/angular-strap.tpl.js +89 -0
- data/vendor/assets/javascripts/angular-strap/angular-strap.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/modules/affix.js +249 -0
- data/vendor/assets/javascripts/angular-strap/modules/affix.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/affix.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/alert.js +120 -0
- data/vendor/assets/javascripts/angular-strap/modules/alert.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/alert.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/alert.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/modules/alert.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/modules/aside.js +96 -0
- data/vendor/assets/javascripts/angular-strap/modules/aside.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/aside.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/aside.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/modules/aside.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/modules/button.js +177 -0
- data/vendor/assets/javascripts/angular-strap/modules/button.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/button.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/collapse.js +273 -0
- data/vendor/assets/javascripts/angular-strap/modules/collapse.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/collapse.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/date-formatter.js +61 -0
- data/vendor/assets/javascripts/angular-strap/modules/date-formatter.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/date-formatter.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/date-parser.js +273 -0
- data/vendor/assets/javascripts/angular-strap/modules/date-parser.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/date-parser.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/datepicker.js +640 -0
- data/vendor/assets/javascripts/angular-strap/modules/datepicker.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/datepicker.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/datepicker.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/modules/datepicker.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/modules/debounce.js +62 -0
- data/vendor/assets/javascripts/angular-strap/modules/debounce.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/debounce.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/dimensions.js +156 -0
- data/vendor/assets/javascripts/angular-strap/modules/dimensions.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/dimensions.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/dropdown.js +149 -0
- data/vendor/assets/javascripts/angular-strap/modules/dropdown.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/dropdown.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/dropdown.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/modules/dropdown.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/modules/modal.js +349 -0
- data/vendor/assets/javascripts/angular-strap/modules/modal.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/modal.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/modal.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/modules/modal.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/modules/navbar.js +72 -0
- data/vendor/assets/javascripts/angular-strap/modules/navbar.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/navbar.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/parse-options.js +76 -0
- data/vendor/assets/javascripts/angular-strap/modules/parse-options.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/parse-options.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/popover.js +112 -0
- data/vendor/assets/javascripts/angular-strap/modules/popover.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/popover.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/popover.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/modules/popover.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/modules/raf.js +61 -0
- data/vendor/assets/javascripts/angular-strap/modules/raf.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/raf.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/scrollspy.js +261 -0
- data/vendor/assets/javascripts/angular-strap/modules/scrollspy.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/scrollspy.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/select.js +325 -0
- data/vendor/assets/javascripts/angular-strap/modules/select.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/select.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/select.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/modules/select.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/modules/tab.js +186 -0
- data/vendor/assets/javascripts/angular-strap/modules/tab.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/tab.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/tab.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/modules/tab.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/modules/timepicker.js +485 -0
- data/vendor/assets/javascripts/angular-strap/modules/timepicker.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/timepicker.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/timepicker.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/modules/timepicker.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/modules/tooltip.js +690 -0
- data/vendor/assets/javascripts/angular-strap/modules/tooltip.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/tooltip.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/tooltip.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/modules/tooltip.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/modules/typeahead.js +266 -0
- data/vendor/assets/javascripts/angular-strap/modules/typeahead.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/typeahead.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/typeahead.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/modules/typeahead.tpl.min.js +8 -0
- metadata +143 -0
@@ -0,0 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* angular-strap
|
3
|
+
* @version v2.1.6 - 2015-01-11
|
4
|
+
* @link http://mgcrea.github.io/angular-strap
|
5
|
+
* @author Olivier Louvignes (olivier@mg-crea.com)
|
6
|
+
* @license MIT License, http://www.opensource.org/licenses/MIT
|
7
|
+
*/
|
8
|
+
"use strict";angular.module("mgcrea.ngStrap.alert",["mgcrea.ngStrap.modal"]).provider("$alert",function(){var t=this.defaults={animation:"am-fade",prefixClass:"alert",prefixEvent:"alert",placement:null,template:"alert/alert.tpl.html",container:!1,element:null,backdrop:!1,keyboard:!0,show:!0,duration:!1,type:!1,dismissable:!0};this.$get=["$modal","$timeout",function(e,n){function a(a){var r={},i=angular.extend({},t,a);r=e(i),r.$scope.dismissable=!!i.dismissable,i.type&&(r.$scope.type=i.type);var o=r.show;return i.duration&&(r.show=function(){o(),n(function(){r.hide()},1e3*i.duration)}),r}return a}]}).directive("bsAlert",["$window","$sce","$alert",function(t,e,n){t.requestAnimationFrame||t.setTimeout;return{restrict:"EAC",scope:!0,link:function(t,a,r){var i={scope:t,element:a,show:!1};angular.forEach(["template","placement","keyboard","html","container","animation","duration","dismissable"],function(t){angular.isDefined(r[t])&&(i[t]=r[t])}),angular.forEach(["title","content","type"],function(n){r[n]&&r.$observe(n,function(a){t[n]=e.trustAsHtml(a)})}),r.bsAlert&&t.$watch(r.bsAlert,function(e){angular.isObject(e)?angular.extend(t,e):t.content=e},!0);var o=n(i);a.on(r.trigger||"click",o.toggle),t.$on("$destroy",function(){o&&o.destroy(),i=null,o=null})}}}]);
|
9
|
+
//# sourceMappingURL=alert.min.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["alert/alert.js"],"names":[],"mappings":"qBAaM,OAAA,wBAAa,kCAEb,SAAU,cAEV,GAAS,KAAA,UACT,UAAU,UACV,YAAU,QACV,YAAM,uBAEN,SAAU,uBACV,WAAM,EACN,QAAA,6BAGF,MAAK,EAEH,UAAS,uBAEH,QAGJ,MAAI,SAAU,WAAe,SAAI,EAAU,WAE3C,GAAgB,YAKd,EAAO,QAAO,UAAe,EAAA,UAK/B,EAAG,OAAQ,cAAU,EAAA,YACnB,EAAO,SACL,OAAA,KAAA,EAAA,yDAOJ,sEAiBI,WAAS,UAAS,OAAO,SAAe,SAAA,EAAc,EAAA,yDAKrD,uCAKH,IAAa,MAAK,EAAS,QAAK,EAAS,MAAU,WACjD,SAAa,WAAK,YAAY,WAAA,OAAA,YAAA,YAAA,WAAA,eAAA,SAAA,0CAKlC,QAAK,SAAW,QAAM,UAAY,QAAS,SAAS,GAClD,EAAG,IAAQ,EAAA,SAAS,EAAW,SAAA,GAC7B,EAAA,GAAQ,EAAO,YAAO,qEAOtB,QAAQ,OAAO,EAAA,uBAOjB,GAAI,EAAa,gFAQtB,EAAA","file":"alert.min.js","sourcesContent":["'use strict';\n\n// @BUG: following snippet won't compile correctly\n// @TODO: submit issue to core\n// '<span ng-if=\"title\"><strong ng-bind=\"title\"></strong> </span><span ng-bind-html=\"content\"></span>' +\n\nangular.module('mgcrea.ngStrap.alert', ['mgcrea.ngStrap.modal'])\n\n .provider('$alert', function() {\n\n var defaults = this.defaults = {\n animation: 'am-fade',\n prefixClass: 'alert',\n prefixEvent: 'alert',\n placement: null,\n template: 'alert/alert.tpl.html',\n container: false,\n element: null,\n backdrop: false,\n keyboard: true,\n show: true,\n // Specific options\n duration: false,\n type: false,\n dismissable: true\n };\n\n this.$get = function($modal, $timeout) {\n\n function AlertFactory(config) {\n\n var $alert = {};\n\n // Common vars\n var options = angular.extend({}, defaults, config);\n\n $alert = $modal(options);\n\n // Support scope as string options [/*title, content, */ type, dismissable]\n $alert.$scope.dismissable = !!options.dismissable;\n if(options.type) {\n $alert.$scope.type = options.type;\n }\n\n // Support auto-close duration\n var show = $alert.show;\n if(options.duration) {\n $alert.show = function() {\n show();\n $timeout(function() {\n $alert.hide();\n }, options.duration * 1000);\n };\n }\n\n return $alert;\n\n }\n\n return AlertFactory;\n\n };\n\n })\n\n .directive('bsAlert', function($window, $sce, $alert) {\n\n var requestAnimationFrame = $window.requestAnimationFrame || $window.setTimeout;\n\n return {\n restrict: 'EAC',\n scope: true,\n link: function postLink(scope, element, attr, transclusion) {\n\n // Directive options\n var options = {scope: scope, element: element, show: false};\n angular.forEach(['template', 'placement', 'keyboard', 'html', 'container', 'animation', 'duration', 'dismissable'], function(key) {\n if(angular.isDefined(attr[key])) options[key] = attr[key];\n });\n\n // Support scope as data-attrs\n angular.forEach(['title', 'content', 'type'], function(key) {\n attr[key] && attr.$observe(key, function(newValue, oldValue) {\n scope[key] = $sce.trustAsHtml(newValue);\n });\n });\n\n // Support scope as an object\n attr.bsAlert && scope.$watch(attr.bsAlert, function(newValue, oldValue) {\n if(angular.isObject(newValue)) {\n angular.extend(scope, newValue);\n } else {\n scope.content = newValue;\n }\n }, true);\n\n // Initialize alert\n var alert = $alert(options);\n\n // Trigger\n element.on(attr.trigger || 'click', alert.toggle);\n\n // Garbage collection\n scope.$on('$destroy', function() {\n if (alert) alert.destroy();\n options = null;\n alert = null;\n });\n\n }\n };\n\n });\n"],"sourceRoot":"/source/"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/**
|
2
|
+
* angular-strap
|
3
|
+
* @version v2.1.6 - 2015-01-11
|
4
|
+
* @link http://mgcrea.github.io/angular-strap
|
5
|
+
* @author Olivier Louvignes (olivier@mg-crea.com)
|
6
|
+
* @license MIT License, http://www.opensource.org/licenses/MIT
|
7
|
+
*/
|
8
|
+
'use strict';
|
9
|
+
|
10
|
+
angular.module('mgcrea.ngStrap.alert').run(['$templateCache', function($templateCache) {
|
11
|
+
|
12
|
+
$templateCache.put('alert/alert.tpl.html', '<div class="alert" ng-class="[type ? \'alert-\' + type : null]"><button type="button" class="close" ng-if="dismissable" ng-click="$hide()">×</button> <strong ng-bind="title"></strong> <span ng-bind-html="content"></span></div>');
|
13
|
+
|
14
|
+
}]);
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/**
|
2
|
+
* angular-strap
|
3
|
+
* @version v2.1.6 - 2015-01-11
|
4
|
+
* @link http://mgcrea.github.io/angular-strap
|
5
|
+
* @author Olivier Louvignes (olivier@mg-crea.com)
|
6
|
+
* @license MIT License, http://www.opensource.org/licenses/MIT
|
7
|
+
*/
|
8
|
+
"use strict";angular.module("mgcrea.ngStrap.alert").run(["$templateCache",function(t){t.put("alert/alert.tpl.html",'<div class="alert" ng-class="[type ? \'alert-\' + type : null]"><button type="button" class="close" ng-if="dismissable" ng-click="$hide()">×</button> <strong ng-bind="title"></strong> <span ng-bind-html="content"></span></div>')}]);
|
@@ -0,0 +1,96 @@
|
|
1
|
+
/**
|
2
|
+
* angular-strap
|
3
|
+
* @version v2.1.6 - 2015-01-11
|
4
|
+
* @link http://mgcrea.github.io/angular-strap
|
5
|
+
* @author Olivier Louvignes (olivier@mg-crea.com)
|
6
|
+
* @license MIT License, http://www.opensource.org/licenses/MIT
|
7
|
+
*/
|
8
|
+
'use strict';
|
9
|
+
|
10
|
+
angular.module('mgcrea.ngStrap.aside', ['mgcrea.ngStrap.modal'])
|
11
|
+
|
12
|
+
.provider('$aside', function() {
|
13
|
+
|
14
|
+
var defaults = this.defaults = {
|
15
|
+
animation: 'am-fade-and-slide-right',
|
16
|
+
prefixClass: 'aside',
|
17
|
+
prefixEvent: 'aside',
|
18
|
+
placement: 'right',
|
19
|
+
template: 'aside/aside.tpl.html',
|
20
|
+
contentTemplate: false,
|
21
|
+
container: false,
|
22
|
+
element: null,
|
23
|
+
backdrop: true,
|
24
|
+
keyboard: true,
|
25
|
+
html: false,
|
26
|
+
show: true
|
27
|
+
};
|
28
|
+
|
29
|
+
this.$get = ["$modal", function($modal) {
|
30
|
+
|
31
|
+
function AsideFactory(config) {
|
32
|
+
|
33
|
+
var $aside = {};
|
34
|
+
|
35
|
+
// Common vars
|
36
|
+
var options = angular.extend({}, defaults, config);
|
37
|
+
|
38
|
+
$aside = $modal(options);
|
39
|
+
|
40
|
+
return $aside;
|
41
|
+
|
42
|
+
}
|
43
|
+
|
44
|
+
return AsideFactory;
|
45
|
+
|
46
|
+
}];
|
47
|
+
|
48
|
+
})
|
49
|
+
|
50
|
+
.directive('bsAside', ["$window", "$sce", "$aside", function($window, $sce, $aside) {
|
51
|
+
|
52
|
+
var requestAnimationFrame = $window.requestAnimationFrame || $window.setTimeout;
|
53
|
+
|
54
|
+
return {
|
55
|
+
restrict: 'EAC',
|
56
|
+
scope: true,
|
57
|
+
link: function postLink(scope, element, attr, transclusion) {
|
58
|
+
// Directive options
|
59
|
+
var options = {scope: scope, element: element, show: false};
|
60
|
+
angular.forEach(['template', 'contentTemplate', 'placement', 'backdrop', 'keyboard', 'html', 'container', 'animation'], function(key) {
|
61
|
+
if(angular.isDefined(attr[key])) options[key] = attr[key];
|
62
|
+
});
|
63
|
+
|
64
|
+
// Support scope as data-attrs
|
65
|
+
angular.forEach(['title', 'content'], function(key) {
|
66
|
+
attr[key] && attr.$observe(key, function(newValue, oldValue) {
|
67
|
+
scope[key] = $sce.trustAsHtml(newValue);
|
68
|
+
});
|
69
|
+
});
|
70
|
+
|
71
|
+
// Support scope as an object
|
72
|
+
attr.bsAside && scope.$watch(attr.bsAside, function(newValue, oldValue) {
|
73
|
+
if(angular.isObject(newValue)) {
|
74
|
+
angular.extend(scope, newValue);
|
75
|
+
} else {
|
76
|
+
scope.content = newValue;
|
77
|
+
}
|
78
|
+
}, true);
|
79
|
+
|
80
|
+
// Initialize aside
|
81
|
+
var aside = $aside(options);
|
82
|
+
|
83
|
+
// Trigger
|
84
|
+
element.on(attr.trigger || 'click', aside.toggle);
|
85
|
+
|
86
|
+
// Garbage collection
|
87
|
+
scope.$on('$destroy', function() {
|
88
|
+
if (aside) aside.destroy();
|
89
|
+
options = null;
|
90
|
+
aside = null;
|
91
|
+
});
|
92
|
+
|
93
|
+
}
|
94
|
+
};
|
95
|
+
|
96
|
+
}]);
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* angular-strap
|
3
|
+
* @version v2.1.6 - 2015-01-11
|
4
|
+
* @link http://mgcrea.github.io/angular-strap
|
5
|
+
* @author Olivier Louvignes (olivier@mg-crea.com)
|
6
|
+
* @license MIT License, http://www.opensource.org/licenses/MIT
|
7
|
+
*/
|
8
|
+
"use strict";angular.module("mgcrea.ngStrap.aside",["mgcrea.ngStrap.modal"]).provider("$aside",function(){var e=this.defaults={animation:"am-fade-and-slide-right",prefixClass:"aside",prefixEvent:"aside",placement:"right",template:"aside/aside.tpl.html",contentTemplate:!1,container:!1,element:null,backdrop:!0,keyboard:!0,html:!1,show:!0};this.$get=["$modal",function(t){function n(n){var a={},i=angular.extend({},e,n);return a=t(i)}return n}]}).directive("bsAside",["$window","$sce","$aside",function(e,t,n){e.requestAnimationFrame||e.setTimeout;return{restrict:"EAC",scope:!0,link:function(e,a,i){var r={scope:e,element:a,show:!1};angular.forEach(["template","contentTemplate","placement","backdrop","keyboard","html","container","animation"],function(e){angular.isDefined(i[e])&&(r[e]=i[e])}),angular.forEach(["title","content"],function(n){i[n]&&i.$observe(n,function(a){e[n]=t.trustAsHtml(a)})}),i.bsAside&&e.$watch(i.bsAside,function(t){angular.isObject(t)?angular.extend(e,t):e.content=t},!0);var o=n(r);a.on(i.trigger||"click",o.toggle),e.$on("$destroy",function(){o&&o.destroy(),r=null,o=null})}}}]);
|
9
|
+
//# sourceMappingURL=aside.min.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["aside/aside.js"],"names":[],"mappings":"qBASM,OAAA,wBAAa,kCAEb,SAAU,cAEV,GAAW,KAAA,UACX,UAAS,0BACT,YAAU,QACV,YAAU,QACV,UAAM,QACN,SAAM,uDAGR,QAAK,iBAEH,UAAS,gBAEH,QAGJ,MAAI,SAAU,SAAQ,WAEtB,GAAgB,GAEhB,GAAA,oEAiBI,WAAS,UAAS,OAAO,SAAe,SAAA,EAAc,EAAA,GAEpC,EAAO,uBAAwB,EAAA,kEAOnD,IAAa,MAAK,EAAS,QAAK,EAAS,MAAU,WACjD,SAAa,WAAK,kBAAY,YAAA,WAAA,WAAA,OAAA,YAAA,aAAA,SAAA,0CAKlC,QAAK,SAAW,QAAM,WAAY,SAAS,GACzC,EAAG,IAAQ,EAAA,SAAS,EAAW,SAAA,GAC7B,EAAA,GAAQ,EAAO,YAAO,qEAOtB,QAAQ,OAAO,EAAA,uBAOjB,GAAI,EAAa,gFAQtB,EAAA","file":"aside.min.js","sourcesContent":["'use strict';\n\nangular.module('mgcrea.ngStrap.aside', ['mgcrea.ngStrap.modal'])\n\n .provider('$aside', function() {\n\n var defaults = this.defaults = {\n animation: 'am-fade-and-slide-right',\n prefixClass: 'aside',\n prefixEvent: 'aside',\n placement: 'right',\n template: 'aside/aside.tpl.html',\n contentTemplate: false,\n container: false,\n element: null,\n backdrop: true,\n keyboard: true,\n html: false,\n show: true\n };\n\n this.$get = function($modal) {\n\n function AsideFactory(config) {\n\n var $aside = {};\n\n // Common vars\n var options = angular.extend({}, defaults, config);\n\n $aside = $modal(options);\n\n return $aside;\n\n }\n\n return AsideFactory;\n\n };\n\n })\n\n .directive('bsAside', function($window, $sce, $aside) {\n\n var requestAnimationFrame = $window.requestAnimationFrame || $window.setTimeout;\n\n return {\n restrict: 'EAC',\n scope: true,\n link: function postLink(scope, element, attr, transclusion) {\n // Directive options\n var options = {scope: scope, element: element, show: false};\n angular.forEach(['template', 'contentTemplate', 'placement', 'backdrop', 'keyboard', 'html', 'container', 'animation'], function(key) {\n if(angular.isDefined(attr[key])) options[key] = attr[key];\n });\n\n // Support scope as data-attrs\n angular.forEach(['title', 'content'], function(key) {\n attr[key] && attr.$observe(key, function(newValue, oldValue) {\n scope[key] = $sce.trustAsHtml(newValue);\n });\n });\n\n // Support scope as an object\n attr.bsAside && scope.$watch(attr.bsAside, function(newValue, oldValue) {\n if(angular.isObject(newValue)) {\n angular.extend(scope, newValue);\n } else {\n scope.content = newValue;\n }\n }, true);\n\n // Initialize aside\n var aside = $aside(options);\n\n // Trigger\n element.on(attr.trigger || 'click', aside.toggle);\n\n // Garbage collection\n scope.$on('$destroy', function() {\n if (aside) aside.destroy();\n options = null;\n aside = null;\n });\n\n }\n };\n\n });\n"],"sourceRoot":"/source/"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/**
|
2
|
+
* angular-strap
|
3
|
+
* @version v2.1.6 - 2015-01-11
|
4
|
+
* @link http://mgcrea.github.io/angular-strap
|
5
|
+
* @author Olivier Louvignes (olivier@mg-crea.com)
|
6
|
+
* @license MIT License, http://www.opensource.org/licenses/MIT
|
7
|
+
*/
|
8
|
+
'use strict';
|
9
|
+
|
10
|
+
angular.module('mgcrea.ngStrap.aside').run(['$templateCache', function($templateCache) {
|
11
|
+
|
12
|
+
$templateCache.put('aside/aside.tpl.html', '<div class="aside" tabindex="-1" role="dialog"><div class="aside-dialog"><div class="aside-content"><div class="aside-header" ng-show="title"><button type="button" class="close" ng-click="$hide()">×</button><h4 class="aside-title" ng-bind="title"></h4></div><div class="aside-body" ng-bind="content"></div><div class="aside-footer"><button type="button" class="btn btn-default" ng-click="$hide()">Close</button></div></div></div></div>');
|
13
|
+
|
14
|
+
}]);
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/**
|
2
|
+
* angular-strap
|
3
|
+
* @version v2.1.6 - 2015-01-11
|
4
|
+
* @link http://mgcrea.github.io/angular-strap
|
5
|
+
* @author Olivier Louvignes (olivier@mg-crea.com)
|
6
|
+
* @license MIT License, http://www.opensource.org/licenses/MIT
|
7
|
+
*/
|
8
|
+
"use strict";angular.module("mgcrea.ngStrap.aside").run(["$templateCache",function(t){t.put("aside/aside.tpl.html",'<div class="aside" tabindex="-1" role="dialog"><div class="aside-dialog"><div class="aside-content"><div class="aside-header" ng-show="title"><button type="button" class="close" ng-click="$hide()">×</button><h4 class="aside-title" ng-bind="title"></h4></div><div class="aside-body" ng-bind="content"></div><div class="aside-footer"><button type="button" class="btn btn-default" ng-click="$hide()">Close</button></div></div></div></div>')}]);
|
@@ -0,0 +1,177 @@
|
|
1
|
+
/**
|
2
|
+
* angular-strap
|
3
|
+
* @version v2.1.6 - 2015-01-11
|
4
|
+
* @link http://mgcrea.github.io/angular-strap
|
5
|
+
* @author Olivier Louvignes (olivier@mg-crea.com)
|
6
|
+
* @license MIT License, http://www.opensource.org/licenses/MIT
|
7
|
+
*/
|
8
|
+
'use strict';
|
9
|
+
|
10
|
+
angular.module('mgcrea.ngStrap.button', [])
|
11
|
+
|
12
|
+
.provider('$button', function() {
|
13
|
+
|
14
|
+
var defaults = this.defaults = {
|
15
|
+
activeClass:'active',
|
16
|
+
toggleEvent:'click'
|
17
|
+
};
|
18
|
+
|
19
|
+
this.$get = function() {
|
20
|
+
return {defaults: defaults};
|
21
|
+
};
|
22
|
+
|
23
|
+
})
|
24
|
+
|
25
|
+
.directive('bsCheckboxGroup', function() {
|
26
|
+
|
27
|
+
return {
|
28
|
+
restrict: 'A',
|
29
|
+
require: 'ngModel',
|
30
|
+
compile: function postLink(element, attr) {
|
31
|
+
element.attr('data-toggle', 'buttons');
|
32
|
+
element.removeAttr('ng-model');
|
33
|
+
var children = element[0].querySelectorAll('input[type="checkbox"]');
|
34
|
+
angular.forEach(children, function(child) {
|
35
|
+
var childEl = angular.element(child);
|
36
|
+
childEl.attr('bs-checkbox', '');
|
37
|
+
childEl.attr('ng-model', attr.ngModel + '.' + childEl.attr('value'));
|
38
|
+
});
|
39
|
+
}
|
40
|
+
|
41
|
+
};
|
42
|
+
|
43
|
+
})
|
44
|
+
|
45
|
+
.directive('bsCheckbox', ["$button", "$$rAF", function($button, $$rAF) {
|
46
|
+
|
47
|
+
var defaults = $button.defaults;
|
48
|
+
var constantValueRegExp = /^(true|false|\d+)$/;
|
49
|
+
|
50
|
+
return {
|
51
|
+
restrict: 'A',
|
52
|
+
require: 'ngModel',
|
53
|
+
link: function postLink(scope, element, attr, controller) {
|
54
|
+
|
55
|
+
var options = defaults;
|
56
|
+
|
57
|
+
// Support label > input[type="checkbox"]
|
58
|
+
var isInput = element[0].nodeName === 'INPUT';
|
59
|
+
var activeElement = isInput ? element.parent() : element;
|
60
|
+
|
61
|
+
var trueValue = angular.isDefined(attr.trueValue) ? attr.trueValue : true;
|
62
|
+
if(constantValueRegExp.test(attr.trueValue)) {
|
63
|
+
trueValue = scope.$eval(attr.trueValue);
|
64
|
+
}
|
65
|
+
var falseValue = angular.isDefined(attr.falseValue) ? attr.falseValue : false;
|
66
|
+
if(constantValueRegExp.test(attr.falseValue)) {
|
67
|
+
falseValue = scope.$eval(attr.falseValue);
|
68
|
+
}
|
69
|
+
|
70
|
+
// Parse exotic values
|
71
|
+
var hasExoticValues = typeof trueValue !== 'boolean' || typeof falseValue !== 'boolean';
|
72
|
+
if(hasExoticValues) {
|
73
|
+
controller.$parsers.push(function(viewValue) {
|
74
|
+
// console.warn('$parser', element.attr('ng-model'), 'viewValue', viewValue);
|
75
|
+
return viewValue ? trueValue : falseValue;
|
76
|
+
});
|
77
|
+
// modelValue -> $formatters -> viewValue
|
78
|
+
controller.$formatters.push(function(modelValue) {
|
79
|
+
// console.warn('$formatter("%s"): modelValue=%o (%o)', element.attr('ng-model'), modelValue, typeof modelValue);
|
80
|
+
return angular.equals(modelValue, trueValue);
|
81
|
+
});
|
82
|
+
// Fix rendering for exotic values
|
83
|
+
scope.$watch(attr.ngModel, function(newValue, oldValue) {
|
84
|
+
controller.$render();
|
85
|
+
});
|
86
|
+
}
|
87
|
+
|
88
|
+
// model -> view
|
89
|
+
controller.$render = function () {
|
90
|
+
// console.warn('$render', element.attr('ng-model'), 'controller.$modelValue', typeof controller.$modelValue, controller.$modelValue, 'controller.$viewValue', typeof controller.$viewValue, controller.$viewValue);
|
91
|
+
var isActive = angular.equals(controller.$modelValue, trueValue);
|
92
|
+
$$rAF(function() {
|
93
|
+
if(isInput) element[0].checked = isActive;
|
94
|
+
activeElement.toggleClass(options.activeClass, isActive);
|
95
|
+
});
|
96
|
+
};
|
97
|
+
|
98
|
+
// view -> model
|
99
|
+
element.bind(options.toggleEvent, function() {
|
100
|
+
scope.$apply(function () {
|
101
|
+
// console.warn('!click', element.attr('ng-model'), 'controller.$viewValue', typeof controller.$viewValue, controller.$viewValue, 'controller.$modelValue', typeof controller.$modelValue, controller.$modelValue);
|
102
|
+
if(!isInput) {
|
103
|
+
controller.$setViewValue(!activeElement.hasClass('active'));
|
104
|
+
}
|
105
|
+
if(!hasExoticValues) {
|
106
|
+
controller.$render();
|
107
|
+
}
|
108
|
+
});
|
109
|
+
});
|
110
|
+
|
111
|
+
}
|
112
|
+
|
113
|
+
};
|
114
|
+
|
115
|
+
}])
|
116
|
+
|
117
|
+
.directive('bsRadioGroup', function() {
|
118
|
+
|
119
|
+
return {
|
120
|
+
restrict: 'A',
|
121
|
+
require: 'ngModel',
|
122
|
+
compile: function postLink(element, attr) {
|
123
|
+
element.attr('data-toggle', 'buttons');
|
124
|
+
element.removeAttr('ng-model');
|
125
|
+
var children = element[0].querySelectorAll('input[type="radio"]');
|
126
|
+
angular.forEach(children, function(child) {
|
127
|
+
angular.element(child).attr('bs-radio', '');
|
128
|
+
angular.element(child).attr('ng-model', attr.ngModel);
|
129
|
+
});
|
130
|
+
}
|
131
|
+
|
132
|
+
};
|
133
|
+
|
134
|
+
})
|
135
|
+
|
136
|
+
.directive('bsRadio', ["$button", "$$rAF", function($button, $$rAF) {
|
137
|
+
|
138
|
+
var defaults = $button.defaults;
|
139
|
+
var constantValueRegExp = /^(true|false|\d+)$/;
|
140
|
+
|
141
|
+
return {
|
142
|
+
restrict: 'A',
|
143
|
+
require: 'ngModel',
|
144
|
+
link: function postLink(scope, element, attr, controller) {
|
145
|
+
|
146
|
+
var options = defaults;
|
147
|
+
|
148
|
+
// Support `label > input[type="radio"]` markup
|
149
|
+
var isInput = element[0].nodeName === 'INPUT';
|
150
|
+
var activeElement = isInput ? element.parent() : element;
|
151
|
+
|
152
|
+
var value = constantValueRegExp.test(attr.value) ? scope.$eval(attr.value) : attr.value;
|
153
|
+
|
154
|
+
// model -> view
|
155
|
+
controller.$render = function () {
|
156
|
+
// console.warn('$render', element.attr('value'), 'controller.$modelValue', typeof controller.$modelValue, controller.$modelValue, 'controller.$viewValue', typeof controller.$viewValue, controller.$viewValue);
|
157
|
+
var isActive = angular.equals(controller.$modelValue, value);
|
158
|
+
$$rAF(function() {
|
159
|
+
if(isInput) element[0].checked = isActive;
|
160
|
+
activeElement.toggleClass(options.activeClass, isActive);
|
161
|
+
});
|
162
|
+
};
|
163
|
+
|
164
|
+
// view -> model
|
165
|
+
element.bind(options.toggleEvent, function() {
|
166
|
+
scope.$apply(function () {
|
167
|
+
// console.warn('!click', element.attr('value'), 'controller.$viewValue', typeof controller.$viewValue, controller.$viewValue, 'controller.$modelValue', typeof controller.$modelValue, controller.$modelValue);
|
168
|
+
controller.$setViewValue(value);
|
169
|
+
controller.$render();
|
170
|
+
});
|
171
|
+
});
|
172
|
+
|
173
|
+
}
|
174
|
+
|
175
|
+
};
|
176
|
+
|
177
|
+
}]);
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* angular-strap
|
3
|
+
* @version v2.1.6 - 2015-01-11
|
4
|
+
* @link http://mgcrea.github.io/angular-strap
|
5
|
+
* @author Olivier Louvignes (olivier@mg-crea.com)
|
6
|
+
* @license MIT License, http://www.opensource.org/licenses/MIT
|
7
|
+
*/
|
8
|
+
"use strict";angular.module("mgcrea.ngStrap.button",[]).provider("$button",function(){var e=this.defaults={activeClass:"active",toggleEvent:"click"};this.$get=function(){return{defaults:e}}}).directive("bsCheckboxGroup",function(){return{restrict:"A",require:"ngModel",compile:function(e,t){e.attr("data-toggle","buttons"),e.removeAttr("ng-model");var a=e[0].querySelectorAll('input[type="checkbox"]');angular.forEach(a,function(e){var a=angular.element(e);a.attr("bs-checkbox",""),a.attr("ng-model",t.ngModel+"."+a.attr("value"))})}}}).directive("bsCheckbox",["$button","$$rAF",function(e,t){var a=e.defaults,n=/^(true|false|\d+)$/;return{restrict:"A",require:"ngModel",link:function(e,r,u,l){var o=a,i="INPUT"===r[0].nodeName,c=i?r.parent():r,s=angular.isDefined(u.trueValue)?u.trueValue:!0;n.test(u.trueValue)&&(s=e.$eval(u.trueValue));var d=angular.isDefined(u.falseValue)?u.falseValue:!1;n.test(u.falseValue)&&(d=e.$eval(u.falseValue));var f="boolean"!=typeof s||"boolean"!=typeof d;f&&(l.$parsers.push(function(e){return e?s:d}),l.$formatters.push(function(e){return angular.equals(e,s)}),e.$watch(u.ngModel,function(){l.$render()})),l.$render=function(){var e=angular.equals(l.$modelValue,s);t(function(){i&&(r[0].checked=e),c.toggleClass(o.activeClass,e)})},r.bind(o.toggleEvent,function(){e.$apply(function(){i||l.$setViewValue(!c.hasClass("active")),f||l.$render()})})}}}]).directive("bsRadioGroup",function(){return{restrict:"A",require:"ngModel",compile:function(e,t){e.attr("data-toggle","buttons"),e.removeAttr("ng-model");var a=e[0].querySelectorAll('input[type="radio"]');angular.forEach(a,function(e){angular.element(e).attr("bs-radio",""),angular.element(e).attr("ng-model",t.ngModel)})}}}).directive("bsRadio",["$button","$$rAF",function(e,t){var a=e.defaults,n=/^(true|false|\d+)$/;return{restrict:"A",require:"ngModel",link:function(e,r,u,l){var o=a,i="INPUT"===r[0].nodeName,c=i?r.parent():r,s=n.test(u.value)?e.$eval(u.value):u.value;l.$render=function(){var e=angular.equals(l.$modelValue,s);t(function(){i&&(r[0].checked=e),c.toggleClass(o.activeClass,e)})},r.bind(o.toggleEvent,function(){e.$apply(function(){l.$setViewValue(s),l.$render()})})}}}]);
|
9
|
+
//# sourceMappingURL=button.min.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["button/button.js"],"names":[],"mappings":"iEAWS,UAAO,+FAQZ,OAAO,SAAA,gBAKH,kBAAmB,2BAGb,YACJ,kBACA,SAAa,EAAiB,mQAelC,cAAS,UAAA,QAAA,SAAA,EAAA,oBAGP,EAAc,qCAGV,YACA,iCAGJ,GAAG,GAAA,EAGC,EAA+B,UAA/B,EAAa,GAAQ,SACtB,EAAA,EAAyB,EAAK,SAAa,+FAM9C,IAAG,GAAA,QAAiB,UAAA,EAAA,YAAA,EAAA,YAAA,CAClB,GAAoB,KAAK,EAAA,0CAKzB,GAAqC,iBAAd,IAA0B,iBAAA,SAEvC,SAAQ,KAAO,SAAA,4GAWzB,EAAI,uEAQN,GAAQ,WACN,IAAa,EAAA,GAAY,QAAA,uCAMrB,KAAA,EAAW,YAAA,2GAkBjB,eAAmB,2BAGjB,YACA,+QAeJ,WAAS,UAAA,QAAA,SAAA,EAAA,oBAGP,EAAc,qCAGV,YACA,mEAOF,EAAe,EAAQ,EAAO,SAAW,EAEvC,EAAG,EAAoB,KAAU,EAAA,OAAA,EAAA,MAAA,EAAA,OAAA,EAAA,gEAMrC,GAAQ,WACN,IAAa,EAAA,GAAY,QAAA","file":"button.min.js","sourcesContent":["'use strict';\n\nangular.module('mgcrea.ngStrap.button', [])\n\n .provider('$button', function() {\n\n var defaults = this.defaults = {\n activeClass:'active',\n toggleEvent:'click'\n };\n\n this.$get = function() {\n return {defaults: defaults};\n };\n\n })\n\n .directive('bsCheckboxGroup', function() {\n\n return {\n restrict: 'A',\n require: 'ngModel',\n compile: function postLink(element, attr) {\n element.attr('data-toggle', 'buttons');\n element.removeAttr('ng-model');\n var children = element[0].querySelectorAll('input[type=\"checkbox\"]');\n angular.forEach(children, function(child) {\n var childEl = angular.element(child);\n childEl.attr('bs-checkbox', '');\n childEl.attr('ng-model', attr.ngModel + '.' + childEl.attr('value'));\n });\n }\n\n };\n\n })\n\n .directive('bsCheckbox', function($button, $$rAF) {\n\n var defaults = $button.defaults;\n var constantValueRegExp = /^(true|false|\\d+)$/;\n\n return {\n restrict: 'A',\n require: 'ngModel',\n link: function postLink(scope, element, attr, controller) {\n\n var options = defaults;\n\n // Support label > input[type=\"checkbox\"]\n var isInput = element[0].nodeName === 'INPUT';\n var activeElement = isInput ? element.parent() : element;\n\n var trueValue = angular.isDefined(attr.trueValue) ? attr.trueValue : true;\n if(constantValueRegExp.test(attr.trueValue)) {\n trueValue = scope.$eval(attr.trueValue);\n }\n var falseValue = angular.isDefined(attr.falseValue) ? attr.falseValue : false;\n if(constantValueRegExp.test(attr.falseValue)) {\n falseValue = scope.$eval(attr.falseValue);\n }\n\n // Parse exotic values\n var hasExoticValues = typeof trueValue !== 'boolean' || typeof falseValue !== 'boolean';\n if(hasExoticValues) {\n controller.$parsers.push(function(viewValue) {\n // console.warn('$parser', element.attr('ng-model'), 'viewValue', viewValue);\n return viewValue ? trueValue : falseValue;\n });\n // modelValue -> $formatters -> viewValue\n controller.$formatters.push(function(modelValue) {\n // console.warn('$formatter(\"%s\"): modelValue=%o (%o)', element.attr('ng-model'), modelValue, typeof modelValue);\n return angular.equals(modelValue, trueValue);\n });\n // Fix rendering for exotic values\n scope.$watch(attr.ngModel, function(newValue, oldValue) {\n controller.$render();\n });\n }\n\n // model -> view\n controller.$render = function () {\n // console.warn('$render', element.attr('ng-model'), 'controller.$modelValue', typeof controller.$modelValue, controller.$modelValue, 'controller.$viewValue', typeof controller.$viewValue, controller.$viewValue);\n var isActive = angular.equals(controller.$modelValue, trueValue);\n $$rAF(function() {\n if(isInput) element[0].checked = isActive;\n activeElement.toggleClass(options.activeClass, isActive);\n });\n };\n\n // view -> model\n element.bind(options.toggleEvent, function() {\n scope.$apply(function () {\n // console.warn('!click', element.attr('ng-model'), 'controller.$viewValue', typeof controller.$viewValue, controller.$viewValue, 'controller.$modelValue', typeof controller.$modelValue, controller.$modelValue);\n if(!isInput) {\n controller.$setViewValue(!activeElement.hasClass('active'));\n }\n if(!hasExoticValues) {\n controller.$render();\n }\n });\n });\n\n }\n\n };\n\n })\n\n .directive('bsRadioGroup', function() {\n\n return {\n restrict: 'A',\n require: 'ngModel',\n compile: function postLink(element, attr) {\n element.attr('data-toggle', 'buttons');\n element.removeAttr('ng-model');\n var children = element[0].querySelectorAll('input[type=\"radio\"]');\n angular.forEach(children, function(child) {\n angular.element(child).attr('bs-radio', '');\n angular.element(child).attr('ng-model', attr.ngModel);\n });\n }\n\n };\n\n })\n\n .directive('bsRadio', function($button, $$rAF) {\n\n var defaults = $button.defaults;\n var constantValueRegExp = /^(true|false|\\d+)$/;\n\n return {\n restrict: 'A',\n require: 'ngModel',\n link: function postLink(scope, element, attr, controller) {\n\n var options = defaults;\n\n // Support `label > input[type=\"radio\"]` markup\n var isInput = element[0].nodeName === 'INPUT';\n var activeElement = isInput ? element.parent() : element;\n\n var value = constantValueRegExp.test(attr.value) ? scope.$eval(attr.value) : attr.value;\n\n // model -> view\n controller.$render = function () {\n // console.warn('$render', element.attr('value'), 'controller.$modelValue', typeof controller.$modelValue, controller.$modelValue, 'controller.$viewValue', typeof controller.$viewValue, controller.$viewValue);\n var isActive = angular.equals(controller.$modelValue, value);\n $$rAF(function() {\n if(isInput) element[0].checked = isActive;\n activeElement.toggleClass(options.activeClass, isActive);\n });\n };\n\n // view -> model\n element.bind(options.toggleEvent, function() {\n scope.$apply(function () {\n // console.warn('!click', element.attr('value'), 'controller.$viewValue', typeof controller.$viewValue, controller.$viewValue, 'controller.$modelValue', typeof controller.$modelValue, controller.$modelValue);\n controller.$setViewValue(value);\n controller.$render();\n });\n });\n\n }\n\n };\n\n });\n"],"sourceRoot":"/source/"}
|
@@ -0,0 +1,273 @@
|
|
1
|
+
/**
|
2
|
+
* angular-strap
|
3
|
+
* @version v2.1.6 - 2015-01-11
|
4
|
+
* @link http://mgcrea.github.io/angular-strap
|
5
|
+
* @author Olivier Louvignes (olivier@mg-crea.com)
|
6
|
+
* @license MIT License, http://www.opensource.org/licenses/MIT
|
7
|
+
*/
|
8
|
+
'use strict';
|
9
|
+
|
10
|
+
angular.module('mgcrea.ngStrap.collapse', [])
|
11
|
+
|
12
|
+
.provider('$collapse', function() {
|
13
|
+
|
14
|
+
var defaults = this.defaults = {
|
15
|
+
animation: 'am-collapse',
|
16
|
+
disallowToggle: false,
|
17
|
+
activeClass: 'in',
|
18
|
+
startCollapsed: false,
|
19
|
+
allowMultiple: false
|
20
|
+
};
|
21
|
+
|
22
|
+
var controller = this.controller = function($scope, $element, $attrs) {
|
23
|
+
var self = this;
|
24
|
+
|
25
|
+
// Attributes options
|
26
|
+
self.$options = angular.copy(defaults);
|
27
|
+
angular.forEach(['animation', 'disallowToggle', 'activeClass', 'startCollapsed', 'allowMultiple'], function (key) {
|
28
|
+
if(angular.isDefined($attrs[key])) self.$options[key] = $attrs[key];
|
29
|
+
});
|
30
|
+
|
31
|
+
self.$toggles = [];
|
32
|
+
self.$targets = [];
|
33
|
+
|
34
|
+
self.$viewChangeListeners = [];
|
35
|
+
|
36
|
+
self.$registerToggle = function(element) {
|
37
|
+
self.$toggles.push(element);
|
38
|
+
};
|
39
|
+
self.$registerTarget = function(element) {
|
40
|
+
self.$targets.push(element);
|
41
|
+
};
|
42
|
+
|
43
|
+
self.$unregisterToggle = function(element) {
|
44
|
+
var index = self.$toggles.indexOf(element);
|
45
|
+
// remove toggle from $toggles array
|
46
|
+
self.$toggles.splice(index, 1);
|
47
|
+
};
|
48
|
+
self.$unregisterTarget = function(element) {
|
49
|
+
var index = self.$targets.indexOf(element);
|
50
|
+
|
51
|
+
// remove element from $targets array
|
52
|
+
self.$targets.splice(index, 1);
|
53
|
+
|
54
|
+
if (self.$options.allowMultiple) {
|
55
|
+
// remove target index from $active array values
|
56
|
+
deactivateItem(element);
|
57
|
+
}
|
58
|
+
|
59
|
+
// fix active item indexes
|
60
|
+
fixActiveItemIndexes(index);
|
61
|
+
|
62
|
+
self.$viewChangeListeners.forEach(function(fn) {
|
63
|
+
fn();
|
64
|
+
});
|
65
|
+
};
|
66
|
+
|
67
|
+
// use array to store all the currently open panels
|
68
|
+
self.$targets.$active = !self.$options.startCollapsed ? [0] : [];
|
69
|
+
self.$setActive = $scope.$setActive = function(value) {
|
70
|
+
if(angular.isArray(value)) {
|
71
|
+
self.$targets.$active = angular.copy(value);
|
72
|
+
}
|
73
|
+
else if(!self.$options.disallowToggle) {
|
74
|
+
// toogle element active status
|
75
|
+
isActive(value) ? deactivateItem(value) : activateItem(value);
|
76
|
+
} else {
|
77
|
+
activateItem(value);
|
78
|
+
}
|
79
|
+
|
80
|
+
self.$viewChangeListeners.forEach(function(fn) {
|
81
|
+
fn();
|
82
|
+
});
|
83
|
+
};
|
84
|
+
|
85
|
+
self.$activeIndexes = function() {
|
86
|
+
return self.$options.allowMultiple ? self.$targets.$active :
|
87
|
+
self.$targets.$active.length === 1 ? self.$targets.$active[0] : -1;
|
88
|
+
};
|
89
|
+
|
90
|
+
function fixActiveItemIndexes(index) {
|
91
|
+
// item with index was removed, so we
|
92
|
+
// need to adjust other items index values
|
93
|
+
var activeIndexes = self.$targets.$active;
|
94
|
+
for(var i = 0; i < activeIndexes.length; i++) {
|
95
|
+
if (index < activeIndexes[i]) {
|
96
|
+
activeIndexes[i] = activeIndexes[i] - 1;
|
97
|
+
}
|
98
|
+
|
99
|
+
// the last item is active, so we need to
|
100
|
+
// adjust its index
|
101
|
+
if (activeIndexes[i] === self.$targets.length) {
|
102
|
+
activeIndexes[i] = self.$targets.length - 1;
|
103
|
+
}
|
104
|
+
}
|
105
|
+
}
|
106
|
+
|
107
|
+
function isActive(value) {
|
108
|
+
var activeItems = self.$targets.$active;
|
109
|
+
return activeItems.indexOf(value) === -1 ? false : true;
|
110
|
+
}
|
111
|
+
|
112
|
+
function deactivateItem(value) {
|
113
|
+
var index = self.$targets.$active.indexOf(value);
|
114
|
+
if (index !== -1) {
|
115
|
+
self.$targets.$active.splice(index, 1);
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
function activateItem(value) {
|
120
|
+
if (!self.$options.allowMultiple) {
|
121
|
+
// remove current selected item
|
122
|
+
self.$targets.$active.splice(0, 1);
|
123
|
+
}
|
124
|
+
|
125
|
+
if (self.$targets.$active.indexOf(value) === -1) {
|
126
|
+
self.$targets.$active.push(value);
|
127
|
+
}
|
128
|
+
}
|
129
|
+
|
130
|
+
};
|
131
|
+
|
132
|
+
this.$get = function() {
|
133
|
+
var $collapse = {};
|
134
|
+
$collapse.defaults = defaults;
|
135
|
+
$collapse.controller = controller;
|
136
|
+
return $collapse;
|
137
|
+
};
|
138
|
+
|
139
|
+
})
|
140
|
+
|
141
|
+
.directive('bsCollapse', ["$window", "$animate", "$collapse", function($window, $animate, $collapse) {
|
142
|
+
|
143
|
+
var defaults = $collapse.defaults;
|
144
|
+
|
145
|
+
return {
|
146
|
+
require: ['?ngModel', 'bsCollapse'],
|
147
|
+
controller: ['$scope', '$element', '$attrs', $collapse.controller],
|
148
|
+
link: function postLink(scope, element, attrs, controllers) {
|
149
|
+
|
150
|
+
var ngModelCtrl = controllers[0];
|
151
|
+
var bsCollapseCtrl = controllers[1];
|
152
|
+
|
153
|
+
if(ngModelCtrl) {
|
154
|
+
|
155
|
+
// Update the modelValue following
|
156
|
+
bsCollapseCtrl.$viewChangeListeners.push(function() {
|
157
|
+
ngModelCtrl.$setViewValue(bsCollapseCtrl.$activeIndexes());
|
158
|
+
});
|
159
|
+
|
160
|
+
// modelValue -> $formatters -> viewValue
|
161
|
+
ngModelCtrl.$formatters.push(function(modelValue) {
|
162
|
+
// console.warn('$formatter("%s"): modelValue=%o (%o)', element.attr('ng-model'), modelValue, typeof modelValue);
|
163
|
+
if (angular.isArray(modelValue)) {
|
164
|
+
// model value is an array, so just replace
|
165
|
+
// the active items directly
|
166
|
+
bsCollapseCtrl.$setActive(modelValue);
|
167
|
+
}
|
168
|
+
else {
|
169
|
+
var activeIndexes = bsCollapseCtrl.$activeIndexes();
|
170
|
+
|
171
|
+
if (angular.isArray(activeIndexes)) {
|
172
|
+
// we have an array of selected indexes
|
173
|
+
if (activeIndexes.indexOf(modelValue * 1) === -1) {
|
174
|
+
// item with modelValue index is not active
|
175
|
+
bsCollapseCtrl.$setActive(modelValue * 1);
|
176
|
+
}
|
177
|
+
}
|
178
|
+
else if (activeIndexes !== modelValue * 1) {
|
179
|
+
bsCollapseCtrl.$setActive(modelValue * 1);
|
180
|
+
}
|
181
|
+
}
|
182
|
+
return modelValue;
|
183
|
+
});
|
184
|
+
|
185
|
+
}
|
186
|
+
|
187
|
+
}
|
188
|
+
};
|
189
|
+
|
190
|
+
}])
|
191
|
+
|
192
|
+
.directive('bsCollapseToggle', function() {
|
193
|
+
|
194
|
+
return {
|
195
|
+
require: ['^?ngModel', '^bsCollapse'],
|
196
|
+
link: function postLink(scope, element, attrs, controllers) {
|
197
|
+
|
198
|
+
var ngModelCtrl = controllers[0];
|
199
|
+
var bsCollapseCtrl = controllers[1];
|
200
|
+
|
201
|
+
// Add base attr
|
202
|
+
element.attr('data-toggle', 'collapse');
|
203
|
+
|
204
|
+
// Push pane to parent bsCollapse controller
|
205
|
+
bsCollapseCtrl.$registerToggle(element);
|
206
|
+
|
207
|
+
// remove toggle from collapse controller when toggle is destroyed
|
208
|
+
scope.$on('$destroy', function() {
|
209
|
+
bsCollapseCtrl.$unregisterToggle(element);
|
210
|
+
});
|
211
|
+
|
212
|
+
element.on('click', function() {
|
213
|
+
var index = attrs.bsCollapseToggle || bsCollapseCtrl.$toggles.indexOf(element);
|
214
|
+
bsCollapseCtrl.$setActive(index * 1);
|
215
|
+
scope.$apply();
|
216
|
+
});
|
217
|
+
|
218
|
+
}
|
219
|
+
};
|
220
|
+
|
221
|
+
})
|
222
|
+
|
223
|
+
.directive('bsCollapseTarget', ["$animate", function($animate) {
|
224
|
+
|
225
|
+
return {
|
226
|
+
require: ['^?ngModel', '^bsCollapse'],
|
227
|
+
// scope: true,
|
228
|
+
link: function postLink(scope, element, attrs, controllers) {
|
229
|
+
|
230
|
+
var ngModelCtrl = controllers[0];
|
231
|
+
var bsCollapseCtrl = controllers[1];
|
232
|
+
|
233
|
+
// Add base class
|
234
|
+
element.addClass('collapse');
|
235
|
+
|
236
|
+
// Add animation class
|
237
|
+
if(bsCollapseCtrl.$options.animation) {
|
238
|
+
element.addClass(bsCollapseCtrl.$options.animation);
|
239
|
+
}
|
240
|
+
|
241
|
+
// Push pane to parent bsCollapse controller
|
242
|
+
bsCollapseCtrl.$registerTarget(element);
|
243
|
+
|
244
|
+
// remove pane target from collapse controller when target is destroyed
|
245
|
+
scope.$on('$destroy', function() {
|
246
|
+
bsCollapseCtrl.$unregisterTarget(element);
|
247
|
+
});
|
248
|
+
|
249
|
+
function render() {
|
250
|
+
var index = bsCollapseCtrl.$targets.indexOf(element);
|
251
|
+
var active = bsCollapseCtrl.$activeIndexes();
|
252
|
+
var action = 'removeClass';
|
253
|
+
if (angular.isArray(active)) {
|
254
|
+
if (active.indexOf(index) !== -1) {
|
255
|
+
action = 'addClass';
|
256
|
+
}
|
257
|
+
}
|
258
|
+
else if (index === active) {
|
259
|
+
action = 'addClass';
|
260
|
+
}
|
261
|
+
|
262
|
+
$animate[action](element, bsCollapseCtrl.$options.activeClass);
|
263
|
+
}
|
264
|
+
|
265
|
+
bsCollapseCtrl.$viewChangeListeners.push(function() {
|
266
|
+
render();
|
267
|
+
});
|
268
|
+
render();
|
269
|
+
|
270
|
+
}
|
271
|
+
};
|
272
|
+
|
273
|
+
}]);
|