anoubis 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/anoubis/application_controller.rb +4 -0
  3. data/app/controllers/anoubis/data/actions.rb +956 -0
  4. data/app/controllers/anoubis/data/callbacks.rb +66 -0
  5. data/app/controllers/anoubis/data/convert.rb +405 -0
  6. data/app/controllers/anoubis/data/defaults.rb +215 -0
  7. data/app/controllers/anoubis/data/get.rb +529 -0
  8. data/app/controllers/anoubis/data/load.rb +87 -0
  9. data/app/controllers/anoubis/data/set.rb +47 -0
  10. data/app/controllers/anoubis/data/setup.rb +102 -0
  11. data/app/controllers/anoubis/data_controller.rb +17 -1
  12. data/app/controllers/anoubis/output/basic.rb +1 -1
  13. data/app/controllers/anoubis/sso/server/login_controller.rb +5 -5
  14. data/app/controllers/anoubis/sso/server/user_controller.rb +2 -2
  15. data/app/models/anoubis/application_record.rb +7 -0
  16. data/config/locales/ru.yml +3 -2
  17. data/lib/anoubis/version.rb +1 -1
  18. metadata +11 -30
  19. data/app/controllers/anoubis/core/data/actions.rb +0 -962
  20. data/app/controllers/anoubis/core/data/callbacks.rb +0 -68
  21. data/app/controllers/anoubis/core/data/convert.rb +0 -407
  22. data/app/controllers/anoubis/core/data/defaults.rb +0 -217
  23. data/app/controllers/anoubis/core/data/get.rb +0 -531
  24. data/app/controllers/anoubis/core/data/load.rb +0 -89
  25. data/app/controllers/anoubis/core/data/set.rb +0 -49
  26. data/app/controllers/anoubis/core/data/setup.rb +0 -104
  27. data/app/controllers/anoubis/core/data_controller.rb +0 -28
  28. data/app/controllers/anoubis/sso/client/data/actions.rb +0 -5
  29. data/app/controllers/anoubis/sso/client/data/callbacks.rb +0 -5
  30. data/app/controllers/anoubis/sso/client/data/convert.rb +0 -5
  31. data/app/controllers/anoubis/sso/client/data/defaults.rb +0 -5
  32. data/app/controllers/anoubis/sso/client/data/get.rb +0 -5
  33. data/app/controllers/anoubis/sso/client/data/load.rb +0 -26
  34. data/app/controllers/anoubis/sso/client/data/set.rb +0 -5
  35. data/app/controllers/anoubis/sso/client/data/setup.rb +0 -5
  36. data/app/controllers/anoubis/sso/client/data_controller.rb +0 -21
  37. data/app/controllers/anoubis/tenant/data/actions.rb +0 -11
  38. data/app/controllers/anoubis/tenant/data/callbacks.rb +0 -11
  39. data/app/controllers/anoubis/tenant/data/convert.rb +0 -11
  40. data/app/controllers/anoubis/tenant/data/defaults.rb +0 -11
  41. data/app/controllers/anoubis/tenant/data/get.rb +0 -11
  42. data/app/controllers/anoubis/tenant/data/load.rb +0 -52
  43. data/app/controllers/anoubis/tenant/data/set.rb +0 -11
  44. data/app/controllers/anoubis/tenant/data/setup.rb +0 -11
  45. data/app/controllers/anoubis/tenant/data_controller.rb +0 -28
