lato_spaces 3.1.20 → 3.1.22

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7d4a4956f15178cebd281e446e02c153afdede8c3d643b043ac4efd7119176be
4
- data.tar.gz: 114ce595974371d87b0511265422e7f41548498eac63b5a65312d8f35e4bbe47
3
+ metadata.gz: 8be2ba859fb4758a001f626ba2faab4b254dc65fdd39e31110a12f01f33cff80
4
+ data.tar.gz: f45a5f7a94806d23ea6a7557be9f57ee6d0423a3805fb4aa7bd8287c26c07b57
5
5
  SHA512:
6
- metadata.gz: 6c4f61e1eef81c9836d9907646eb452dbd047828b0f430370c03913fe8d24db9a5eae85514abd6348322decd6adbab5d02ecbfa19cf6bf74cd5cbc42399f70f6
7
- data.tar.gz: 1d2d463a65cb52f4024761f749d6a03cdee6071322a466d7681b3501bcdd8541986548090ccb29e6fd7b1429d76b716dde4ef7ed48b10e631d5449552412f553
6
+ metadata.gz: '01259f92ebb9457bdac1ad09df4164d2862f430461e5ec88b6662d18fba8cb9ddb12d9944650f433f44fb008495acce978ecb63392b4ee4881abc4cebca07e39'
7
+ data.tar.gz: 90de698d6fd4af00d2d787f033e26d022d459eaf03eb43ee97fc16cf9563cf77957d0e5495ca64bb0030c8db3951f82bba6740b6d8396b9a50ad2f367923efeb
data/README.md CHANGED
@@ -29,6 +29,13 @@ Rails.application.routes.draw do
29
29
  end
30
30
  ```
31
31
 
32
+ Import Lato Scss on **app/assets/stylesheets/application.scss** file:
33
+ ```scss
34
+ @import 'lato_spaces/application';
35
+
36
+ // ....
37
+ ```
38
+
32
39
  Import Lato Spaces Js on **app/javascript/application.js** file:
33
40
  ```js
34
41
  import "lato_spaces/application";
@@ -52,7 +52,7 @@ module LatoSpaces
52
52
  private
53
53
 
54
54
  def membership_params
55
- params.require(:membership).permit(:email)
55
+ params.require(:membership).permit(LatoSpaces.config.membership_params)
56
56
  end
57
57
 
58
58
  def find_group
@@ -12,16 +12,22 @@ module LatoSpaces::AssociableRequired
12
12
  # Hooks
13
13
  ##
14
14
 
15
- after_create do
16
- lato_spaces_associations.create!(lato_spaces_group_id: lato_spaces_group_id)
15
+ after_create_commit do
16
+ unless lato_spaces_associations.create(lato_spaces_group_id: lato_spaces_group_id)
17
+ Rails.logger.error "Failed to create LatoSpaces association for #{self.class.name} with ID #{id} and group ID #{lato_spaces_group_id}"
18
+ end
17
19
  end
18
20
 
19
21
  # External hooks
20
22
  ##
21
23
 
22
24
  # listen LatoSpaces::Association destroy event to destroy item
23
- LatoSpaces::Association.after_destroy do |association|
24
- association.item&.destroy!
25
+ LatoSpaces::Association.after_destroy_commit do |association|
26
+ if association.item
27
+ unless association.item.destroy
28
+ Rails.logger.error "Failed to destroy #{association.item.class.name} with ID #{association.item_id} after LatoSpaces association destruction"
29
+ end
30
+ end
25
31
  end
26
32
  end
27
33
  end
@@ -0,0 +1,9 @@
1
+ module LatoSpacesMembershipApplication
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ # Add here custom relations, scopes, ecc.
6
+ end
7
+
8
+ # Add here custom methods
9
+ end
@@ -1,5 +1,7 @@
1
1
  module LatoSpaces
2
2
  class Membership < ApplicationRecord
