redmine_extensions 0.3.11 → 0.4.0.beta
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 +3 -34
- data/app/helpers/redmine_extensions/application_helper.rb +5 -7
- data/app/models/easy_setting.rb +1 -1
- data/app/presenters/redmine_extensions/easy_setting_presenter.rb +1 -1
- data/lib/generators/redmine_extensions/entity/entity_generator.rb +2 -2
- data/lib/redmine_extensions/easy_query_helpers/outputs.rb +2 -2
- data/lib/redmine_extensions/easy_settings/mapper.rb +1 -1
- data/lib/redmine_extensions/engine.rb +1 -1
- data/lib/redmine_extensions/migration.rb +1 -1
- data/lib/redmine_extensions/patch_manager.rb +5 -13
- data/lib/redmine_extensions/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 186ecf1e1604893d9fda643e2b589dbada90b4319c0da5d7a5c2c0f3c53eb176
|
4
|
+
data.tar.gz: f956c9668a5926ba5012902dfb2a1c88d2dd020f7ea06428310e3ef3963e9cff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac84a447270e5d19538c99c5fc6d4dcd95ac936de8645c179ebd497d27d09ff65f2def4d24ee5f1b80aa9ac4d78289feca73edfe1242ac94d4a136e03dd50804
|
7
|
+
data.tar.gz: ca999dfd768ba7df0f23f45f5508136eeebd4b09fdef1a92383ec26d0c4d6e3d950252b420913e804eafde49498b00e55122773f490dfce1bb4b53a6de8ea7a4
|
@@ -88,7 +88,6 @@ EasyGem.schedule.require(function () {
|
|
88
88
|
},
|
89
89
|
activate_on_input_click: true,
|
90
90
|
load_immediately: false,
|
91
|
-
show_toggle_button: true,
|
92
91
|
select_first_value: true,
|
93
92
|
autocomplete_options: {},
|
94
93
|
multiselectOnChange: null // onchange of multiselect input function
|
@@ -103,7 +102,7 @@ EasyGem.schedule.require(function () {
|
|
103
102
|
if (Array.isArray(this.options.source)) {
|
104
103
|
this.options.preload = true;
|
105
104
|
this._initData(this.options.source);
|
106
|
-
} else if (this.options.preload && this.options.load_immediately)
|
105
|
+
} else if ( (this.options.preload || this.options.select_first_value) && this.options.load_immediately ) {
|
107
106
|
this.load();
|
108
107
|
} else if (this.selectedValues) {
|
109
108
|
this.setValue(this.selectedValues);
|
@@ -120,9 +119,6 @@ EasyGem.schedule.require(function () {
|
|
120
119
|
this.valueElement = $('<span></span>');
|
121
120
|
this.tag.after(this.valueElement);
|
122
121
|
|
123
|
-
if (this.options.show_toggle_button)
|
124
|
-
this._createToggleButton();
|
125
|
-
|
126
122
|
this.valueElement.entityArray({
|
127
123
|
inputNames: this.inputName,
|
128
124
|
afterRemove: function (entity) {
|
@@ -146,33 +142,6 @@ EasyGem.schedule.require(function () {
|
|
146
142
|
if (fn) select.on("change", fn);
|
147
143
|
},
|
148
144
|
|
149
|
-
_createToggleButton: function () {
|
150
|
-
var that = this;
|
151
|
-
this.link_ac_toggle = $('<a>').attr('class', 'icon icon-add clear-link');
|
152
|
-
this.link_ac_toggle.click(function (evt) {
|
153
|
-
var $elem = $(this);
|
154
|
-
evt.preventDefault();
|
155
|
-
that.load(function () {
|
156
|
-
var select = $('<select>').prop('multiple', true).prop('size', 5).prop('name', that.inputName);
|
157
|
-
var option;
|
158
|
-
$.each(that.possibleValues, function (i, v) {
|
159
|
-
option = $('<option>').prop('value', v.id).text(v.value);
|
160
|
-
option.prop('selected', that.getValue().indexOf(v.id) > -1);
|
161
|
-
select.append(option);
|
162
|
-
});
|
163
|
-
that.multiselectOnChange(select, that.options.multiselectOnChange);
|
164
|
-
var $container = $elem.closest('.easy-multiselect-tag-container');
|
165
|
-
$container.find(':input').prop('disabled', true);
|
166
|
-
$container.children().hide();
|
167
|
-
$container.append(select);
|
168
|
-
that.valueElement = select;
|
169
|
-
that.expanded = true;
|
170
|
-
});
|
171
|
-
});
|
172
|
-
this.element.parent().addClass('input-append');
|
173
|
-
this.element.after(this.link_ac_toggle);
|
174
|
-
},
|
175
|
-
|
176
145
|
_createAutocomplete: function () {
|
177
146
|
var that = this;
|
178
147
|
|
@@ -286,7 +255,7 @@ EasyGem.schedule.require(function () {
|
|
286
255
|
this.valuesLoaded = true;
|
287
256
|
|
288
257
|
this.selectedValues = this.selectedValues ? this.selectedValues : [];
|
289
|
-
if (this.selectedValues.length === 0 && this.options.
|
258
|
+
if (this.selectedValues.length === 0 && this.options.select_first_value && this.possibleValues.length > 0) {
|
290
259
|
this.selectedValues.push(this.possibleValues[0]['id']);
|
291
260
|
}
|
292
261
|
|
@@ -381,7 +350,7 @@ EasyGem.schedule.require(function () {
|
|
381
350
|
for (var i = values.length - 1; i >= 0; i--) {
|
382
351
|
if (values[i] instanceof Object && !Array.isArray(values[i]) && values[i] !== null) {
|
383
352
|
selected.push(values[i]);
|
384
|
-
} else if (this.options.preload) {
|
353
|
+
} else if (this.options.preload || this.options.select_first_value) {
|
385
354
|
var that = this;
|
386
355
|
if (!Array.isArray(that.possibleValues))
|
387
356
|
return;
|
@@ -20,7 +20,7 @@ module RedmineExtensions
|
|
20
20
|
else
|
21
21
|
presenter = RedmineExtensions::BasePresenter.present(model, self, options)
|
22
22
|
end
|
23
|
-
if
|
23
|
+
if block
|
24
24
|
yield presenter
|
25
25
|
else
|
26
26
|
presenter
|
@@ -110,7 +110,7 @@ module RedmineExtensions
|
|
110
110
|
|
111
111
|
def late_javascript_tag(content_or_options_with_block = nil, html_options = {}, &block)
|
112
112
|
content =
|
113
|
-
if
|
113
|
+
if block
|
114
114
|
html_options = content_or_options_with_block if content_or_options_with_block.is_a?(Hash)
|
115
115
|
capture(&block)
|
116
116
|
else
|
@@ -264,7 +264,6 @@ module RedmineExtensions
|
|
264
264
|
# * +load_immediately+ - tells if values should be loaded immediatelly after page loaded, or wait for first use of the field.
|
265
265
|
# Warning! if this option is false, selected values passed in first format will be ignored till it is loaded.
|
266
266
|
# Please use second format for proper functionality.
|
267
|
-
# * +show_toggle_button+ - only valid with <tt>multiple: true, preload: true</tt> options set. Shows toggle button to expand select to the multiselect tag.
|
268
267
|
# * +select_first_value+ - if selectd_values are empty, with this option first available value will be selected.
|
269
268
|
# Available only with <tt>preload: true</tt> option.
|
270
269
|
# With <tt>load_immediately: false</tt> it will appear kinda weird for user because it will select the value after user starts to interact with input.
|
@@ -272,7 +271,7 @@ module RedmineExtensions
|
|
272
271
|
# * +rootElement+ - Has sence only if jsonpath is used for available values. It tells if the json response has values wrapped under root element.
|
273
272
|
# For response like <tt>{projects: [[<name>, <id>], [<name2>, <id2>]]}</tt> user option <tt>rootElement: 'projects'</tt>
|
274
273
|
def autocomplete_field_tag(name, jsonpath_or_array, selected_values, options = {})
|
275
|
-
options.reverse_merge!({select_first_value: false,
|
274
|
+
options.reverse_merge!({select_first_value: false, load_immediately: false, preload: true, multiple: true, combo: false})
|
276
275
|
options[:id] ||= sanitize_to_id(name)
|
277
276
|
|
278
277
|
selected_values ||= []
|
@@ -285,7 +284,7 @@ module RedmineExtensions
|
|
285
284
|
|
286
285
|
content_tag(:span, :class => 'easy-multiselect-tag-container') do
|
287
286
|
search_field_tag('', '', (options[:html_options] || {}).merge(id: options[:id])) +
|
288
|
-
late_javascript_tag("$('##{options[:id]}').easymultiselect({multiple: #{options[:multiple]}, rootElement: #{options[:rootElement].to_json}, inputName: '#{name}', preload: #{options[:preload]}, combo: #{options[:combo]}, source: #{source}, selected: #{selected_values.to_json},
|
287
|
+
late_javascript_tag("$('##{options[:id]}').easymultiselect({multiple: #{options[:multiple]}, rootElement: #{options[:rootElement].to_json}, inputName: '#{name}', preload: #{options[:preload]}, combo: #{options[:combo]}, source: #{source}, selected: #{selected_values.to_json}, select_first_value: #{options[:select_first_value]}, load_immediately: #{options[:load_immediately]}, autocomplete_options: #{(options[:jquery_auto_complete_options]||{}).to_json} });")
|
289
288
|
end
|
290
289
|
end
|
291
290
|
|
@@ -297,13 +296,12 @@ module RedmineExtensions
|
|
297
296
|
# HTML options can be passed as a hash with +html_options+. These options will be passed to the input element.
|
298
297
|
#
|
299
298
|
# ==== Examples
|
300
|
-
# autocomplete_field(:issue, :tag_ids, Tag.all.pluck(:name, :id), multiple: true
|
299
|
+
# autocomplete_field(:issue, :tag_ids, Tag.all.pluck(:name, :id), multiple: true)
|
301
300
|
# # => <span class="easy-multiselect-tag-container"> \
|
302
301
|
# <input type="text" id="issue_tags" /> \
|
303
302
|
# <button type="button" tabindex="-1" class="..." role="button" ...>
|
304
303
|
# <span class="ui-button-icon-primary ui-icon ui-icon-triangle-1-s"></span><span class="ui-button-text"> </span>
|
305
304
|
# </button>
|
306
|
-
# <a class="icon icon-add clear-link"></a> # toggle button to the multiselect tag from show_toggle_button option
|
307
305
|
# ...(wraping service tags)
|
308
306
|
# <input type="hidden" name="issue[tag_ids][]" value="#{@issue.tag_ids.first}" />
|
309
307
|
# <input type="hidden" name="issue[tag_ids][]" value="#{@issue.tag_ids.second}" />
|
data/app/models/easy_setting.rb
CHANGED
@@ -119,7 +119,7 @@ module RedmineExtensions
|
|
119
119
|
end
|
120
120
|
|
121
121
|
def method_missing(meth, *attrs)
|
122
|
-
if @plugin && @plugin.settings[:easy_settings] && @plugin.settings[:easy_settings].
|
122
|
+
if @plugin && @plugin.settings[:easy_settings] && @plugin.settings[:easy_settings].key?(meth.to_sym)
|
123
123
|
EasySetting.value(prefix+meth.to_s, project_id)
|
124
124
|
else
|
125
125
|
super
|
@@ -385,7 +385,7 @@ module RedmineExtensions
|
|
385
385
|
end
|
386
386
|
|
387
387
|
def name_column
|
388
|
-
'name' if string_columns.
|
388
|
+
'name' if string_columns.key?('name')
|
389
389
|
string_columns.keys.first
|
390
390
|
end
|
391
391
|
|
@@ -394,7 +394,7 @@ module RedmineExtensions
|
|
394
394
|
end
|
395
395
|
|
396
396
|
def description_column
|
397
|
-
'description' if text_columns.
|
397
|
+
'description' if text_columns.key?('description')
|
398
398
|
text_columns.keys.first
|
399
399
|
end
|
400
400
|
|
@@ -69,12 +69,12 @@ module RedmineExtensions
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def render_edit
|
72
|
-
outputs.map{ |output| output.render_edit }.join
|
72
|
+
outputs.map{ |output| output.render_edit }.join.html_safe
|
73
73
|
end
|
74
74
|
|
75
75
|
def render_data
|
76
76
|
if outputs.any?
|
77
|
-
outputs.map{ |output| output.render_data }.join
|
77
|
+
outputs.map{ |output| output.render_data }.join.html_safe
|
78
78
|
else
|
79
79
|
view_context.l(:label_no_output)
|
80
80
|
end
|
@@ -63,7 +63,7 @@ module RedmineExtensions
|
|
63
63
|
|
64
64
|
# include helpers
|
65
65
|
initializer 'redmine_extensions.rails_patching', before: :load_config_initializers do |app|
|
66
|
-
ActiveSupport.on_load(Rails
|
66
|
+
ActiveSupport.on_load(Rails::VERSION::MAJOR >= 5 ? :action_controller_base : :action_controller) do
|
67
67
|
helper RedmineExtensions::ApplicationHelper
|
68
68
|
# helper RedmineExtensions::EasyQueryHelper
|
69
69
|
end
|
@@ -57,7 +57,7 @@ module RedmineExtensions
|
|
57
57
|
@@patches_locations[patching_module] = const.methods(false).map{|m| const.method(m) }.first.source_location.first
|
58
58
|
rescue
|
59
59
|
# [0] is register_*_patch
|
60
|
-
from_location = caller_locations
|
60
|
+
from_location = caller_locations(2..2).first
|
61
61
|
@@patches_locations[patching_module] = from_location.absolute_path
|
62
62
|
end
|
63
63
|
|
@@ -78,7 +78,7 @@ module RedmineExtensions
|
|
78
78
|
end
|
79
79
|
section ||= :others
|
80
80
|
|
81
|
-
raise ArgumentError, "EasyPatchManager->register_patch: The section (#{section}) must be one of x#{@@registered_patches.keys.join(', ')}x " unless @@registered_patches.
|
81
|
+
raise ArgumentError, "EasyPatchManager->register_patch: The section (#{section}) must be one of x#{@@registered_patches.keys.join(', ')}x " unless @@registered_patches.key?(section)
|
82
82
|
|
83
83
|
original_klasses_to_patch.each do |original_klass_to_patch|
|
84
84
|
pcollection = @@registered_patches[section].move_and_get_or_insert( original_klass_to_patch, options )
|
@@ -191,17 +191,13 @@ module RedmineExtensions
|
|
191
191
|
# raise ArgumentError, 'Section order has to be a integer!' unless order.is_a?(Numeric)
|
192
192
|
# @name = name
|
193
193
|
# @order = order
|
194
|
-
@patches_collections =
|
194
|
+
@patches_collections = []
|
195
195
|
@last_order = 0
|
196
196
|
end
|
197
197
|
|
198
198
|
def each(&block)
|
199
199
|
@patches_collections.each do |patch_collection|
|
200
|
-
|
201
|
-
block.call patch_collection
|
202
|
-
else
|
203
|
-
yield patch_collection
|
204
|
-
end
|
200
|
+
yield patch_collection
|
205
201
|
end
|
206
202
|
end
|
207
203
|
|
@@ -335,11 +331,7 @@ module RedmineExtensions
|
|
335
331
|
def each(&block)
|
336
332
|
|
337
333
|
@patches.each do |patch|
|
338
|
-
|
339
|
-
block.call patch
|
340
|
-
else
|
341
|
-
yield patch
|
342
|
-
end
|
334
|
+
yield patch
|
343
335
|
end
|
344
336
|
|
345
337
|
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.
|
4
|
+
version: 0.4.0.beta
|
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:
|
11
|
+
date: 2021-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '4.2'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '6.
|
22
|
+
version: '6.2'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '4.2'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '6.
|
32
|
+
version: '6.2'
|
33
33
|
description: Redmine Extensions provide many extended functionalities for Redmine
|
34
34
|
project.
|
35
35
|
email:
|
@@ -204,14 +204,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
204
204
|
requirements:
|
205
205
|
- - ">="
|
206
206
|
- !ruby/object:Gem::Version
|
207
|
-
version: '2.
|
207
|
+
version: '2.5'
|
208
208
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
209
209
|
requirements:
|
210
|
-
- - "
|
210
|
+
- - ">"
|
211
211
|
- !ruby/object:Gem::Version
|
212
|
-
version:
|
212
|
+
version: 1.3.1
|
213
213
|
requirements: []
|
214
|
-
rubygems_version: 3.0.
|
214
|
+
rubygems_version: 3.0.8
|
215
215
|
signing_key:
|
216
216
|
specification_version: 4
|
217
217
|
summary: Redmine Extensions is set of usefull features for Redmine. Main focus is
|