@@ -0,0 +1,102 @@
1
+ module Anoubis
2
+ ##
3
+ # Module consists all procedures and functons of {DataController}
4
+ module Data
5
+ ##
6
+ # Module setups system parameters for {DataController}
7
+ module Setup
8
+ ##
9
+ # Setups frame data information. It loads menu data, sets titles and tabs of the frame.
10
+ def setup_frame
11
+ self.load_menu_data
12
+ if self.etc.menu
13
+ self.get_parent_data
14
+ if self.etc.data.parent
15
+ self.output.title = self.etc.menu.page_title.sub '%{title}', self.etc.data.parent.sys_title.to_s
16
+ else
17
+ self.output.title = self.etc.menu.page_title
18
+ end
19
+ self.output.short = self.etc.menu.short_title
20
+ self.output.mode = self.etc.menu.mode
21
+ self.output.access = self.etc.menu.access
22
+ end
23
+ tabs = self.tabs
24
+ tabs.each do |key, item|
25
+ item = self.get_tab key, item
26
+ self.output.addTab(item)
27
+ end
28
+ end
29
+
30
+ ##
31
+ # Setups order for current tab. Parameters is set into {Anoubis::Etc::TabItem#sort self.etc.tab.sort} and
32
+ # {Anoubis::Etc::TabItem#order self.etc.tab.order} attributes.
33
+ def setup_order
34
+ sort = nil
35
+ first = nil
36
+ self.etc.data.fields.each do |key, field|
37
+ if field.order
38
+ first = key if !first
39
+ first = key if field.order.default
40
+ if params.key? :sort
41
+ sort = key if params[:sort] == key.to_s
42
+ end
43
+ end
44
+ end
45
+ sort = first if !sort
46
+ if sort
47
+ self.etc.tab.sort = sort.to_s
48
+ self.etc.tab.order = self.etc.data.fields[sort].order.order
49
+ if params.key? :order
50
+ self.etc.tab.order = :desc if params[:order] == 'desc'
51
+ self.etc.tab.order = :asc if params[:order] == 'asc'
52
+ end
53
+ end
54
+ end
55
+
56
+ ##
57
+ # @!group Block of fields setup functions
58
+
59
+ ##
60
+ # Setups defined fields and places it into attribute {Anoubis::Etc::Data#fields self.etc.data.fields}
61
+ def setup_fields
62
+ if !self.etc.data.fields
63
+ self.etc.data.fields = {}
64
+
65
+ fields = self.fields
66
+
67
+ fields.each_key do |key|
68
+ if fields[key].key? :edit
69
+ if self.menu_access fields[key][:edit], false
70
+ fields[key][:editable] = fields[key][:edit]
71
+ end
72
+ end
73
+ self.etc.data.fields[key] = Anoubis::Etc::Field.new(key, self.get_model, fields[key].merge(action: self.etc.action))
74
+ end
75
+ self.setup_order if %w[index export].include? self.etc.action
76
+ end
77
+ end
78
+
79
+ ##
80
+ # Setups additional parameters for table field with type 'datetime'
81
+ # Resulting data placed in {Etc::Data#fields self.etc.data.fields} (Hash)
82
+ # @param key [Symbol] key of table field.
83
+ def setup_fields_datetime (key)
84
+ self.etc.data.fields[key][:format] = 'full' if !self.etc.data.fields[key].has_key? :format
85
+ self.etc.data.fields[key][:format] = 'full' if !['full', 'month', 'date', 'datetime'].include? self.etc.data.fields[key][:format]
86
+ end
87
+
88
+
89
+
90
+ ##
91
+ # Setups additional parameters for table field with type 'float'
92
+ # Resulting data placed in {Etc::Data#fields self.etc.data.fields} (Hash)
93
+ # @param key [Symbol] key of table field.
94
+ def setup_fields_float (key)
95
+ self.etc.data.fields[key][:precision] = 2 if !self.etc.data.fields[key][:precision]
96
+ self.etc.data.fields[key][:point] = ',' if !self.etc.data.fields[key][:point]
97
+ self.etc.data.fields[key][:separator] = '' if !self.etc.data.fields[key][:separator]
98
+ end
99
+ # @!endgroup
100
+ end
101
+ end
102
+ end
@@ -1,5 +1,21 @@
1
+ require_dependency "anoubis/data/actions"
2
+ require_dependency "anoubis/data/load"
3
+ require_dependency "anoubis/data/get"
4
+ require_dependency "anoubis/data/set"
5
+ require_dependency "anoubis/data/setup"
6
+ require_dependency "anoubis/data/defaults"
7
+ require_dependency "anoubis/data/convert"
8
+ require_dependency "anoubis/data/callbacks"
9
+
1
10
  ##
2
11
  # Main data controller class
3
12
  class Anoubis::DataController < Anoubis::ApplicationController
4
-
13
+ include Anoubis::Data::Actions
14
+ include Anoubis::Data::Load
15
+ include Anoubis::Data::Get
16
+ include Anoubis::Data::Set
17
+ include Anoubis::Data::Setup
18
+ include Anoubis::Data::Defaults
19
+ include Anoubis::Data::Convert
20
+ include Anoubis::Data::Callbacks
5
21
  end
@@ -30,7 +30,7 @@ module Anoubis
30
30
  self.result = 0
