pg_rails 7.0.6 → 7.0.8.pre.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -0
  3. data/pg_associable/app/assets/{css → stylesheets}/pg_associable.scss +1 -1
  4. data/pg_associable/app/helpers/pg_associable/form_builder_methods.rb +2 -19
  5. data/pg_associable/app/helpers/pg_associable/helpers.rb +2 -1
  6. data/pg_associable/app/inputs/pg_associable_input.rb +53 -0
  7. data/pg_associable/app/javascript/asociable_controller.tsx +171 -0
  8. data/pg_associable/app/{assets/js → javascript}/modal_controller.js +6 -3
  9. data/pg_associable/app/views/pg_associable/_resultados.html.slim +3 -1
  10. data/pg_associable/app/views/pg_associable/_resultados_inline.html.slim +5 -2
  11. data/pg_associable/index.js +2 -4
  12. data/pg_associable/lib/pg_associable/engine.rb +0 -8
  13. data/pg_associable/spec/pg_associable/helpers_spec.rb +4 -3
  14. data/pg_engine/app/admin/accounts.rb +25 -0
  15. data/pg_engine/{lib/templates/activeadmin → app/admin}/audits.rb +3 -3
  16. data/pg_engine/app/admin/dashboard.rb +34 -0
  17. data/pg_engine/app/admin/user_accounts.rb +26 -0
  18. data/pg_engine/{lib/templates/activeadmin → app/admin}/users.rb +1 -2
  19. data/pg_engine/app/assets/javascripts/active_admin.js +1 -0
  20. data/pg_engine/app/assets/stylesheets/active_admin.scss +17 -0
  21. data/pg_engine/app/controllers/admin/accounts_controller.rb +33 -0
  22. data/pg_engine/app/controllers/admin/user_accounts_controller.rb +33 -0
  23. data/pg_engine/app/controllers/admin/users_controller.rb +47 -0
  24. data/pg_engine/app/controllers/pg_engine/resource_helper.rb +1 -0
  25. data/pg_engine/app/decorators/account_decorator.rb +16 -0
  26. data/pg_engine/app/decorators/user_account_decorator.rb +19 -0
  27. data/pg_engine/app/decorators/user_decorator.rb +20 -0
  28. data/pg_engine/app/helpers/pg_engine/flash_helper.rb +1 -1
  29. data/pg_engine/app/models/account.rb +39 -0
  30. data/pg_engine/app/models/user.rb +61 -0
  31. data/pg_engine/app/models/user_account.rb +46 -0
  32. data/pg_engine/app/policies/account_policy.rb +31 -0
  33. data/pg_engine/app/policies/pg_engine/application_policy.rb +1 -1
  34. data/pg_engine/app/policies/user_account_policy.rb +31 -0
  35. data/pg_engine/app/policies/user_policy.rb +31 -0
  36. data/pg_engine/app/views/admin/accounts/_account.html.slim +1 -0
  37. data/pg_engine/app/views/admin/accounts/_form.html.slim +12 -0
  38. data/pg_engine/app/views/admin/accounts/edit.html.slim +5 -0
  39. data/pg_engine/app/views/admin/accounts/new.html.slim +5 -0
  40. data/pg_engine/app/views/admin/accounts/show.html.slim +27 -0
  41. data/pg_engine/app/views/admin/user_accounts/_form.html.slim +12 -0
  42. data/pg_engine/app/views/admin/user_accounts/_user_account.html.slim +1 -0
  43. data/pg_engine/app/views/admin/user_accounts/edit.html.slim +5 -0
  44. data/pg_engine/app/views/admin/user_accounts/new.html.slim +5 -0
  45. data/pg_engine/app/views/admin/user_accounts/show.html.slim +24 -0
  46. data/pg_engine/app/views/admin/users/_form.html.slim +12 -0
  47. data/pg_engine/app/views/admin/users/_user.html.slim +1 -0
  48. data/pg_engine/app/views/admin/users/edit.html.slim +5 -0
  49. data/pg_engine/app/views/admin/users/new.html.slim +5 -0
  50. data/pg_engine/app/views/admin/users/show.html.slim +27 -0
  51. data/pg_engine/config/initializers/active_admin.rb +352 -0
  52. data/pg_engine/config/initializers/devise.rb +313 -0
  53. data/pg_engine/config/locales/devise.en.yml +65 -0
  54. data/pg_engine/config/routes.rb +11 -0
  55. data/pg_engine/db/migrate/20240205194218_devise_create_users.rb +47 -0
  56. data/pg_engine/db/migrate/20240208234111_unaccent.rb +5 -0
  57. data/pg_engine/db/migrate/20240208234901_install_audited.rb +32 -0
  58. data/pg_engine/db/migrate/20240210025702_create_active_admin_comments.rb +16 -0
  59. data/pg_engine/db/migrate/20240211152951_create_accounts.rb +24 -0
  60. data/pg_engine/db/migrate/20240211153049_create_user_accounts.rb +20 -0
  61. data/pg_engine/db/seeds.rb +8 -0
  62. data/pg_engine/lib/pg_engine/engine.rb +16 -2
  63. data/pg_engine/lib/tasks/auto_anotar_modelos.rake +1 -1
  64. data/pg_engine/spec/controllers/admin/accounts_controller_spec.rb +206 -0
  65. data/pg_engine/spec/controllers/admin/user_accounts_controller_spec.rb +189 -0
  66. data/pg_engine/spec/controllers/admin/users_controller_spec.rb +180 -0
  67. data/pg_engine/spec/factories/accounts.rb +11 -0
  68. data/pg_engine/spec/factories/user_accounts.rb +21 -0
  69. data/pg_engine/spec/factories/users.rb +59 -0
  70. data/pg_engine/spec/models/account_spec.rb +13 -0
  71. data/pg_engine/spec/models/user_account_spec.rb +13 -0
  72. data/pg_engine/spec/models/user_spec.rb +13 -0
  73. data/pg_layout/app/views/layouts/pg_layout/layout.html.slim +1 -0
  74. data/pg_layout/app/views/pg_layout/_flash.html.slim +1 -1
  75. data/pg_layout/lib/pg_layout/engine.rb +0 -1
  76. data/pg_rails/lib/version.rb +1 -1
  77. data/pg_rails/scss/pg_rails.scss +1 -1
  78. data/pg_scaffold/lib/generators/pg_pundit/templates/policy.rb +1 -1
  79. data/pg_scaffold/lib/generators/pg_rspec/scaffold/templates/controller_spec.rb +4 -4
  80. data/pg_scaffold/lib/generators/pg_slim/templates/_form.html.slim +1 -1
  81. data/pg_scaffold/spec/generators_spec.rb +1 -1
  82. metadata +62 -14
  83. data/pg_associable/app/assets/js/asociable_controller.js +0 -58
  84. data/pg_associable/app/assets/js/asociable_inline_controller.js +0 -142
  85. data/pg_associable/app/inputs/pg_associable/pg_associable_inline_input.rb +0 -39
  86. data/pg_associable/app/inputs/pg_associable/pg_associable_input.rb +0 -41
  87. data/pg_associable/lib/pg_associable/simple_form_initializer.rb +0 -34
  88. data/pg_associable/lib/tasks/pg_associable_tasks.rake +0 -4
