anoubis 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/anoubis/application_controller.rb +18 -6
- data/app/controllers/anoubis/core/application_controller.rb +6 -6
- data/app/controllers/anoubis/core/data/actions.rb +15 -15
- data/app/controllers/anoubis/core/data/callbacks.rb +5 -5
- data/app/controllers/anoubis/core/data/convert.rb +33 -33
- data/app/controllers/anoubis/core/data/defaults.rb +8 -8
- data/app/controllers/anoubis/core/data/get.rb +14 -14
- data/app/controllers/anoubis/core/data/load.rb +3 -3
- data/app/controllers/anoubis/core/data/set.rb +2 -2
- data/app/controllers/anoubis/core/data/setup.rb +5 -5
- data/app/controllers/anoubis/core/data_controller.rb +10 -10
- data/app/controllers/anoubis/core/index/actions.rb +2 -2
- data/app/controllers/anoubis/core/index/callbacks.rb +1 -1
- data/app/controllers/anoubis/core/index_controller.rb +4 -4
- data/app/controllers/anoubis/etc/base.rb +16 -11
- data/app/controllers/anoubis/etc/data.rb +1 -1
- data/app/controllers/anoubis/etc/field.rb +10 -10
- data/app/controllers/anoubis/etc/field_options.rb +1 -1
- data/app/controllers/anoubis/etc/field_order.rb +1 -1
- data/app/controllers/anoubis/etc/filter.rb +2 -2
- data/app/controllers/anoubis/etc/menu.rb +2 -2
- data/app/controllers/anoubis/etc/model.rb +1 -1
- data/app/controllers/anoubis/etc/tab_item.rb +1 -1
- data/app/controllers/anoubis/etc.rb +1 -1
- data/app/controllers/anoubis/export.rb +1 -1
- data/app/controllers/anoubis/output/autocomplete.rb +1 -1
- data/app/controllers/anoubis/output/basic.rb +1 -1
- data/app/controllers/anoubis/output/data.rb +1 -1
- data/app/controllers/anoubis/output/delete.rb +1 -1
- data/app/controllers/anoubis/output/edit.rb +1 -1
- data/app/controllers/anoubis/output/frame.rb +5 -5
- data/app/controllers/anoubis/output/login.rb +1 -1
- data/app/controllers/anoubis/output/menu.rb +3 -3
- data/app/controllers/anoubis/output/update.rb +1 -1
- data/app/controllers/anoubis/sso/client/application_controller.rb +2 -2
- data/app/controllers/anoubis/sso/client/data/actions.rb +2 -2
- data/app/controllers/anoubis/sso/client/data/callbacks.rb +2 -2
- data/app/controllers/anoubis/sso/client/data/convert.rb +2 -2
- data/app/controllers/anoubis/sso/client/data/defaults.rb +2 -2
- data/app/controllers/anoubis/sso/client/data/get.rb +2 -2
- data/app/controllers/anoubis/sso/client/data/load.rb +6 -6
- data/app/controllers/anoubis/sso/client/data/set.rb +2 -2
- data/app/controllers/anoubis/sso/client/data/setup.rb +2 -2
- data/app/controllers/anoubis/sso/client/data_controller.rb +9 -9
- data/app/controllers/anoubis/sso/client/index/actions.rb +6 -6
- data/app/controllers/anoubis/sso/client/index/callbacks.rb +1 -1
- data/app/controllers/anoubis/sso/client/index_controller.rb +3 -3
- data/app/controllers/anoubis/sso/server/application_controller.rb +2 -2
- data/app/controllers/anoubis/sso/server/login_controller.rb +1 -1
- data/app/controllers/anoubis/sso/server/user_controller.rb +1 -1
- data/app/controllers/anoubis/tenant/application_controller.rb +4 -4
- data/app/controllers/anoubis/tenant/data/actions.rb +2 -2
- data/app/controllers/anoubis/tenant/data/callbacks.rb +2 -2
- data/app/controllers/anoubis/tenant/data/convert.rb +2 -2
- data/app/controllers/anoubis/tenant/data/defaults.rb +2 -2
- data/app/controllers/anoubis/tenant/data/get.rb +2 -2
- data/app/controllers/anoubis/tenant/data/load.rb +5 -5
- data/app/controllers/anoubis/tenant/data/set.rb +2 -2
- data/app/controllers/anoubis/tenant/data/setup.rb +2 -2
- data/app/controllers/anoubis/tenant/data_controller.rb +10 -10
- data/app/controllers/anoubis/tenant/index/actions.rb +15 -15
- data/app/controllers/anoubis/tenant/index/callbacks.rb +2 -2
- data/app/controllers/anoubis/tenant/index_controller.rb +4 -4
- data/app/controllers/anoubis/tenants_controller.rb +1 -1
- data/app/controllers/anoubis/users_controller.rb +1 -1
- data/app/models/anoubis/application_record.rb +2 -2
- data/app/models/anoubis/core/application_record.rb +3 -3
- data/app/models/anoubis/sso/client/group_menu.rb +6 -6
- data/app/models/anoubis/sso/client/menu.rb +8 -8
- data/app/models/anoubis/sso/client/user.rb +3 -3
- data/app/models/anoubis/sso/server/user.rb +1 -1
- data/app/models/anoubis/tenant/group_menu.rb +5 -5
- data/app/models/anoubis/tenant/menu.rb +13 -13
- data/app/models/anoubis/tenant/system.rb +5 -5
- data/app/models/anoubis/tenant/user.rb +4 -4
- data/app/services/anoubis/session_service.rb +1 -1
- data/config/locales/en.yml +17 -2
- data/config/locales/ru.yml +18 -3
- data/db/seeds.rb +30 -30
- data/lib/anoubis/version.rb +1 -1
- data/lib/anoubis.rb +1 -1
- data/spec/controllers/anoubis/index_controller_spec.rb +1 -1
- data/spec/dummy/log/development.log +0 -0
- data/spec/dummy/log/test.log +0 -0
- data/spec/dummy/tmp/development_secret.txt +1 -0
- data/spec/models/anoubis/group_locale_spec.rb +1 -1
- data/spec/models/anoubis/group_menu_spec.rb +6 -6
- data/spec/models/anoubis/group_spec.rb +3 -3
- data/spec/models/anoubis/menu_locale_spec.rb +1 -1
- data/spec/models/anoubis/menu_spec.rb +1 -1
- data/spec/models/anoubis/system_locale_spec.rb +1 -1
- data/spec/models/anoubis/system_menu_spec.rb +5 -5
- data/spec/models/anoubis/system_spec.rb +4 -4
- data/spec/models/anoubis/tenant_spec.rb +4 -4
- data/spec/models/anoubis/user_spec.rb +2 -2
- metadata +62 -56
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2952b978cd0972cc3e1ced91c7728940ce7d90e0247097c1a2e755f06ab01bd4
|
4
|
+
data.tar.gz: 4d83a4fd21a78e398a380aab8300d5b0d2eef043ab866bc92ff46935eb09c9ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a07795ecbb430b0c62f3245f202de5cc88debdaa42256e70e49f5a1838c61ae18c72d0287b48b5089c7e8ab42647b831854d2fc7ade6fcb62644225f6de4424c
|
7
|
+
data.tar.gz: c256666a07e9b8ba80769840dca82e2029d556530bae8620fc25acfc01b778c8d534c2d65a70222ea153ef6a8d6030a9a894310de15f4a7ce577a22c552000ba
|
@@ -55,18 +55,30 @@ class Anoubis::ApplicationController < ActionController::API
|
|
55
55
|
rescue
|
56
56
|
I18n.locale = default_locale
|
57
57
|
end
|
58
|
+
|
59
|
+
after_anoubis_initialization
|
60
|
+
end
|
61
|
+
|
62
|
+
##
|
63
|
+
# Procedure fires after initializes all parameters
|
64
|
+
def after_anoubis_initialization
|
65
|
+
|
58
66
|
end
|
59
67
|
|
60
68
|
##
|
61
69
|
# Generates options headers for CORS requests
|
62
70
|
# @param methods [String] list of allowed HTTP actions separated by space <i>(e.g. 'GET POST DELETE')</i>
|
63
71
|
def options(methods = 'POST')
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
72
|
+
return unless check_origin
|
73
|
+
return unless request.origin
|
74
|
+
|
75
|
+
headers['Access-Control-Allow-Origin'] = request.headers['origin']
|
76
|
+
headers['Access-Control-Allow-Methods'] = methods
|
77
|
+
|
78
|
+
return if request.method != 'OPTIONS'
|
79
|
+
|
80
|
+
headers['Access-Control-Max-Age'] = '1000'
|
81
|
+
headers['Access-Control-Allow-Headers'] = '*,x-requested-with,Content-Type,Authorization'
|
70
82
|
end
|
71
83
|
|
72
84
|
##
|
@@ -1,6 +1,6 @@
|
|
1
1
|
##
|
2
2
|
# Application controller for Anubis library.
|
3
|
-
class
|
3
|
+
class Anoubis::Core::ApplicationController < ActionController::API
|
4
4
|
prepend_before_action :anubis_core_initialization
|
5
5
|
|
6
6
|
#include AbstractController::Translation
|
@@ -23,7 +23,7 @@ class Anubis::Core::ApplicationController < ActionController::API
|
|
23
23
|
attr_accessor :current_user
|
24
24
|
|
25
25
|
# @!attribute [rw] output
|
26
|
-
# @return [
|
26
|
+
# @return [Anoubis::Output] standard output.
|
27
27
|
attr_accessor :output
|
28
28
|
|
29
29
|
# @!attribute [rw] writer
|
@@ -31,11 +31,11 @@ class Anubis::Core::ApplicationController < ActionController::API
|
|
31
31
|
attr_accessor :writer
|
32
32
|
|
33
33
|
# @!attribute [rw] etc
|
34
|
-
# @return [
|
34
|
+
# @return [Anoubis::Etc::Base] global system parameters
|
35
35
|
attr_accessor :etc
|
36
36
|
|
37
37
|
# @!attribute [rw] exports
|
38
|
-
# @return [
|
38
|
+
# @return [Anoubis::Export] Export data class
|
39
39
|
attr_accessor :exports
|
40
40
|
|
41
41
|
##
|
@@ -50,9 +50,9 @@ class Anubis::Core::ApplicationController < ActionController::API
|
|
50
50
|
self.version = 0
|
51
51
|
|
52
52
|
if defined? params
|
53
|
-
self.etc =
|
53
|
+
self.etc = Anoubis::Etc::Base.new({ params: params })
|
54
54
|
else
|
55
|
-
self.etc =
|
55
|
+
self.etc = Anoubis::Etc::Base.new
|
56
56
|
end
|
57
57
|
self.output = nil
|
58
58
|
self.exports = nil
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Anoubis
|
2
2
|
module Core
|
3
3
|
module Data
|
4
4
|
##
|
@@ -88,9 +88,9 @@ module Anubis
|
|
88
88
|
# ]
|
89
89
|
# }
|
90
90
|
def index
|
91
|
-
self.etc.data =
|
91
|
+
self.etc.data = Anoubis::Etc::Data.new
|
92
92
|
self.set_parent_model 'index'
|
93
|
-
self.output =
|
93
|
+
self.output = Anoubis::Output::Data.new
|
94
94
|
self.output.count = self.get_table_data_count
|
95
95
|
self.setup_fields
|
96
96
|
self.output.limit = self.etc.data.limit
|
@@ -186,8 +186,8 @@ module Anubis
|
|
186
186
|
# "tab": "inner"
|
187
187
|
# }
|
188
188
|
def frame
|
189
|
-
self.output =
|
190
|
-
self.etc.data =
|
189
|
+
self.output = Anoubis::Output::Frame.new
|
190
|
+
self.etc.data = Anoubis::Etc::Data.new if !self.etc.data
|
191
191
|
self.etc.action = 'frame'
|
192
192
|
if self.parent_model
|
193
193
|
if !self.get_parent_data
|
@@ -281,7 +281,7 @@ module Anubis
|
|
281
281
|
# "tab": "inner"
|
282
282
|
# }
|
283
283
|
def show
|
284
|
-
self.output =
|
284
|
+
self.output = Anoubis::Output::Edit.new
|
285
285
|
self.set_parent_model 'show'
|
286
286
|
self.output.tab = self.etc.tab.tab
|
287
287
|
if params.key?(:value) && params.key?(:field)
|
@@ -388,7 +388,7 @@ module Anubis
|
|
388
388
|
end
|
389
389
|
|
390
390
|
def new_action_skeleton(action)
|
391
|
-
self.output =
|
391
|
+
self.output = Anoubis::Output::Edit.new
|
392
392
|
self.set_parent_model action
|
393
393
|
self.output.tab = self.etc.tab.tab
|
394
394
|
if self.etc.tab.buttons.key? action.to_sym
|
@@ -488,7 +488,7 @@ module Anubis
|
|
488
488
|
# "tab": "inner"
|
489
489
|
# }
|
490
490
|
def create
|
491
|
-
self.output =
|
491
|
+
self.output = Anoubis::Output::Update.new
|
492
492
|
self.set_parent_model 'create'
|
493
493
|
self.output.tab = self.etc.tab.tab
|
494
494
|
if params.key? :data
|
@@ -623,7 +623,7 @@ module Anubis
|
|
623
623
|
# "tab": "inner"
|
624
624
|
# }
|
625
625
|
def edit
|
626
|
-
self.output =
|
626
|
+
self.output = Anoubis::Output::Edit.new
|
627
627
|
self.set_parent_model 'edit'
|
628
628
|
self.output.tab = self.etc.tab.tab
|
629
629
|
if self.table_actions.include?('edit')
|
@@ -728,7 +728,7 @@ module Anubis
|
|
728
728
|
# "tab": "inner"
|
729
729
|
# }
|
730
730
|
def update
|
731
|
-
self.output =
|
731
|
+
self.output = Anoubis::Output::Update.new
|
732
732
|
self.set_parent_model 'update'
|
733
733
|
self.output.tab = self.etc.tab.tab
|
734
734
|
if self.table_actions.include?('edit')
|
@@ -827,7 +827,7 @@ module Anubis
|
|
827
827
|
# "tab": "inner"
|
828
828
|
# }
|
829
829
|
def destroy
|
830
|
-
self.output =
|
830
|
+
self.output = Anoubis::Output::Delete.new
|
831
831
|
self.set_parent_model 'destroy'
|
832
832
|
self.output.tab = self.etc.tab.tab
|
833
833
|
if self.etc.tab.buttons.key? :delete
|
@@ -862,7 +862,7 @@ module Anubis
|
|
862
862
|
##
|
863
863
|
# Returns autocomplete data
|
864
864
|
def autocomplete
|
865
|
-
self.output =
|
865
|
+
self.output = Anoubis::Output::Autocomplete.new
|
866
866
|
self.output.result = -1
|
867
867
|
self.set_parent_model 'autocomplete'
|
868
868
|
self.output.tab = self.etc.tab.tab
|
@@ -890,15 +890,15 @@ module Anubis
|
|
890
890
|
##
|
891
891
|
# Export data from database
|
892
892
|
def export
|
893
|
-
self.etc.data =
|
893
|
+
self.etc.data = Anoubis::Etc::Data.new
|
894
894
|
self.set_parent_model 'export'
|
895
|
-
self.output =
|
895
|
+
self.output = Anoubis::Output::Data.new
|
896
896
|
if self.etc.tab.export
|
897
897
|
self.output.count = self.get_table_data_count
|
898
898
|
count = (self.output.count / 40).to_i + 1
|
899
899
|
self.setup_fields
|
900
900
|
|
901
|
-
self.exports =
|
901
|
+
self.exports = Anoubis::Export.new format: self.export_format, fields: self.get_fields_properties
|
902
902
|
|
903
903
|
case self.exports.format
|
904
904
|
when 'xls'
|
@@ -1,11 +1,11 @@
|
|
1
|
-
module
|
1
|
+
module Anoubis
|
2
2
|
module Core
|
3
3
|
module Data
|
4
4
|
##
|
5
5
|
# Module presents all callbacks called in actions.
|
6
6
|
module Callbacks
|
7
7
|
##
|
8
|
-
# Fires after data was received from server and placed in {
|
8
|
+
# Fires after data was received from server and placed in {Anoubis::Output::Data#data self.output.data} array.
|
9
9
|
# It's rewrote for change data before output.
|
10
10
|
def after_get_table_data
|
11
11
|
|
@@ -20,14 +20,14 @@ module Anubis
|
|
20
20
|
end
|
21
21
|
|
22
22
|
##
|
23
|
-
# Fires after data was was updated on the server and placed in {
|
23
|
+
# Fires after data was was updated on the server and placed in {Anoubis::Output::Data#data self.output.data} array.
|
24
24
|
# It's rewrote for change data before output.
|
25
25
|
def after_update_data
|
26
26
|
|
27
27
|
end
|
28
28
|
|
29
29
|
##
|
30
|
-
# Fires after data was was created in {
|
30
|
+
# Fires after data was was created in {Anoubis::Output::Data#data self.output.data} array and before it saved to server.
|
31
31
|
# It's rewrote for change data before output.
|
32
32
|
# @param data [Hash] Data for create
|
33
33
|
# @return [Hash] Processed data. If returned nil then update is terminated.
|
@@ -36,7 +36,7 @@ module Anubis
|
|
36
36
|
end
|
37
37
|
|
38
38
|
##
|
39
|
-
# Fires after data was was created on the server and placed in {
|
39
|
+
# Fires after data was was created on the server and placed in {Anoubis::Output::Data#data self.output.data} array.
|
40
40
|
# It's rewrote for change data before output.
|
41
41
|
def after_create_data
|
42
42
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Anoubis
|
2
2
|
module Core
|
3
3
|
module Data
|
4
4
|
##
|
@@ -27,8 +27,8 @@ module Anubis
|
|
27
27
|
# @!group Block of conversion database value into human view format
|
28
28
|
|
29
29
|
##
|
30
|
-
# Convert value from database to view format according by defining field type and {
|
31
|
-
# @param key [Symbol] field's identifier in {
|
30
|
+
# Convert value from database to view format according by defining field type and {Anoubis::Etc::Base#action action}
|
31
|
+
# @param key [Symbol] field's identifier in {Anoubis::Etc::Data#fields self.etc.data.fields} structure
|
32
32
|
# @param value [String] value from database
|
33
33
|
def convert_db_to_view_value(key, value)
|
34
34
|
field = self.etc.data.fields[key]
|
@@ -40,7 +40,7 @@ module Anubis
|
|
40
40
|
|
41
41
|
##
|
42
42
|
# Convert value from database to view format for 'string' type
|
43
|
-
# @param key [Symbol] field's identifier in {
|
43
|
+
# @param key [Symbol] field's identifier in {Anoubis::Etc::Data#fields self.etc.data.fields} structure
|
44
44
|
# @param value [String] value from database
|
45
45
|
def convert_db_to_view_value_string(key, value)
|
46
46
|
return { key => '' } if !value
|
@@ -49,7 +49,7 @@ module Anubis
|
|
49
49
|
|
50
50
|
##
|
51
51
|
# Convert value from database to view format for 'boolean' type
|
52
|
-
# @param key [Symbol] field's identifier in {
|
52
|
+
# @param key [Symbol] field's identifier in {Anoubis::Etc::Data#fields self.etc.data.fields} structure
|
53
53
|
# @param value [Boolean] value from database
|
54
54
|
def convert_db_to_view_value_boolean(key, value)
|
55
55
|
return { key => '' } if !value
|
@@ -58,7 +58,7 @@ module Anubis
|
|
58
58
|
|
59
59
|
##
|
60
60
|
# Convert value from database to view format for 'integer' type
|
61
|
-
# @param key [Symbol] field's identifier in {
|
61
|
+
# @param key [Symbol] field's identifier in {Anoubis::Etc::Data#fields self.etc.data.fields} structure
|
62
62
|
# @param value [String] value from database
|
63
63
|
def convert_db_to_view_value_number(key, value)
|
64
64
|
return { key => self.etc.data.fields[key].error_text } if !value
|
@@ -68,7 +68,7 @@ module Anubis
|
|
68
68
|
|
69
69
|
##
|
70
70
|
# Convert value from database to view format for 'text' type
|
71
|
-
# @param key [Symbol] field's identifier in {
|
71
|
+
# @param key [Symbol] field's identifier in {Anoubis::Etc::Data#fields self.etc.data.fields} structure
|
72
72
|
# @param value [String] value from database
|
73
73
|
def convert_db_to_view_value_text(key, value)
|
74
74
|
return { key => '' } if !value
|
@@ -77,7 +77,7 @@ module Anubis
|
|
77
77
|
|
78
78
|
##
|
79
79
|
# Convert value from database to view format for 'html' type
|
80
|
-
# @param key [Symbol] field's identifier in {
|
80
|
+
# @param key [Symbol] field's identifier in {Anoubis::Etc::Data#fields self.etc.data.fields} structure
|
81
81
|
# @param value [String] value from database
|
82
82
|
def convert_db_to_view_value_html(key, value)
|
83
83
|
return { key => '' } if !value
|
@@ -86,7 +86,7 @@ module Anubis
|
|
86
86
|
|
87
87
|
##
|
88
88
|
# Convert value from database to table format for 'listbox' type
|
89
|
-
# @param key [Symbol] field's identifier in {
|
89
|
+
# @param key [Symbol] field's identifier in {Anoubis::Etc::Data#fields self.etc.data.fields} structure
|
90
90
|
# @param value [String] value from database
|
91
91
|
def convert_db_to_view_value_listbox(key, value)
|
92
92
|
field = self.etc.data.fields[key]
|
@@ -129,7 +129,7 @@ module Anubis
|
|
129
129
|
|
130
130
|
##
|
131
131
|
# Convert value from database to view format for 'key' type
|
132
|
-
# @param key [Symbol] field's identifier in {
|
132
|
+
# @param key [Symbol] field's identifier in {Anoubis::Etc::Data#fields self.etc.data.fields} structure
|
133
133
|
# @param value [String] value from database
|
134
134
|
def convert_db_to_view_value_key(key, value)
|
135
135
|
return { key => '' } if !value
|
@@ -264,7 +264,7 @@ module Anubis
|
|
264
264
|
##
|
265
265
|
# Convert value from database to edit form for float type
|
266
266
|
# @param key [Symbol] field's identifier
|
267
|
-
# @param field [
|
267
|
+
# @param field [Anoubis::Etc::Data#fields] field's options
|
268
268
|
# @param value [Float] value from database before processing
|
269
269
|
# @return [Hash] return resulting value at format <b>{ key+'_view': processed_value, key: value }</b>
|
270
270
|
def convert_db_to_table_value_float(key, field, value)
|
@@ -278,10 +278,10 @@ module Anubis
|
|
278
278
|
|
279
279
|
##
|
280
280
|
# Converts inputted value to database format.
|
281
|
-
# Field type is got from {
|
282
|
-
# Resulting data is placed into {
|
283
|
-
# Errors are placed in {
|
284
|
-
# @param key [Symbol] field's identifier in {
|
281
|
+
# Field type is got from {Anoubis::Etc::Data#fields self.etc.data.fields} according by key.
|
282
|
+
# Resulting data is placed into {Anoubis::Etc::Data#data self.etc.data.data} attribute according by key.
|
283
|
+
# Errors are placed in {Anoubis::Output::Update#errors self.output.errors} array according by key.
|
284
|
+
# @param key [Symbol] field's identifier in {Anoubis::Etc::Data#fields self.etc.data.fields} structure
|
285
285
|
# @param value [String] value from user input
|
286
286
|
def convert_view_to_db_value(key, value)
|
287
287
|
field = self.etc.data.fields[key]
|
@@ -292,8 +292,8 @@ module Anubis
|
|
292
292
|
end
|
293
293
|
|
294
294
|
##
|
295
|
-
# Converts inputted value to database format for {
|
296
|
-
# @param key [Symbol] field's identifier in {
|
295
|
+
# Converts inputted value to database format for {Anoubis::Etc::Field#type 'string' field type}.
|
296
|
+
# @param key [Symbol] field's identifier in {Anoubis::Etc::Data#fields self.etc.data.fields} structure
|
297
297
|
# @param value [String] inputted value
|
298
298
|
def convert_view_to_db_value_string(key, value)
|
299
299
|
proc = format('self.etc.data.data.%s = value', key)
|
@@ -302,8 +302,8 @@ module Anubis
|
|
302
302
|
end
|
303
303
|
|
304
304
|
##
|
305
|
-
# Converts inputted value to database format for {
|
306
|
-
# @param key [Symbol] field's identifier in {
|
305
|
+
# Converts inputted value to database format for {Anoubis::Etc::Field#type 'boolean' field type}.
|
306
|
+
# @param key [Symbol] field's identifier in {Anoubis::Etc::Data#fields self.etc.data.fields} structure
|
307
307
|
# @param value [Boolean] inputted value
|
308
308
|
def convert_view_to_db_value_boolean(key, value)
|
309
309
|
proc = format('self.etc.data.data.%s = value', key)
|
@@ -312,8 +312,8 @@ module Anubis
|
|
312
312
|
end
|
313
313
|
|
314
314
|
##
|
315
|
-
# Converts inputted value to database format for {
|
316
|
-
# @param key [Symbol] field's identifier in {
|
315
|
+
# Converts inputted value to database format for {Anoubis::Etc::Field#type 'number' field type}.
|
316
|
+
# @param key [Symbol] field's identifier in {Anoubis::Etc::Data#fields self.etc.data.fields} structure
|
317
317
|
# @param value [String] inputted value
|
318
318
|
def convert_view_to_db_value_number(key, value)
|
319
319
|
field = self.etc.data.fields[key]
|
@@ -328,8 +328,8 @@ module Anubis
|
|
328
328
|
end
|
329
329
|
|
330
330
|
##
|
331
|
-
# Converts inputted value to database format for {
|
332
|
-
# @param key [Symbol] field's identifier in {
|
331
|
+
# Converts inputted value to database format for {Anoubis::Etc::Field#type 'text' field type}.
|
332
|
+
# @param key [Symbol] field's identifier in {Anoubis::Etc::Data#fields self.etc.data.fields} structure
|
333
333
|
# @param value [String] inputted value
|
334
334
|
def convert_view_to_db_value_text(key, value)
|
335
335
|
proc = format('self.etc.data.data.%s = value', key)
|
@@ -338,8 +338,8 @@ module Anubis
|
|
338
338
|
end
|
339
339
|
|
340
340
|
##
|
341
|
-
# Converts inputted value to database format for {
|
342
|
-
# @param key [Symbol] field's identifier in {
|
341
|
+
# Converts inputted value to database format for {Anoubis::Etc::Field#type 'html' field type}.
|
342
|
+
# @param key [Symbol] field's identifier in {Anoubis::Etc::Data#fields self.etc.data.fields} structure
|
343
343
|
# @param value [String] inputted value
|
344
344
|
def convert_view_to_db_value_html(key, value)
|
345
345
|
proc = format('self.etc.data.data.%s = value', key)
|
@@ -348,9 +348,9 @@ module Anubis
|
|
348
348
|
end
|
349
349
|
|
350
350
|
##
|
351
|
-
# Converts inputted value to database format for {
|
352
|
-
# for {
|
353
|
-
# @param key [Symbol] field's identifier in {
|
351
|
+
# Converts inputted value to database format for {Anoubis::Etc::Field#type 'listbox' field type}
|
352
|
+
# for {Anoubis::Data::Actions#create 'create'} action
|
353
|
+
# @param key [Symbol] field's identifier in {Anoubis::Etc::Data#fields self.etc.data.fields} structure
|
354
354
|
# @param value [String] inputted value
|
355
355
|
def convert_view_to_db_value_listbox(key, value)
|
356
356
|
field = self.etc.data.fields[key]
|
@@ -364,9 +364,9 @@ module Anubis
|
|
364
364
|
end
|
365
365
|
|
366
366
|
##
|
367
|
-
# Converts inputted value to database format for {
|
368
|
-
# for {
|
369
|
-
# @param key [Symbol] field's identifier in {
|
367
|
+
# Converts inputted value to database format for {Anoubis::Etc::Field#type 'key' field type}
|
368
|
+
# for {Anoubis::Data::Actions#create 'create'} action
|
369
|
+
# @param key [Symbol] field's identifier in {Anoubis::Etc::Data#fields self.etc.data.fields} structure
|
370
370
|
# @param value [String] inputted value
|
371
371
|
def convert_view_to_db_value_key(key, value)
|
372
372
|
field = self.etc.data.fields[key]
|
@@ -383,8 +383,8 @@ module Anubis
|
|
383
383
|
end
|
384
384
|
|
385
385
|
##
|
386
|
-
# Converts inputted value to database format for {
|
387
|
-
# @param key [Symbol] field's identifier in {
|
386
|
+
# Converts inputted value to database format for {Anoubis::Etc::Field#type 'datetime' field type}.
|
387
|
+
# @param key [Symbol] field's identifier in {Anoubis::Etc::Data#fields self.etc.data.fields} structure
|
388
388
|
# @param value [String] inputted value
|
389
389
|
def convert_view_to_db_value_datetime(key, value)
|
390
390
|
zone = ActiveSupport::TimeZone[self.current_user.timezone]
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Anoubis
|
2
2
|
module Core
|
3
3
|
module Data
|
4
4
|
##
|
@@ -77,8 +77,8 @@ module Anubis
|
|
77
77
|
##
|
78
78
|
# Returns model that is used for controller actions. By default it's not defined.
|
79
79
|
# This is primary model and it must be defined in customer conroller. Different models may be defined according
|
80
|
-
# by {
|
81
|
-
# @return [
|
80
|
+
# by {Anoubis::Etc::Base#action self.etc.action} attribute.
|
81
|
+
# @return [Anoubis::ApplicationRecord, nil, any] returns model
|
82
82
|
def model
|
83
83
|
nil
|
84
84
|
end
|
@@ -92,7 +92,7 @@ module Anubis
|
|
92
92
|
##
|
93
93
|
# Returns eager load parameters that are used for controller actions. By default it's set to \[\].
|
94
94
|
# This procedure could be redefined in cusomer controller. Different eager loads may be defined according
|
95
|
-
# by {
|
95
|
+
# by {Anoubis::Etc::Base#action self.etc.action} attribute.
|
96
96
|
def eager_load
|
97
97
|
[]
|
98
98
|
end
|
@@ -100,7 +100,7 @@ module Anubis
|
|
100
100
|
##
|
101
101
|
# Returns fields that is used for controller actions in defined {#model}. By default it's defined for id field.
|
102
102
|
# This is primary definition and it must be defined in customer conroller. Different fields may be defined according
|
103
|
-
# by {
|
103
|
+
# by {Anoubis::Etc::Base#action self.etc.action} attribute.
|
104
104
|
# @return [Hash] returns defined fields for current model
|
105
105
|
def fields
|
106
106
|
{
|
@@ -127,8 +127,8 @@ module Anubis
|
|
127
127
|
##
|
128
128
|
# Returns parent model that is used for controller actions. By default it's defined as <i>nil</i>.
|
129
129
|
# This procedure could be redefined in customer controller. Different models may be defined according
|
130
|
-
# by {
|
131
|
-
# @return [
|
130
|
+
# by {Anoubis::Etc::Base#action self.etc.action} attribute.
|
131
|
+
# @return [Anoubis::ApplicationRecord, nil] returns model
|
132
132
|
def parent_model
|
133
133
|
nil
|
134
134
|
end
|
@@ -136,7 +136,7 @@ module Anubis
|
|
136
136
|
##
|
137
137
|
# Returns eager load parameters for parent model that are used for controller actions. By default it's set to \[\].
|
138
138
|
# This procedure could be redefined in customer controller. Different eager loads may be defined according
|
139
|
-
# by {
|
139
|
+
# by {Anoubis::Etc::Base#action self.etc.action} attribute.
|
140
140
|
def parent_eager_load
|
141
141
|
[]
|
142
142
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Anoubis
|
2
2
|
module Core
|
3
3
|
module Data
|
4
4
|
##
|
@@ -132,7 +132,7 @@
|
|
132
132
|
self.setup_fields
|
133
133
|
#puts 'get_filter_where'
|
134
134
|
#puts self.etc.data.fields
|
135
|
-
self.etc.data.filter =
|
135
|
+
self.etc.data.filter = Anoubis::Etc::Filter.new({ data: filter, fields: self.etc.data.fields })
|
136
136
|
|
137
137
|
#puts self.etc.data.filter.to_h
|
138
138
|
end
|
@@ -275,10 +275,10 @@
|
|
275
275
|
# @!endgroup
|
276
276
|
|
277
277
|
##
|
278
|
-
# @!group Block of {
|
278
|
+
# @!group Block of {Anoubis::Data::Actions#edit edit} and {Anoubis::Data::Actions#update update} getters
|
279
279
|
|
280
280
|
##
|
281
|
-
# Get model that is used for {
|
281
|
+
# Get model that is used for {Anoubis::Data::Actions#edit edit} or {Anoubis::Data::Actions#update update} actions.
|
282
282
|
def get_edit_model
|
283
283
|
return self.etc.data.model if self.etc.data.model
|
284
284
|
self.etc.data.model = self.edit_model
|
@@ -287,8 +287,8 @@
|
|
287
287
|
end
|
288
288
|
|
289
289
|
##
|
290
|
-
# Get default eager load definition for {
|
291
|
-
# {
|
290
|
+
# Get default eager load definition for {Anoubis::Data::Actions#edit edit} or
|
291
|
+
# {Anoubis::Data::Actions#update update} actions.
|
292
292
|
def get_edit_eager_load
|
293
293
|
return self.etc.data.eager_load if self.etc.data.model
|
294
294
|
self.get_edit_model
|
@@ -296,8 +296,8 @@
|
|
296
296
|
end
|
297
297
|
|
298
298
|
##
|
299
|
-
# Return current table fields hash for {
|
300
|
-
# {
|
299
|
+
# Return current table fields hash for {Anoubis::Data::Actions#edit edit} or
|
300
|
+
# {Anoubis::Data::Actions#update update} actions.
|
301
301
|
# @return [Hash] current defined table fields
|
302
302
|
def get_edit_fields
|
303
303
|
self.setup_edit_fields
|
@@ -305,7 +305,7 @@
|
|
305
305
|
end
|
306
306
|
|
307
307
|
##
|
308
|
-
# Get table data for single row for {
|
308
|
+
# Get table data for single row for {Anoubis::Data::Actions#edit edit} or {Anoubis::Data::Actions#update update}
|
309
309
|
# actions.
|
310
310
|
# @param row [ActiveRecord] single row of model data
|
311
311
|
# @return [Hash] calculated hash of model row
|
@@ -328,10 +328,10 @@
|
|
328
328
|
# @!endgroup
|
329
329
|
|
330
330
|
##
|
331
|
-
# @!group Block of {
|
331
|
+
# @!group Block of {Anoubis::Data::Actions#new new} or {Anoubis::Data::Actions#create create} getters
|
332
332
|
|
333
333
|
##
|
334
|
-
# Return current table fields hash for {
|
334
|
+
# Return current table fields hash for {Anoubis::Data::Actions#new new} or {Anoubis::Data::Actions#create create}
|
335
335
|
# actions
|
336
336
|
# @return [Hash] current defined table fields
|
337
337
|
def get_new_fields
|
@@ -340,7 +340,7 @@
|
|
340
340
|
end
|
341
341
|
|
342
342
|
##
|
343
|
-
# Get table data for single row for {
|
343
|
+
# Get table data for single row for {Anoubis::Data::Actions#new new} or {Anoubis::Data::Actions#create create}
|
344
344
|
# actions.
|
345
345
|
# @param row [ActiveRecord] single row of model data
|
346
346
|
# @return [Hash] calculated hash of model row
|
@@ -435,7 +435,7 @@
|
|
435
435
|
|
436
436
|
##
|
437
437
|
# Returns permitted parameters. Parameters is got from standard parameters output and checks according
|
438
|
-
# by described {
|
438
|
+
# by described {Anoubis::Etc::Data#fields self.etc.data.fields}.
|
439
439
|
# @return [Hash<Symbol, string>] permitted paramters' collection
|
440
440
|
def get_permited_params
|
441
441
|
permit = []
|
@@ -469,7 +469,7 @@
|
|
469
469
|
|
470
470
|
##
|
471
471
|
# Get autocomplete data for field
|
472
|
-
# @param field [
|
472
|
+
# @param field [Anoubis::Etc::Field] - field for loading data
|
473
473
|
# @param value [String] - search value for load data
|
474
474
|
# @return [Hash] resulting hash for selected data
|
475
475
|
def get_autocomplete_data(field, value)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Anoubis
|
2
2
|
module Core
|
3
3
|
module Data
|
4
4
|
##
|
@@ -6,7 +6,7 @@ module Anubis
|
|
6
6
|
module Load
|
7
7
|
##
|
8
8
|
# Loads current menu data. Procedure loads menu data from MySQL database or from Redis cache and places it in
|
9
|
-
# self.etc.menu {
|
9
|
+
# self.etc.menu {Anoubis::Etc#menu}
|
10
10
|
def load_menu_data
|
11
11
|
|
12
12
|
end
|
@@ -69,7 +69,7 @@ module Anubis
|
|
69
69
|
|
70
70
|
##
|
71
71
|
# Load data for autocomplete action from database
|
72
|
-
# @param field [
|
72
|
+
# @param field [Anoubis::Etc::Field] - field for loading data
|
73
73
|
def load_autocomplete_data(field)
|
74
74
|
self.etc.data.data = field.model.model.where(field.model.where).where(field.autocomplete[:where]).where(get_tenant_where(field.model.model)).order(field.model.order).limit(field.autocomplete[:limit])
|
75
75
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Anoubis
|
2
2
|
module Core
|
3
3
|
module Data
|
4
4
|
##
|
@@ -14,7 +14,7 @@ module Anubis
|
|
14
14
|
# - 'update' - for update action
|
15
15
|
# - 'destroy' - for defstroy action
|
16
16
|
def set_parent_model(action = '')
|
17
|
-
self.etc.data =
|
17
|
+
self.etc.data = Anoubis::Etc::Data.new if !self.etc.data
|
18
18
|
self.etc.action = action if action != ''
|
19
19
|
self.set_current_tab
|
20
20
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Anoubis
|
2
2
|
##
|
3
3
|
# Module consists all procedures and functons of {DataController}
|
4
4
|
module Core
|
@@ -29,8 +29,8 @@ module Anubis
|
|
29
29
|
end
|
30
30
|
|
31
31
|
##
|
32
|
-
# Setups order for current tab. Parameters is set into {
|
33
|
-
# {
|
32
|
+
# Setups order for current tab. Parameters is set into {Anoubis::Etc::TabItem#sort self.etc.tab.sort} and
|
33
|
+
# {Anoubis::Etc::TabItem#order self.etc.tab.order} attributes.
|
34
34
|
def setup_order
|
35
35
|
sort = nil
|
36
36
|
first = nil
|
@@ -58,7 +58,7 @@ module Anubis
|
|
58
58
|
# @!group Block of fields setup functions
|
59
59
|
|
60
60
|
##
|
61
|
-
# Setups defined fields and places it into attribute {
|
61
|
+
# Setups defined fields and places it into attribute {Anoubis::Etc::Data#fields self.etc.data.fields}
|
62
62
|
def setup_fields
|
63
63
|
if !self.etc.data.fields
|
64
64
|
self.etc.data.fields = {}
|
@@ -71,7 +71,7 @@ module Anubis
|
|
71
71
|
fields[key][:editable] = fields[key][:edit]
|
72
72
|
end
|
73
73
|
end
|
74
|
-
self.etc.data.fields[key] =
|
74
|
+
self.etc.data.fields[key] = Anoubis::Etc::Field.new(key, self.get_model, fields[key].merge(action: self.etc.action))
|
75
75
|
end
|
76
76
|
self.setup_order if %w[index export].include? self.etc.action
|
77
77
|
end
|