31
31
  self.tab = ''
32
32
  self.messages = {
33
- '0': I18n.t('success'),
33
+ '0': I18n.t('anoubis.success'),
34
34
  '-1': I18n.t('errors.access_not_allowed'),
35
35
  '-2': I18n.t('errors.incorrect_parameters')
36
36
  }
@@ -23,7 +23,7 @@ class Anoubis::Sso::Server::LoginController < Anoubis::Sso::Server::ApplicationC
23
23
 
24
24
  result = {
25
25
  result: 0,
26
- message: I18n.t('core.success')
26
+ message: I18n.t('anoubis.success')
27
27
  }
28
28
  code = 200
29
29
 
@@ -107,7 +107,7 @@ class Anoubis::Sso::Server::LoginController < Anoubis::Sso::Server::ApplicationC
107
107
  def create
108
108
  result = {
109
109
  result: 0,
110
- message: I18n.t('core.success')
110
+ message: I18n.t('anoubis.success')
111
111
  }
112
112
  code = 200
113
113
 
@@ -155,7 +155,7 @@ class Anoubis::Sso::Server::LoginController < Anoubis::Sso::Server::ApplicationC
155
155
  def update
156
156
  result = {
157
157
  result: 0,
158
- message: I18n.t('core.success')
158
+ message: I18n.t('anoubis.success')
159
159
  }
160
160
 
161
161
  if self.system
@@ -213,7 +213,7 @@ class Anoubis::Sso::Server::LoginController < Anoubis::Sso::Server::ApplicationC
213
213
  def destroy
214
214
  result = {
215
215
  result: 0,
216
- message: I18n.t('core.success')
216
+ message: I18n.t('anoubis.success')
217
217
  }
218
218
 
219
219
  begin
@@ -263,7 +263,7 @@ class Anoubis::Sso::Server::LoginController < Anoubis::Sso::Server::ApplicationC
263
263
  def show
264
264
  result = {
265
265
  result: 0,
266
- message: I18n.t('core.success')
266
+ message: I18n.t('anoubis.success')
267
267
  }
268
268
 
269
269
  if self.system
@@ -6,7 +6,7 @@ class Anoubis::Sso::Server::UserController < Anoubis::Sso::Server::ApplicationCo
6
6
  def show
7
7
  result = {
8
8
  result: 0,
9
- message: I18n.t('anubis.core.success')
9
+ message: I18n.t('anoubis.success')
10
10
  }
11
11
  code = 200
12
12
 
@@ -25,7 +25,7 @@ class Anoubis::Sso::Server::UserController < Anoubis::Sso::Server::ApplicationCo
25
25
  def update
26
26
  result = {
27
27
  result: 0,
28
- message: I18n.t('anubis.core.success')
28
+ message: I18n.t('anoubis.success')
29
29
  }
30
30
  code = 200
31
31
 
@@ -123,4 +123,11 @@ class Anoubis::ApplicationRecord < ActiveRecord::Base
123
123
  end
124
124
  result
125
125
  end
126
+
127
+ ##
128
+ # Returns system title of table element
129
+ # @return [String] System title
130
+ def sys_title
131
+ id.to_s
132
+ end
126
133
  end
@@ -39,6 +39,8 @@ ru:
39
39
  all: "Все"
40
40
  success: "Успешное завершение"
41
41
  error: "Ошибка"
42
+ default_tab: "Основная"
43
+ default_tab_hint: "Это основная вкладка"
42
44
  errors:
43
45
  incorrect_login: "Некорректный логин или пароль"
44
46
  session_expired: "Сессия завершена"
@@ -66,8 +68,7 @@ ru:
66
68
  incorrect_parameters: Некорректные параметры
67
69
  error_changing_data: Ошибка изменения данных
68
70
 
69
- default_tab: Основная
70
- default_tab_hint: Это основная вкладка
71
+
71
72
  months:
72
73
  main:
73
74
  - Январь
@@ -1,5 +1,5 @@
1
1
  module Anoubis
2
2
  ##
3
3
  # Anoubis current version
4
- VERSION = '1.0.7'
4
+ VERSION = '1.0.8'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anoubis
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Ryabov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-21 00:00:00.000000000 Z
11
+ date: 2022-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -149,18 +149,17 @@ files:
149
149
  - Rakefile