@@ -0,0 +1,180 @@
1
+ # frozen_string_literal: true
2
+
3
+ # generado con pg_rails
4
+
5
+ require 'rails_helper'
6
+
7
+ # This spec was generated by rspec-rails when you ran the scaffold generator.
8
+ # It demonstrates how one might use RSpec to specify the controller code that
9
+ # was generated by Rails when you ran the scaffold generator.
10
+ #
11
+ # It assumes that the implementation code is generated by the rails scaffold
12
+ # generator. If you are using any extension libraries to generate different
13
+ # controller code, this generated spec may or may not pass.
14
+ #
15
+ # It only uses APIs available in rails and/or rspec-rails. There are a number
16
+ # of tools you can use to make these specs even more expressive, but we're
17
+ # sticking to rails and rspec-rails APIs to keep things simple and stable.
18
+ #
19
+ # Compared to earlier versions of this generator, there is very limited use of
20
+ # stubs and message expectations in this spec. Stubs are only used when there
21
+ # is no simpler way to get a handle on the object needed for the example.
22
+ # Message expectations are only used when there is no simpler way to specify
23
+ # that an instance is receiving a specific message.
24
+ #
25
+ # Also compared to earlier versions of this generator, there are no longer any
26
+ # expectations of assigns and templates rendered. These features have been
27
+ # removed from Rails core in Rails 5, but can be added back in via the
28
+ # `rails-controller-testing` gem.
29
+
30
+ RSpec.describe Admin::UsersController do
31
+ render_views
32
+
33
+ # This should return the minimal set of attributes required to create a valid
34
+ # User. As you add validations to User, be sure to
35
+ # adjust the attributes here as well.
36
+ let(:valid_attributes) do
37
+ attributes_for(:user)
38
+ end
39
+
40
+ let(:invalid_attributes) do
41
+ {
42
+ email: nil
43
+ }
44
+ end
45
+
46
+ let(:logger_user) { create :user, :admin }
47
+
48
+ before do
49
+ sign_in logger_user
50
+ end
51
+
52
+ describe 'GET #index' do
53
+ subject do
54
+ get :index, params: {}
55
+ end
56
+
57
+ let!(:user) { create :user }
58
+
59
+ it 'returns a success response' do
60
+ subject
61
+ expect(response).to be_successful
62
+ end
63
+
64
+ context 'when está descartado' do
65
+ before { user.discard! }
66
+
67
+ it do
68
+ subject
69
+ expect(assigns(:collection)).to eq [logger_user]
70
+ end
71
+ end
72
+ end
73
+
74
+ describe 'GET #show' do
75
+ it 'returns a success response' do
76
+ user = create(:user)
77
+ get :show, params: { id: user.to_param }
78
+ expect(response).to be_successful
79
+ end
80
+ end
81
+
82
+ describe 'GET #new' do
83
+ it 'returns a success response' do
84
+ get :new, params: {}
85
+ expect(response).to be_successful
86
+ end
87
+ end
88
+
89
+ describe 'GET #edit' do
90
+ it 'returns a success response' do
91
+ user = create(:user)
92
+ get :edit, params: { id: user.to_param }
93
+ expect(response).to be_successful
94
+ end
95
+ end
96
+
97
+ describe 'POST #create' do
98
+ context 'with valid params' do
99
+ it 'creates a new User' do
100
+ expect do
101
+ post :create, params: { user: valid_attributes }
102
+ end.to change(User, :count).by(1)
103
+ end
104
+
105
+ it 'redirects to the created user' do
106
+ post :create, params: { user: valid_attributes }
107
+ expect(response).to redirect_to(User.last.decorate.target_object)
108
+ end
109
+ end
110
+
111
+ context 'with invalid params' do
112
+ it 'returns a unprocessable_entity response' do
113
+ post :create, params: { user: invalid_attributes }
114
+ expect(response).to have_http_status(:unprocessable_entity)
115
+ end
116
+
117
+ it 'renders the new template' do
118
+ post :create, params: { user: invalid_attributes }
119
+ expect(response).to render_template(:new)
120
+ end
121
+ end
122
+ end
123
+
124
+ describe 'PUT #update' do
125
+ context 'with valid params' do
126
+ let(:new_attributes) do
127
+ attributes_for(:user)
128
+ end
129
+
130
+ it 'updates the requested user' do
131
+ user = create(:user)
132
+ put :update, params: { id: user.to_param, user: new_attributes }
133
+ user.reload
134
+ expect(user.email).to eq new_attributes[:email]
135
+ end
136
+
137
+ it 'redirects to the user' do
138
+ user = create(:user)
139
+ put :update, params: { id: user.to_param, user: valid_attributes }
140
+ expect(response).to redirect_to(user.decorate.target_object)
141
+ end
142
+ end
143
+
144
+ context 'with invalid params' do
145
+ it 'returns a unprocessable_entity response' do
146
+ user = create(:user)
147
+ put :update, params: { id: user.to_param, user: invalid_attributes }
148
+ expect(response).to have_http_status(:unprocessable_entity)
149
+ end
150
+
151
+ it 'renders the edit template' do
152
+ user = create(:user)
153
+ put :update, params: { id: user.to_param, user: invalid_attributes }
154
+ expect(response).to render_template(:edit)
155
+ end
156
+ end
157
+ end
158
+
159
+ describe 'DELETE #destroy' do
160
+ subject do
161
+ delete :destroy, params: { id: user.to_param }
162
+ end
163
+
164
+ let!(:user) { create :user }
165
+
166
+ it 'destroys the requested user' do
167
+ expect { subject }.to change(User.kept, :count).by(-1)
168
+ end
169
+
170
+ it 'setea el discarded_at' do
171
+ subject
172
+ expect(user.reload.discarded_at).to be_present
173
+ end
174
+
175
+ it 'redirects to the users list' do
176
+ subject
177
+ expect(response).to redirect_to(admin_users_url)
178
+ end
179
+ end
180
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ # generado con pg_rails
4
+
5
+ FactoryBot.define do
6
+ factory :account do
7
+ plan { Account.plan.values.sample }
8
+ nombre { Faker::Lorem.sentence }
9
+ hashid { Faker::Lorem.sentence }
10
+ end
11
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # generado con pg_rails
4
+
5
+ FactoryBot.define do
6
+ factory :user_account do
7
+ association :user
8
+ association :account
9
+ profiles { [UserAccount.profiles.values.sample] }
10
+
11
+ trait :user_existente do
12
+ user { nil }
13
+ user_id { User.pluck(:id).sample }
14
+ end
15
+
16
+ trait :account_existente do
17
+ account { nil }
18
+ account_id { Account.pluck(:id).sample }
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ # == Schema Information
4
+ #
5
+ # Table name: users
6
+ #
7
+ # id :bigint not null, primary key
8
+ # confirmation_sent_at :datetime
9
+ # confirmation_token :string
10
+ # confirmed_at :datetime
11
+ # current_sign_in_at :datetime
12
+ # current_sign_in_ip :string
13
+ # discarded_at :datetime
14
+ # email :string default(""), not null
15
+ # encrypted_password :string default(""), not null
16
+ # failed_attempts :integer default(0), not null
17
+ # last_sign_in_at :datetime
18
+ # last_sign_in_ip :string
19
+ # locked_at :datetime
20
+ # profiles :integer default([]), not null, is an Array
21
+ # remember_created_at :datetime
22
+ # reset_password_sent_at :datetime
23
+ # reset_password_token :string
24
+ # sign_in_count :integer default(0), not null
25
+ # unconfirmed_email :string
26
+ # unlock_token :string
27
+ # created_at :datetime not null
28
+ # updated_at :datetime not null
29
+ #
30
+ # Indexes
31
+ #
32
+ # index_users_on_confirmation_token (confirmation_token) UNIQUE
33
+ # index_users_on_email (email) UNIQUE
34
+ # index_users_on_reset_password_token (reset_password_token) UNIQUE
35
+ # index_users_on_unlock_token (unlock_token) UNIQUE
36
+ #
37
+
38
+ FactoryBot.define do
39
+ factory :orphan_user, class: 'User' do
40
+ email { Faker::Internet.email }
41
+ password { "password#{rand(99_999)}" }
42
+ confirmed_at { Faker::Date.backward }
43
+
44
+ trait :admin do
45
+ developer { true }
46
+ end
47
+
48
+ trait :developer do
49
+ developer { true }
50
+ end
51
+
52
+ factory :user do
53
+ after(:create) do |user, _context|
54
+ account = create :account
55
+ create :user_account, user:, account:
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ # generado con pg_rails
4
+
5
+ require 'rails_helper'
6
+
7
+ RSpec.describe Account do
8
+ let(:account) { create(:account) }
9
+
10
+ it 'se persiste' do
11
+ expect(account).to be_persisted
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ # generado con pg_rails
4
+
5
+ require 'rails_helper'
6
+
7
+ RSpec.describe UserAccount do
8
+ let(:user_account) { create(:user_account) }
9
+
10
+ it 'se persiste' do
11
+ expect(user_account).to be_persisted
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ # generado con pg_rails
4
+
5
+ require 'rails_helper'
6
+
7
+ RSpec.describe User do
8
+ let(:user) { create(:user) }
9
+
10
+ it 'se persiste' do
11
+ expect(user).to be_persisted
12
+ end
13
+ end
@@ -3,6 +3,7 @@ html
3
3
  head
4
4
  title = Rails.application.class.module_parent_name
5
5
  meta name="viewport" content="width=device-width,initial-scale=1"
6
+ meta name="turbo-cache-control" content="no-cache"
6
7
  = csrf_meta_tags
7
8
  = csp_meta_tag
8
9
 
@@ -5,6 +5,6 @@
5
5
 
6
6
  - flash_to_show.each do |flash_type, message|
7
7
  .toast(class="bg-#{flash_type_to_class(flash_type)}-subtle" role="alert"
8
- aria-live="assertive" aria-atomic="true")
8
+ data-turbo-temporary="true" aria-live="assertive" aria-atomic="true")
9
9
  .toast-body
10
10
  = message
@@ -2,6 +2,5 @@
2
2
 
3
3
  module PgLayout
4
4
  class Engine < ::Rails::Engine
5
- isolate_namespace PgLayout
6
5
  end
7
6
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.0.6'
4
+ VERSION = '7.0.8-alpha'
5
5
  end
@@ -1,3 +1,3 @@
1
1
  @import './../../pg_engine/app/assets/stylesheets/pg_rails_b5';
2
- @import './../../pg_associable/app/assets/css/pg_associable';
2
+ @import './../../pg_associable/app/assets/stylesheets/pg_associable';
3
3
  @import './../../pg_layout/app/assets/stylesheets/sidebar';
@@ -31,7 +31,7 @@ class <%= class_name %>Policy < ApplicationPolicy
31
31
  # end
32
32
 
33
33
  # def acceso_total?
34
- # user.admin?
34
+ # user.developer?
35
35
  # end
36
36
  end
37
37
  <% end -%>
@@ -54,10 +54,10 @@ RSpec.describe <%= controller_class_name %>Controller do
54
54
  end
55
55
  <% end -%>
56
56
 
57
- let(:user) { create :user, :admin }
57
+ let(:logged_user) { create :user, :developer }
58
58
 
59
59
  before do
60
- sign_in user if user.present?
60
+ sign_in logged_user if logged_user.present?
61
61
  end
62
62
 
63
63
  describe 'routing' do
@@ -85,7 +85,7 @@ RSpec.describe <%= controller_class_name %>Controller do
85
85
  end
86
86
 
87
87
  context 'when user is not logged in' do
88
- let(:user) { nil }
88
+ let(:logged_user) { nil }
89
89
 
90
90
  it 'redirects to login path' do
91
91
  subject
@@ -99,7 +99,7 @@ RSpec.describe <%= controller_class_name %>Controller do
99
99
 
100
100
  it do
101
101
  subject
102
- expect(assigns(:collection)).to be_empty
102
+ expect(assigns(:collection)).not_to include(<%= nombre_tabla_completo_singular %>)
103
103
  end
104
104
  end
105
105
  <% end -%>
@@ -6,7 +6,7 @@ div style="max-width: 300px"
6
6
 
7
7
  = hidden_field_tag :asociable, true if asociable
8
8
  <%- attributes.each do |attribute| -%>
9
- = f.<%= attribute.reference? ? :pg_associable_inline : :input %> :<%= attribute.name %>
9
+ = f.<%= attribute.reference? ? :pg_associable : :input %> :<%= attribute.name %>
10
10
  <%- end -%>
11
11
  .mt-2
12
12
  = f.button :submit
@@ -33,7 +33,7 @@ describe 'Generators' do
33
33
 
34
34
  my_assert_file 'spec/controllers/frontend/modelos_controller_spec.rb' do |content|
35
35
  assert_match(/routing/, content)
36
- assert_match(/sign_in user/, content)
36
+ assert_match(/sign_in/, content)
37
37
  end
38
38
  end
39
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.6
4
+ version: 7.0.8.pre.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martín Rosso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-10 00:00:00.000000000 Z
11
+ date: 2024-02-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rails goodies.
14
14
  email:
@@ -19,29 +19,38 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - MIT-LICENSE
21
21
  - README.md
22
- - pg_associable/app/assets/css/pg_associable.scss
23
- - pg_associable/app/assets/js/asociable_controller.js
24
- - pg_associable/app/assets/js/asociable_inline_controller.js
25
- - pg_associable/app/assets/js/modal_controller.js
22
+ - pg_associable/app/assets/stylesheets/pg_associable.scss
26
23
  - pg_associable/app/helpers/pg_associable/form_builder_methods.rb
27
24
  - pg_associable/app/helpers/pg_associable/helpers.rb
28
- - pg_associable/app/inputs/pg_associable/pg_associable_inline_input.rb
29
- - pg_associable/app/inputs/pg_associable/pg_associable_input.rb
25
+ - pg_associable/app/inputs/pg_associable_input.rb
26
+ - pg_associable/app/javascript/asociable_controller.tsx
27
+ - pg_associable/app/javascript/modal_controller.js
30
28
  - pg_associable/app/views/pg_associable/_resultados.html.slim
31
29
  - pg_associable/app/views/pg_associable/_resultados_inline.html.slim
32
30
  - pg_associable/app/views/pg_engine/base/_pg_associable_modal.html.slim
33
31
  - pg_associable/index.js
34
32
  - pg_associable/lib/pg_associable.rb
35
33
  - pg_associable/lib/pg_associable/engine.rb
36
- - pg_associable/lib/pg_associable/simple_form_initializer.rb
37
- - pg_associable/lib/tasks/pg_associable_tasks.rake
38
34
  - pg_associable/spec/pg_associable/helpers_spec.rb
35
+ - pg_engine/app/admin/accounts.rb
36
+ - pg_engine/app/admin/audits.rb
37
+ - pg_engine/app/admin/dashboard.rb
38
+ - pg_engine/app/admin/user_accounts.rb
39
+ - pg_engine/app/admin/users.rb
40
+ - pg_engine/app/assets/javascripts/active_admin.js
41
+ - pg_engine/app/assets/stylesheets/active_admin.scss
39
42
  - pg_engine/app/assets/stylesheets/pg_rails_b5.scss
43
+ - pg_engine/app/controllers/admin/accounts_controller.rb
44
+ - pg_engine/app/controllers/admin/user_accounts_controller.rb
45
+ - pg_engine/app/controllers/admin/users_controller.rb
40
46
  - pg_engine/app/controllers/pg_engine/base_controller.rb
41
47
  - pg_engine/app/controllers/pg_engine/devise_controller.rb
42
48
  - pg_engine/app/controllers/pg_engine/require_sign_in.rb
43
49
  - pg_engine/app/controllers/pg_engine/resource_helper.rb
50
+ - pg_engine/app/decorators/account_decorator.rb
44
51
  - pg_engine/app/decorators/pg_engine/base_decorator.rb
52
+ - pg_engine/app/decorators/user_account_decorator.rb
53
+ - pg_engine/app/decorators/user_decorator.rb
45
54
  - pg_engine/app/helpers/pg_engine/flash_helper.rb
46
55
  - pg_engine/app/helpers/pg_engine/form_helper.rb
47
56
  - pg_engine/app/helpers/pg_engine/index_helper.rb
@@ -51,13 +60,45 @@ files:
51
60
  - pg_engine/app/inputs/pg_engine/fecha_input.rb
52
61
  - pg_engine/app/lib/pg_engine/filtros_builder.rb
53
62
  - pg_engine/app/lib/pg_form_builder.rb
63
+ - pg_engine/app/models/account.rb
54
64
  - pg_engine/app/models/pg_engine/base_record.rb
65
+ - pg_engine/app/models/user.rb
66
+ - pg_engine/app/models/user_account.rb
67
+ - pg_engine/app/policies/account_policy.rb
55
68
  - pg_engine/app/policies/pg_engine/application_policy.rb
69
+ - pg_engine/app/policies/user_account_policy.rb
70
+ - pg_engine/app/policies/user_policy.rb
71
+ - pg_engine/app/views/admin/accounts/_account.html.slim
72
+ - pg_engine/app/views/admin/accounts/_form.html.slim
73
+ - pg_engine/app/views/admin/accounts/edit.html.slim
74
+ - pg_engine/app/views/admin/accounts/new.html.slim
75
+ - pg_engine/app/views/admin/accounts/show.html.slim
76
+ - pg_engine/app/views/admin/user_accounts/_form.html.slim
77
+ - pg_engine/app/views/admin/user_accounts/_user_account.html.slim
78
+ - pg_engine/app/views/admin/user_accounts/edit.html.slim
79
+ - pg_engine/app/views/admin/user_accounts/new.html.slim
80
+ - pg_engine/app/views/admin/user_accounts/show.html.slim
81
+ - pg_engine/app/views/admin/users/_form.html.slim
82
+ - pg_engine/app/views/admin/users/_user.html.slim
83
+ - pg_engine/app/views/admin/users/edit.html.slim
84
+ - pg_engine/app/views/admin/users/new.html.slim
85
+ - pg_engine/app/views/admin/users/show.html.slim
56
86
  - pg_engine/app/views/pg_engine/base/download.xlsx.axlsx
57
87
  - pg_engine/app/views/pg_engine/base/index.html.slim
88
+ - pg_engine/config/initializers/active_admin.rb
89
+ - pg_engine/config/initializers/devise.rb
90
+ - pg_engine/config/locales/devise.en.yml
58
91
  - pg_engine/config/locales/es.yml
92
+ - pg_engine/config/routes.rb
59
93
  - pg_engine/config/simple_form/simple_form.rb
60
94
  - pg_engine/config/simple_form/simple_form_bootstrap.rb
95
+ - pg_engine/db/migrate/20240205194218_devise_create_users.rb
96
+ - pg_engine/db/migrate/20240208234111_unaccent.rb
97
+ - pg_engine/db/migrate/20240208234901_install_audited.rb
98
+ - pg_engine/db/migrate/20240210025702_create_active_admin_comments.rb
99
+ - pg_engine/db/migrate/20240211152951_create_accounts.rb
100
+ - pg_engine/db/migrate/20240211153049_create_user_accounts.rb
101
+ - pg_engine/db/seeds.rb
61
102
  - pg_engine/lib/pg_engine.rb
62
103
  - pg_engine/lib/pg_engine/configuracion.rb
63
104
  - pg_engine/lib/pg_engine/core_ext.rb
@@ -65,8 +106,15 @@ files:
65
106
  - pg_engine/lib/pg_engine/route_helpers.rb
66
107
  - pg_engine/lib/pg_engine/utils/pg_logger.rb
67
108
  - pg_engine/lib/tasks/auto_anotar_modelos.rake
68
- - pg_engine/lib/templates/activeadmin/audits.rb
69
- - pg_engine/lib/templates/activeadmin/users.rb
109
+ - pg_engine/spec/controllers/admin/accounts_controller_spec.rb
110
+ - pg_engine/spec/controllers/admin/user_accounts_controller_spec.rb
111
+ - pg_engine/spec/controllers/admin/users_controller_spec.rb
112
+ - pg_engine/spec/factories/accounts.rb
113
+ - pg_engine/spec/factories/user_accounts.rb
114
+ - pg_engine/spec/factories/users.rb
115
+ - pg_engine/spec/models/account_spec.rb
116
+ - pg_engine/spec/models/user_account_spec.rb
117
+ - pg_engine/spec/models/user_spec.rb
70
118
  - pg_layout/app/assets/stylesheets/sidebar.scss
71
119
  - pg_layout/app/javascript/cookies.js
72
120
  - pg_layout/app/javascript/navbar_controller.js
@@ -168,9 +216,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
168
216
  version: '3.0'
169
217
  required_rubygems_version: !ruby/object:Gem::Requirement
170
218
  requirements:
171
- - - ">="
219
+ - - ">"
172
220
  - !ruby/object:Gem::Version
173
- version: '0'
221
+ version: 1.3.1
174
222
  requirements: []
175
223
  rubygems_version: 3.3.22
176
224
  signing_key:
@@ -1,58 +0,0 @@
1
- import { Controller } from '@hotwired/stimulus'
2
-
3
- export default class extends Controller {
4
- static outlets = ['modal']
5
-
6
- lastValue = null
7
-
8
- connect (e) {
9
- console.log('connect asociable')
10
-
11
- // ID único para identificar el campo y el modal
12
- const elemId = Math.trunc(Math.random() * 1000000000)
13
- this.element.setAttribute('data-asociable-modal-outlet', `.modal-${elemId}`)
14
- this.element.classList.add(`asociable-${elemId}`)
15
-
16
- const that = this
17
- const modalLink = this.targets.element.querySelector('.modal-link')
18
- const path = modalLink.attributes.href.value
19
- modalLink.setAttribute('href', `${path}?id=${elemId}`)
20
- modalLink.onclick = (e) => {
21
- // Si ya hay un modal abierto lo abro y evito que se haga el get
22
- // Si no, dejo que se ejecute el comportamiento por default
23
- if (that.modalOutlets.length > 0) {
24
- e.preventDefault()
25
- that.modalOutlet.openModal()
26
- }
27
- }
28
- const input = this.element.querySelector('input[type=text]')
29
- if (input.value) {
30
- this.element.classList.add('filled')
31
- }
32
- }
33
-
34
- selectItem (e) {
35
- // TODO: text en data
36
- this.completarCampo(e.target.dataset.id, e.target.text)
37
- }
38
-
39
- completarCampo (id, text) {
40
- const textField = this.element.querySelector('input[type=text]')
41
- const hiddenField = this.element.querySelector('input[type=hidden]')
42
- if (id === undefined) {
43
- id = null
44
- }
45
- hiddenField.value = id
46
- if (id) {
47
- textField.value = text
48
- this.element.classList.add('filled')
49
- } else {
50
- textField.value = null
51
- this.element.classList.remove('filled')
52
- }
53
- }
54
-
55
- disconnect (e) {
56
- console.log('disconnect asociable')
57
- }
58
- }