pg_rails 7.0.6 → 7.0.7

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.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -0
  3. data/pg_associable/lib/pg_associable/engine.rb +0 -4
  4. data/pg_associable/spec/pg_associable/helpers_spec.rb +4 -3
  5. data/pg_engine/app/admin/accounts.rb +25 -0
  6. data/pg_engine/{lib/templates/activeadmin → app/admin}/audits.rb +3 -3
  7. data/pg_engine/app/admin/dashboard.rb +34 -0
  8. data/pg_engine/app/admin/user_accounts.rb +26 -0
  9. data/pg_engine/{lib/templates/activeadmin → app/admin}/users.rb +1 -2
  10. data/pg_engine/app/assets/javascripts/active_admin.js +1 -0
  11. data/pg_engine/app/assets/stylesheets/active_admin.scss +17 -0
  12. data/pg_engine/app/controllers/admin/accounts_controller.rb +33 -0
  13. data/pg_engine/app/controllers/admin/user_accounts_controller.rb +33 -0
  14. data/pg_engine/app/controllers/admin/users_controller.rb +47 -0
  15. data/pg_engine/app/controllers/pg_engine/resource_helper.rb +1 -0
  16. data/pg_engine/app/decorators/account_decorator.rb +16 -0
  17. data/pg_engine/app/decorators/user_account_decorator.rb +19 -0
  18. data/pg_engine/app/decorators/user_decorator.rb +20 -0
  19. data/pg_engine/app/helpers/pg_engine/flash_helper.rb +1 -1
  20. data/pg_engine/app/models/account.rb +39 -0
  21. data/pg_engine/app/models/user.rb +61 -0
  22. data/pg_engine/app/models/user_account.rb +46 -0
  23. data/pg_engine/app/policies/account_policy.rb +31 -0
  24. data/pg_engine/app/policies/pg_engine/application_policy.rb +1 -1
  25. data/pg_engine/app/policies/user_account_policy.rb +31 -0
  26. data/pg_engine/app/policies/user_policy.rb +31 -0
  27. data/pg_engine/app/views/admin/accounts/_account.html.slim +1 -0
  28. data/pg_engine/app/views/admin/accounts/_form.html.slim +12 -0
  29. data/pg_engine/app/views/admin/accounts/edit.html.slim +5 -0
  30. data/pg_engine/app/views/admin/accounts/new.html.slim +5 -0
  31. data/pg_engine/app/views/admin/accounts/show.html.slim +27 -0
  32. data/pg_engine/app/views/admin/user_accounts/_form.html.slim +12 -0
  33. data/pg_engine/app/views/admin/user_accounts/_user_account.html.slim +1 -0
  34. data/pg_engine/app/views/admin/user_accounts/edit.html.slim +5 -0
  35. data/pg_engine/app/views/admin/user_accounts/new.html.slim +5 -0
  36. data/pg_engine/app/views/admin/user_accounts/show.html.slim +24 -0
  37. data/pg_engine/app/views/admin/users/_form.html.slim +12 -0
  38. data/pg_engine/app/views/admin/users/_user.html.slim +1 -0
  39. data/pg_engine/app/views/admin/users/edit.html.slim +5 -0
  40. data/pg_engine/app/views/admin/users/new.html.slim +5 -0
  41. data/pg_engine/app/views/admin/users/show.html.slim +27 -0
  42. data/pg_engine/config/initializers/active_admin.rb +355 -0
  43. data/pg_engine/config/initializers/devise.rb +313 -0
  44. data/pg_engine/config/locales/devise.en.yml +65 -0
  45. data/pg_engine/config/routes.rb +11 -0
  46. data/pg_engine/db/migrate/20240205194218_devise_create_users.rb +47 -0
  47. data/pg_engine/db/migrate/20240208234111_unaccent.rb +5 -0
  48. data/pg_engine/db/migrate/20240208234901_install_audited.rb +32 -0
  49. data/pg_engine/db/migrate/20240210025702_create_active_admin_comments.rb +16 -0
  50. data/pg_engine/db/migrate/20240211152951_create_accounts.rb +24 -0
  51. data/pg_engine/db/migrate/20240211153049_create_user_accounts.rb +20 -0
  52. data/pg_engine/db/seeds.rb +5 -0
  53. data/pg_engine/lib/pg_engine/engine.rb +16 -2
  54. data/pg_engine/spec/controllers/admin/accounts_controller_spec.rb +206 -0
  55. data/pg_engine/spec/controllers/admin/user_accounts_controller_spec.rb +189 -0
  56. data/pg_engine/spec/controllers/admin/users_controller_spec.rb +180 -0
  57. data/pg_engine/spec/factories/accounts.rb +11 -0
  58. data/pg_engine/spec/factories/user_accounts.rb +21 -0
  59. data/pg_engine/spec/factories/users.rb +59 -0
  60. data/pg_engine/spec/models/account_spec.rb +13 -0
  61. data/pg_engine/spec/models/user_account_spec.rb +13 -0
  62. data/pg_engine/spec/models/user_spec.rb +13 -0
  63. data/pg_layout/lib/pg_layout/engine.rb +0 -1
  64. data/pg_rails/lib/version.rb +1 -1
  65. data/pg_scaffold/lib/generators/pg_pundit/templates/policy.rb +1 -1
  66. data/pg_scaffold/lib/generators/pg_rspec/scaffold/templates/controller_spec.rb +4 -4
  67. data/pg_scaffold/spec/generators_spec.rb +1 -1
  68. metadata +56 -4