150
150
  - app/controllers/anoubis/application_controller.rb
151
151
  - app/controllers/anoubis/core/application_controller.rb
152
- - app/controllers/anoubis/core/data/actions.rb
153
- - app/controllers/anoubis/core/data/callbacks.rb
154
- - app/controllers/anoubis/core/data/convert.rb
155
- - app/controllers/anoubis/core/data/defaults.rb
156
- - app/controllers/anoubis/core/data/get.rb
157
- - app/controllers/anoubis/core/data/load.rb
158
- - app/controllers/anoubis/core/data/set.rb
159
- - app/controllers/anoubis/core/data/setup.rb
160
- - app/controllers/anoubis/core/data_controller.rb
161
152
  - app/controllers/anoubis/core/index/actions.rb
162
153
  - app/controllers/anoubis/core/index/callbacks.rb
163
154
  - app/controllers/anoubis/core/index_controller.rb
155
+ - app/controllers/anoubis/data/actions.rb
156
+ - app/controllers/anoubis/data/callbacks.rb
157
+ - app/controllers/anoubis/data/convert.rb
158
+ - app/controllers/anoubis/data/defaults.rb
159
+ - app/controllers/anoubis/data/get.rb
160
+ - app/controllers/anoubis/data/load.rb
161
+ - app/controllers/anoubis/data/set.rb
162
+ - app/controllers/anoubis/data/setup.rb
164
163
  - app/controllers/anoubis/data_controller.rb
165
164
  - app/controllers/anoubis/etc.rb
166
165
  - app/controllers/anoubis/etc/base.rb
@@ -183,15 +182,6 @@ files:
183
182
  - app/controllers/anoubis/output/menu.rb
184
183
  - app/controllers/anoubis/output/update.rb
185
184
  - app/controllers/anoubis/sso/client/application_controller.rb
186
- - app/controllers/anoubis/sso/client/data/actions.rb
187
- - app/controllers/anoubis/sso/client/data/callbacks.rb
188
- - app/controllers/anoubis/sso/client/data/convert.rb
189
- - app/controllers/anoubis/sso/client/data/defaults.rb
190
- - app/controllers/anoubis/sso/client/data/get.rb
191
- - app/controllers/anoubis/sso/client/data/load.rb
192
- - app/controllers/anoubis/sso/client/data/set.rb
193
- - app/controllers/anoubis/sso/client/data/setup.rb
194
- - app/controllers/anoubis/sso/client/data_controller.rb
195
185
  - app/controllers/anoubis/sso/client/index/actions.rb
196
186
  - app/controllers/anoubis/sso/client/index/callbacks.rb
197
187
  - app/controllers/anoubis/sso/client/index_controller.rb
@@ -199,15 +189,6 @@ files:
199
189
  - app/controllers/anoubis/sso/server/login_controller.rb
200
190
  - app/controllers/anoubis/sso/server/user_controller.rb
201
191
  - app/controllers/anoubis/tenant/application_controller.rb
202
- - app/controllers/anoubis/tenant/data/actions.rb
203
- - app/controllers/anoubis/tenant/data/callbacks.rb
204
- - app/controllers/anoubis/tenant/data/convert.rb
205
- - app/controllers/anoubis/tenant/data/defaults.rb
206
- - app/controllers/anoubis/tenant/data/get.rb
207
- - app/controllers/anoubis/tenant/data/load.rb
208
- - app/controllers/anoubis/tenant/data/set.rb
209
- - app/controllers/anoubis/tenant/data/setup.rb
210
- - app/controllers/anoubis/tenant/data_controller.rb
211
192
  - app/controllers/anoubis/tenant/index/actions.rb
212
193
  - app/controllers/anoubis/tenant/index/callbacks.rb
213
194
  - app/controllers/anoubis/tenant/index_controller.rb
@@ -340,7 +321,7 @@ metadata:
340
321
  homepage_uri: https://github.com/RA-Company/
341
322
  source_code_uri: https://github.com/RA-Company/anoubis
342
323
  changelog_uri: https://github.com/RA-Company/anoubis/blob/main/CHANGELOG.md
343
- documentation_uri: https://www.rubydoc.info/gems/anoubis/1.0.7
324
+ documentation_uri: https://www.rubydoc.info/gems/anoubis/1.0.8
344
325
  post_install_message:
345
326
  rdoc_options: []
346
327
  require_paths: