lato_spaces 3.1.22 → 3.1.24
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 +4 -4
- data/Rakefile +0 -2
- data/app/controllers/lato_spaces/application_controller.rb +16 -0
- data/app/views/lato_spaces/application/index.html.erb +26 -12
- data/lib/lato_spaces/config.rb +10 -0
- data/lib/lato_spaces/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 36ee9aa758f48c9b1f32c5921701308a5ee3cc462728c2128e7029ec323e9454
|
|
4
|
+
data.tar.gz: e466dfc7f67349bd8fb4c190d27f59a0c5ae5bdc51b0360aa2c0c4d2a6e3c892
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a293aa99cb50fbdd593eceaf096a74d1296bda6c222f4ff9411b51fb864ec11d9f65cd0917d082c4dcb2437c9238c51de15fb4f185b97470154e43c860708446
|
|
7
|
+
data.tar.gz: 4a16c6c4e6b9cdce284b0791132d5645a36d2227949b34dac41c2c18aea22ed6ce569d5fbb7aca9183d1e683eab0d196fbff8e81753363bd0dd181be1cf85e60
|
data/Rakefile
CHANGED
|
@@ -9,6 +9,22 @@ module LatoSpaces
|
|
|
9
9
|
def index
|
|
10
10
|
@memberships = LatoSpaces::Membership.where(lato_user_id: @session.user_id).order(created_at: :desc)
|
|
11
11
|
@groups = LatoSpaces::Group.joins(:lato_spaces_memberships).where(lato_spaces_memberships: { lato_user_id: @session.user_id }).order(name: :asc)
|
|
12
|
+
|
|
13
|
+
if LatoSpaces.config.setgroup_auto_after_login_if_single && LatoSpaces.config.setgroup_redirect_path && @session.get(:spaces_group_id).blank? && @groups.size == 1
|
|
14
|
+
group_id = @groups.first&.id
|
|
15
|
+
if group_id && session_group_create(group_id)
|
|
16
|
+
redirect_to Rails.application.routes.url_helpers.send(LatoSpaces.config.setgroup_redirect_path)
|
|
17
|
+
return
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
if LatoSpaces.config.setgroup_auto_after_login && LatoSpaces.config.setgroup_redirect_path && @session.get(:spaces_group_id).blank?
|
|
22
|
+
group_id = @groups.first&.id
|
|
23
|
+
if group_id && session_group_create(group_id)
|
|
24
|
+
redirect_to Rails.application.routes.url_helpers.send(LatoSpaces.config.setgroup_redirect_path)
|
|
25
|
+
return
|
|
26
|
+
end
|
|
27
|
+
end
|
|
12
28
|
end
|
|
13
29
|
|
|
14
30
|
def setgroup
|
|
@@ -3,35 +3,49 @@
|
|
|
3
3
|
<% end %>
|
|
4
4
|
|
|
5
5
|
<%= turbo_frame_tag 'index' do %>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
<%
|
|
7
|
+
|
|
8
|
+
groups = @groups.map do |group|
|
|
9
|
+
is_selected = @session.get(:spaces_group_id)&.to_i == group.id
|
|
10
|
+
is_preferred = @memberships.find { |m| m.lato_spaces_group_id == group.id }&.preferred
|
|
11
|
+
|
|
12
|
+
{
|
|
13
|
+
id: group.id,
|
|
14
|
+
name: group.name,
|
|
15
|
+
is_selected: is_selected,
|
|
16
|
+
is_preferred: is_preferred
|
|
17
|
+
}
|
|
18
|
+
end
|
|
10
19
|
|
|
20
|
+
groups = groups.sort_by { |g| [g[:is_preferred] ? 0 : 1, g[:name].downcase] }
|
|
21
|
+
%>
|
|
22
|
+
|
|
23
|
+
<div class="row">
|
|
24
|
+
<% groups.each do |group| %>
|
|
11
25
|
<div class="col col-12 col-lg-6 col-lg-4 col-xl-3 mb-3">
|
|
12
|
-
<div class="card h-100 border border-4 position-relative <%= is_selected ? 'border-success' : 'border-light' %>">
|
|
13
|
-
<%= link_to lato_spaces.setgroup_path(group), class: "position-absolute top-0 left-0 w-100 h-100", data: { turbo_method: :post } do %><% end %>
|
|
26
|
+
<div class="card h-100 border border-4 position-relative <%= group[:is_selected] ? 'border-success' : 'border-light' %>">
|
|
27
|
+
<%= link_to lato_spaces.setgroup_path(group[:id]), class: "position-absolute top-0 left-0 w-100 h-100", data: { turbo_method: :post } do %><% end %>
|
|
14
28
|
<div class="card-body">
|
|
15
29
|
<div class="d-flex align-items-center justify-content-between d-lg-block">
|
|
16
30
|
<div class="d-flex align-items-center d-lg-block text-center">
|
|
17
31
|
<i class="<%= LatoSpaces.config.group_icon %> fs-1 me-2 me-lg-0"></i><br>
|
|
18
|
-
<span class="fw-bold"><%= group
|
|
32
|
+
<span class="fw-bold"><%= group[:name] %></span>
|
|
19
33
|
</div>
|
|
20
34
|
<div class="d-flex justify-content-center align-items-center mt-lg-2 position-relative">
|
|
21
35
|
<% if @session.user.lato_spaces_admin || LatoSpaces.config.permit_group_management %>
|
|
22
|
-
<%= link_to lato_spaces.groups_show_path(group), class: "btn btn-light me-1", data: { turbo_frame: '_top' } do %>
|
|
36
|
+
<%= link_to lato_spaces.groups_show_path(group[:id]), class: "btn btn-light me-1", data: { turbo_frame: '_top' } do %>
|
|
23
37
|
<i class="bi bi-gear"></i>
|
|
24
38
|
<% end %>
|
|
25
39
|
<% end %>
|
|
26
40
|
|
|
27
41
|
<% if LatoSpaces.config.permit_group_preferred %>
|
|
28
|
-
<%= link_to lato_spaces.setpreferred_path(group), class: "btn btn-#{is_preferred ? 'warning' : 'light'} ms-1 me-1", data: { turbo_method: :post } do %>
|
|
29
|
-
<i class="bi bi-star<%= is_preferred ? '-fill' : '' %>"></i>
|
|
42
|
+
<%= link_to lato_spaces.setpreferred_path(group[:id]), class: "btn btn-#{group[:is_preferred] ? 'warning' : 'light'} ms-1 me-1", data: { turbo_method: :post } do %>
|
|
43
|
+
<i class="bi bi-star<%= group[:is_preferred] ? '-fill' : '' %>"></i>
|
|
30
44
|
<% end %>
|
|
31
45
|
<% end %>
|
|
32
46
|
|
|
33
|
-
<%= link_to lato_spaces.setgroup_path(group), class: "btn btn-#{is_selected ? 'success' : 'primary'} ms-1", data: { turbo_method: :post } do %>
|
|
34
|
-
<i class="bi bi-check-circle<%= is_selected ? '-fill' : '' %>"></i>
|
|
47
|
+
<%= link_to lato_spaces.setgroup_path(group[:id]), class: "btn btn-#{group[:is_selected] ? 'success' : 'primary'} ms-1", data: { turbo_method: :post } do %>
|
|
48
|
+
<i class="bi bi-check-circle<%= group[:is_selected] ? '-fill' : '' %>"></i>
|
|
35
49
|
<% end %>
|
|
36
50
|
</div>
|
|
37
51
|
</div>
|
data/lib/lato_spaces/config.rb
CHANGED
|
@@ -7,6 +7,14 @@ module LatoSpaces
|
|
|
7
7
|
# Path of the redirect after set group.
|
|
8
8
|
attr_accessor :setgroup_redirect_path
|
|
9
9
|
|
|
10
|
+
# Auto-select first group after login.
|
|
11
|
+
# NOTE: Requires to set `setgroup_redirect_path` to work properly.
|
|
12
|
+
attr_accessor :setgroup_auto_after_login
|
|
13
|
+
|
|
14
|
+
# Auto-select first group after login only if user has a single group.
|
|
15
|
+
# NOTE: Requires to set `setgroup_redirect_path` to work properly.
|
|
16
|
+
attr_accessor :setgroup_auto_after_login_if_single
|
|
17
|
+
|
|
10
18
|
# Icon of the group (bootstrap icon).
|
|
11
19
|
attr_accessor :group_icon
|
|
12
20
|
|
|
@@ -27,6 +35,8 @@ module LatoSpaces
|
|
|
27
35
|
|
|
28
36
|
def initialize
|
|
29
37
|
@setgroup_redirect_path = nil
|
|
38
|
+
@setgroup_auto_after_login = false
|
|
39
|
+
@setgroup_auto_after_login_if_single = false
|
|
30
40
|
@group_icon = 'bi bi-people-fill'
|
|
31
41
|
@group_params = %i[name]
|
|
32
42
|
@membership_params = %i[email]
|
data/lib/lato_spaces/version.rb
CHANGED
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.
|
|
4
|
+
version: 3.1.24
|
|
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-
|
|
11
|
+
date: 2025-12-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|