lato_spaces 3.1.2 → 3.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4bd598447fb55743b4cd8b2ac7ab0cea245cfe4dc20d80136f28dd5593e12d07
4
- data.tar.gz: f0cb1927530c842a05926add45b95cbe0242b3dd1c27b37f4b6be4319f243475
3
+ metadata.gz: fe232e4b134fb01afbad6d9220fb77dce9141717b95cad6b9fb22699f5022f91
4
+ data.tar.gz: 3c8878cca97ac1bfe8ab2b122a899b03d163b308ccb1e3f45f4ac3fce6d11c44
5
5
  SHA512:
6
- metadata.gz: bc181e79db41bab5c947d48a3729c0159127884a39a16c052519e2520fb563d9d758049eeb45c1dcfc57b5b643d5f1d91d0d80182fa1a2448421559a0129f038
7
- data.tar.gz: a203322fd20e2f97fe7af0b504c2fe5a4b1fa133d602d16deee36e5f7e111f56ecc82931c491ea7f848cb759385f9a705d4bc155c84a32b82f7798c56d6574d4
6
+ metadata.gz: db3a73c4672d9bb625a1c38596645c73d9d7683d906b0a58c397df04caa734fcb1cb1cac6dd30236ecee0635c09d06089a620eeccc350b5f3c1e273d2ed6973f
7
+ data.tar.gz: 8e65409a32a0cade03aefa2e2eebec8957f65f59dab8f508778a3de061f6e7192f4c7d7c4721a6a2f5a52f24d76735a1ccb804699ff7346cf16951c7c68d3f1b
@@ -89,7 +89,7 @@ module LatoSpaces
89
89
  private
90
90
 
91
91
  def group_params
92
- params.require(:group).permit(:name)
92
+ params.require(:group).permit(LatoSpaces.config.group_params)
93
93
  end
94
94
 
95
95
  def find_group
@@ -21,10 +21,7 @@ module LatoSpaces::AssociableRequired
21
21
 
22
22
  # listen LatoSpaces::Association destroy event to destroy item
23
23
  LatoSpaces::Association.after_destroy do |association|
24
- if lato_spaces_associations.find_by_id association.id
25
- self.destroy!
26
- end
24
+ association.item&.destroy!
27
25
  end
28
26
  end
29
27
  end
30
-
@@ -7,7 +7,7 @@ module LatoSpaces::AssociableUnique
7
7
 
8
8
  # listen LatoSpaces::Association create event to avoid duplicate associations
9
9
  LatoSpaces::Association.before_create do |association|
10
- if association.item_type == self.class.name && association.item_id == id && lato_spaces_associations.count.positive?
10
+ if association.item&.lato_spaces_associations&.length&.positive?
11
11
  throw(:abort)
12
12
  end
13
13
  end
@@ -8,6 +8,8 @@
8
8
  <%= lato_form_item_input_text form, :name, required: true %>
9
9
  </div>
10
10
 
11
+ <%= render 'layouts/lato_spaces/group-form-extra_content', form: form %>
12
+
11
13
  <div class="d-flex justify-content-end">
12
14
  <%= lato_form_submit form, group.persisted? ? 'Update' : 'Confirm', class: %w[btn-success] %>
13
15
  </div>
@@ -0,0 +1,7 @@
1
+ <%
2
+
3
+ form ||= nil
4
+
5
+ %>
6
+
7
+ <!-- Free for extra form content -->
@@ -10,6 +10,9 @@ module LatoSpaces
10
10
  # Icon of the group (bootstrap icon).
11
11
  attr_accessor :group_icon
12
12
 
13
+ # Params of the group.
14
+ attr_accessor :group_params
15
+
13
16
  # Permit creation of groups for users.
14
17
  attr_accessor :permit_group_creation
15
18
 
@@ -19,6 +22,7 @@ module LatoSpaces
19
22
  def initialize
20
23
  @setgroup_redirect_path = nil
21
24
  @group_icon = 'bi bi-people-fill'
25
+ @group_params = %i[name]
22
26
  @permit_group_creation = false
23
27
  @permit_group_management = false
24
28
  end
@@ -1,3 +1,3 @@
1
1
  module LatoSpaces
2
- VERSION = "3.1.2"
2
+ VERSION = "3.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lato_spaces
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.2
4
+ version: 3.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregorio Galante
@@ -74,6 +74,7 @@ files:
74
74
  - app/views/lato_spaces/groups/update.html.erb
75
75
  - app/views/lato_spaces/memberships/_form.html.erb
76
76
  - app/views/lato_spaces/memberships/create.html.erb
77
+ - app/views/layouts/lato_spaces/_group-form-extra_content.html.erb
77
78
  - app/views/layouts/lato_spaces/_group-informations_content.html.erb
78
79
  - config/locales/en.yml
79
80
  - config/routes.rb