@@ -0,0 +1,27 @@
1
+ - content_for :title do
2
+ = @account.to_s
3
+ - content_for :actions do
4
+ = @account.destroy_link
5
+ .ms-1
6
+ = @account.edit_link
7
+
8
+ table.table.table-borderless.table-sm.w-auto.mb-0.m-3
9
+ - atributos_para_mostrar.each do |att|
10
+ tr
11
+ th = @clase_modelo.human_attribute_name(att)
12
+ td = @account.send(att)
13
+ tr
14
+ th = t('attributes.creado_por')
15
+ td = @account.creado_por
16
+ tr
17
+ th = t('attributes.created_at')
18
+ td = @account.created_at
19
+ tr
20
+ th = t('attributes.actualizado_por')
21
+ td = @account.actualizado_por
22
+ tr
23
+ th = t('attributes.updated_at')
24
+ td = @account.updated_at
25
+ tr
26
+ th = t('attributes.discarded_at')
27
+ td = @account.discarded_at
@@ -0,0 +1,12 @@
1
+ / # locals: (object: nil, asociable: false)
2
+
3
+ div style="max-width: 300px"
4
+ = pg_form_for(@user_account || object) do |f|
5
+ = f.mensajes_de_error
6
+
7
+ = hidden_field_tag :asociable, true if asociable
8
+ = f.pg_associable_inline :user
9
+ = f.pg_associable_inline :account
10
+ = f.input :profiles
11
+ .mt-2
12
+ = f.button :submit
@@ -0,0 +1,5 @@
1
+ - content_for :title do
2
+ | Modificar #{@clase_modelo.nombre_singular.downcase}
3
+
4
+ .p-3
5
+ = render 'form'
@@ -0,0 +1,5 @@
1
+ - content_for :title do
2
+ | Crear #{@clase_modelo.nombre_singular.downcase}
3
+
4
+ .p-3
5
+ = render 'form'
@@ -0,0 +1,24 @@
1
+ - content_for :title do
2
+ = @user_account.to_s
3
+ - content_for :actions do
4
+ = @user_account.destroy_link
5
+ .ms-1
6
+ = @user_account.edit_link
7
+
8
+ table.table.table-borderless.table-sm.w-auto.mb-0.m-3
9
+ - atributos_para_mostrar.each do |att|
10
+ tr
11
+ th = @clase_modelo.human_attribute_name(att)
12
+ td = @user_account.send(att)
13
+ tr
14
+ th = t('attributes.creado_por')
15
+ td = @user_account.creado_por
16
+ tr
17
+ th = t('attributes.created_at')
18
+ td = @user_account.created_at
19
+ tr
20
+ th = t('attributes.actualizado_por')
21
+ td = @user_account.actualizado_por
22
+ tr
23
+ th = t('attributes.updated_at')
24
+ td = @user_account.updated_at
@@ -0,0 +1,12 @@
1
+ / # locals: (object: nil, asociable: false)
2
+
3
+ div style="max-width: 300px"
4
+ = pg_form_for(@user || object) do |f|
5
+ = f.mensajes_de_error
6
+
7
+ = hidden_field_tag :asociable, true if asociable
8
+ = f.input :email
9
+ = f.input :password, required: false, hint: 'Si se deja en blanco no se cambia'
10
+ = f.input :developer
11
+ .mt-2
12
+ = f.button :submit
@@ -0,0 +1 @@
1
+ h1 el partiaaal
@@ -0,0 +1,5 @@
1
+ - content_for :title do
2
+ | Modificar #{@clase_modelo.nombre_singular.downcase}
3
+
4
+ .p-3
5
+ = render 'form'
@@ -0,0 +1,5 @@
1
+ - content_for :title do
2
+ | Crear #{@clase_modelo.nombre_singular.downcase}
3
+
4
+ .p-3
5
+ = render 'form'
@@ -0,0 +1,27 @@
1
+ - content_for :title do
2
+ = @user.to_s
3
+ - content_for :actions do
4
+ = @user.destroy_link
5
+ .ms-1
6
+ = @user.edit_link
7
+
8
+ table.table.table-borderless.table-sm.w-auto.mb-0.m-3
9
+ - atributos_para_mostrar.each do |att|
10
+ tr
11
+ th = @clase_modelo.human_attribute_name(att)
12
+ td = @user.send(att)
13
+ / tr
14
+ th = t('attributes.creado_por')
15
+ td = @user.creado_por
16
+ tr
17
+ th = t('attributes.created_at')
18
+ td = @user.created_at
19
+ / tr
20
+ th = t('attributes.actualizado_por')
21
+ td = @user.actualizado_por
22
+ tr
23
+ th = t('attributes.updated_at')
24
+ td = @user.updated_at
25
+ tr
26
+ th = t('attributes.discarded_at')
27
+ td = @user.discarded_at
@@ -0,0 +1,355 @@
1
+ ActiveAdmin.setup do |config|
2
+ # == Site Title
3
+ #
4
+ # Set the title that is displayed on the main layout
5
+ # for each of the active admin pages.
6
+ #
7
+ config.site_title = "PgRails"
8
+
9
+ # Set the link url for the title. For example, to take
10
+ # users to your main site. Defaults to no link.
11
+ #
12
+ config.site_title_link = "/"
13
+
14
+ # Set an optional image to be displayed for the header
15
+ # instead of a string (overrides :site_title)
16
+ #
17
+ # Note: Aim for an image that's 21px high so it fits in the header.
18
+ #
19
+ # config.site_title_image = "logo.png"
20
+
21
+ # == Load Paths
22
+ #
23
+ # By default Active Admin files go inside app/admin/.
24
+ # You can change this directory.
25
+ #
26
+ # eg:
27
+ # config.load_paths = [File.join(Rails.root, 'app', 'ui')]
28
+ #
29
+ # Or, you can also load more directories.
30
+ # Useful when setting namespaces with users that are not your main AdminUser entity.
31
+ #
32
+ # eg:
33
+ # config.load_paths = [
34
+ # File.join(Rails.root, 'app', 'admin'),
35
+ # File.join(Rails.root, 'app', 'cashier')
36
+ # ]
37
+ config.load_paths = [
38
+ File.join(Rails.root, 'app', 'admin'),
39
+ File.join(PgEngine::Engine.root, 'app', 'admin')
40
+ ]
41
+ # == Default Namespace
42
+ #
43
+ # Set the default namespace each administration resource
44
+ # will be added to.
45
+ #
46
+ # eg:
47
+ config.default_namespace = :active_admin
48
+ #
49
+ # This will create resources in the HelloWorld module and
50
+ # will namespace routes to /hello_world/*
51
+ #
52
+ # To set no namespace by default, use:
53
+ # config.default_namespace = false
54
+ #
55
+ # Default:
56
+ # config.default_namespace = :admin
57
+ #
58
+ # You can customize the settings for each namespace by using
59
+ # a namespace block. For example, to change the site title
60
+ # within a namespace:
61
+ #
62
+ # config.namespace :admin do |admin|
63
+ # admin.site_title = "Custom Admin Title"
64
+ # end
65
+ #
66
+ # This will ONLY change the title for the admin section. Other
67
+ # namespaces will continue to use the main "site_title" configuration.
68
+
69
+ # == User Authentication
70
+ #
71
+ # Active Admin will automatically call an authentication
72
+ # method in a before filter of all controller actions to
73
+ # ensure that there is a currently logged in admin user.
74
+ #
75
+ # This setting changes the method which Active Admin calls
76
+ # within the application controller.
77
+ config.authentication_method = :authenticate_user!
78
+
79
+ # == User Authorization
80
+ #
81
+ # Active Admin will automatically call an authorization
82
+ # method in a before filter of all controller actions to
83
+ # ensure that there is a user with proper rights. You can use
84
+ # CanCanAdapter or make your own. Please refer to documentation.
85
+ # config.authorization_adapter = ActiveAdmin::CanCanAdapter
86
+
87
+ # In case you prefer Pundit over other solutions you can here pass
88
+ # the name of default policy class. This policy will be used in every
89
+ # case when Pundit is unable to find suitable policy.
90
+ # config.pundit_default_policy = "MyDefaultPunditPolicy"
91
+
92
+ # If you wish to maintain a separate set of Pundit policies for admin
93
+ # resources, you may set a namespace here that Pundit will search
94
+ # within when looking for a resource's policy.
95
+ # config.pundit_policy_namespace = :admin
96
+
97
+ # You can customize your CanCan Ability class name here.
98
+ # config.cancan_ability_class = "Ability"
99
+
100
+ # You can specify a method to be called on unauthorized access.
101
+ # This is necessary in order to prevent a redirect loop which happens
102
+ # because, by default, user gets redirected to Dashboard. If user
103
+ # doesn't have access to Dashboard, he'll end up in a redirect loop.
104
+ # Method provided here should be defined in application_controller.rb.
105
+ # config.on_unauthorized_access = :access_denied
106
+
107
+ # == Current User
108
+ #
109
+ # Active Admin will associate actions with the current
110
+ # user performing them.
111
+ #
112
+ # This setting changes the method which Active Admin calls
113
+ # (within the application controller) to return the currently logged in user.
114
+ config.current_user_method = :current_user
115
+
116
+ # == Logging Out
117
+ #
118
+ # Active Admin displays a logout link on each screen. These
119
+ # settings configure the location and method used for the link.
120
+ #
121
+ # This setting changes the path where the link points to. If it's
122
+ # a string, the strings is used as the path. If it's a Symbol, we
123
+ # will call the method to return the path.
124
+ #
125
+ # Default:
126
+ config.logout_link_path = :destroy_user_session_path
127
+
128
+ # This setting changes the http method used when rendering the
129
+ # link. For example :get, :delete, :put, etc..
130
+ #
131
+ # Default:
132
+ config.logout_link_method = :delete
133
+
134
+ # == Root
135
+ #
136
+ # Set the action to call for the root path. You can set different
137
+ # roots for each namespace.
138
+ #
139
+ # Default:
140
+ # config.root_to = 'dashboard#index'
141
+
142
+ # == Admin Comments
143
+ #
144
+ # This allows your users to comment on any resource registered with Active Admin.
145
+ #
146
+ # You can completely disable comments:
147
+ # config.comments = false
148
+ #
149
+ # You can change the name under which comments are registered:
150
+ # config.comments_registration_name = 'AdminComment'
151
+ #
152
+ # You can change the order for the comments and you can change the column
153
+ # to be used for ordering:
154
+ # config.comments_order = 'created_at ASC'
155
+ #
156
+ # You can disable the menu item for the comments index page:
157
+ # config.comments_menu = false
158
+ #
159
+ # You can customize the comment menu:
160
+ # config.comments_menu = { parent: 'Admin', priority: 1 }
161
+
162
+ # == Batch Actions
163
+ #
164
+ # Enable and disable Batch Actions
165
+ #
166
+ config.batch_actions = true
167
+
168
+ # == Controller Filters
169
+ #
170
+ # You can add before, after and around filters to all of your
171
+ # Active Admin resources and pages from here.
172
+ #
173
+ # config.before_action :do_something_awesome
174
+
175
+ # == Attribute Filters
176
+ #
177
+ # You can exclude possibly sensitive model attributes from being displayed,
178
+ # added to forms, or exported by default by ActiveAdmin
179
+ #
180
+ config.filter_attributes = [:encrypted_password, :password, :password_confirmation]
181
+
182
+ # == Localize Date/Time Format
183
+ #
184
+ # Set the localize format to display dates and times.
185
+ # To understand how to localize your app with I18n, read more at
186
+ # https://guides.rubyonrails.org/i18n.html
187
+ #
188
+ # You can run `bin/rails runner 'puts I18n.t("date.formats")'` to see the
189
+ # available formats in your application.
190
+ #
191
+ config.localize_format = :long
192
+
193
+ # == Setting a Favicon
194
+ #
195
+ # config.favicon = 'favicon.ico'
196
+
197
+ # == Meta Tags
198
+ #
199
+ # Add additional meta tags to the head element of active admin pages.
200
+ #
201
+ # Add tags to all pages logged in users see:
202
+ # config.meta_tags = { author: 'My Company' }
203
+
204
+ # By default, sign up/sign in/recover password pages are excluded
205
+ # from showing up in search engine results by adding a robots meta
206
+ # tag. You can reset the hash of meta tags included in logged out
207
+ # pages:
208
+ # config.meta_tags_for_logged_out_pages = {}
209
+
210
+ # == Removing Breadcrumbs
211
+ #
212
+ # Breadcrumbs are enabled by default. You can customize them for individual
213
+ # resources or you can disable them globally from here.
214
+ #
215
+ # config.breadcrumb = false
216
+
217
+ # == Create Another Checkbox
218
+ #
219
+ # Create another checkbox is disabled by default. You can customize it for individual
220
+ # resources or you can enable them globally from here.
221
+ #
222
+ # config.create_another = true
223
+
224
+ # == Register Stylesheets & Javascripts
225
+ #
226
+ # We recommend using the built in Active Admin layout and loading
227
+ # up your own stylesheets / javascripts to customize the look
228
+ # and feel.
229
+ #
230
+ # To load a stylesheet:
231
+ # config.register_stylesheet 'my_stylesheet.css'
232
+ #
233
+ # You can provide an options hash for more control, which is passed along to stylesheet_link_tag():
234
+ # config.register_stylesheet 'my_print_stylesheet.css', media: :print
235
+ #
236
+ # To load a javascript file:
237
+ # config.register_javascript 'my_javascript.js'
238
+
239
+ # == CSV options
240
+ #
241
+ # Set the CSV builder separator
242
+ # config.csv_options = { col_sep: ';' }
243
+ #
244
+ # Force the use of quotes
245
+ # config.csv_options = { force_quotes: true }
246
+
247
+ # == Menu System
248
+ #
249
+ # You can add a navigation menu to be used in your application, or configure a provided menu
250
+ #
251
+ # To change the default utility navigation to show a link to your website & a logout btn
252
+ #
253
+ # config.namespace :admin do |admin|
254
+ # admin.build_menu :utility_navigation do |menu|
255
+ # menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
256
+ # admin.add_logout_button_to_menu menu
257
+ # end
258
+ # end
259
+ #
260
+ # If you wanted to add a static menu item to the default menu provided:
261
+ #
262
+ # config.namespace :admin do |admin|
263
+ # admin.build_menu :default do |menu|
264
+ # menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
265
+ # end
266
+ # end
267
+
268
+ # == Download Links
269
+ #
270
+ # You can disable download links on resource listing pages,
271
+ # or customize the formats shown per namespace/globally
272
+ #
273
+ # To disable/customize for the :admin namespace:
274
+ #
275
+ # config.namespace :admin do |admin|
276
+ #
277
+ # # Disable the links entirely
278
+ # admin.download_links = false
279
+ #
280
+ # # Only show XML & PDF options
281
+ # admin.download_links = [:xml, :pdf]
282
+ #
283
+ # # Enable/disable the links based on block
284
+ # # (for example, with cancan)
285
+ # admin.download_links = proc { can?(:view_download_links) }
286
+ #
287
+ # end
288
+
289
+ # == Pagination
290
+ #
291
+ # Pagination is enabled by default for all resources.
292
+ # You can control the default per page count for all resources here.
293
+ #
294
+ # config.default_per_page = 30
295
+ #
296
+ # You can control the max per page count too.
297
+ #
298
+ # config.max_per_page = 10_000
299
+
300
+ # == Filters
301
+ #
302
+ # By default the index screen includes a "Filters" sidebar on the right
303
+ # hand side with a filter for each attribute of the registered model.
304
+ # You can enable or disable them for all resources here.
305
+ #
306
+ # config.filters = true
307
+ #
308
+ # By default the filters include associations in a select, which means
309
+ # that every record will be loaded for each association (up
310
+ # to the value of config.maximum_association_filter_arity).
311
+ # You can enabled or disable the inclusion
312
+ # of those filters by default here.
313
+ #
314
+ # config.include_default_association_filters = true
315
+
316
+ # config.maximum_association_filter_arity = 256 # default value of :unlimited will change to 256 in a future version
317
+ # config.filter_columns_for_large_association = [
318
+ # :display_name,
319
+ # :full_name,
320
+ # :name,
321
+ # :username,
322
+ # :login,
323
+ # :title,
324
+ # :email,
325
+ # ]
326
+ # config.filter_method_for_large_association = '_start'
327
+
328
+ # == Head
329
+ #
330
+ # You can add your own content to the site head like analytics. Make sure
331
+ # you only pass content you trust.
332
+ #
333
+ # config.head = ''.html_safe
334
+
335
+ # == Footer
336
+ #
337
+ # By default, the footer shows the current Active Admin version. You can
338
+ # override the content of the footer here.
339
+ #
340
+ # config.footer = 'my custom footer text'
341
+
342
+ # == Sorting
343
+ #
344
+ # By default ActiveAdmin::OrderClause is used for sorting logic
345
+ # You can inherit it with own class and inject it for all resources
346
+ #
347
+ # config.order_clause = MyOrderClause
348
+
349
+ # == Webpacker
350
+ #
351
+ # By default, Active Admin uses Sprocket's asset pipeline.
352
+ # You can switch to using Webpacker here.
353
+ #
354
+ # config.use_webpacker = true
355
+ end