lato_spaces 3.1.1 → 3.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/lato_spaces/groups_controller.rb +1 -1
- data/app/models/concerns/lato_spaces/associable.rb +9 -5
- data/app/views/lato_spaces/groups/_form.html.erb +2 -0
- data/app/views/layouts/lato_spaces/_group-form-extra_content.html.erb +7 -0
- data/app/views/layouts/lato_spaces/_group-informations_content.html.erb +12 -1
- data/lib/lato_spaces/config.rb +4 -0
- data/lib/lato_spaces/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83d1d5a40a62a72578b2dae9e6c0147c0c85a1b937c187ab38cdbfbac706a6bd
|
4
|
+
data.tar.gz: 61c10fa403fdeec163fdb834a877724a7ad0e8f3f0a62099a68e9c2d8338a8e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3310aa62fbb20968b3b0506d9637c226765ddb188c1bcd441010ad4cd0eac2b4dfd3c5eeb5f97d9583c224b723f59dea423f69784d8337e5f5f7f79a3239e468
|
7
|
+
data.tar.gz: 1865a648a751ed6dce943f63716326552d4c86c4b7a5836c18bc9878978f82ef2ce1ec49b58a515bae3e4e88fe300afaf18f42bd0c9dc9e955d9f9f30efa313b
|
@@ -16,7 +16,7 @@ module LatoSpaces::Associable
|
|
16
16
|
scope :without_lato_spaces_groups, -> { left_outer_joins(:lato_spaces_groups).where(lato_spaces_groups: { id: nil }) }
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
19
|
+
def add_to_lato_spaces_group(group_id)
|
20
20
|
association = lato_spaces_associations.create(lato_spaces_group_id: group_id)
|
21
21
|
unless association.valid?
|
22
22
|
errors.add(:base, association.errors.full_messages.join(', '))
|
@@ -26,7 +26,7 @@ module LatoSpaces::Associable
|
|
26
26
|
true
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
29
|
+
def remove_from_lato_spaces_group(group_id)
|
30
30
|
association = lato_spaces_associations.find_by(lato_spaces_group_id: group_id)
|
31
31
|
return true unless association
|
32
32
|
|
@@ -38,9 +38,9 @@ module LatoSpaces::Associable
|
|
38
38
|
true
|
39
39
|
end
|
40
40
|
|
41
|
-
def
|
41
|
+
def switch_lato_spaces_group(group_id)
|
42
42
|
association = lato_spaces_associations.first
|
43
|
-
return
|
43
|
+
return add_to_lato_spaces_group(group_id) unless association
|
44
44
|
|
45
45
|
unless association.update(lato_spaces_group_id: group_id)
|
46
46
|
errors.add(:base, association.errors.full_messages.join(', '))
|
@@ -48,5 +48,9 @@ module LatoSpaces::Associable
|
|
48
48
|
end
|
49
49
|
|
50
50
|
true
|
51
|
-
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def lato_spaces_group
|
54
|
+
lato_spaces_groups.first
|
55
|
+
end
|
52
56
|
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>
|
@@ -4,4 +4,15 @@ group ||= LatoSpaces::Group.new
|
|
4
4
|
|
5
5
|
%>
|
6
6
|
|
7
|
-
|
7
|
+
<table class="table">
|
8
|
+
<tbody>
|
9
|
+
<tr>
|
10
|
+
<th>Total members</th>
|
11
|
+
<td><%= group.lato_spaces_memberships.count %></td>
|
12
|
+
</tr>
|
13
|
+
<tr>
|
14
|
+
<th>Total items</th>
|
15
|
+
<td><%= group.lato_spaces_associations.count %></td>
|
16
|
+
</tr>
|
17
|
+
</tbody>
|
18
|
+
</table>
|
data/lib/lato_spaces/config.rb
CHANGED
@@ -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
|
data/lib/lato_spaces/version.rb
CHANGED
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.
|
4
|
+
version: 3.1.3
|
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
|