lesli_shield 1.1.7 → 1.1.8
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/app/assets/stylesheets/lesli_shield/application.css +1082 -0
- data/app/assets/stylesheets/lesli_shield/invitations.css +1008 -0
- data/app/controllers/lesli_shield/invites_controller.rb +100 -49
- data/app/controllers/lesli_shield/profiles_controller.rb +9 -3
- data/app/controllers/lesli_shield/role/actions_controller.rb +134 -38
- data/app/controllers/lesli_shield/roles_controller.rb +114 -141
- data/app/controllers/lesli_shield/users_controller.rb +11 -4
- data/app/controllers/users/confirmations_controller.rb +2 -2
- data/app/controllers/users/invitations_controller.rb +101 -0
- data/app/controllers/users/passwords_controller.rb +1 -1
- data/app/controllers/users/registrations_controller.rb +2 -2
- data/app/controllers/users/sessions_controller.rb +3 -1
- data/app/jobs/lesli_shield/invitation_delivery_job.rb +123 -0
- data/app/mailers/lesli_shield/devise_mailer.rb +3 -3
- data/app/mailers/lesli_shield/invitation_mailer.rb +58 -0
- data/app/models/concerns/lesli_shield/role_management.rb +70 -0
- data/app/models/concerns/lesli_shield/user_security.rb +22 -19
- data/app/models/lesli_shield/invite.rb +183 -12
- data/app/services/lesli_shield/invitation_audit.rb +34 -0
- data/app/services/lesli_shield/invitation_email_policy.rb +64 -0
- data/app/services/lesli_shield/invitation_service.rb +405 -0
- data/app/services/lesli_shield/invite_service.rb +34 -5
- data/app/services/lesli_shield/profile_service.rb +1 -0
- data/app/services/lesli_shield/role_action_service.rb +37 -92
- data/app/services/lesli_shield/role_audit.rb +42 -0
- data/app/services/lesli_shield/role_permission_service.rb +347 -0
- data/app/services/lesli_shield/role_privilege_deployment_service.rb +79 -0
- data/app/services/lesli_shield/role_privilege_service.rb +69 -105
- data/app/services/lesli_shield/role_service.rb +431 -0
- data/app/services/lesli_shield/user_registration_service.rb +1 -1
- data/app/services/lesli_shield/user_validator_service.rb +9 -9
- data/app/views/devise/confirmations/new.html.erb +5 -5
- data/app/views/devise/confirmations/show.html.erb +3 -3
- data/app/views/devise/passwords/edit.html.erb +7 -7
- data/app/views/devise/passwords/new.html.erb +7 -7
- data/app/views/devise/registrations/new.html.erb +13 -13
- data/app/views/devise/sessions/new.html.erb +8 -8
- data/app/views/devise/shared/_demo.html.erb +3 -3
- data/app/views/devise/shared/_links.html.erb +8 -11
- data/app/views/lesli_shield/invites/_form.html.erb +64 -7
- data/app/views/lesli_shield/invites/_invite.html.erb +55 -2
- data/app/views/lesli_shield/invites/_invite_actions.html.erb +34 -0
- data/app/views/lesli_shield/invites/_status_badge.html.erb +13 -0
- data/app/views/lesli_shield/invites/index.html.erb +119 -63
- data/app/views/lesli_shield/invites/new.html.erb +11 -36
- data/app/views/lesli_shield/invites/show.html.erb +13 -52
- data/app/views/lesli_shield/profiles/_information-form.html.erb +11 -0
- data/app/views/lesli_shield/profiles/show.html.erb +1 -4
- data/app/views/lesli_shield/role/actions/_custom_actions.html.erb +24 -0
- data/app/views/lesli_shield/role/actions/_deployment_status.html.erb +14 -0
- data/app/views/lesli_shield/role/actions/_matrix.html.erb +69 -0
- data/app/views/lesli_shield/role/actions/_permissions.html.erb +95 -0
- data/app/views/lesli_shield/role/actions/_toggle.html.erb +34 -0
- data/app/views/lesli_shield/role/actions/index.html.erb +14 -10
- data/app/views/lesli_shield/roles/_deployment_badge.html.erb +15 -0
- data/app/views/lesli_shield/roles/_empty_state.html.erb +20 -0
- data/app/views/lesli_shield/roles/_field_errors.html.erb +5 -0
- data/app/views/lesli_shield/roles/_filters.html.erb +66 -0
- data/app/views/lesli_shield/roles/_form.html.erb +149 -18
- data/app/views/lesli_shield/roles/_management_menu.html.erb +37 -0
- data/app/views/lesli_shield/roles/_pagination.html.erb +43 -0
- data/app/views/lesli_shield/roles/_role_list.html.erb +116 -0
- data/app/views/lesli_shield/roles/_status_badge.html.erb +11 -0
- data/app/views/lesli_shield/roles/_type_badge.html.erb +9 -0
- data/app/views/lesli_shield/roles/index.html.erb +15 -38
- data/app/views/lesli_shield/roles/new.html.erb +11 -0
- data/app/views/lesli_shield/roles/show.html.erb +79 -7
- data/app/views/lesli_shield/users/_information-form.html.erb +6 -0
- data/app/views/users/invitations/show.html.erb +142 -0
- data/app/views/users/invitations/unavailable.html.erb +19 -0
- data/config/locales/devise.en.yml +8 -0
- data/config/locales/devise.es.yml +8 -0
- data/config/locales/translations.en.yml +313 -78
- data/config/locales/translations.es.yml +313 -78
- data/config/routes.rb +10 -3
- data/db/migrate/v1/0801120110_create_lesli_shield_invites.rb +40 -6
- data/lib/lesli_shield/engine.rb +4 -0
- data/lib/lesli_shield/router.rb +10 -0
- data/lib/lesli_shield/version.rb +2 -2
- data/lib/tasks/lesli_shield_tasks.rake +1 -1
- data/readme.md +13 -1
- metadata +35 -5
- data/app/mailers/lesli_shield/invitation.html.erb +0 -23
- data/app/views/lesli_shield/invites/edit.html.erb +0 -12
- data/app/views/lesli_shield/role/actions/_form.html.erb +0 -75
|
@@ -31,8 +31,8 @@ Building a better future, one line of code at a time.
|
|
|
31
31
|
%>
|
|
32
32
|
|
|
33
33
|
<%
|
|
34
|
-
title = I18n.t("overrides.lesli_shield.
|
|
35
|
-
default: :"lesli_shield.
|
|
34
|
+
title = I18n.t("overrides.lesli_shield.devise_registrations.view_title",
|
|
35
|
+
default: :"lesli_shield.devise_registrations.view_title")
|
|
36
36
|
%>
|
|
37
37
|
|
|
38
38
|
<%= render("devise/shared/application-devise", title: title) do %>
|
|
@@ -46,14 +46,14 @@ title = I18n.t("overrides.lesli_shield.devise/registrations.view_title",
|
|
|
46
46
|
) do |form| %>
|
|
47
47
|
|
|
48
48
|
<p class="mb-6 text-center text-sm leading-6 text-slate-600">
|
|
49
|
-
<%= I18n.t("lesli_shield.
|
|
49
|
+
<%= I18n.t("lesli_shield.devise_registrations.view_description") %>
|
|
50
50
|
</p>
|
|
51
51
|
|
|
52
52
|
<%= render "devise/shared/error_messages", resource: resource %>
|
|
53
53
|
|
|
54
54
|
<%= form.field_control_email(
|
|
55
55
|
:email,
|
|
56
|
-
label: I18n.t("lesli_shield.
|
|
56
|
+
label: I18n.t("lesli_shield.devise_registrations.label_email"),
|
|
57
57
|
message: resource.errors[:email].to_sentence.presence,
|
|
58
58
|
category: resource.errors[:email].any? ? :danger : nil,
|
|
59
59
|
icon: "person",
|
|
@@ -66,10 +66,10 @@ title = I18n.t("overrides.lesli_shield.devise/registrations.view_title",
|
|
|
66
66
|
|
|
67
67
|
<%= form.field_control_password(
|
|
68
68
|
:password,
|
|
69
|
-
label: I18n.t("lesli_shield.
|
|
69
|
+
label: I18n.t("lesli_shield.devise_registrations.label_password"),
|
|
70
70
|
message: resource.errors[:password].to_sentence.presence ||
|
|
71
71
|
I18n.t(
|
|
72
|
-
"lesli_shield.
|
|
72
|
+
"lesli_shield.devise_registrations.view_password_length",
|
|
73
73
|
minimum: @minimum_password_length,
|
|
74
74
|
maximum: Devise.password_length.max
|
|
75
75
|
),
|
|
@@ -85,7 +85,7 @@ title = I18n.t("overrides.lesli_shield.devise/registrations.view_title",
|
|
|
85
85
|
<%= form.field_control_password(
|
|
86
86
|
:password_confirmation,
|
|
87
87
|
label: I18n.t(
|
|
88
|
-
"lesli_shield.
|
|
88
|
+
"lesli_shield.devise_registrations.label_password_confirmation"
|
|
89
89
|
),
|
|
90
90
|
message: resource.errors[:password_confirmation].to_sentence.presence,
|
|
91
91
|
category: resource.errors[:password_confirmation].any? ? :danger : nil,
|
|
@@ -99,20 +99,20 @@ title = I18n.t("overrides.lesli_shield.devise/registrations.view_title",
|
|
|
99
99
|
|
|
100
100
|
<div class="mb-4">
|
|
101
101
|
<p class="text-left text-xs leading-5 text-slate-500">
|
|
102
|
-
<%= I18n.t("lesli_shield.
|
|
102
|
+
<%= I18n.t("lesli_shield.devise_registrations.view_legal_notice") %>
|
|
103
103
|
</p>
|
|
104
104
|
</div>
|
|
105
105
|
|
|
106
106
|
<%= form.field_control_button(
|
|
107
107
|
I18n.t(
|
|
108
|
-
"overrides.lesli_shield.
|
|
109
|
-
default: :"lesli_shield.
|
|
108
|
+
"overrides.lesli_shield.devise_registrations.button_create_account",
|
|
109
|
+
default: :"lesli_shield.devise_registrations.button_create_account"
|
|
110
110
|
),
|
|
111
111
|
{
|
|
112
112
|
class: "w-full",
|
|
113
113
|
data: {
|
|
114
114
|
turbo_submits_with: I18n.t(
|
|
115
|
-
"lesli_shield.
|
|
115
|
+
"lesli_shield.devise_registrations.button_creating_account"
|
|
116
116
|
)
|
|
117
117
|
}
|
|
118
118
|
},
|
|
@@ -120,9 +120,9 @@ title = I18n.t("overrides.lesli_shield.devise/registrations.view_title",
|
|
|
120
120
|
) %>
|
|
121
121
|
|
|
122
122
|
<p class="mt-1 text-center text-sm text-slate-600">
|
|
123
|
-
<%= I18n.t("lesli_shield.
|
|
123
|
+
<%= I18n.t("lesli_shield.devise_registrations.view_already_have_an_account") %>
|
|
124
124
|
<%= link_to(
|
|
125
|
-
I18n.t("lesli_shield.
|
|
125
|
+
I18n.t("lesli_shield.devise_registrations.button_login"),
|
|
126
126
|
new_user_session_path,
|
|
127
127
|
class: "font-semibold text-[var(--lesli-color-primary)] underline underline-offset-2 hover:opacity-80 focus-visible:rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--lesli-color-primary)]"
|
|
128
128
|
) %>
|
|
@@ -31,8 +31,8 @@ Building a better future, one line of code at a time.
|
|
|
31
31
|
%>
|
|
32
32
|
|
|
33
33
|
<%
|
|
34
|
-
title = I18n.t("overrides.lesli_shield.
|
|
35
|
-
default: :"lesli_shield.
|
|
34
|
+
title = I18n.t("overrides.lesli_shield.devise_sessions.view_title",
|
|
35
|
+
default: :"lesli_shield.devise_sessions.view_title")
|
|
36
36
|
|
|
37
37
|
demo_credentials = if Lesli.config.demo
|
|
38
38
|
{
|
|
@@ -48,7 +48,7 @@ end
|
|
|
48
48
|
|
|
49
49
|
<%
|
|
50
50
|
email_field_options = {
|
|
51
|
-
label: I18n.t("lesli_shield.
|
|
51
|
+
label: I18n.t("lesli_shield.devise_sessions.label_email", default: "Email address"),
|
|
52
52
|
category: authentication_error.present? ? :danger : nil,
|
|
53
53
|
icon: "person",
|
|
54
54
|
autofocus: true,
|
|
@@ -58,7 +58,7 @@ end
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
password_field_options = {
|
|
61
|
-
label: I18n.t("lesli_shield.
|
|
61
|
+
label: I18n.t("lesli_shield.devise_sessions.label_password", default: "Password"),
|
|
62
62
|
message: authentication_error,
|
|
63
63
|
category: authentication_error.present? ? :danger : nil,
|
|
64
64
|
icon: "key",
|
|
@@ -100,15 +100,15 @@ end
|
|
|
100
100
|
<% end %>
|
|
101
101
|
|
|
102
102
|
<%= form.field_control_button(
|
|
103
|
-
I18n.t("lesli_shield.
|
|
103
|
+
I18n.t("lesli_shield.devise_sessions.button_log_in"),
|
|
104
104
|
{ class: "is-fullwidth" },
|
|
105
105
|
icon: "login"
|
|
106
106
|
) %>
|
|
107
107
|
|
|
108
108
|
<% if Lesli.config.security.dig(:allow_registration) %>
|
|
109
109
|
<p class="mt-1 text-center text-sm text-slate-600">
|
|
110
|
-
<%= I18n.t("lesli_shield.
|
|
111
|
-
<%= link_to I18n.t("lesli_shield.
|
|
110
|
+
<%= I18n.t("lesli_shield.devise_sessions.view_still_not_registered") %>
|
|
111
|
+
<%= link_to I18n.t("lesli_shield.devise_sessions.button_create_account"),
|
|
112
112
|
new_user_registration_path %>
|
|
113
113
|
</p>
|
|
114
114
|
<% end %>
|
|
@@ -117,7 +117,7 @@ end
|
|
|
117
117
|
<%= render("devise/shared/links",
|
|
118
118
|
password_reset:true,
|
|
119
119
|
#magic_link:true,
|
|
120
|
-
login:true,
|
|
120
|
+
#login:true,
|
|
121
121
|
#otp:true,
|
|
122
122
|
) %>
|
|
123
123
|
<% end %>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
<fieldset data-demo-credentials class="mb-8 rounded-xl border border-sky-200 bg-sky-50 px-4 pb-4 text-sm text-sky-950">
|
|
3
3
|
<legend class="px-2 font-semibold text-sky-800">
|
|
4
|
-
<%= I18n.t("lesli_shield.
|
|
4
|
+
<%= I18n.t("lesli_shield.devise_sessions.demo_title") %>
|
|
5
5
|
</legend>
|
|
6
6
|
<dl class="mt-1 grid grid-cols-[auto_1fr] gap-x-3 gap-y-1">
|
|
7
|
-
<dt class="font-medium"><%= I18n.t("lesli_shield.
|
|
7
|
+
<dt class="font-medium"><%= I18n.t("lesli_shield.devise_sessions.demo_email") %>:</dt>
|
|
8
8
|
<dd class="break-all"><%= credentials.fetch(:email) %></dd>
|
|
9
|
-
<dt class="font-medium"><%= I18n.t("lesli_shield.
|
|
9
|
+
<dt class="font-medium"><%= I18n.t("lesli_shield.devise_sessions.demo_password") %>:</dt>
|
|
10
10
|
<dd><%= credentials.fetch(:password) %></dd>
|
|
11
11
|
</dl>
|
|
12
12
|
</fieldset>
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
=begin
|
|
3
|
-
|
|
1
|
+
<%#
|
|
4
2
|
Lesli
|
|
5
3
|
|
|
6
|
-
Copyright (c)
|
|
4
|
+
Copyright (c) 2026, Lesli Technologies, S. A.
|
|
7
5
|
|
|
8
6
|
This program is free software: you can redistribute it and/or modify
|
|
9
7
|
it under the terms of the GNU General Public License as published by
|
|
@@ -20,7 +18,7 @@ along with this program. If not, see http://www.gnu.org/licenses/.
|
|
|
20
18
|
|
|
21
19
|
Lesli · Ruby on Rails SaaS Development Framework.
|
|
22
20
|
|
|
23
|
-
Made with ♥ by
|
|
21
|
+
Made with ♥ by LesliTech
|
|
24
22
|
Building a better future, one line of code at a time.
|
|
25
23
|
|
|
26
24
|
@contact hello@lesli.tech
|
|
@@ -29,7 +27,6 @@ Building a better future, one line of code at a time.
|
|
|
29
27
|
|
|
30
28
|
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
31
29
|
// ·
|
|
32
|
-
=end
|
|
33
30
|
%>
|
|
34
31
|
|
|
35
32
|
<% login = defined?(login) ? login : false %>
|
|
@@ -44,7 +41,7 @@ Building a better future, one line of code at a time.
|
|
|
44
41
|
<span class="icon mr-1">
|
|
45
42
|
<span class="material-symbols-outlined" aria-hidden="true">login</span>
|
|
46
43
|
</span>
|
|
47
|
-
<span><%= I18n.t("lesli_shield.
|
|
44
|
+
<span><%= I18n.t("lesli_shield.devise_shared.button_login") %></span>
|
|
48
45
|
<% end %>
|
|
49
46
|
<% end %>
|
|
50
47
|
|
|
@@ -53,7 +50,7 @@ Building a better future, one line of code at a time.
|
|
|
53
50
|
<span class="icon mr-2">
|
|
54
51
|
<span class="material-symbols-outlined" aria-hidden="true">lock_reset</span>
|
|
55
52
|
</span>
|
|
56
|
-
<span><%= I18n.t("lesli_shield.
|
|
53
|
+
<span><%= I18n.t("lesli_shield.devise_shared.button_reset_password") %></span>
|
|
57
54
|
<% end %>
|
|
58
55
|
<% end %>
|
|
59
56
|
|
|
@@ -61,14 +58,14 @@ Building a better future, one line of code at a time.
|
|
|
61
58
|
<%# Dynamic check if instance allow users to login through magic links (passes) %>
|
|
62
59
|
<%# if Rails.application.config.lesli.dig(:security, :enable_login_link) %>
|
|
63
60
|
<% if magic_link %>
|
|
64
|
-
<%= link_to(
|
|
61
|
+
<%= link_to(pass_path) do %>
|
|
65
62
|
<span class="icon mr-1">
|
|
66
63
|
<svg width="25" height="25" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
67
64
|
<path d="M17.5 7.25005H15.25C14.6748 7.25005 14.0996 7.34967 13.5498 7.52545C14.1748 8.00005 14.7002 8.57525 15.0996 9.25005H15.25H17.5C19.2998 9.25005 20.75 10.7003 20.75 12.5001C20.75 14.2999 19.2998 15.7501 17.5 15.7501H15.25C15.0996 15.7501 14.9248 15.7247 14.7754 15.7003H14.75C13.2002 15.4503 12 14.125 12 12.5C12 11.5 11.3496 10.6504 10.4502 10.375C10.1504 11.0254 10 11.75 10 12.5C10 15.4005 12.3496 17.75 15.25 17.75H17.5C20.4005 17.75 22.75 15.4004 22.75 12.5C22.75 9.5996 20.4004 7.25 17.5 7.25V7.25005Z" fill="#112A62"/>
|
|
68
65
|
<path d="M9.9248 15.7502H7.5C5.7002 15.7502 4.25 14.3 4.25 12.5002C4.25 10.7004 5.7002 9.25024 7.5 9.25024H9.75C11.5498 9.25024 13 10.7004 13 12.5002C13 13.5002 13.6504 14.3498 14.5498 14.6252C14.8496 13.9748 15 13.2502 15 12.5002C15 9.59974 12.6504 7.25024 9.75 7.25024H7.5C4.5995 7.25024 2.25 9.59984 2.25 12.5002C2.25 15.4006 4.5996 17.7502 7.5 17.7502H9.75C10.3252 17.7502 10.9004 17.6506 11.4502 17.4504C10.8496 17.0002 10.3252 16.4006 9.9248 15.7502Z" fill="#112A62"/>
|
|
69
66
|
</svg>
|
|
70
67
|
</span>
|
|
71
|
-
<span><%= I18n.t("lesli_shield.
|
|
68
|
+
<span><%= I18n.t("lesli_shield.devise_shared.button_magic_link") %></span>
|
|
72
69
|
<% end %>
|
|
73
70
|
<% end %>
|
|
74
71
|
|
|
@@ -83,7 +80,7 @@ Building a better future, one line of code at a time.
|
|
|
83
80
|
<path fill="#112a62" d="m.134 2.09.492.61a8.595 8.595 0 0 1 10.973.125l.508-.594a9.372 9.372 0 0 0-11.973-.14ZM.69 14.774l-.492.609a9.38 9.38 0 0 0 11.973-.14l-.508-.594a8.596 8.596 0 0 1-10.972.125zM9.767 11.786v-.781h.782v.781z"/>
|
|
84
81
|
</svg>
|
|
85
82
|
</span>
|
|
86
|
-
<span><%= I18n.t("lesli_shield.
|
|
83
|
+
<span><%= I18n.t("lesli_shield.devise_shared.button_one_time_password") %></span>
|
|
87
84
|
<% end %>
|
|
88
85
|
<% end %>
|
|
89
86
|
</div>
|
|
@@ -1,10 +1,67 @@
|
|
|
1
|
-
|
|
1
|
+
<%
|
|
2
|
+
role_errors = (@invite.errors[:role_id] + @invite.errors[:role])
|
|
3
|
+
.to_sentence
|
|
4
|
+
.presence
|
|
5
|
+
%>
|
|
6
|
+
|
|
7
|
+
<%= form_with(
|
|
8
|
+
model: @invite,
|
|
9
|
+
builder: LesliView::Forms::Builder,
|
|
10
|
+
html: { class: "space-y-6" }
|
|
11
|
+
) do |form| %>
|
|
2
12
|
<%= form.fieldset do %>
|
|
3
|
-
<%= form.field_control_email(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
13
|
+
<%= form.field_control_email(
|
|
14
|
+
:email,
|
|
15
|
+
label: I18n.t("lesli_shield.invites.field_email"),
|
|
16
|
+
message: @invite.errors[:email].to_sentence.presence,
|
|
17
|
+
category: @invite.errors[:email].any? ? :danger : nil,
|
|
18
|
+
autocomplete: "email",
|
|
19
|
+
required: true
|
|
20
|
+
) %>
|
|
21
|
+
|
|
22
|
+
<%= form.field_control(
|
|
23
|
+
:full_name,
|
|
24
|
+
label: "#{I18n.t("lesli_shield.invites.field_name")} " \
|
|
25
|
+
"(#{I18n.t("lesli_shield.invites.field_optional")})",
|
|
26
|
+
message: @invite.errors[:full_name].to_sentence.presence ||
|
|
27
|
+
I18n.t("lesli_shield.invites.field_name_hint"),
|
|
28
|
+
category: @invite.errors[:full_name].any? ? :danger : nil,
|
|
29
|
+
autocomplete: "name"
|
|
30
|
+
) %>
|
|
31
|
+
|
|
32
|
+
<%= form.field_control_select(
|
|
33
|
+
:role_id,
|
|
34
|
+
@assignable_roles.pluck(:name, :id),
|
|
35
|
+
label: I18n.t("lesli_shield.invites.field_role"),
|
|
36
|
+
message: role_errors,
|
|
37
|
+
category: role_errors.present? ? :danger : nil,
|
|
38
|
+
humanize: false,
|
|
39
|
+
options: {
|
|
40
|
+
prompt: I18n.t("lesli_shield.invites.role_prompt")
|
|
41
|
+
},
|
|
42
|
+
html_options: { required: true }
|
|
43
|
+
) %>
|
|
44
|
+
|
|
45
|
+
<%= form.field_control_textarea(
|
|
46
|
+
:notes,
|
|
47
|
+
label: "#{I18n.t("lesli_shield.invites.field_message")} " \
|
|
48
|
+
"(#{I18n.t("lesli_shield.invites.field_optional")})",
|
|
49
|
+
message: @invite.errors[:notes].to_sentence.presence ||
|
|
50
|
+
I18n.t("lesli_shield.invites.field_message_hint"),
|
|
51
|
+
category: @invite.errors[:notes].any? ? :danger : nil,
|
|
52
|
+
rows: 5
|
|
53
|
+
) %>
|
|
54
|
+
|
|
55
|
+
<%= form.field_control_button(
|
|
56
|
+
I18n.t("lesli_shield.invites.button_create_and_send"),
|
|
57
|
+
{
|
|
58
|
+
class: "w-full sm:w-auto",
|
|
59
|
+
data: {
|
|
60
|
+
turbo_submits_with: I18n.t(
|
|
61
|
+
"lesli_shield.invites.button_creating_and_sending"
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
) %>
|
|
9
66
|
<% end %>
|
|
10
67
|
<% end %>
|
|
@@ -1,2 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
<%
|
|
2
|
+
format_time = lambda do |value|
|
|
3
|
+
value.present? ? I18n.l(value, format: :long) : "—"
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
inviter_name = invite.invited_by.full_name.to_s.strip.presence ||
|
|
7
|
+
invite.invited_by.email
|
|
8
|
+
|
|
9
|
+
details = [
|
|
10
|
+
[I18n.t("lesli_shield.invites.detail_email"), invite.email],
|
|
11
|
+
[
|
|
12
|
+
I18n.t("lesli_shield.invites.detail_name"),
|
|
13
|
+
invite.full_name.presence || I18n.t("lesli_shield.invites.value_not_available")
|
|
14
|
+
],
|
|
15
|
+
[
|
|
16
|
+
I18n.t("lesli_shield.invites.detail_role"),
|
|
17
|
+
invite.role&.name || I18n.t("lesli_shield.invites.value_not_available")
|
|
18
|
+
],
|
|
19
|
+
[I18n.t("lesli_shield.invites.detail_invited_by"), inviter_name],
|
|
20
|
+
[I18n.t("lesli_shield.invites.detail_sent_at"), format_time.call(invite.sent_at)],
|
|
21
|
+
[I18n.t("lesli_shield.invites.detail_expires_at"), format_time.call(invite.expires_at)],
|
|
22
|
+
[I18n.t("lesli_shield.invites.detail_accepted_at"), format_time.call(invite.accepted_at)],
|
|
23
|
+
[I18n.t("lesli_shield.invites.detail_cancelled_at"), format_time.call(invite.cancelled_at)]
|
|
24
|
+
]
|
|
25
|
+
%>
|
|
26
|
+
|
|
27
|
+
<article id="<%= dom_id invite %>" class="overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-sm">
|
|
28
|
+
<div class="flex flex-col gap-3 border-b border-slate-200 bg-slate-50 px-6 py-5 sm:flex-row sm:items-center sm:justify-between">
|
|
29
|
+
<div>
|
|
30
|
+
<p class="text-sm font-medium text-slate-500">
|
|
31
|
+
<%= I18n.t("lesli_shield.invites.detail_recipient") %>
|
|
32
|
+
</p>
|
|
33
|
+
<p class="mt-1 text-lg font-semibold text-slate-900">
|
|
34
|
+
<%= invite.full_name.presence || invite.email %>
|
|
35
|
+
</p>
|
|
36
|
+
</div>
|
|
37
|
+
<%= render "status_badge", invite: invite %>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<dl class="grid grid-cols-1 sm:grid-cols-2">
|
|
41
|
+
<% details.each do |label, value| %>
|
|
42
|
+
<div class="border-b border-slate-100 px-6 py-5 sm:odd:border-r">
|
|
43
|
+
<dt class="text-sm font-medium text-slate-500"><%= label %></dt>
|
|
44
|
+
<dd class="mt-1 break-words text-sm font-semibold text-slate-900"><%= value %></dd>
|
|
45
|
+
</div>
|
|
46
|
+
<% end %>
|
|
47
|
+
</dl>
|
|
48
|
+
|
|
49
|
+
<div class="px-6 py-5">
|
|
50
|
+
<h2 class="text-sm font-medium text-slate-500">
|
|
51
|
+
<%= I18n.t("lesli_shield.invites.detail_message") %>
|
|
52
|
+
</h2>
|
|
53
|
+
<p class="mt-2 whitespace-pre-wrap text-sm leading-6 text-slate-700"><%= invite.notes.presence || "—" %></p>
|
|
54
|
+
</div>
|
|
55
|
+
</article>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<%
|
|
2
|
+
show_view = local_assigns.fetch(:show_view, false)
|
|
3
|
+
action_classes = "inline-flex h-9 items-center justify-center rounded-lg border px-3 text-xs font-semibold transition focus:outline-none focus:ring-4"
|
|
4
|
+
%>
|
|
5
|
+
|
|
6
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
7
|
+
<% if show_view %>
|
|
8
|
+
<%= link_to I18n.t("lesli_shield.invites.action_view"),
|
|
9
|
+
invite_path(invite),
|
|
10
|
+
class: "#{action_classes} border-slate-200 bg-white text-slate-700 hover:bg-slate-50 focus:ring-slate-500/10" %>
|
|
11
|
+
<% end %>
|
|
12
|
+
|
|
13
|
+
<% if invite.resend_available? %>
|
|
14
|
+
<%= button_to I18n.t("lesli_shield.invites.action_resend"),
|
|
15
|
+
resend_invite_path(invite),
|
|
16
|
+
method: :post,
|
|
17
|
+
form: { class: "inline" },
|
|
18
|
+
class: "#{action_classes} border-emerald-200 bg-emerald-50 text-emerald-700 hover:bg-emerald-100 focus:ring-emerald-500/10",
|
|
19
|
+
data: {
|
|
20
|
+
turbo_confirm: I18n.t("lesli_shield.invites.confirm_resend")
|
|
21
|
+
} %>
|
|
22
|
+
<% end %>
|
|
23
|
+
|
|
24
|
+
<% if invite.cancellable? %>
|
|
25
|
+
<%= button_to I18n.t("lesli_shield.invites.action_cancel"),
|
|
26
|
+
cancel_invite_path(invite),
|
|
27
|
+
method: :patch,
|
|
28
|
+
form: { class: "inline" },
|
|
29
|
+
class: "#{action_classes} border-rose-200 bg-rose-50 text-rose-700 hover:bg-rose-100 focus:ring-rose-500/10",
|
|
30
|
+
data: {
|
|
31
|
+
turbo_confirm: I18n.t("lesli_shield.invites.confirm_cancel")
|
|
32
|
+
} %>
|
|
33
|
+
<% end %>
|
|
34
|
+
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<%
|
|
2
|
+
status = invite.lifecycle_status
|
|
3
|
+
status_classes = {
|
|
4
|
+
"pending" => "bg-amber-50 text-amber-700 ring-amber-600/20",
|
|
5
|
+
"accepted" => "bg-emerald-50 text-emerald-700 ring-emerald-600/20",
|
|
6
|
+
"cancelled" => "bg-slate-100 text-slate-600 ring-slate-500/20",
|
|
7
|
+
"expired" => "bg-rose-50 text-rose-700 ring-rose-600/20"
|
|
8
|
+
}
|
|
9
|
+
%>
|
|
10
|
+
|
|
11
|
+
<span class="inline-flex items-center rounded-full px-2.5 py-1 text-xs font-semibold ring-1 ring-inset <%= status_classes.fetch(status) %>">
|
|
12
|
+
<%= I18n.t("lesli_shield.invites.statuses_#{status}") %>
|
|
13
|
+
</span>
|
|
@@ -1,67 +1,123 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
(at your option) any later version.
|
|
11
|
-
|
|
12
|
-
This program is distributed in the hope that it will be useful,
|
|
13
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
-
GNU General Public License for more details.
|
|
16
|
-
|
|
17
|
-
You should have received a copy of the GNU General Public License
|
|
18
|
-
along with this program. If not, see http://www.gnu.org/licenses/.
|
|
19
|
-
|
|
20
|
-
Lesli · Ruby on Rails SaaS Development Framework.
|
|
21
|
-
|
|
22
|
-
Made with ♥ by LesliTech
|
|
23
|
-
Building a better future, one line of code at a time.
|
|
1
|
+
<%
|
|
2
|
+
records = @invites.fetch(:records)
|
|
3
|
+
status_filters = [
|
|
4
|
+
[nil, I18n.t("lesli_shield.invites.filter_all")],
|
|
5
|
+
*LesliShield::InviteService::STATUS_FILTERS.map do |status|
|
|
6
|
+
[status, I18n.t("lesli_shield.invites.statuses_#{status}")]
|
|
7
|
+
end
|
|
8
|
+
]
|
|
9
|
+
%>
|
|
24
10
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
11
|
+
<%= render LesliView::Layout::Container.new("shield-invites") do %>
|
|
12
|
+
<%= render LesliView::Components::Header.new(
|
|
13
|
+
I18n.t("lesli_shield.invites.title"),
|
|
14
|
+
I18n.t("lesli_shield.invites.subtitle")
|
|
15
|
+
) do %>
|
|
16
|
+
<%= link_to new_invite_path,
|
|
17
|
+
class: "inline-flex h-10 items-center justify-center gap-2 rounded-xl bg-sky-600 px-4 text-sm font-semibold text-white shadow-sm transition hover:bg-sky-700 focus:outline-none focus:ring-4 focus:ring-sky-500/20" do %>
|
|
18
|
+
<span class="material-symbols" aria-hidden="true">person_add</span>
|
|
19
|
+
<span><%= I18n.t("lesli_shield.invites.action_create") %></span>
|
|
20
|
+
<% end %>
|
|
21
|
+
<% end %>
|
|
28
22
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
%>
|
|
23
|
+
<nav
|
|
24
|
+
class="mb-6 flex flex-wrap gap-2"
|
|
25
|
+
aria-label="<%= I18n.t("lesli_shield.invites.filters_label") %>">
|
|
26
|
+
<% status_filters.each do |status, label| %>
|
|
27
|
+
<%
|
|
28
|
+
active = @status_filter == status
|
|
29
|
+
filter_classes = class_names(
|
|
30
|
+
"inline-flex items-center rounded-full border px-3 py-1.5 text-sm font-medium transition focus:outline-none focus:ring-4 focus:ring-sky-500/10",
|
|
31
|
+
active ?
|
|
32
|
+
"border-sky-600 bg-sky-600 text-white" :
|
|
33
|
+
"border-slate-200 bg-white text-slate-600 hover:border-slate-300 hover:text-slate-900"
|
|
34
|
+
)
|
|
35
|
+
%>
|
|
36
|
+
<%= link_to label,
|
|
37
|
+
invites_path(status: status),
|
|
38
|
+
class: filter_classes,
|
|
39
|
+
aria: { current: active ? "page" : nil } %>
|
|
40
|
+
<% end %>
|
|
41
|
+
</nav>
|
|
32
42
|
|
|
33
|
-
<%
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
43
|
+
<% if records.any? %>
|
|
44
|
+
<div class="overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-sm">
|
|
45
|
+
<div class="overflow-x-auto">
|
|
46
|
+
<table class="min-w-full divide-y divide-slate-200">
|
|
47
|
+
<thead class="bg-slate-50">
|
|
48
|
+
<tr>
|
|
49
|
+
<% %w[recipient role status sent_at expires_at actions].each do |column| %>
|
|
50
|
+
<th scope="col" class="px-5 py-3 text-left text-xs font-semibold uppercase tracking-wide text-slate-500">
|
|
51
|
+
<%= I18n.t("lesli_shield.invites.column_#{column}") %>
|
|
52
|
+
</th>
|
|
53
|
+
<% end %>
|
|
54
|
+
</tr>
|
|
55
|
+
</thead>
|
|
56
|
+
<tbody class="divide-y divide-slate-100 bg-white">
|
|
57
|
+
<% records.each do |invite| %>
|
|
58
|
+
<tr class="transition hover:bg-slate-50/80">
|
|
59
|
+
<td class="whitespace-nowrap px-5 py-4">
|
|
60
|
+
<%= link_to invite_path(invite), class: "block focus:outline-none" do %>
|
|
61
|
+
<span class="block text-sm font-semibold text-slate-900">
|
|
62
|
+
<%= invite.full_name.presence || invite.email %>
|
|
63
|
+
</span>
|
|
64
|
+
<% if invite.full_name.present? %>
|
|
65
|
+
<span class="mt-0.5 block text-sm text-slate-500"><%= invite.email %></span>
|
|
66
|
+
<% end %>
|
|
67
|
+
<% end %>
|
|
68
|
+
</td>
|
|
69
|
+
<td class="whitespace-nowrap px-5 py-4 text-sm text-slate-600">
|
|
70
|
+
<%= invite.role&.name || I18n.t("lesli_shield.invites.value_not_available") %>
|
|
71
|
+
</td>
|
|
72
|
+
<td class="whitespace-nowrap px-5 py-4">
|
|
73
|
+
<%= render "status_badge", invite: invite %>
|
|
74
|
+
</td>
|
|
75
|
+
<td class="whitespace-nowrap px-5 py-4 text-sm text-slate-600">
|
|
76
|
+
<%= invite.sent_at.present? ? I18n.l(invite.sent_at, format: :short) : "—" %>
|
|
77
|
+
</td>
|
|
78
|
+
<td class="whitespace-nowrap px-5 py-4 text-sm text-slate-600">
|
|
79
|
+
<%= invite.expires_at.present? ? I18n.l(invite.expires_at, format: :short) : "—" %>
|
|
80
|
+
</td>
|
|
81
|
+
<td class="whitespace-nowrap px-5 py-4">
|
|
82
|
+
<%= render "invite_actions", invite: invite, show_view: true %>
|
|
83
|
+
</td>
|
|
84
|
+
</tr>
|
|
85
|
+
<% end %>
|
|
86
|
+
</tbody>
|
|
87
|
+
</table>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
<% else %>
|
|
91
|
+
<%
|
|
92
|
+
if @status_filter.present?
|
|
93
|
+
empty_title = I18n.t("lesli_shield.invites.empty_filtered_title")
|
|
94
|
+
empty_description = I18n.t(
|
|
95
|
+
"lesli_shield.invites.empty_filtered_description"
|
|
96
|
+
)
|
|
97
|
+
empty_action = I18n.t(
|
|
98
|
+
"lesli_shield.invites.empty_filtered_action"
|
|
99
|
+
)
|
|
100
|
+
empty_action_path = invites_path
|
|
101
|
+
else
|
|
102
|
+
empty_title = I18n.t("lesli_shield.invites.empty_title")
|
|
103
|
+
empty_description = I18n.t(
|
|
104
|
+
"lesli_shield.invites.empty_description"
|
|
105
|
+
)
|
|
106
|
+
empty_action = I18n.t("lesli_shield.invites.empty_action")
|
|
107
|
+
empty_action_path = new_invite_path
|
|
108
|
+
end
|
|
109
|
+
%>
|
|
110
|
+
<section class="rounded-2xl border border-dashed border-slate-300 bg-white px-6 py-16 text-center shadow-sm">
|
|
111
|
+
<span class="material-symbols mx-auto mb-4 block text-5xl text-slate-300" aria-hidden="true">person_add</span>
|
|
112
|
+
<h2 class="text-lg font-semibold text-slate-900">
|
|
113
|
+
<%= empty_title %>
|
|
114
|
+
</h2>
|
|
115
|
+
<p class="mx-auto mt-2 max-w-md text-sm leading-6 text-slate-500">
|
|
116
|
+
<%= empty_description %>
|
|
117
|
+
</p>
|
|
118
|
+
<%= link_to empty_action,
|
|
119
|
+
empty_action_path,
|
|
120
|
+
class: "mt-6 inline-flex h-10 items-center justify-center rounded-xl bg-sky-600 px-4 text-sm font-semibold text-white shadow-sm transition hover:bg-sky-700 focus:outline-none focus:ring-4 focus:ring-sky-500/20" %>
|
|
121
|
+
</section>
|
|
60
122
|
<% end %>
|
|
61
|
-
|
|
62
|
-
<%= render(LesliView::Elements::Table.new(
|
|
63
|
-
columns: columns,
|
|
64
|
-
records: @invites[:records],
|
|
65
|
-
link: lambda {|invite| invite_path(invite.id) }
|
|
66
|
-
)) %>
|
|
67
|
-
<% end %>
|
|
123
|
+
<% end %>
|
|
@@ -1,36 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
This program is distributed in the hope that it will be useful,
|
|
13
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
-
GNU General Public License for more details.
|
|
16
|
-
|
|
17
|
-
You should have received a copy of the GNU General Public License
|
|
18
|
-
along with this program. If not, see http://www.gnu.org/licenses/.
|
|
19
|
-
|
|
20
|
-
Lesli · Ruby on Rails SaaS Development Framework.
|
|
21
|
-
|
|
22
|
-
Made with ♥ by https://www.lesli.tech
|
|
23
|
-
Building a better future, one line of code at a time.
|
|
24
|
-
|
|
25
|
-
@contact hello@lesli.tech
|
|
26
|
-
@website https://www.lesli.tech
|
|
27
|
-
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
|
28
|
-
|
|
29
|
-
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
30
|
-
// ·
|
|
31
|
-
%>
|
|
32
|
-
|
|
33
|
-
<%= render LesliView::Layout::Container.new('shield-invites') do %>
|
|
34
|
-
<%= render LesliView::Components::Header.new('Invites')%>
|
|
35
|
-
<%= render "form" %>
|
|
36
|
-
<% end %>
|
|
1
|
+
<%= render LesliView::Layout::Container.new("shield-invites") do %>
|
|
2
|
+
<%= render LesliView::Components::Header.new(
|
|
3
|
+
I18n.t("lesli_shield.invites.new_title"),
|
|
4
|
+
I18n.t("lesli_shield.invites.new_description"),
|
|
5
|
+
back: invites_path
|
|
6
|
+
) %>
|
|
7
|
+
|
|
8
|
+
<div class="max-w-2xl">
|
|
9
|
+
<%= render "form" %>
|
|
10
|
+
</div>
|
|
11
|
+
<% end %>
|