redmine_extensions 0.1.25 → 0.1.26

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5c54c79b99314f16b3c9b00441a76daa37163ccc
4
- data.tar.gz: 94549012ed16ef815d480e77effe0ba27d55223c
3
+ metadata.gz: 49202931f4c3a05d89f793c947979841d0ef5f4e
4
+ data.tar.gz: 922beb61ca9d0a864879b4fbb396cbd4e1cee1ca
5
5
  SHA512:
6
- metadata.gz: 9f560f0cef90aaf337d32aaaf9ebe4413ce3fe9b1256e46c086c7f75453c477f5a58ef41bda3de09eb975cc241b52c30207fb41cbc9c97dfe0c2d76d213d1e6a
7
- data.tar.gz: 13da939d8836988e2a2893f2c33fd8617d43caf78463e68c625079f2c43815406fff3d05f01207bc9cdc2becbf8915efddf95dbd80bef63469ddec218faa21b9
6
+ metadata.gz: 541afe7e1b26d5995b266c06fa4d75c292d37aeb80976a5dd4d66a69051f7c2938284524f6b88eeb68619f8bcd8d30d552a628b82123b6646759390fd18a5446
7
+ data.tar.gz: 21d487db7682775e685605c607d0745321487f60730e36bf9702ab7634eb04e24335802bba169f0ca9be859c4b35c50db87b816cc3239d2243a5d6cc8bc492ac
@@ -36,16 +36,20 @@ module RedmineExtensions
36
36
  end
37
37
  end
38
38
 
39
- def self.filter_registered_for(query)
40
- whitelist = registered_whitelists[query.type]
39
+ def self.filter_registered_for(query, whitelist = [])
40
+ whitelist += (registered_whitelists[query.type] || [])
41
41
  res = registered_outputs
42
- res = res.slice(*whitelist.map(&:to_sym)) if whitelist
43
- res = res.select do |name, output|
42
+ res = res.slice(*whitelist.map(&:to_sym)) if whitelist.any?
43
+ res = res.select do |_name, output|
44
44
  output.available_for?(query)
45
45
  end
46
46
  res.merge(registered_per_query[query.type] || {})
47
47
  end
48
48
 
49
+ def self.output_available?(query, output)
50
+ self.filter_registered_for(query, [output]).any?
51
+ end
52
+
49
53
  def self.available_outputs_for(query)
50
54
  filter_registered_for(query).keys
51
55
  end
@@ -1,3 +1,3 @@
1
1
  module RedmineExtensions
2
- VERSION = '0.1.25'
2
+ VERSION = '0.1.26'
3
3
  end
@@ -11,7 +11,6 @@ RSpec.describe 'autocomplete', type: :feature, js: true do
11
11
 
12
12
  it 'generate autocomplete_field in form_for' do
13
13
  visit '/dummy_autocompletes'
14
- binding.pry
15
14
  expect(page).to have_css('input#dummy_entities_autocomplete[type="text"]')
16
15
  expect(page).to have_css('input[type="hidden"][name="dummy_entity[array_of_dummies][]"][value="value1"]', visible: false)
17
16
  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.1.25
4
+ version: 0.1.26
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: 2017-05-12 00:00:00.000000000 Z
11
+ date: 2017-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails