base_editing_bootstrap 1.3.0 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/app/views/base_editing/_form.html.erb +5 -3
- data/app/views/base_editing/_form_fields_container.html.erb +2 -0
- data/lib/base_editing_bootstrap/VERSION +1 -1
- data/lib/generators/base_editing_bootstrap/scaffold/templates/spec/model.rb.tt +11 -2
- data/spec/support/external_shared/base_model.rb +14 -23
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e340e913487e9367deddd3f112c3a379af1ae132da18d27f19b44b6c4f133f6
|
4
|
+
data.tar.gz: 35c0c82b8cc25665ddbeced4615baec2076ca3c6dc33651cc32d73b622d0b761
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fca88f75c5a9e90adf8fc20a6cb46165745a90545649542f984b70b3dfb5b9310fbfaf11d9fc58debbde83022c46d8ab376b475ea64df88ac608f981e17fd567
|
7
|
+
data.tar.gz: f7f4fe4e1755e174b980915ecd685754f68a9e5ea80cc258aa31c50325c16c709448992e2a3b28a64808d09ddbbff2d0a673e6446f9470b09409614f751921e2
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,18 @@
|
|
2
2
|
All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.
|
3
3
|
|
4
4
|
- - -
|
5
|
+
## 1.3.2 - 2025-01-10
|
6
|
+
#### Bug Fixes
|
7
|
+
- Fields in form inside layout - (a2e1d42) - Marino Bonetti
|
8
|
+
|
9
|
+
- - -
|
10
|
+
|
11
|
+
## 1.3.1 - 2025-01-10
|
12
|
+
#### Bug Fixes
|
13
|
+
- Better spec helpers - (0d16364) - Marino Bonetti
|
14
|
+
|
15
|
+
- - -
|
16
|
+
|
5
17
|
## 1.3.0 - 2025-01-09
|
6
18
|
#### Documentation
|
7
19
|
- Aggiunta documentazione per override search field - (ba97155) - Marino Bonetti
|
@@ -4,9 +4,11 @@
|
|
4
4
|
|
5
5
|
<div class="card-body">
|
6
6
|
<%= render partial: "form_field_header", local: {form:} %>
|
7
|
-
<%= render
|
8
|
-
|
9
|
-
|
7
|
+
<%= render layout: "form_fields_container" do %>
|
8
|
+
<%= render collection: form_attributes(form.object),
|
9
|
+
layout: "form_field_container",
|
10
|
+
partial: "form_field", locals: {form:} %>
|
11
|
+
<% end %>
|
10
12
|
</div>
|
11
13
|
|
12
14
|
<div class="card-footer">
|
@@ -1 +1 @@
|
|
1
|
-
1.3.
|
1
|
+
1.3.2
|
@@ -1,6 +1,15 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
RSpec.describe <%= class_name %>, type: :model do
|
3
3
|
it_behaves_like "a base model",
|
4
|
-
ransack_permitted_attributes: %w[<%= attributes_names.join(" ") %>]
|
5
|
-
|
4
|
+
ransack_permitted_attributes: %w[<%= attributes_names.join(" ") %>]
|
5
|
+
|
6
|
+
# it_behaves_like "a base model",
|
7
|
+
# ransack_permitted_attributes: %w[<%= attributes_names.join(" ") %>],
|
8
|
+
# ransack_permitted_associations: [] do
|
9
|
+
# let(:auth_object) { :auth_object } <- default
|
10
|
+
# let(:auth_object) { create(:user, :as_admin) } <- in caso di necessità di override
|
11
|
+
# let(:new_user_ransack_permitted_attributes) { ransack_permitted_attributes }
|
12
|
+
# let(:new_user_ransack_permitted_associations) { ransack_permitted_associations }
|
13
|
+
# end
|
14
|
+
|
6
15
|
end
|
@@ -6,48 +6,39 @@ RSpec.shared_examples "a base model" do |ransack_permitted_attributes: [], ransa
|
|
6
6
|
expect(described_class).to respond_to(:human_action_message)
|
7
7
|
end
|
8
8
|
|
9
|
+
##
|
10
|
+
# Oggetto solitamente di classe User che identifichi l'utente a cui eseguire il check dei permessi
|
11
|
+
let(:auth_object) { :auth_object }
|
12
|
+
let(:new_user_ransack_permitted_attributes) { ransack_permitted_attributes }
|
13
|
+
let(:new_user_ransack_permitted_associations) { ransack_permitted_associations }
|
14
|
+
|
9
15
|
describe "with ransackables" do
|
10
|
-
where(:base_model_method, :
|
16
|
+
where(:base_model_method, :result, :new_user_result) do
|
11
17
|
[
|
12
18
|
[
|
13
|
-
:ransackable_attributes,
|
14
|
-
],
|
15
|
-
[
|
16
|
-
:ransackable_attributes, :permitted_attributes_for_ransack, ransack_permitted_attributes.map(&:to_sym), ransack_permitted_attributes.map(&:to_s)
|
19
|
+
:ransackable_attributes, ransack_permitted_attributes.map(&:to_s), lazy { new_user_ransack_permitted_attributes.map(&:to_s) }
|
17
20
|
],
|
18
21
|
[
|
19
|
-
:ransackable_associations,
|
22
|
+
:ransackable_associations, ransack_permitted_associations.map(&:to_s), lazy { new_user_ransack_permitted_associations.map(&:to_s) }
|
20
23
|
],
|
21
|
-
[
|
22
|
-
:ransackable_associations, :permitted_associations_for_ransack, ransack_permitted_associations.map(&:to_sym), ransack_permitted_associations.map(&:to_s)
|
23
|
-
]
|
24
24
|
]
|
25
25
|
end
|
26
26
|
|
27
27
|
with_them do
|
28
|
-
subject { described_class.send(base_model_method,
|
28
|
+
subject { described_class.send(base_model_method, inner_auth_object) }
|
29
29
|
|
30
|
-
let(:
|
31
|
-
# before do
|
32
|
-
# allow(User).to receive(:new).and_return(simulated_user_instance)
|
33
|
-
# end
|
34
|
-
let(:auth_object) { nil }
|
35
|
-
let(:policy) {
|
36
|
-
instance_double("BaseModelPolicy", policy_method => policy_output)
|
37
|
-
}
|
30
|
+
let(:inner_auth_object) { nil }
|
38
31
|
it "new user" do
|
39
32
|
expect(Pundit).to receive(:policy).with(an_instance_of(User),
|
40
33
|
an_instance_of(described_class)).and_call_original
|
41
|
-
#.and_return(policy)
|
42
34
|
|
43
|
-
is_expected.to match_array(
|
35
|
+
is_expected.to match_array(new_user_result)
|
44
36
|
end
|
45
37
|
|
46
38
|
context "with auth_object" do
|
47
|
-
let(:
|
39
|
+
let(:inner_auth_object) { auth_object }
|
48
40
|
it do
|
49
|
-
expect(Pundit).to receive(:policy).with(
|
50
|
-
# .and_return(policy)
|
41
|
+
expect(Pundit).to receive(:policy).with(inner_auth_object, an_instance_of(described_class)).and_call_original
|
51
42
|
|
52
43
|
is_expected.to match_array(result)
|
53
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: base_editing_bootstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marino Bonetti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -319,6 +319,7 @@ files:
|
|
319
319
|
- app/views/base_editing/_form_field.html.erb
|
320
320
|
- app/views/base_editing/_form_field_container.html.erb
|
321
321
|
- app/views/base_editing/_form_field_header.html.erb
|
322
|
+
- app/views/base_editing/_form_fields_container.html.erb
|
322
323
|
- app/views/base_editing/_form_footer.html.erb
|
323
324
|
- app/views/base_editing/_index_body.html.erb
|
324
325
|
- app/views/base_editing/_index_main_buttons.html.erb
|