ecm_tags 0.0.4 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 612660c2d7bb74717c925a22c54b0571af3f0cbd
4
- data.tar.gz: cf8e322c4d8d842b10b2bcd9b1464dac45c63cc0
3
+ metadata.gz: 48c7c394a3a5e2df86cc629b57e93534e82ab34d
4
+ data.tar.gz: 3bb976c8cc6d988a21caf96e4af0ab1629a40f30
5
5
  SHA512:
6
- metadata.gz: 988e30a98613678549a3f34ac0a4754ee3d72e47adbbaa99b9c98953172bec542b0beb2f30de4d2ccdba030cbfb23854a4afb3c34f07f417fa1a382707a27c72
7
- data.tar.gz: 2c839998d6d101283d29b004fc7e90a89ea83d8b814951b4c8e633c42be0a6e63137817a2fa519a27684d1f02413fcf33476dbb74594a059c8156286dd1e455f
6
+ metadata.gz: c4b9abfebe2c615b16944a3c5f7d3a4fb5ed364e0fd007feccccf2f8bc71a74833ef0bfdcc0dafacb68c92244d27bbf5c4338807bbe80b1eb32c63f364377f39
7
+ data.tar.gz: 72304783882c072c0fc5017621c674d209a65f3e5b8114e69edc377809e04808dec313ec1c1c8443db1169c9efc34bcf56f72f51a729f8672a6004c18ba5fd70
@@ -28,7 +28,7 @@ module Ecm
28
28
  end
29
29
 
30
30
  def permitted_params
31
- params.require(:tag_search).permit(:tag_list, :fuzzy)
31
+ params.require(:tag_search).permit(:tag_list, :exact)
32
32
  end
33
33
  end
34
34
  end
@@ -2,12 +2,18 @@ module Ecm::Tags
2
2
  class TagSearch
3
3
  include ActiveModel::Model
4
4
 
5
- attr_accessor :tag_list, :result, :taggable_classes, :fuzzy
5
+ attr_accessor :tag_list, :result, :taggable_classes, :exact
6
+
7
+ validates :tag_list, presence: true
6
8
 
7
9
  def self.call(*args)
8
10
  new(*args).do_work
9
11
  end
10
12
 
13
+ def self.i18n_scope
14
+ :activerecord
15
+ end
16
+
11
17
  def do_work
12
18
  say "#{self.class.name} running..."
13
19
  output = result
@@ -36,12 +42,12 @@ module Ecm::Tags
36
42
  @taggable_classes ||= Ecm::Tags::Tagging.uniq.pluck(:taggable_type)
37
43
  end
38
44
 
39
- def fuzzy
40
- @fuzzy ||= false
45
+ def exact
46
+ @exact ||= Ecm::Tags::Configuration.tag_search_exact_default_value
41
47
  end
42
48
 
43
- def fuzzy=(value)
44
- @fuzzy = ActiveRecord::Type::Boolean.new.type_cast_from_database(value)
49
+ def exact=(value)
50
+ @exact = ActiveRecord::Type::Boolean.new.type_cast_from_database(value)
45
51
  end
46
52
 
47
53
  private
@@ -54,11 +60,11 @@ module Ecm::Tags
54
60
  end
55
61
 
56
62
  def wild
57
- @wild ||= fuzzy
63
+ @wild ||= !exact
58
64
  end
59
65
 
60
66
  def any
61
- @any ||= fuzzy
67
+ @any ||= !exact
62
68
  end
63
69
 
64
70
  def search
@@ -1,6 +1,6 @@
1
1
  = simple_form_for(@tag_search, url: ecm_tags.tag_searchs_path) do |f|
2
2
  = f.input :tag_list
3
- = f.input :fuzzy, as: :boolean
3
+ = f.input :exact, as: :boolean
4
4
  = f.button :submit, class: 'btn btn-primary'
5
5
 
6
6
  #tag_search_result
@@ -12,6 +12,9 @@ de:
12
12
  tagger: Ersteller
13
13
  created_at: Erstellt am
14
14
  udpated_at: Aktualisiert am
15
+ ecm/tags/tag_search:
16
+ exact: Wortgenau
17
+ tag_list: Tags
15
18
  model:
16
19
  ecm/tags/tag:
17
20
  one: Tag
@@ -10,6 +10,7 @@ module Ecm
10
10
  end
11
11
  mattr_accessor(:base_controller) { 'FrontendController' }
12
12
  mattr_accessor(:add_submit_button_to_search_box) { true }
13
+ mattr_accessor(:tag_search_exact_default_value) { false }
13
14
  end
14
15
  end
15
16
  end
@@ -1,5 +1,5 @@
1
1
  module Ecm
2
2
  module Tags
3
- VERSION = '0.0.4'.freeze
3
+ VERSION = '1.0.0'.freeze
4
4
  end
5
5
  end
@@ -10,4 +10,10 @@ Ecm::Tags.configure do |config|
10
10
  # Default: config.add_submit_button_to_search_box = true
11
11
  #
12
12
  config.add_submit_button_to_search_box = true
13
+
14
+ # Use exact search by default or not.
15
+ #
16
+ # Default: config.tag_search_exact_default_value = false
17
+ #
18
+ config.tag_search_exact_default_value = false
13
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecm_tags
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Vasquez Angel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-07 00:00:00.000000000 Z
11
+ date: 2016-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails