will_filter 3.1.11 → 5.1.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 +7 -0
- data/.gitignore +1 -0
- data/Gemfile +8 -3
- data/Gemfile.lock +182 -127
- data/README.rdoc +1 -10
- data/app/assets/images/will_filter/loading.gif +0 -0
- data/app/assets/javascripts/will_filter/filter.js +526 -517
- data/app/assets/stylesheets/will_filter/filter.css.scss +405 -108
- data/app/controllers/will_filter/calendar_controller.rb +10 -1
- data/app/controllers/will_filter/exporter_controller.rb +12 -3
- data/app/controllers/will_filter/filter_controller.rb +19 -10
- data/app/models/will_filter/filter.rb +254 -203
- data/app/views/will_filter/calendar/index.html.erb +55 -43
- data/app/views/will_filter/common/_actions_bar.html.erb +3 -3
- data/app/views/will_filter/common/_results_table.html.erb +55 -39
- data/app/views/will_filter/common/_scripts.html.erb +2 -12
- data/app/views/will_filter/exporter/index.html.erb +26 -22
- data/app/views/will_filter/filter/_condition.html.erb +25 -9
- data/app/views/will_filter/filter/_conditions.html.erb +12 -9
- data/app/views/will_filter/filter/_conditions_footer.html.erb +25 -10
- data/app/views/will_filter/filter/_conditions_header.html.erb +38 -24
- data/app/views/will_filter/filter/_container.html.erb +10 -9
- data/app/views/will_filter/filter/containers/_date.html.erb +8 -10
- data/app/views/will_filter/filter/containers/_date_range.html.erb +21 -13
- data/app/views/will_filter/filter/containers/_date_time.html.erb +8 -10
- data/app/views/will_filter/filter/containers/_date_time_range.html.erb +21 -13
- data/app/views/will_filter/filter/containers/_list.html.erb +16 -6
- data/config/routes.rb +26 -16
- data/deploy +63 -0
- data/lib/generators/will_filter/templates/config.yml +18 -5
- data/lib/generators/will_filter/templates/create_will_filter_filters.rb +12 -1
- data/lib/generators/will_filter/will_filter_generator.rb +10 -1
- data/lib/tasks/will_filter_tasks.rake +10 -2
- data/lib/will_filter.rb +10 -1
- data/lib/will_filter/calendar.rb +10 -1
- data/lib/will_filter/config.rb +31 -4
- data/lib/will_filter/containers/boolean.rb +10 -1
- data/lib/will_filter/containers/date.rb +10 -1
- data/lib/will_filter/containers/date_range.rb +10 -1
- data/lib/will_filter/containers/date_time.rb +10 -1
- data/lib/will_filter/containers/date_time_range.rb +10 -1
- data/lib/will_filter/containers/double.rb +10 -1
- data/lib/will_filter/containers/double_delimited.rb +10 -1
- data/lib/will_filter/containers/double_range.rb +10 -1
- data/lib/will_filter/containers/filter_list.rb +21 -7
- data/lib/will_filter/containers/list.rb +10 -1
- data/lib/will_filter/containers/nil.rb +10 -1
- data/lib/will_filter/containers/numeric.rb +10 -1
- data/lib/will_filter/containers/numeric_delimited.rb +10 -1
- data/lib/will_filter/containers/numeric_range.rb +10 -1
- data/lib/will_filter/containers/single_date.rb +12 -1
- data/lib/will_filter/containers/text.rb +10 -1
- data/lib/will_filter/containers/text_delimited.rb +11 -2
- data/lib/will_filter/engine.rb +10 -1
- data/lib/will_filter/extensions/action_controller_extension.rb +34 -10
- data/lib/will_filter/extensions/action_view_extension.rb +12 -3
- data/lib/will_filter/extensions/active_record_extension.rb +11 -1
- data/lib/will_filter/extensions/active_record_relation_extension.rb +51 -0
- data/lib/will_filter/extensions/array_extension.rb +10 -1
- data/lib/will_filter/filter_condition.rb +11 -7
- data/lib/will_filter/filter_container.rb +10 -1
- data/lib/will_filter/filter_exception.rb +10 -1
- data/lib/will_filter/railtie.rb +14 -4
- data/lib/will_filter/version.rb +11 -2
- data/spec/config/config_spec.rb +5 -5
- data/spec/models/will_filter/filter_spec.rb +130 -131
- data/test/dummy/app/assets/javascripts/application.js +3 -0
- data/test/dummy/app/assets/javascripts/bootstrap.js +1951 -0
- data/test/dummy/app/assets/javascripts/jquery-2.1.3.min.js +4 -0
- data/test/dummy/app/assets/javascripts/select2.min.js +3 -0
- data/test/dummy/app/assets/stylesheets/{application.css → application.css.sass} +5 -2
- data/test/dummy/app/assets/stylesheets/bootstrap.min.css +7 -0
- data/test/dummy/app/assets/stylesheets/select2.min.css +1 -0
- data/test/dummy/app/controllers/advanced_controller.rb +4 -4
- data/test/dummy/app/controllers/orders_controller.rb +2 -2
- data/test/dummy/app/controllers/simple_controller.rb +3 -3
- data/test/dummy/app/models/event.rb +1 -1
- data/test/dummy/app/models/user.rb +1 -1
- data/test/dummy/app/views/common/_events.html.erb +7 -13
- data/test/dummy/app/views/common/_menu.html.erb +25 -27
- data/test/dummy/app/views/layouts/application.html.erb +3 -5
- data/test/dummy/config/environments/development.rb +2 -0
- data/test/dummy/config/environments/production.rb +2 -0
- data/test/dummy/config/environments/test.rb +2 -0
- data/test/dummy/config/initializers/assets.rb +12 -0
- data/test/dummy/config/routes.rb +10 -10
- data/test/dummy/db/schema.rb +46 -50
- data/will_filter.gemspec +3 -3
- metadata +39 -44
- data/.rvmrc +0 -1
- data/app/assets/javascripts/will_filter/filter_prototype_effects.js +0 -38
- data/app/assets/stylesheets/will_filter/actions.css.scss +0 -27
- data/app/assets/stylesheets/will_filter/buttons.css.scss +0 -24
- data/app/assets/stylesheets/will_filter/calendar.css.scss +0 -102
- data/app/assets/stylesheets/will_filter/exporter.css.scss +0 -89
- data/app/assets/stylesheets/will_filter/results.css.scss +0 -63
- data/app/views/layouts/will_filter/application.html.erb +0 -14
- data/test/dummy/app/assets/javascripts/orders.js +0 -2
- data/test/dummy/app/assets/stylesheets/orders.css +0 -4
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Copyright (c)
|
|
2
|
+
# Copyright (c) 2017 Michael Berkovich, theiceberk@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# __ __ ____ _ _ _____ ____ _ ______ ___ ____
|
|
5
|
+
# | |__| || || | | | | || || | | | / _]| \
|
|
6
|
+
# | | | | | | | | | | | __| | | | | | | / [_ | D )
|
|
7
|
+
# | | | | | | | |___ | |___ | |_ | | | |___|_| |_|| _]| /
|
|
8
|
+
# | ` ' | | | | || | | _] | | | | | | | [_ | \
|
|
9
|
+
# \ / | | | || | | | | | | | | | | || . \
|
|
10
|
+
# \_/\_/ |____||_____||_____| |__| |____||_____| |__| |_____||__|\_|
|
|
11
|
+
#
|
|
3
12
|
#
|
|
4
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
14
|
# a copy of this software and associated documentation files (the
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Copyright (c)
|
|
2
|
+
# Copyright (c) 2017 Michael Berkovich, theiceberk@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# __ __ ____ _ _ _____ ____ _ ______ ___ ____
|
|
5
|
+
# | |__| || || | | | | || || | | | / _]| \
|
|
6
|
+
# | | | | | | | | | | | __| | | | | | | / [_ | D )
|
|
7
|
+
# | | | | | | | |___ | |___ | |_ | | | |___|_| |_|| _]| /
|
|
8
|
+
# | ` ' | | | | || | | _] | | | | | | | [_ | \
|
|
9
|
+
# \ / | | | || | | | | | | | | | | || . \
|
|
10
|
+
# \_/\_/ |____||_____||_____| |__| |____||_____| |__| |_____||__|\_|
|
|
11
|
+
#
|
|
3
12
|
#
|
|
4
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
14
|
# a copy of this software and associated documentation files (the
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Copyright (c)
|
|
2
|
+
# Copyright (c) 2017 Michael Berkovich, theiceberk@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# __ __ ____ _ _ _____ ____ _ ______ ___ ____
|
|
5
|
+
# | |__| || || | | | | || || | | | / _]| \
|
|
6
|
+
# | | | | | | | | | | | __| | | | | | | / [_ | D )
|
|
7
|
+
# | | | | | | | |___ | |___ | |_ | | | |___|_| |_|| _]| /
|
|
8
|
+
# | ` ' | | | | || | | _] | | | | | | | [_ | \
|
|
9
|
+
# \ / | | | || | | | | | | | | | | || . \
|
|
10
|
+
# \_/\_/ |____||_____||_____| |__| |____||_____| |__| |_____||__|\_|
|
|
11
|
+
#
|
|
3
12
|
#
|
|
4
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
14
|
# a copy of this software and associated documentation files (the
|
|
@@ -20,6 +29,7 @@
|
|
|
20
29
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
21
30
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
31
|
#++
|
|
32
|
+
|
|
23
33
|
module WillFilter
|
|
24
34
|
module Containers
|
|
25
35
|
class SingleDate < WillFilter::FilterContainer
|
|
@@ -49,6 +59,7 @@ module WillFilter
|
|
|
49
59
|
end
|
|
50
60
|
|
|
51
61
|
def sql_condition
|
|
62
|
+
return [' 1 = 0'] if time.nil?
|
|
52
63
|
return [" #{condition.full_key} >= ? and #{condition.full_key} < ? ", time, time + 1.day] if operator == :is_on
|
|
53
64
|
return [" #{condition.full_key} < ? and #{condition.full_key} >= ? ", time, time + 1.day] if operator == :is_not_on
|
|
54
65
|
end
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Copyright (c)
|
|
2
|
+
# Copyright (c) 2017 Michael Berkovich, theiceberk@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# __ __ ____ _ _ _____ ____ _ ______ ___ ____
|
|
5
|
+
# | |__| || || | | | | || || | | | / _]| \
|
|
6
|
+
# | | | | | | | | | | | __| | | | | | | / [_ | D )
|
|
7
|
+
# | | | | | | | |___ | |___ | |_ | | | |___|_| |_|| _]| /
|
|
8
|
+
# | ` ' | | | | || | | _] | | | | | | | [_ | \
|
|
9
|
+
# \ / | | | || | | | | | | | | | | || . \
|
|
10
|
+
# \_/\_/ |____||_____||_____| |__| |____||_____| |__| |_____||__|\_|
|
|
11
|
+
#
|
|
3
12
|
#
|
|
4
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
14
|
# a copy of this software and associated documentation files (the
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Copyright (c)
|
|
2
|
+
# Copyright (c) 2017 Michael Berkovich, theiceberk@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# __ __ ____ _ _ _____ ____ _ ______ ___ ____
|
|
5
|
+
# | |__| || || | | | | || || | | | / _]| \
|
|
6
|
+
# | | | | | | | | | | | __| | | | | | | / [_ | D )
|
|
7
|
+
# | | | | | | | |___ | |___ | |_ | | | |___|_| |_|| _]| /
|
|
8
|
+
# | ` ' | | | | || | | _] | | | | | | | [_ | \
|
|
9
|
+
# \ / | | | || | | | | | | | | | | || . \
|
|
10
|
+
# \_/\_/ |____||_____||_____| |__| |____||_____| |__| |_____||__|\_|
|
|
11
|
+
#
|
|
3
12
|
#
|
|
4
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
14
|
# a copy of this software and associated documentation files (the
|
|
@@ -39,7 +48,7 @@ module WillFilter
|
|
|
39
48
|
end
|
|
40
49
|
|
|
41
50
|
def split_values
|
|
42
|
-
value.split(TEXT_DELIMITER)
|
|
51
|
+
value.to_s.split(TEXT_DELIMITER)
|
|
43
52
|
end
|
|
44
53
|
|
|
45
54
|
def sql_condition
|
data/lib/will_filter/engine.rb
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Copyright (c)
|
|
2
|
+
# Copyright (c) 2017 Michael Berkovich, theiceberk@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# __ __ ____ _ _ _____ ____ _ ______ ___ ____
|
|
5
|
+
# | |__| || || | | | | || || | | | / _]| \
|
|
6
|
+
# | | | | | | | | | | | __| | | | | | | / [_ | D )
|
|
7
|
+
# | | | | | | | |___ | |___ | |_ | | | |___|_| |_|| _]| /
|
|
8
|
+
# | ` ' | | | | || | | _] | | | | | | | [_ | \
|
|
9
|
+
# \ / | | | || | | | | | | | | | | || . \
|
|
10
|
+
# \_/\_/ |____||_____||_____| |__| |____||_____| |__| |_____||__|\_|
|
|
11
|
+
#
|
|
3
12
|
#
|
|
4
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
14
|
# a copy of this software and associated documentation files (the
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Copyright (c)
|
|
2
|
+
# Copyright (c) 2017 Michael Berkovich, theiceberk@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# __ __ ____ _ _ _____ ____ _ ______ ___ ____
|
|
5
|
+
# | |__| || || | | | | || || | | | / _]| \
|
|
6
|
+
# | | | | | | | | | | | __| | | | | | | / [_ | D )
|
|
7
|
+
# | | | | | | | |___ | |___ | |_ | | | |___|_| |_|| _]| /
|
|
8
|
+
# | ` ' | | | | || | | _] | | | | | | | [_ | \
|
|
9
|
+
# \ / | | | || | | | | | | | | | | || . \
|
|
10
|
+
# \_/\_/ |____||_____||_____| |__| |____||_____| |__| |_____||__|\_|
|
|
11
|
+
#
|
|
3
12
|
#
|
|
4
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
14
|
# a copy of this software and associated documentation files (the
|
|
@@ -25,22 +34,37 @@ module WillFilter
|
|
|
25
34
|
module ActionControllerExtension
|
|
26
35
|
def self.included(base)
|
|
27
36
|
base.send(:include, InstanceMethods)
|
|
28
|
-
base.
|
|
37
|
+
base.before_action :init_will_filter
|
|
38
|
+
base.after_action :reset_will_filter
|
|
29
39
|
end
|
|
30
40
|
|
|
31
41
|
module InstanceMethods
|
|
32
42
|
def init_will_filter
|
|
33
|
-
# only if the filters need to be
|
|
34
|
-
return unless WillFilter::Config.user_filters_enabled?
|
|
35
|
-
|
|
36
43
|
wf_current_user = nil
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
wf_current_project = nil
|
|
45
|
+
|
|
46
|
+
# only if the filters need to be
|
|
47
|
+
if WillFilter::Config.user_filters_enabled?
|
|
48
|
+
begin
|
|
49
|
+
wf_current_user = self.send(WillFilter::Config.current_user_method)
|
|
50
|
+
rescue => ex
|
|
51
|
+
wf_current_user = nil
|
|
52
|
+
end
|
|
41
53
|
end
|
|
42
54
|
|
|
43
|
-
WillFilter::Config.
|
|
55
|
+
if WillFilter::Config.project_filters_enabled?
|
|
56
|
+
begin
|
|
57
|
+
wf_current_project = self.send(WillFilter::Config.current_project_method)
|
|
58
|
+
rescue => ex
|
|
59
|
+
wf_current_project = nil
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
WillFilter::Config.init(wf_current_user, wf_current_project)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def reset_will_filter
|
|
67
|
+
WillFilter::Config.reset!
|
|
44
68
|
end
|
|
45
69
|
end
|
|
46
70
|
end
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Copyright (c)
|
|
2
|
+
# Copyright (c) 2017 Michael Berkovich, theiceberk@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# __ __ ____ _ _ _____ ____ _ ______ ___ ____
|
|
5
|
+
# | |__| || || | | | | || || | | | / _]| \
|
|
6
|
+
# | | | | | | | | | | | __| | | | | | | / [_ | D )
|
|
7
|
+
# | | | | | | | |___ | |___ | |_ | | | |___|_| |_|| _]| /
|
|
8
|
+
# | ` ' | | | | || | | _] | | | | | | | [_ | \
|
|
9
|
+
# \ / | | | || | | | | | | | | | | || . \
|
|
10
|
+
# \_/\_/ |____||_____||_____| |__| |____||_____| |__| |_____||__|\_|
|
|
11
|
+
#
|
|
3
12
|
#
|
|
4
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
14
|
# a copy of this software and associated documentation files (the
|
|
@@ -26,11 +35,11 @@ module WillFilter
|
|
|
26
35
|
extend ActiveSupport::Concern
|
|
27
36
|
|
|
28
37
|
def will_filter_tag(results, opts = {})
|
|
29
|
-
render(:partial =>
|
|
38
|
+
render(:partial => '/will_filter/filter/container', :locals => {:wf_filter => results.wf_filter, :opts => opts})
|
|
30
39
|
end
|
|
31
40
|
|
|
32
41
|
def will_filter_scripts_tag(opts = {})
|
|
33
|
-
render(:partial =>
|
|
42
|
+
render(:partial => '/will_filter/common/scripts', :locals => {:opts => opts})
|
|
34
43
|
end
|
|
35
44
|
|
|
36
45
|
def will_filter_table_tag(results, opts = {})
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Copyright (c)
|
|
2
|
+
# Copyright (c) 2017 Michael Berkovich, theiceberk@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# __ __ ____ _ _ _____ ____ _ ______ ___ ____
|
|
5
|
+
# | |__| || || | | | | || || | | | / _]| \
|
|
6
|
+
# | | | | | | | | | | | __| | | | | | | / [_ | D )
|
|
7
|
+
# | | | | | | | |___ | |___ | |_ | | | |___|_| |_|| _]| /
|
|
8
|
+
# | ` ' | | | | || | | _] | | | | | | | [_ | \
|
|
9
|
+
# \ / | | | || | | | | | | | | | | || . \
|
|
10
|
+
# \_/\_/ |____||_____||_____| |__| |____||_____| |__| |_____||__|\_|
|
|
11
|
+
#
|
|
3
12
|
#
|
|
4
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
14
|
# a copy of this software and associated documentation files (the
|
|
@@ -24,6 +33,7 @@
|
|
|
24
33
|
module WillFilter
|
|
25
34
|
module ActiveRecordExtension
|
|
26
35
|
extend ActiveSupport::Concern
|
|
36
|
+
|
|
27
37
|
module ClassMethods
|
|
28
38
|
def filter(opts = {})
|
|
29
39
|
if ActiveRecord::Base == self.class
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#--
|
|
2
|
+
# Copyright (c) 2017 Michael Berkovich, theiceberk@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# __ __ ____ _ _ _____ ____ _ ______ ___ ____
|
|
5
|
+
# | |__| || || | | | | || || | | | / _]| \
|
|
6
|
+
# | | | | | | | | | | | __| | | | | | | / [_ | D )
|
|
7
|
+
# | | | | | | | |___ | |___ | |_ | | | |___|_| |_|| _]| /
|
|
8
|
+
# | ` ' | | | | || | | _] | | | | | | | [_ | \
|
|
9
|
+
# \ / | | | || | | | | | | | | | | || . \
|
|
10
|
+
# \_/\_/ |____||_____||_____| |__| |____||_____| |__| |_____||__|\_|
|
|
11
|
+
#
|
|
12
|
+
#
|
|
13
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
14
|
+
# a copy of this software and associated documentation files (the
|
|
15
|
+
# "Software"), to deal in the Software without restriction, including
|
|
16
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
17
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
18
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
19
|
+
# the following conditions:
|
|
20
|
+
#
|
|
21
|
+
# The above copyright notice and this permission notice shall be
|
|
22
|
+
# included in all copies or substantial portions of the Software.
|
|
23
|
+
#
|
|
24
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
26
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
27
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
28
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
29
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
30
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
31
|
+
#++
|
|
32
|
+
|
|
33
|
+
module ActiveRecord
|
|
34
|
+
class Relation
|
|
35
|
+
|
|
36
|
+
def wf_filter=(filter)
|
|
37
|
+
@wf_filter = filter
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def wf_filter
|
|
41
|
+
@wf_filter
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def add_filter_condition(condition_key, operator_key, values = [])
|
|
45
|
+
sub_filter = wf_filter.dup
|
|
46
|
+
sub_filter.replace_condition(condition_key, operator_key, values)
|
|
47
|
+
sub_filter
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Copyright (c)
|
|
2
|
+
# Copyright (c) 2017 Michael Berkovich, theiceberk@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# __ __ ____ _ _ _____ ____ _ ______ ___ ____
|
|
5
|
+
# | |__| || || | | | | || || | | | / _]| \
|
|
6
|
+
# | | | | | | | | | | | __| | | | | | | / [_ | D )
|
|
7
|
+
# | | | | | | | |___ | |___ | |_ | | | |___|_| |_|| _]| /
|
|
8
|
+
# | ` ' | | | | || | | _] | | | | | | | [_ | \
|
|
9
|
+
# \ / | | | || | | | | | | | | | | || . \
|
|
10
|
+
# \_/\_/ |____||_____||_____| |__| |____||_____| |__| |_____||__|\_|
|
|
11
|
+
#
|
|
3
12
|
#
|
|
4
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
14
|
# a copy of this software and associated documentation files (the
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Copyright (c)
|
|
2
|
+
# Copyright (c) 2017 Michael Berkovich, theiceberk@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# __ __ ____ _ _ _____ ____ _ ______ ___ ____
|
|
5
|
+
# | |__| || || | | | | || || | | | / _]| \
|
|
6
|
+
# | | | | | | | | | | | __| | | | | | | / [_ | D )
|
|
7
|
+
# | | | | | | | |___ | |___ | |_ | | | |___|_| |_|| _]| /
|
|
8
|
+
# | ` ' | | | | || | | _] | | | | | | | [_ | \
|
|
9
|
+
# \ / | | | || | | | | | | | | | | || . \
|
|
10
|
+
# \_/\_/ |____||_____||_____| |__| |____||_____| |__| |_____||__|\_|
|
|
11
|
+
#
|
|
3
12
|
#
|
|
4
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
14
|
# a copy of this software and associated documentation files (the
|
|
@@ -44,12 +53,7 @@ module WillFilter
|
|
|
44
53
|
end
|
|
45
54
|
|
|
46
55
|
def full_key
|
|
47
|
-
|
|
48
|
-
parts = key.to_s.split(".")
|
|
49
|
-
join_class = parts.first.camelcase.constantize
|
|
50
|
-
return "#{join_class.table_name}.#{parts.last}"
|
|
51
|
-
end
|
|
52
|
-
"#{filter.table_name}.#{key}"
|
|
56
|
+
filter.sql_attribute_for_key(key)
|
|
53
57
|
end
|
|
54
58
|
|
|
55
59
|
def to_s
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Copyright (c)
|
|
2
|
+
# Copyright (c) 2017 Michael Berkovich, theiceberk@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# __ __ ____ _ _ _____ ____ _ ______ ___ ____
|
|
5
|
+
# | |__| || || | | | | || || | | | / _]| \
|
|
6
|
+
# | | | | | | | | | | | __| | | | | | | / [_ | D )
|
|
7
|
+
# | | | | | | | |___ | |___ | |_ | | | |___|_| |_|| _]| /
|
|
8
|
+
# | ` ' | | | | || | | _] | | | | | | | [_ | \
|
|
9
|
+
# \ / | | | || | | | | | | | | | | || . \
|
|
10
|
+
# \_/\_/ |____||_____||_____| |__| |____||_____| |__| |_____||__|\_|
|
|
11
|
+
#
|
|
3
12
|
#
|
|
4
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
14
|
# a copy of this software and associated documentation files (the
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Copyright (c)
|
|
2
|
+
# Copyright (c) 2017 Michael Berkovich, theiceberk@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# __ __ ____ _ _ _____ ____ _ ______ ___ ____
|
|
5
|
+
# | |__| || || | | | | || || | | | / _]| \
|
|
6
|
+
# | | | | | | | | | | | __| | | | | | | / [_ | D )
|
|
7
|
+
# | | | | | | | |___ | |___ | |_ | | | |___|_| |_|| _]| /
|
|
8
|
+
# | ` ' | | | | || | | _] | | | | | | | [_ | \
|
|
9
|
+
# \ / | | | || | | | | | | | | | | || . \
|
|
10
|
+
# \_/\_/ |____||_____||_____| |__| |____||_____| |__| |_____||__|\_|
|
|
11
|
+
#
|
|
3
12
|
#
|
|
4
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
14
|
# a copy of this software and associated documentation files (the
|
data/lib/will_filter/railtie.rb
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Copyright (c)
|
|
2
|
+
# Copyright (c) 2017 Michael Berkovich, theiceberk@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# __ __ ____ _ _ _____ ____ _ ______ ___ ____
|
|
5
|
+
# | |__| || || | | | | || || | | | / _]| \
|
|
6
|
+
# | | | | | | | | | | | __| | | | | | | / [_ | D )
|
|
7
|
+
# | | | | | | | |___ | |___ | |_ | | | |___|_| |_|| _]| /
|
|
8
|
+
# | ` ' | | | | || | | _] | | | | | | | [_ | \
|
|
9
|
+
# \ / | | | || | | | | | | | | | | || . \
|
|
10
|
+
# \_/\_/ |____||_____||_____| |__| |____||_____| |__| |_____||__|\_|
|
|
11
|
+
#
|
|
3
12
|
#
|
|
4
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
14
|
# a copy of this software and associated documentation files (the
|
|
@@ -25,8 +34,8 @@ require 'rails'
|
|
|
25
34
|
require 'pp'
|
|
26
35
|
|
|
27
36
|
[
|
|
28
|
-
|
|
29
|
-
|
|
37
|
+
'.',
|
|
38
|
+
'./containers'
|
|
30
39
|
].each do |dir|
|
|
31
40
|
Dir[File.expand_path("#{File.dirname(__FILE__)}/#{dir}/*.rb")].sort.each do |file|
|
|
32
41
|
require(file)
|
|
@@ -36,6 +45,7 @@ end
|
|
|
36
45
|
require File.join(File.dirname(__FILE__), 'extensions/array_extension')
|
|
37
46
|
require File.join(File.dirname(__FILE__), 'extensions/action_view_extension')
|
|
38
47
|
require File.join(File.dirname(__FILE__), 'extensions/active_record_extension')
|
|
48
|
+
require File.join(File.dirname(__FILE__), 'extensions/active_record_relation_extension')
|
|
39
49
|
require File.join(File.dirname(__FILE__), 'extensions/action_controller_extension')
|
|
40
50
|
|
|
41
51
|
module WillFilter
|
|
@@ -49,7 +59,7 @@ module WillFilter
|
|
|
49
59
|
end
|
|
50
60
|
ActiveSupport.on_load(:action_controller) do
|
|
51
61
|
include WillFilter::ActionControllerExtension
|
|
52
|
-
end
|
|
62
|
+
end
|
|
53
63
|
end
|
|
54
64
|
end
|
|
55
65
|
end
|
data/lib/will_filter/version.rb
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Copyright (c)
|
|
2
|
+
# Copyright (c) 2017 Michael Berkovich, theiceberk@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# __ __ ____ _ _ _____ ____ _ ______ ___ ____
|
|
5
|
+
# | |__| || || | | | | || || | | | / _]| \
|
|
6
|
+
# | | | | | | | | | | | __| | | | | | | / [_ | D )
|
|
7
|
+
# | | | | | | | |___ | |___ | |_ | | | |___|_| |_|| _]| /
|
|
8
|
+
# | ` ' | | | | || | | _] | | | | | | | [_ | \
|
|
9
|
+
# \ / | | | || | | | | | | | | | | || . \
|
|
10
|
+
# \_/\_/ |____||_____||_____| |__| |____||_____| |__| |_____||__|\_|
|
|
11
|
+
#
|
|
3
12
|
#
|
|
4
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
14
|
# a copy of this software and associated documentation files (the
|
|
@@ -22,5 +31,5 @@
|
|
|
22
31
|
#++
|
|
23
32
|
|
|
24
33
|
module WillFilter
|
|
25
|
-
VERSION =
|
|
34
|
+
VERSION = '5.1.0'
|
|
26
35
|
end
|
data/spec/config/config_spec.rb
CHANGED
|
@@ -4,11 +4,11 @@ describe WillFilter::Config do
|
|
|
4
4
|
subject { WillFilter::Config }
|
|
5
5
|
describe 'operator_order' do
|
|
6
6
|
context 'by default' do
|
|
7
|
-
its(:config) {should_not == nil}
|
|
8
|
-
its(:containers) {should_not == nil}
|
|
9
|
-
its(:data_types) {should_not == nil}
|
|
10
|
-
its(:operators) {should_not == nil}
|
|
11
|
-
its(:operator_order) {should_not == nil}
|
|
7
|
+
# its(:config) {should_not == nil}
|
|
8
|
+
# its(:containers) {should_not == nil}
|
|
9
|
+
# its(:data_types) {should_not == nil}
|
|
10
|
+
# its(:operators) {should_not == nil}
|
|
11
|
+
# its(:operator_order) {should_not == nil}
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
end
|