redmine_extensions 0.0.34 → 0.0.36
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/redmine_extensions.js +46 -20
- data/{spec/redmine/public/javascripts/redmine_extensions/redmine_extensions.js → app/assets/javascripts/redmine_extensions/redmine_extensions.js.orig} +48 -15
- data/app/helpers/redmine_extensions/application_helper.rb +2 -2
- data/app/helpers/redmine_extensions/application_helper.rb.orig +66 -109
- data/lib/redmine_extensions/version.rb +1 -1
- data/spec/redmine/{db/test.sqlite3 → tmp/pdf/empty} +0 -0
- data/spec/redmine/tmp/test/empty +0 -0
- data/spec/redmine/tmp/thumbnails/empty +0 -0
- metadata +9 -52
- data/app/views/easy_entity_assignments/_assignments_container.html.erb.orig +0 -45
- data/app/views/easy_queries/_entities.html.erb.orig +0 -67
- data/lib/redmine_extensions/easy_query_adapter.rb.orig +0 -185
- data/lib/redmine_extensions/version.rb.orig +0 -7
- data/spec/redmine/Gemfile.lock +0 -191
- data/spec/redmine/config/secrets.yml +0 -3
- data/spec/redmine/db/development.sqlite3 +0 -0
- data/spec/redmine/db/schema.rb +0 -678
- data/spec/redmine/log/development.log +0 -22900
- data/spec/redmine/log/test.scm.stderr.log +0 -11
- data/spec/redmine/plugins/easy_test_plugin/Gemfile +0 -1
- data/spec/redmine/plugins/easy_test_plugin/app/controllers/easy_issue_tests_controller.rb +0 -9
- data/spec/redmine/plugins/easy_test_plugin/app/models/easy_testing_query.rb +0 -90
- data/spec/redmine/plugins/easy_test_plugin/app/views/easy_issue_tests/index.html.erb +0 -2
- data/spec/redmine/plugins/easy_test_plugin/config/locales/en.yml +0 -2
- data/spec/redmine/plugins/easy_test_plugin/config/routes.rb +0 -2
- data/spec/redmine/plugins/easy_test_plugin/init.rb +0 -34
- data/spec/redmine/plugins/easy_test_plugin/lib/easy_test_plugin/hooks.rb +0 -5
- data/spec/redmine/plugins/easy_test_plugin/lib/easy_test_plugin/internals.rb +0 -4
- data/spec/redmine/plugins/easy_test_plugin/lib/easy_test_plugin/redmine_patch/controllers/issues_controller_patch.example +0 -30
- data/spec/redmine/plugins/easy_test_plugin/lib/easy_test_plugin/redmine_patch/helpers/issues_helper_patch.example +0 -30
- data/spec/redmine/plugins/easy_test_plugin/lib/easy_test_plugin/redmine_patch/models/issue_patch.example +0 -30
- data/spec/redmine/public/javascripts/redmine_extensions/application.js +0 -13
- data/spec/redmine/public/javascripts/redmine_extensions/jquery.easy_query.js +0 -235
- data/spec/redmine/public/javascripts/redmine_extensions/jquery.entityarray.js +0 -130
@@ -1,130 +0,0 @@
|
|
1
|
-
;(function ($, window, document, undefined) {
|
2
|
-
"use strict";
|
3
|
-
|
4
|
-
var pluginName = "entityArray",
|
5
|
-
defaults = {
|
6
|
-
propertyName: "value"
|
7
|
-
};
|
8
|
-
|
9
|
-
function Plugin (element, options) {
|
10
|
-
this.element = element;
|
11
|
-
this.options = $.extend({}, defaults, options);
|
12
|
-
this._defaults = defaults;
|
13
|
-
this._name = pluginName;
|
14
|
-
this.init();
|
15
|
-
}
|
16
|
-
|
17
|
-
Plugin.prototype = {
|
18
|
-
|
19
|
-
init: function () {
|
20
|
-
var self = this;
|
21
|
-
this.entities = {};
|
22
|
-
this.element.addClass("entity-array");
|
23
|
-
this.createEmptyInput();
|
24
|
-
|
25
|
-
if (this.options.entities) {
|
26
|
-
$.each(this.options.entities, function () {
|
27
|
-
self.add(this);
|
28
|
-
});
|
29
|
-
}
|
30
|
-
},
|
31
|
-
|
32
|
-
add: function (entity) {
|
33
|
-
var self = this;
|
34
|
-
|
35
|
-
this.normalizeEntityData(entity);
|
36
|
-
if (!entity.id || entity === "" || this.entities[entity.id]) {
|
37
|
-
return null;
|
38
|
-
}
|
39
|
-
|
40
|
-
entity.element = $("<span/>")
|
41
|
-
.html(entity.name)
|
42
|
-
.addClass(entity.className || this.options.className)
|
43
|
-
.appendTo(this.element)
|
44
|
-
.after(" ");
|
45
|
-
|
46
|
-
$("<input/>")
|
47
|
-
.attr("type", "hidden")
|
48
|
-
.attr("name", this.options.inputNames)
|
49
|
-
.val(entity.id)
|
50
|
-
.appendTo(entity.element);
|
51
|
-
|
52
|
-
$("<span/>")
|
53
|
-
.html(' ')
|
54
|
-
.addClass("icon icon-del")
|
55
|
-
.appendTo(entity.element)
|
56
|
-
.data("entity-id", entity.id)
|
57
|
-
.click(function () {
|
58
|
-
self.removeEntity($(this).data("entity-id"));
|
59
|
-
});
|
60
|
-
|
61
|
-
this.entities[entity.id] = entity;
|
62
|
-
|
63
|
-
this.removeEmptyInput();
|
64
|
-
|
65
|
-
return entity;
|
66
|
-
},
|
67
|
-
|
68
|
-
removeEntity: function (entityId) {
|
69
|
-
var entity = this.entities[entityId];
|
70
|
-
entity.element.remove();
|
71
|
-
|
72
|
-
delete this.entities[entityId];
|
73
|
-
|
74
|
-
if (Object.keys(this.entities).length === 0) {
|
75
|
-
this.createEmptyInput();
|
76
|
-
}
|
77
|
-
|
78
|
-
if (typeof this.options.afterRemove === "function") {
|
79
|
-
this.options.afterRemove(entity);
|
80
|
-
}
|
81
|
-
},
|
82
|
-
|
83
|
-
clear: function () {
|
84
|
-
for( var id in this.entities ) {
|
85
|
-
this.removeEntity(id);
|
86
|
-
}
|
87
|
-
},
|
88
|
-
|
89
|
-
getValue: function() {
|
90
|
-
return Object.keys(this.entities);
|
91
|
-
},
|
92
|
-
|
93
|
-
normalizeEntityData: function (entityData) {
|
94
|
-
entityData.id = entityData.id.toString();
|
95
|
-
entityData.name = entityData.name.toString();
|
96
|
-
},
|
97
|
-
|
98
|
-
createEmptyInput: function () {
|
99
|
-
this.emptyInput = $("<input/>")
|
100
|
-
.attr("type", "hidden")
|
101
|
-
.attr("name", this.options.inputNames)
|
102
|
-
.appendTo(this.element);
|
103
|
-
},
|
104
|
-
|
105
|
-
removeEmptyInput: function () {
|
106
|
-
if (this.emptyInput) {
|
107
|
-
this.emptyInput.remove();
|
108
|
-
this.emptyInput = null;
|
109
|
-
}
|
110
|
-
}
|
111
|
-
|
112
|
-
};
|
113
|
-
|
114
|
-
$.fn[pluginName] = function (options, methodAttrs) {
|
115
|
-
var value = null;
|
116
|
-
this.each(function () {
|
117
|
-
var instance = $.data(this, "plugin_" + pluginName);
|
118
|
-
if (!instance) {
|
119
|
-
$.data(this, "plugin_" + pluginName, new Plugin($(this), options));
|
120
|
-
} else {
|
121
|
-
value = instance[options].call(instance, methodAttrs);
|
122
|
-
}
|
123
|
-
});
|
124
|
-
if( value !== null )
|
125
|
-
return value;
|
126
|
-
else
|
127
|
-
return this;
|
128
|
-
};
|
129
|
-
|
130
|
-
})(jQuery, window, document);
|