redmine_extensions 0.2.10 → 0.2.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/redmine_extensions/application.js +0 -1
- data/app/assets/javascripts/redmine_extensions/blocking.js +2 -1
- data/app/assets/javascripts/redmine_extensions/blocking_dynamic_loading.js +53 -0
- data/app/assets/javascripts/redmine_extensions/blocking_module.js +208 -127
- data/app/assets/javascripts/redmine_extensions/blocking_schedule.js +50 -33
- data/app/views/easy_front_end/_easy_front_end.html.erb +2 -2
- data/lib/generators/redmine_extensions/entity/templates/index.api.rsb.erb +5 -5
- data/lib/generators/redmine_extensions/entity/templates/mail_added.html.erb.erb +1 -1
- data/lib/generators/redmine_extensions/entity/templates/mail_added.text.erb.erb +2 -2
- data/lib/generators/redmine_extensions/entity/templates/mail_updated.text.erb.erb +2 -2
- data/lib/generators/redmine_extensions/entity/templates/routes.rb.erb +12 -12
- data/lib/redmine_extensions/version.rb +1 -1
- metadata +12 -12
- data/app/assets/javascripts/redmine_extensions/dynamic_loading.js +0 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b6908fe3fa7949e58a19003cbc84109a5aa1d99
|
4
|
+
data.tar.gz: ef57c4be4e0d348483a6f44d3d31920fbb22f0c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fbc838412a96e26c5c068af3c641404bdd11bb87237935826c8ffe33ebdae4b758d76ffa60b61f4670888a43bcc8b63267c87a45370e3c70a57d56241bfd8b7
|
7
|
+
data.tar.gz: be933bea060cdb21c914b7e8d91504f8442426ec2b3ecf2923165f271e80b8d6c84446ada363068d23c01a5269d86ebf8d8e65cfb8c95b360eda42796ced39c5
|
@@ -4,7 +4,8 @@
|
|
4
4
|
//= require ./blocking_namespace
|
5
5
|
// require ./event_bus
|
6
6
|
//= require ./blocking_schedule
|
7
|
-
|
7
|
+
//= require ./blocking_module
|
8
8
|
//= require ./blocking_polyfill
|
9
9
|
//= require ./blocking_render
|
10
10
|
//= require ./blocking_utils
|
11
|
+
//= require ./blocking_dynamic_loading
|
@@ -0,0 +1,53 @@
|
|
1
|
+
(function () {
|
2
|
+
var alreadyLoaded = {};
|
3
|
+
EasyGem.dynamic = {
|
4
|
+
_alreadyLoaded: alreadyLoaded,
|
5
|
+
/**
|
6
|
+
* Append Javascript <script> tag to page
|
7
|
+
* @example
|
8
|
+
* EasyGem.dynamic.jsTag("/plugin_assets/my_plugin/javascripts/counter.js");
|
9
|
+
* EasyGem.schedule.require(function(counter){
|
10
|
+
* setInterval(counter.count(), 1000);
|
11
|
+
* }, function(){
|
12
|
+
* return window.utils.counter;
|
13
|
+
* })
|
14
|
+
* @param {String} src - absolute path to requested file
|
15
|
+
*/
|
16
|
+
jsTag: function (src) {
|
17
|
+
if (alreadyLoaded[src]) return;
|
18
|
+
alreadyLoaded[src] = true;
|
19
|
+
var jsScript = document.createElement("script");
|
20
|
+
jsScript.setAttribute("src", src);
|
21
|
+
jsScript.setAttribute("defer", "true");
|
22
|
+
document.head.appendChild(jsScript);
|
23
|
+
},
|
24
|
+
/**
|
25
|
+
* Append CSS <link> tag to page
|
26
|
+
* @param {String} src - absolute path to requested file
|
27
|
+
*/
|
28
|
+
cssTag: function (src) {
|
29
|
+
if (alreadyLoaded[src]) return;
|
30
|
+
alreadyLoaded[src] = true;
|
31
|
+
var link = document.createElement('link');
|
32
|
+
link.rel = "stylesheet";
|
33
|
+
link.type = "text/css";
|
34
|
+
link.href = src;
|
35
|
+
link.media = "all";
|
36
|
+
document.head.appendChild(link);
|
37
|
+
},
|
38
|
+
/**
|
39
|
+
* Load multiple JS files into page
|
40
|
+
* @param {Array.<String>} array
|
41
|
+
*/
|
42
|
+
jsTags: function (array) {
|
43
|
+
array.forEach(this.jsTag);
|
44
|
+
},
|
45
|
+
/**
|
46
|
+
* Load multiple CSS files into page
|
47
|
+
* @param {Array.<String>} array
|
48
|
+
*/
|
49
|
+
cssTags: function (array) {
|
50
|
+
array.forEach(this.cssTag);
|
51
|
+
}
|
52
|
+
};
|
53
|
+
})();
|
@@ -1,163 +1,244 @@
|
|
1
1
|
(function () {
|
2
2
|
"use strict";
|
3
|
-
return;
|
4
3
|
|
5
|
-
var
|
6
|
-
|
7
|
-
var
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
var getMissingModule = function (dependencyNames) {
|
13
|
-
for (var i = 0; i < dependencyNames.length; i++) {
|
14
|
-
var dependencyName = dependencyNames[i];
|
15
|
-
var dependency = modules[dependencyName];
|
16
|
-
if (!dependency || !dependency.instance) return dependencyName;
|
17
|
-
}
|
18
|
-
return null;
|
19
|
-
};
|
20
|
-
|
21
|
-
EASY.eventBus.on("moduleReady", function (moduleName) {
|
22
|
-
if (waiters[moduleName]) {
|
23
|
-
var subWaiters = waiters[moduleName];
|
24
|
-
delete waiters[moduleName];
|
25
|
-
delete modulesOrdered[moduleName];
|
26
|
-
subWaiters.forEach(function (pack) {
|
27
|
-
requireTry(pack);
|
28
|
-
})
|
29
|
-
}
|
30
|
-
});
|
4
|
+
var moduleInstances = {};
|
5
|
+
/** @type {Object.<String,EasyModule>} */
|
6
|
+
var moduleDefinitions = {};
|
7
|
+
/** @type {Array.<Waiter>} */
|
8
|
+
var waiters = [];
|
9
|
+
/** @type {Object.<String,String>} */
|
10
|
+
var urls = {};
|
31
11
|
|
12
|
+
function Waiter(dependencies, callback) {
|
13
|
+
this.dependencies = dependencies;
|
14
|
+
this.callback = callback;
|
15
|
+
}
|
32
16
|
|
33
17
|
/**
|
34
|
-
* @property {Function} factory
|
35
18
|
* @property {String} name
|
36
|
-
* @property {Array.<
|
19
|
+
* @property {Array.<String>} dependencies
|
20
|
+
* @property {Array.<Waiter>} waiters
|
37
21
|
* @constructor
|
38
22
|
*/
|
39
|
-
function
|
23
|
+
function EasyModule(moduleName) {
|
40
24
|
this.name = moduleName;
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
this.construct();
|
45
|
-
}
|
25
|
+
setTimeout(function () {
|
26
|
+
executeWaiters();
|
27
|
+
}, 0);
|
46
28
|
}
|
47
29
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
var
|
56
|
-
|
57
|
-
|
58
|
-
|
30
|
+
/**
|
31
|
+
* @methodOf EasyModule
|
32
|
+
*/
|
33
|
+
EasyModule.prototype.checkDependencies = function () {
|
34
|
+
if (!checkDependencies(this.dependencies)) return false;
|
35
|
+
var instance = {};
|
36
|
+
var waiters = this.waiters;
|
37
|
+
for (var i = 0; i < waiters.length; i++) {
|
38
|
+
var waiter = waiters[i];
|
39
|
+
var instances = waiter.dependencies.map(function (moduleName) {
|
40
|
+
return moduleInstances[moduleName];
|
41
|
+
});
|
42
|
+
instance = waiter.callback.apply(instance, instances) || instance;
|
59
43
|
}
|
44
|
+
moduleInstances[this.name] = instance;
|
45
|
+
};
|
46
|
+
|
47
|
+
function checkDependencies(dependencies) {
|
48
|
+
// console.log({dependencies: dependencies,instances:Object.keys(moduleInstances),definitions:Object.keys(moduleDefinitions)});
|
49
|
+
for (var i = 0; i < dependencies.length; i++) {
|
50
|
+
/** @type {String} */
|
51
|
+
var dependency = dependencies[i];
|
52
|
+
if (moduleInstances[dependency]) continue;
|
53
|
+
if (!moduleDefinitions[dependency]) {
|
60
54
|
|
61
|
-
|
62
|
-
|
63
|
-
/** @type {Module} */
|
64
|
-
var dependency;
|
65
|
-
for (var i = 0; i < this.dependencies.length; i++) {
|
66
|
-
dependency = this.dependencies[i];
|
67
|
-
if (dependency.instance) {
|
68
|
-
dependencyInstances.push(dependency.instance);
|
69
|
-
} else {
|
70
|
-
return dependency.construct(visited.concat([this.name]));
|
55
|
+
for (var j = i; j < dependencies.length; j++) {
|
56
|
+
loadModule(dependencies[j]);
|
71
57
|
}
|
58
|
+
return false;
|
72
59
|
}
|
60
|
+
moduleDefinitions[dependency].checkDependencies();
|
61
|
+
if (!moduleInstances[dependency]) return false;
|
73
62
|
}
|
74
|
-
|
75
|
-
|
76
|
-
EASY.eventBus.fire("moduleReady", this.name);
|
77
|
-
} else {
|
78
|
-
var self = this;
|
79
|
-
setTimeout(function () {
|
80
|
-
self.construct();
|
81
|
-
}, 10);
|
82
|
-
}
|
83
|
-
};
|
63
|
+
return true;
|
64
|
+
}
|
84
65
|
|
85
|
-
|
86
|
-
var
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
66
|
+
function executeWaiter(waiter) {
|
67
|
+
var instances = waiter.dependencies.map(function (moduleName) {
|
68
|
+
return moduleInstances[moduleName];
|
69
|
+
});
|
70
|
+
waiter.callback.apply(window, instances);
|
71
|
+
}
|
72
|
+
|
73
|
+
function executeWaiters() {
|
74
|
+
var executed = false;
|
75
|
+
for (var i = 0; i < waiters.length; i++) {
|
76
|
+
var waiter = waiters[i];
|
77
|
+
if (checkDependencies(waiter.dependencies)) {
|
78
|
+
executeWaiter(waiter);
|
79
|
+
executed = true;
|
80
|
+
waiters[i] = null;
|
96
81
|
}
|
97
|
-
dependencyInstances.push(dependency.instance);
|
98
|
-
}
|
99
|
-
return dependencyInstances;
|
100
|
-
};
|
101
|
-
/**
|
102
|
-
* @param {{dependencies:Array.<String>,body:Function,context:Object}} pack
|
103
|
-
*/
|
104
|
-
var requireTry = function (pack) {
|
105
|
-
var dependencyInstances = getDependencies(pack.dependencies);
|
106
|
-
if (dependencyInstances !== null) {
|
107
|
-
return pack.body.apply([pack.context || window].concat(dependencyInstances));
|
108
|
-
}
|
109
|
-
var missingModule = getMissingModule(pack.dependencies);
|
110
|
-
if (missingModule === null) return;
|
111
|
-
if (!modules[missingModule]) {
|
112
|
-
modulesOrdered[missingModule] = true;
|
113
82
|
}
|
83
|
+
waiters = waiters.filter(function (item) {
|
84
|
+
return item;
|
85
|
+
})
|
86
|
+
}
|
114
87
|
|
115
|
-
|
116
|
-
|
88
|
+
function loadModule(moduleName) {
|
89
|
+
var url = urls[moduleName];
|
90
|
+
if (url) {
|
91
|
+
EasyGem.dynamic.jsTag(url);
|
117
92
|
}
|
118
|
-
|
119
|
-
};
|
93
|
+
}
|
120
94
|
|
95
|
+
function findMissingModules() {
|
96
|
+
var moduleMap = {};
|
97
|
+
for (var i = 0; i < waiters.length; i++) {
|
98
|
+
missingModules(waiters[i].dependencies, moduleMap);
|
99
|
+
}
|
100
|
+
var modules = Object.keys(moduleMap);
|
101
|
+
if (modules.length > 0) {
|
102
|
+
throw "Missing modules: " + modules.join(", ");
|
103
|
+
}
|
104
|
+
}
|
121
105
|
|
122
|
-
|
106
|
+
function missingModules(dependencies, modules) {
|
107
|
+
for (var i = 0; i < dependencies.length; i++) {
|
108
|
+
/** @type {String} */
|
109
|
+
var dependency = dependencies[i];
|
110
|
+
if (moduleInstances[dependency]) continue;
|
111
|
+
if (!moduleDefinitions[dependency]) {
|
112
|
+
modules[dependency] = true;
|
113
|
+
continue;
|
114
|
+
}
|
115
|
+
missingModules(moduleDefinitions[dependency].dependencies, modules);
|
116
|
+
}
|
117
|
+
}
|
123
118
|
|
124
119
|
/**
|
125
|
-
*
|
126
|
-
*
|
127
|
-
* @param {String} moduleName
|
128
|
-
* @param {Array.<String>} dependencies
|
129
|
-
* @param {Function} factory
|
120
|
+
*
|
121
|
+
* @type {{urls: Object<String, String>, module: EasyGem.module.module, part: EasyGem.module.part, transform: EasyGem.module.transform, setUrl: EasyGem.module.setUrl}}
|
130
122
|
*/
|
131
|
-
|
132
|
-
|
123
|
+
EasyGem.module = {
|
124
|
+
/**
|
125
|
+
* Object containing urls for modules. Filling the urls is recommended to do in <head>.
|
126
|
+
* Use [moduleName] as key and absolute path (with or without a hostname) as value
|
127
|
+
* If url have to be specified later, use EasyGem.module.setUrl() instead.
|
128
|
+
* @type {Object<String, String>}
|
129
|
+
* @example
|
130
|
+
* EasyGem.module.urls["myModule"] = "/assets/my_module.js"
|
131
|
+
*/
|
132
|
+
urls: urls,
|
133
|
+
/**
|
134
|
+
* Define module in one separate file. Use this method as first line of the file
|
135
|
+
* Module can be downloaded on-demand by loadModules() if url is provided by setUrl() function.
|
136
|
+
* @example
|
137
|
+
* EasyGem.module.module("myModule", ["jQuery", "c3"], function($, c3) {
|
138
|
+
* return {
|
139
|
+
* init: function(){
|
140
|
+
* c3.init($("#graph"));
|
141
|
+
* }
|
142
|
+
* }
|
143
|
+
* }
|
144
|
+
* @param {String} moduleName
|
145
|
+
* @param {Array.<String>} prerequisites - other modules needed for construction of module
|
146
|
+
* @param {Function} getter - factory function
|
147
|
+
*/
|
148
|
+
module: function (moduleName, prerequisites, getter) {
|
149
|
+
var module = moduleDefinitions[moduleName] = new EasyModule(moduleName);
|
150
|
+
module.dependencies = prerequisites;
|
151
|
+
module.waiters = [new Waiter(prerequisites, getter)];
|
152
|
+
},
|
153
|
+
/**
|
154
|
+
* Define module part if module code is distributed into many separate files.
|
155
|
+
* For dynamic loading by url, all files have to be combine by pipeline into one.
|
156
|
+
* Module is executed only if all [prerequisites] from all parts of the module is fulfilled, but only part's
|
157
|
+
* [prerequisites] will be used as arguments for [getter].
|
158
|
+
* [prerequisites] argument can be omitted if no prerequisites are required
|
159
|
+
* @param {String} moduleName
|
160
|
+
* @param {Array.<String>|Function} prerequisites
|
161
|
+
* @param {Function} [getter]
|
162
|
+
*/
|
163
|
+
part: function (moduleName, prerequisites, getter) {
|
164
|
+
if (getter === undefined) {
|
165
|
+
getter = prerequisites;
|
166
|
+
prerequisites = [];
|
167
|
+
}
|
168
|
+
var module = moduleDefinitions[moduleName];
|
169
|
+
if (!module){
|
170
|
+
module = moduleDefinitions[moduleName] = new EasyModule(moduleName);
|
171
|
+
module.waiters = [];
|
172
|
+
module.dependencies = [];
|
173
|
+
}
|
174
|
+
module.waiters.push(new Waiter(prerequisites, getter));
|
175
|
+
for (var i = 0; i < prerequisites.length; i++) {
|
176
|
+
var prerequisite = prerequisites[i];
|
177
|
+
if (module.dependencies.indexOf(prerequisite) === -1) {
|
178
|
+
module.dependencies.push(prerequisite);
|
179
|
+
}
|
180
|
+
}
|
181
|
+
},
|
182
|
+
/**
|
183
|
+
* Transform simple EasyGem.schedule.require [prerequisite] into proper module.
|
184
|
+
* Use it sparingly if module have to be defined for usage in other modules as prerequisite.
|
185
|
+
* If named getter is saved by EasyGem.schedule.define, the name can also be used.
|
186
|
+
* @param {String} moduleName
|
187
|
+
* @param {String|Function} prerequisite - getter function
|
188
|
+
* @example
|
189
|
+
* EasyGem.module.transform("c3", function() {
|
190
|
+
* return window.c3;
|
191
|
+
* });
|
192
|
+
* -- OR --
|
193
|
+
* EasyGem.module.transform("c3", "c3");
|
194
|
+
*/
|
195
|
+
transform: function (moduleName, prerequisite) {
|
196
|
+
EasyGem.schedule.require(function (instance) {
|
197
|
+
moduleInstances[moduleName] = instance;
|
198
|
+
executeWaiters();
|
199
|
+
}, prerequisite);
|
200
|
+
},
|
201
|
+
/**
|
202
|
+
* Save url for later dynamic load of the module. Use it only if url is defined later in page parsing.
|
203
|
+
* If you can specify url in header, use EasyGem.module.urls object instead;
|
204
|
+
* @param {String} moduleName
|
205
|
+
* @param {String} url - absolute url of the module file, with or without hostname
|
206
|
+
*/
|
207
|
+
setUrl: function (moduleName, url) {
|
208
|
+
urls[moduleName] = url;
|
209
|
+
executeWaiters();
|
210
|
+
}
|
133
211
|
};
|
134
212
|
/**
|
135
|
-
*
|
136
|
-
*
|
213
|
+
* Load specified modules and execute [callback].
|
214
|
+
* Module instances are constructed if not constructed before.
|
215
|
+
* Missing modules are downloaded if url is provided.
|
216
|
+
* @param {Array.<String>} moduleNames
|
217
|
+
* @param {Function} callback - function with module instances as arguments
|
218
|
+
* @example
|
219
|
+
* EasyGem.loadModules(["jQuery", "myModule"], function($, myModule) {
|
220
|
+
* myModule.init($("#my_module_container"));
|
221
|
+
* });
|
137
222
|
*/
|
138
|
-
|
139
|
-
|
223
|
+
EasyGem.loadModules = function (moduleNames, callback) {
|
224
|
+
var waiter = new Waiter(moduleNames, callback);
|
225
|
+
if (checkDependencies(moduleNames)) {
|
226
|
+
executeWaiter(waiter);
|
227
|
+
} else {
|
228
|
+
waiters.push(waiter);
|
229
|
+
setTimeout(findMissingModules, 5000);
|
230
|
+
}
|
140
231
|
};
|
141
232
|
/**
|
142
|
-
*
|
143
|
-
* @param {
|
144
|
-
* @param {
|
233
|
+
* Same as EasyGem.loadModules, but only for one module.
|
234
|
+
* @param {String} moduleName
|
235
|
+
* @param {Function} callback - function with the module instance as first argument
|
145
236
|
*/
|
146
|
-
|
147
|
-
|
148
|
-
requireTry({dependencies: dependencies, body: body, context: context});
|
237
|
+
EasyGem.loadModule = function (moduleName, callback) {
|
238
|
+
this.loadModules([moduleName], callback);
|
149
239
|
};
|
150
|
-
|
240
|
+
var transform = EasyGem.module.transform;
|
241
|
+
transform("jQuery", "jQuery");
|
242
|
+
transform("jQueryUI", "jQueryUI");
|
151
243
|
|
152
|
-
EASY.modules.toModule("jQuery", function () {
|
153
|
-
return window.jQuery;
|
154
|
-
});
|
155
|
-
EASY.modules.toModule("$", function () {
|
156
|
-
return window.jQuery;
|
157
|
-
});
|
158
|
-
EASY.modules.toModule("jQueryUI", function () {
|
159
|
-
if (window.jQuery && window.jQuery.widget) {
|
160
|
-
return window.jQuery;
|
161
|
-
}
|
162
|
-
});
|
163
244
|
})();
|
@@ -86,9 +86,25 @@
|
|
86
86
|
if (prerequisiteArray.length === 0) return 0;
|
87
87
|
var count = 0;
|
88
88
|
for (var i = 0; i < prerequisiteArray.length; i++) {
|
89
|
-
|
89
|
+
var pack = prerequisiteArray[i];
|
90
|
+
if (!pack) {
|
90
91
|
count++;
|
91
|
-
|
92
|
+
continue;
|
93
|
+
}
|
94
|
+
if (pack.pre) {
|
95
|
+
var instance = preparePrerequisite(pack.pre);
|
96
|
+
if (instance) {
|
97
|
+
count++;
|
98
|
+
prerequisiteArray[i] = null;
|
99
|
+
pack.func.call(window, instance);
|
100
|
+
}
|
101
|
+
} else {
|
102
|
+
var instances = prepareMorePrerequisites(pack.pres);
|
103
|
+
if (instances) {
|
104
|
+
count++;
|
105
|
+
prerequisiteArray[i] = null;
|
106
|
+
pack.func.apply(window, instances);
|
107
|
+
}
|
92
108
|
}
|
93
109
|
}
|
94
110
|
if (count) {
|
@@ -97,28 +113,6 @@
|
|
97
113
|
}
|
98
114
|
return count;
|
99
115
|
};
|
100
|
-
var executeOnePrerequisite = function (pack) {
|
101
|
-
var getter, getters, instance, instances;
|
102
|
-
if (getter = pack.pre) {
|
103
|
-
instance = preparePrerequisite(getter);
|
104
|
-
if (instance) {
|
105
|
-
pack.func.call(window, instance);
|
106
|
-
return true;
|
107
|
-
}
|
108
|
-
return false;
|
109
|
-
} else if (getters = pack.pres) {
|
110
|
-
instances = [];
|
111
|
-
for (var j = 0; j < getters.length; j++) {
|
112
|
-
getter = getters[j];
|
113
|
-
instance = preparePrerequisite(getter);
|
114
|
-
if (!instance) break;
|
115
|
-
instances.push(instance);
|
116
|
-
}
|
117
|
-
if (instances.length !== getters.length) return false;
|
118
|
-
pack.func.apply(window, instances);
|
119
|
-
return true;
|
120
|
-
}
|
121
|
-
};
|
122
116
|
/**
|
123
117
|
* @param {(Function|string)} getter
|
124
118
|
* @return {(Object|null)}
|
@@ -140,6 +134,15 @@
|
|
140
134
|
return getter();
|
141
135
|
}
|
142
136
|
};
|
137
|
+
var prepareMorePrerequisites = function (getters) {
|
138
|
+
var instance, instances = [];
|
139
|
+
for (var j = 0; j < getters.length; j++) {
|
140
|
+
instance = preparePrerequisite(getters[j]);
|
141
|
+
if (!instance) return null;
|
142
|
+
instances.push(instance);
|
143
|
+
}
|
144
|
+
return instances;
|
145
|
+
};
|
143
146
|
|
144
147
|
var cycle = function scheduleCycle() {
|
145
148
|
setTimeout(cycle, 30);
|
@@ -148,7 +151,7 @@
|
|
148
151
|
document.addEventListener("DOMContentLoaded", cycle);
|
149
152
|
/**
|
150
153
|
*
|
151
|
-
* @type {{
|
154
|
+
* @type {{late: EasyGem.schedule.late, require: EasyGem.schedule.require, main: EasyGem.schedule.main, define: EasyGem.schedule.define}}
|
152
155
|
*/
|
153
156
|
EasyGem.schedule = {
|
154
157
|
/**
|
@@ -187,17 +190,21 @@
|
|
187
190
|
pres.push(arguments[i]);
|
188
191
|
}
|
189
192
|
}
|
190
|
-
var
|
191
|
-
if (
|
192
|
-
|
193
|
+
var instances = prepareMorePrerequisites(pres);
|
194
|
+
if (instances) {
|
195
|
+
func.apply(window, instances);
|
196
|
+
} else {
|
197
|
+
prerequisiteArray.push({func: func, pres: pres});
|
193
198
|
}
|
194
199
|
} else {
|
195
200
|
if (typeof prerequisite === "string") {
|
196
201
|
prerequisite = prerequisite.toLowerCase();
|
197
202
|
}
|
198
|
-
|
199
|
-
if (
|
200
|
-
|
203
|
+
var instance = preparePrerequisite(prerequisite);
|
204
|
+
if (instance) {
|
205
|
+
func.call(window, instance);
|
206
|
+
} else {
|
207
|
+
prerequisiteArray.push({func: func, pre: prerequisite});
|
201
208
|
}
|
202
209
|
}
|
203
210
|
},
|
@@ -223,9 +230,19 @@
|
|
223
230
|
* });
|
224
231
|
* @param {string} name
|
225
232
|
* @param {Function} getter - getter or constructor
|
233
|
+
* @param {...(SchedulePrerequisite|string)} [prerequisite] - more than one prerequisite can be specified here
|
234
|
+
* as rest parameters. Function or String are accepted. If String is used,
|
235
|
+
* predefined getter from [moduleGetters] or getter defined by [define]
|
236
|
+
* are called.
|
226
237
|
*/
|
227
|
-
define: function (name, getter) {
|
228
|
-
|
238
|
+
define: function (name, getter, prerequisite) {
|
239
|
+
if (prerequisite) {
|
240
|
+
this.require.apply(this, [function () {
|
241
|
+
moduleGetters[name.toLowerCase()] = getter;
|
242
|
+
}].concat(Array.prototype.slice.call(arguments, 2)));
|
243
|
+
} else {
|
244
|
+
moduleGetters[name.toLowerCase()] = getter;
|
245
|
+
}
|
229
246
|
}
|
230
247
|
};
|
231
248
|
EASY.schedule = EasyGem.schedule;
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<%=
|
3
3
|
if params['combine_by_pipeline'].nil?
|
4
4
|
if Rails.env.development? && ENV['DART'] == '1'
|
5
|
-
javascript_include_tag('dart/localhost', plugin: plugin)
|
5
|
+
javascript_include_tag('dart/localhost', plugin: plugin, defer: true)
|
6
6
|
else
|
7
7
|
javascript_include_tag("#{plugin}.dart", defer: true)
|
8
8
|
end
|
@@ -10,7 +10,7 @@
|
|
10
10
|
if params['combine_by_pipeline'] == 'false'
|
11
11
|
#javascript_include_tag('dart/debug', plugin: plugin, defer: true)
|
12
12
|
if ENV['DART'] == '1'
|
13
|
-
javascript_include_tag('dart/localhost', plugin: plugin)
|
13
|
+
javascript_include_tag('dart/localhost', plugin: plugin, defer: true)
|
14
14
|
end
|
15
15
|
else
|
16
16
|
javascript_include_tag("#{plugin}.dart", defer: true)
|
@@ -1,5 +1,5 @@
|
|
1
|
-
api.array :<%= model_name_pluralize_underscored %>, api_meta(total_count: @entity_count, offset: @offset, limit: @limit) do
|
2
|
-
@entities.each do |<%= model_name_underscored %>|
|
3
|
-
render_api_<%= model_name_underscored %>(api, <%= model_name_underscored %>)
|
4
|
-
end
|
5
|
-
end
|
1
|
+
api.array :<%= model_name_pluralize_underscored %>, api_meta(total_count: @entity_count, offset: @offset, limit: @limit) do
|
2
|
+
@entities.each do |<%= model_name_underscored %>|
|
3
|
+
render_api_<%= model_name_underscored %>(api, <%= model_name_underscored %>)
|
4
|
+
end
|
5
|
+
end
|
@@ -1 +1 @@
|
|
1
|
-
<h1><%%= link_to(@<%= model_name_underscored %>.to_s, @<%= model_name_underscored %>_url) %></h1>
|
1
|
+
<h1><%%= link_to(@<%= model_name_underscored %>.to_s, @<%= model_name_underscored %>_url) %></h1>
|
@@ -1,2 +1,2 @@
|
|
1
|
-
<%%= @<%= model_name_underscored %>.to_s %>
|
2
|
-
<%%= @<%= model_name_underscored %>_url %>
|
1
|
+
<%%= @<%= model_name_underscored %>.to_s %>
|
2
|
+
<%%= @<%= model_name_underscored %>_url %>
|
@@ -1,2 +1,2 @@
|
|
1
|
-
<%%= @<%= model_name_underscored %>.to_s %>
|
2
|
-
<%%= @<%= model_name_underscored %>_url %>
|
1
|
+
<%%= @<%= model_name_underscored %>.to_s %>
|
2
|
+
<%%= @<%= model_name_underscored %>_url %>
|
@@ -1,13 +1,13 @@
|
|
1
|
-
<% if project? %>
|
2
|
-
resources :projects do
|
3
|
-
resources :<%= model_name_pluralize_underscored %>
|
4
|
-
end
|
5
|
-
<% end %>
|
6
|
-
resources :<%= model_name_pluralize_underscored %> do
|
7
|
-
collection do
|
8
|
-
get 'autocomplete'
|
9
|
-
get 'bulk_edit'
|
10
|
-
post 'bulk_update'
|
11
|
-
get 'context_menu'
|
12
|
-
end
|
1
|
+
<% if project? %>
|
2
|
+
resources :projects do
|
3
|
+
resources :<%= model_name_pluralize_underscored %>
|
4
|
+
end
|
5
|
+
<% end %>
|
6
|
+
resources :<%= model_name_pluralize_underscored %> do
|
7
|
+
collection do
|
8
|
+
get 'autocomplete'
|
9
|
+
get 'bulk_edit'
|
10
|
+
post 'bulk_update'
|
11
|
+
get 'context_menu'
|
12
|
+
end
|
13
13
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redmine_extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Easy Software Ltd
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -146,13 +146,13 @@ files:
|
|
146
146
|
- Rakefile
|
147
147
|
- app/assets/javascripts/redmine_extensions/application.js
|
148
148
|
- app/assets/javascripts/redmine_extensions/blocking.js
|
149
|
+
- app/assets/javascripts/redmine_extensions/blocking_dynamic_loading.js
|
149
150
|
- app/assets/javascripts/redmine_extensions/blocking_module.js
|
150
151
|
- app/assets/javascripts/redmine_extensions/blocking_namespace.js
|
151
152
|
- app/assets/javascripts/redmine_extensions/blocking_polyfill.js
|
152
153
|
- app/assets/javascripts/redmine_extensions/blocking_render.js
|
153
154
|
- app/assets/javascripts/redmine_extensions/blocking_schedule.js
|
154
155
|
- app/assets/javascripts/redmine_extensions/blocking_utils.js
|
155
|
-
- app/assets/javascripts/redmine_extensions/dynamic_loading.js
|
156
156
|
- app/assets/javascripts/redmine_extensions/easy_togglers.js
|
157
157
|
- app/assets/javascripts/redmine_extensions/event_bus.js
|
158
158
|
- app/assets/javascripts/redmine_extensions/jquery.entityarray.js
|
@@ -304,22 +304,22 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
304
304
|
version: '0'
|
305
305
|
requirements: []
|
306
306
|
rubyforge_project:
|
307
|
-
rubygems_version: 2.6.
|
307
|
+
rubygems_version: 2.6.7
|
308
308
|
signing_key:
|
309
309
|
specification_version: 4
|
310
310
|
summary: Redmine Extensions is set of usefull features for Redmine. Main focus is
|
311
311
|
on development helpers, but many users can find it helpfull
|
312
312
|
test_files:
|
313
|
-
- spec/
|
314
|
-
- spec/features/autocomplete_spec.rb
|
315
|
-
- spec/models/easy_setting_spec.rb
|
316
|
-
- spec/presenters/redmine_extensions/easy_setting_presenter_spec.rb
|
317
|
-
- spec/support/plugin_generator.rb
|
313
|
+
- spec/factories/easy_queries.rb
|
318
314
|
- spec/factories/easy_settings.rb
|
315
|
+
- spec/factories/issues.rb
|
319
316
|
- spec/factories/projects.rb
|
320
|
-
- spec/factories/trackers.rb
|
321
317
|
- spec/factories/time_entries.rb
|
322
|
-
- spec/factories/
|
318
|
+
- spec/factories/trackers.rb
|
323
319
|
- spec/factories/users.rb
|
324
|
-
- spec/
|
320
|
+
- spec/features/autocomplete_spec.rb
|
321
|
+
- spec/models/easy_setting_spec.rb
|
322
|
+
- spec/presenters/redmine_extensions/easy_setting_presenter_spec.rb
|
325
323
|
- spec/rails_helper.rb
|
324
|
+
- spec/spec_helper.rb
|
325
|
+
- spec/support/plugin_generator.rb
|
@@ -1,54 +0,0 @@
|
|
1
|
-
EasyGem.dynamic = {
|
2
|
-
_alreadyLoaded: {},
|
3
|
-
/**
|
4
|
-
* Append Javascript <script> tag to page
|
5
|
-
* @example
|
6
|
-
* EasyGem.dynamic.jsTag("/plugin_assets/my_plugin/javascripts/counter.js");
|
7
|
-
* EasyGem.schedule.require(function(counter){
|
8
|
-
* setInterval(counter.count(), 1000);
|
9
|
-
* }, function(){
|
10
|
-
* return window.utils.counter;
|
11
|
-
* })
|
12
|
-
* @param {String} src - absolute path to requested file
|
13
|
-
*/
|
14
|
-
jsTag: function (src) {
|
15
|
-
if (this._alreadyLoaded[src]) return;
|
16
|
-
this._alreadyLoaded[src] = true;
|
17
|
-
var jsScript = document.createElement("script");
|
18
|
-
jsScript.setAttribute("src", src);
|
19
|
-
jsScript.setAttribute("defer", "true");
|
20
|
-
document.head.appendChild(jsScript);
|
21
|
-
},
|
22
|
-
/**
|
23
|
-
* Append CSS <link> tag to page
|
24
|
-
* @param {String} src - absolute path to requested file
|
25
|
-
*/
|
26
|
-
cssTag: function (src) {
|
27
|
-
if (this._alreadyLoaded[src]) return;
|
28
|
-
this._alreadyLoaded[src] = true;
|
29
|
-
var link = document.createElement('link');
|
30
|
-
link.rel = "stylesheet";
|
31
|
-
link.type = "text/css";
|
32
|
-
link.href = src;
|
33
|
-
link.media = "all";
|
34
|
-
document.head.appendChild(link);
|
35
|
-
},
|
36
|
-
/**
|
37
|
-
* Load multiple JS files into page
|
38
|
-
* @param {Array.<String>} array
|
39
|
-
*/
|
40
|
-
jsTags: function (array) {
|
41
|
-
for (var i = 0; i < array.length; i++) {
|
42
|
-
this.jsTag(array[i]);
|
43
|
-
}
|
44
|
-
},
|
45
|
-
/**
|
46
|
-
* Load multiple CSS files into page
|
47
|
-
* @param {Array.<String>} array
|
48
|
-
*/
|
49
|
-
cssTags: function (array) {
|
50
|
-
for (var i = 0; i < array.length; i++) {
|
51
|
-
this.cssTag(array[i]);
|
52
|
-
}
|
53
|
-
}
|
54
|
-
};
|