This repository has been archived by the owner on Jun 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 367
/
entry.js
53 lines (41 loc) · 1.55 KB
/
entry.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
'use strict';
require('./less/calendar.less');
var angular = require('angular');
function requireAll(r) {
r.keys().forEach(r);
}
var templates = {};
if (EXCLUDE_TEMPLATES === false) {
var templatesContext = require.context('./templates', false, /\.html/);
templatesContext.keys().forEach(function(templateName) {
var templateNameWithoutPrefix = templateName.replace('./', '');
var cacheTemplateName = 'mwl/' + templateNameWithoutPrefix;
var configTemplateName = templateNameWithoutPrefix.replace('.html', '');
templates[configTemplateName] = {
cacheTemplateName: cacheTemplateName,
template: templatesContext(templateName)
};
});
}
module.exports = angular
.module('mwl.calendar', [])
.config(function(calendarConfig) {
angular.forEach(templates, function(template, templateName) {
if (!calendarConfig.templates[templateName]) {
calendarConfig.templates[templateName] = template.cacheTemplateName;
}
});
})
.run(function($templateCache, $interpolate) {
angular.forEach(templates, function(template) {
if (!$templateCache.get(template.cacheTemplateName)) {
var templateContents = template.template
.replace('{{', $interpolate.startSymbol())
.replace('}}', $interpolate.endSymbol());
$templateCache.put(template.cacheTemplateName, templateContents);
}
});
}).name;
requireAll(require.context('./directives', true, /\.js$/));
requireAll(require.context('./filters', true, /\.js$/));
requireAll(require.context('./services', true, /\.js$/));