3
+ include LatoSpacesMembershipApplication
4
+
3
5
  attr_accessor :email
4
6
  attr_accessor :user_infos, :actions # lato index
5
7
 
@@ -8,8 +8,10 @@
8
8
  <%= lato_form_item_input_email form, :email, required: true %>
9
9
  </div>
10
10
 
11
+ <%= render 'layouts/lato_spaces/membership-form-extra_content', form: form %>
12
+
11
13
  <div class="d-flex justify-content-end">
12
14
  <%= lato_form_submit form, I18n.t('lato_spaces.cta_confirm'), class: %w[btn-success] %>
13
15
  </div>
14
16
  <% end %>
15
- <% end %>
17
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <%
2
+
3
+ form ||= nil
4
+
5
+ %>
6
+
7
+ <!-- Free for extra form content -->
@@ -13,10 +13,13 @@ module LatoSpaces
13
13
  # Params of the group.
14
14
  attr_accessor :group_params
15
15
 
16
- # Permit creation of groups for users.
16
+ # Params of the membership.
17
+ attr_accessor :membership_params
18
+
19
+ # Permit creation of groups for users (not admins).
17
20
  attr_accessor :permit_group_creation
18
21
 
19
- # Permit management of groups for users.
22
+ # Permit management of groups for users (not admins).
20
23
  attr_accessor :permit_group_management
21
24
 
22
25
  # Permit users to choose a preferred group.
@@ -26,6 +29,7 @@ module LatoSpaces
26
29
  @setgroup_redirect_path = nil
27
30
  @group_icon = 'bi bi-people-fill'
28
31
  @group_params = %i[name]
32
+ @membership_params = %i[email]
29
33
  @permit_group_creation = false
30
34
  @permit_group_management = false
31
35
  @permit_group_preferred = false
@@ -1,3 +1,3 @@
1
1
  module LatoSpaces
2
- VERSION = "3.1.20"
2
+ VERSION = "3.1.22"
3
3
  end
@@ -26,6 +26,13 @@ namespace :lato_spaces do
26
26
 
27
27
  FileUtils.copy(src_file_path, dest_file_path) unless File.exist? dest_file_path
28
28
  end
29
+
30
+ # Copy "lato_spaces_membership_application.rb" model concern from gem to main application
31
+ ##
32
+
33
+ gem_concern_path = LatoSpaces::Engine.root.join('app', 'models', 'concerns', 'lato_spaces_membership_application.rb').to_s
34
+ app_concern_path = Rails.root.join('app', 'models', 'concerns', 'lato_spaces_membership_application.rb').to_s
35
+ FileUtils.copy(gem_concern_path, app_concern_path) unless File.exist? app_concern_path
29
36
  end
30
37
  end
31
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lato_spaces
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.20
4
+ version: 3.1.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregorio Galante
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-29 00:00:00.000000000 Z
11
+ date: 2025-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -63,6 +63,7 @@ files:
63
63
  - app/models/concerns/lato_spaces/associable.rb
64
64
  - app/models/concerns/lato_spaces/associable_required.rb
65
65
  - app/models/concerns/lato_spaces/associable_unique.rb
66
+ - app/models/concerns/lato_spaces_membership_application.rb
66
67
  - app/models/lato_spaces/association.rb
67
68
  - app/models/lato_spaces/group.rb
68
69
  - app/models/lato_spaces/membership.rb
@@ -76,6 +77,7 @@ files:
76
77
  - app/views/lato_spaces/memberships/create.html.erb
77
78
  - app/views/layouts/lato_spaces/_group-form-extra_content.html.erb
78
79
  - app/views/layouts/lato_spaces/_group-informations_content.html.erb
80
+ - app/views/layouts/lato_spaces/_membership-form-extra_content.html.erb
79
81
  - config/importmap.rb
80
82
  - config/locales/en.yml
81
83
  - config/locales/it.yml