lesli_shield 0.1.1 → 1.0.1
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/javascripts/lesli_shield/application.js +1 -4415
- data/app/assets/javascripts/lesli_shield/confirmations.js +1 -47
- data/app/assets/javascripts/lesli_shield/passwords.js +1 -699
- data/app/assets/javascripts/lesli_shield/registrations.js +1 -699
- data/app/assets/javascripts/lesli_shield/sessions.js +1 -699
- data/app/assets/stylesheets/lesli_shield/application.css +0 -3
- data/app/assets/stylesheets/lesli_shield/confirmations.css +0 -25828
- data/app/assets/stylesheets/lesli_shield/devise/oauth.css +1 -0
- data/app/assets/stylesheets/lesli_shield/passwords.css +1 -25812
- data/app/assets/stylesheets/lesli_shield/registrations.css +1 -26168
- data/app/assets/stylesheets/lesli_shield/sessions.css +1 -26168
- data/app/assets/stylesheets/lesli_shield/users.css +1 -0
- data/app/controllers/lesli_shield/application_controller.rb +2 -2
- data/app/controllers/lesli_shield/dashboards_controller.rb +8 -1
- data/app/controllers/lesli_shield/role/actions_controller.rb +46 -0
- data/app/controllers/lesli_shield/roles_controller.rb +182 -0
- data/app/controllers/lesli_shield/sessions_controller.rb +67 -0
- data/app/controllers/lesli_shield/settings_controller.rb +61 -0
- data/app/controllers/lesli_shield/users_controller.rb +90 -0
- data/app/controllers/users/confirmations_controller.rb +2 -1
- data/app/controllers/users/passwords_controller.rb +31 -35
- data/app/controllers/users/registrations_controller.rb +28 -33
- data/app/controllers/users/sessions_controller.rb +38 -48
- data/app/helpers/lesli_shield/sessions_helper.rb +4 -0
- data/app/helpers/lesli_shield/settings_helper.rb +4 -0
- data/app/helpers/lesli_shield/users_helper.rb +4 -0
- data/app/interfaces/lesli_shield/authentication_interface.rb +64 -0
- data/app/interfaces/lesli_shield/authorization_interface.rb +40 -0
- data/{db/migrate/v1/0801050210_create_lesli_shield_dashboard_components.rb → app/models/lesli_shield/account.rb} +8 -18
- data/app/models/lesli_shield/application_record.rb +3 -3
- data/app/models/lesli_shield/setting.rb +4 -0
- data/app/models/lesli_shield/user.rb +5 -0
- data/app/services/lesli_shield/tokens.rb +39 -0
- data/app/views/devise/confirmations/new.html.erb +14 -0
- data/app/views/devise/passwords/edit.html.erb +27 -69
- data/app/views/devise/passwords/new.html.erb +31 -73
- data/app/views/devise/registrations/new.html.erb +43 -97
- data/app/views/devise/sessions/new.html.erb +48 -68
- data/app/views/devise/shared/_demo.html.erb +6 -7
- data/app/views/devise/shared/_error_messages.html.erb +27 -13
- data/app/views/devise/shared/_links.html.erb +1 -1
- data/app/views/lesli_shield/dashboards/index.html.erb +8 -0
- data/app/views/lesli_shield/dashboards/show.html.erb +1 -1
- data/app/views/lesli_shield/partials/_navigation.html.erb +39 -0
- data/app/views/lesli_shield/roles/_form-information.html.erb +21 -0
- data/app/views/lesli_shield/roles/_form-privileges.html.erb +104 -0
- data/app/views/lesli_shield/roles/_session.html.erb +2 -0
- data/app/views/lesli_shield/roles/edit.html.erb +12 -0
- data/app/views/lesli_shield/roles/index.html.erb +45 -0
- data/app/views/lesli_shield/roles/new.html.erb +11 -0
- data/app/views/lesli_shield/roles/show.html.erb +13 -0
- data/app/views/lesli_shield/roles/update.turbo_stream.erb +3 -0
- data/app/views/lesli_shield/sessions/_form.html.erb +17 -0
- data/app/views/lesli_shield/sessions/_session.html.erb +2 -0
- data/app/views/lesli_shield/sessions/edit.html.erb +12 -0
- data/app/views/lesli_shield/sessions/index.html.erb +37 -0
- data/app/views/lesli_shield/sessions/new.html.erb +11 -0
- data/app/views/lesli_shield/sessions/show.html.erb +6 -0
- data/app/views/lesli_shield/settings/_form.html.erb +17 -0
- data/app/views/lesli_shield/settings/_setting.html.erb +2 -0
- data/app/views/lesli_shield/settings/edit.html.erb +12 -0
- data/app/views/lesli_shield/settings/index.html.erb +16 -0
- data/app/views/lesli_shield/settings/new.html.erb +11 -0
- data/app/views/lesli_shield/settings/show.html.erb +9 -0
- data/app/views/lesli_shield/users/_information-card.html.erb +49 -0
- data/app/views/lesli_shield/users/_information-form.html.erb +12 -0
- data/app/views/lesli_shield/users/_management-sessions.html.erb +27 -0
- data/app/views/lesli_shield/users/_viewer-activities.html.erb +5 -0
- data/app/views/lesli_shield/users/edit.html.erb +0 -0
- data/app/views/lesli_shield/users/index.html.erb +45 -0
- data/app/views/lesli_shield/users/new.html.erb +11 -0
- data/app/views/lesli_shield/users/show.html.erb +27 -0
- data/app/views/lesli_shield/users/update.turbo_stream.erb +3 -0
- data/config/locales/translations.en.yml +1 -22
- data/config/locales/translations.es.yml +1 -22
- data/config/locales/translations.fr.yml +1 -22
- data/config/locales/translations.it.yml +1 -22
- data/config/locales/translations.pt.yml +1 -22
- data/config/routes.rb +31 -7
- data/db/migrate/v1/0801000110_create_lesli_shield_accounts.rb +3 -8
- data/db/migrate/v1/0801001710_create_lesli_shield_settings.rb +37 -0
- data/db/migrate/v1/{0801050110_create_lesli_shield_dashboards.rb → 0801003010_create_lesli_shield_dashboards.rb} +3 -17
- data/db/migrate/v1/0801120310_create_lesli_shield_user_shortcuts.rb +44 -0
- data/db/migrate/v1/0801120410_create_lesli_shield_user_tokens.rb +46 -0
- data/lib/lesli_shield/engine.rb +1 -5
- data/lib/lesli_shield/routing.rb +0 -3
- data/lib/lesli_shield/version.rb +2 -2
- data/lib/scss/_devise-simple.scss +90 -0
- data/lib/scss/_devise.scss +162 -0
- data/lib/scss/application.scss +6 -0
- data/lib/scss/confirmations.scss +24 -24
- data/lib/scss/devise/oauth.scss +1 -1
- data/lib/scss/passwords.scss +4 -2
- data/lib/scss/registrations.scss +2 -2
- data/lib/scss/sessions.scss +2 -2
- data/lib/scss/users.scss +58 -0
- data/lib/tasks/lesli_shield_tasks.rake +49 -4
- data/lib/vue/application.js +7 -0
- data/lib/vue/apps/sessions/index.vue +50 -0
- data/lib/vue/stores/sessions.js +43 -0
- data/readme.md +32 -18
- metadata +67 -15
- data/app/views/layouts/lesli_shield/application.html.erb +0 -15
@@ -1,9 +1,7 @@
|
|
1
|
-
|
2
|
-
=begin
|
3
|
-
|
1
|
+
<%#
|
4
2
|
Lesli
|
5
3
|
|
6
|
-
Copyright (c)
|
4
|
+
Copyright (c) 2025, 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
|
@@ -29,102 +27,45 @@ 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
|
|
36
33
|
<%= render("lesli/wrappers/application-devise", title:"Create an account to discover Lesli") do %>
|
37
34
|
|
38
35
|
<%# Log in form %>
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
<div class="field mb-5">
|
61
|
-
<label for="user_password" class="label">Password</label>
|
62
|
-
<div class="control has-icons-left has-icons-right">
|
63
|
-
<input
|
64
|
-
id="user_password"
|
65
|
-
name="user_password"
|
66
|
-
type="password"
|
67
|
-
ref="password"
|
68
|
-
:class="['input', `is-${notification.type}`]"
|
69
|
-
placeholder="* * * * * * *"
|
70
|
-
v-model="sign_up.password"
|
71
|
-
@input="typing">
|
72
|
-
<span
|
73
|
-
:class="['icon', 'is-small', 'is-left', `has-text-${notification.type}`]">
|
74
|
-
<i class="ri-key-fill"></i>
|
75
|
-
</span>
|
76
|
-
<span
|
77
|
-
@click="togglePasswordInput()"
|
78
|
-
:class="['icon', 'is-small', 'is-right', `has-text-${notification.type}`]">
|
79
|
-
<i class="ri-eye-fill"></i>
|
80
|
-
</span>
|
81
|
-
</div>
|
82
|
-
<p v-cloak v-if="notification.show" :class="['help', `is-${notification.type}`]">
|
83
|
-
{{ notification.message }}
|
84
|
-
</p>
|
85
|
-
</div>
|
36
|
+
<%= form_for(
|
37
|
+
resource,
|
38
|
+
as: resource_name,
|
39
|
+
url: user_registration_path,
|
40
|
+
builder: LesliView::Forms::Builder
|
41
|
+
) do |form| %>
|
42
|
+
|
43
|
+
<%= form.field_control_builder(
|
44
|
+
label_html:form.label(:email, "E-mail address"),
|
45
|
+
control_html:form.email_field(:email, autofocus: true, autocomplete: "email", placeholder: Lesli.config.company[:email]),
|
46
|
+
category: flash.first&.first,
|
47
|
+
icon: "person"
|
48
|
+
) %>
|
49
|
+
|
50
|
+
<%= form.field_control_builder(
|
51
|
+
label_html:form.label(:password),
|
52
|
+
control_html:form.password_field(:password, autocomplete: "current-password", placeholder: "* * * * * *"),
|
53
|
+
message_text: flash.first&.second,
|
54
|
+
category: flash.first&.first,
|
55
|
+
icon: "key"
|
56
|
+
) %>
|
86
57
|
|
87
58
|
<div class="field mb-5">
|
88
59
|
<p>Password needs to contain:</p>
|
89
60
|
<ul class="pl-3 password-requirements">
|
90
|
-
<li
|
91
|
-
|
92
|
-
'has-text-danger': password_uppercase == 1,
|
93
|
-
'has-text-success': password_uppercase == 2
|
94
|
-
}
|
95
|
-
]">
|
96
|
-
<span class="text">
|
97
|
-
• minimum one uppercase letter
|
98
|
-
</span>
|
99
|
-
<span class="icon">
|
100
|
-
<i class="ri-eye-fill"></i>
|
101
|
-
</span>
|
61
|
+
<li>
|
62
|
+
• Minimum one uppercase letter
|
102
63
|
</li>
|
103
|
-
<li
|
104
|
-
|
105
|
-
'has-text-danger': password_symbol == 1,
|
106
|
-
'has-text-success': password_symbol == 2
|
107
|
-
}
|
108
|
-
]">
|
109
|
-
<span class="text">
|
110
|
-
• one symbol
|
111
|
-
</span>
|
112
|
-
<span class="icon">
|
113
|
-
<i class="ri-eye-fill"></i>
|
114
|
-
</span>
|
64
|
+
<li>
|
65
|
+
• One symbol
|
115
66
|
</li>
|
116
|
-
<li
|
117
|
-
|
118
|
-
'has-text-danger': password_number == 1,
|
119
|
-
'has-text-success': password_number == 2
|
120
|
-
}
|
121
|
-
]">
|
122
|
-
<span class="text">
|
123
|
-
• one number
|
124
|
-
</span>
|
125
|
-
<span class="icon">
|
126
|
-
<i class="ri-eye-fill"></i>
|
127
|
-
</span>
|
67
|
+
<li>
|
68
|
+
• One number
|
128
69
|
</li>
|
129
70
|
</ul>
|
130
71
|
</div>
|
@@ -136,16 +77,21 @@ Building a better future, one line of code at a time.
|
|
136
77
|
</p>
|
137
78
|
</div>
|
138
79
|
|
139
|
-
<div class="field">
|
80
|
+
<div class="field mb-4 mt-5">
|
140
81
|
<div class="control is-fullwidth">
|
141
|
-
<
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
<% end %>
|
147
|
-
</p>
|
82
|
+
<button
|
83
|
+
type="submit"
|
84
|
+
class="button is-primary is-fullwidth mb-2">
|
85
|
+
Create account
|
86
|
+
</button>
|
148
87
|
</div>
|
149
88
|
</div>
|
150
|
-
|
89
|
+
|
90
|
+
<p class="account has-text-centered">
|
91
|
+
Already have an account?
|
92
|
+
<%= link_to(new_user_session_path, :class => "has-text-primary") do %>
|
93
|
+
<u><b>Log in</b></u>
|
94
|
+
<% end %>
|
95
|
+
</p>
|
96
|
+
<% end %>
|
151
97
|
<% end %>
|
@@ -1,9 +1,8 @@
|
|
1
|
-
|
2
|
-
=begin
|
1
|
+
<%#
|
3
2
|
|
4
3
|
Lesli
|
5
4
|
|
6
|
-
Copyright (c)
|
5
|
+
Copyright (c) 2025, Lesli Technologies, S. A.
|
7
6
|
|
8
7
|
This program is free software: you can redistribute it and/or modify
|
9
8
|
it under the terms of the GNU General Public License as published by
|
@@ -20,7 +19,7 @@ along with this program. If not, see http://www.gnu.org/licenses/.
|
|
20
19
|
|
21
20
|
Lesli · Ruby on Rails SaaS Development Framework.
|
22
21
|
|
23
|
-
Made with ♥ by
|
22
|
+
Made with ♥ by LesliTech
|
24
23
|
Building a better future, one line of code at a time.
|
25
24
|
|
26
25
|
@contact hello@lesli.tech
|
@@ -29,86 +28,67 @@ Building a better future, one line of code at a time.
|
|
29
28
|
|
30
29
|
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
31
30
|
// ·
|
32
|
-
|
31
|
+
%>
|
32
|
+
|
33
|
+
<%
|
34
|
+
if Lesli.config.demo
|
35
|
+
resource.email = Lesli.config.company[:email]
|
36
|
+
resource.password = Lesli.config.security[:password]
|
37
|
+
end
|
33
38
|
%>
|
34
39
|
|
35
40
|
<%= render("lesli/wrappers/application-devise", title:"Welcome to Lesli") do %>
|
36
41
|
|
37
|
-
|
38
|
-
|
42
|
+
<%= form_for(
|
43
|
+
resource,
|
44
|
+
as: resource_name,
|
45
|
+
url: user_session_path,
|
46
|
+
builder: LesliView::Forms::Builder
|
47
|
+
) do |form| %>
|
48
|
+
|
39
49
|
<% if Lesli.config.demo %>
|
40
50
|
<%= render("devise/shared/demo") %>
|
41
51
|
<% end %>
|
42
|
-
<div class="field mb-4">
|
43
|
-
<label for="user_email" class="label">E-mail address</label>
|
44
|
-
<div class="control has-icons-left has-icons-right">
|
45
|
-
<input
|
46
|
-
required
|
47
|
-
id="user_email"
|
48
|
-
name="user_email"
|
49
|
-
type="email"
|
50
|
-
ref="email"
|
51
|
-
:class="['input', `is-${notification.type}`]"
|
52
|
-
placeholder="hello@lesli.tech"
|
53
|
-
v-model="sign_in.email"
|
54
|
-
@input="typing">
|
55
|
-
<span :class="['icon', 'is-small', 'is-left', `has-text-${notification.type}`]">
|
56
|
-
<i class="ri-user-line"></i>
|
57
|
-
</span>
|
58
|
-
</div>
|
59
|
-
</div>
|
60
|
-
<div class="field mb-5">
|
61
|
-
<label for="user_password" class="label">Password</label>
|
62
|
-
<div class="control has-icons-left has-icons-right">
|
63
|
-
<input
|
64
|
-
required
|
65
|
-
id="user_password"
|
66
|
-
name="user_password"
|
67
|
-
type="password"
|
68
|
-
ref="password"
|
69
|
-
:class="['input', `is-${notification.type}`]"
|
70
|
-
placeholder="* * * * * * *"
|
71
|
-
v-model="sign_in.password"
|
72
|
-
@input="typing">
|
73
|
-
<span :class="['icon', 'is-small', 'is-left', `has-text-${notification.type}`]">
|
74
|
-
<i class="ri-key-fill"></i>
|
75
|
-
</span>
|
76
|
-
<span
|
77
|
-
@click="togglePasswordInput()"
|
78
|
-
:class="['icon', 'is-small', 'is-right', `has-text-${notification.type}`]">
|
79
|
-
<i class="ri-eye-fill"></i>
|
80
|
-
</span>
|
81
|
-
</div>
|
82
|
-
<p v-cloak v-if="notification.show" :class="['help', `is-${notification.type}`]">
|
83
|
-
{{ notification.message }}
|
84
|
-
</p>
|
85
|
-
</div>
|
86
52
|
|
87
|
-
|
53
|
+
<%= form.field_control_builder(
|
54
|
+
label_html:form.label(:email, "E-mail address"),
|
55
|
+
control_html:form.email_field(:email, autofocus: true, autocomplete: "email", placeholder: Lesli.config.company[:email]),
|
56
|
+
category: flash.first&.first,
|
57
|
+
icon: "person"
|
58
|
+
) %>
|
59
|
+
|
60
|
+
<%= form.field_control_builder(
|
61
|
+
label_html:form.label(:password),
|
62
|
+
control_html:form.password_field(:password, autocomplete: "current-password", placeholder: "* * * * * *"),
|
63
|
+
message_text: flash.first&.second,
|
64
|
+
category: flash.first&.first,
|
65
|
+
icon: "key"
|
66
|
+
) %>
|
67
|
+
|
68
|
+
<% if params[:r].presence %>
|
69
|
+
<%= tag(:input, :type => "hidden", :name => "user[redirect]", :value => params[:r]) %>
|
70
|
+
<% end %>
|
71
|
+
|
72
|
+
<div class="field mb-4 mt-5">
|
88
73
|
<div class="control is-fullwidth">
|
89
74
|
<button
|
90
75
|
type="submit"
|
91
|
-
|
76
|
+
class="button is-primary is-fullwidth mb-2">
|
92
77
|
Log in
|
93
78
|
</button>
|
94
|
-
<% if Lesli.config.security.dig(:allow_registration) %>
|
95
|
-
<p class="account has-text-centered">
|
96
|
-
Still not registered?
|
97
|
-
<%= link_to(new_user_registration_path, :class => "has-text-primary") do %>
|
98
|
-
<u><b>Create account</b></u>
|
99
|
-
<% end %>
|
100
|
-
</p>
|
101
|
-
<% end %>
|
102
79
|
</div>
|
103
80
|
</div>
|
104
81
|
|
105
|
-
|
106
|
-
<p class="
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
82
|
+
<% if Lesli.config.security.dig(:allow_registration) %>
|
83
|
+
<p class="account has-text-centered">
|
84
|
+
Still not registered?
|
85
|
+
<%= link_to(new_user_registration_path, :class => "has-text-primary") do %>
|
86
|
+
<u><b>Create account</b></u>
|
87
|
+
<% end %>
|
88
|
+
</p>
|
89
|
+
<% end %>
|
111
90
|
|
112
|
-
|
91
|
+
<% end %>
|
113
92
|
|
93
|
+
<%= render("devise/shared/links", password_reset:true, magic_link:false, otp:false) %>
|
114
94
|
<% end %>
|
@@ -1,7 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
</div>
|
1
|
+
|
2
|
+
<fieldset class="shield-form-demo mb-4 px-4 pb-2">
|
3
|
+
<legend>demo account</legend>
|
4
|
+
<p><small><b>Username: </b><%= Lesli.config.company[:email] %></small></label>
|
5
|
+
<p><small><b>Password: </b><%= Lesli.config.security[:password] %></small></p>
|
6
|
+
</fieldset>
|
@@ -1,15 +1,29 @@
|
|
1
|
+
|
2
|
+
<% if flash[:danger] %>
|
3
|
+
<div class="notification is-danger">
|
4
|
+
<%= flash[:danger] %>
|
5
|
+
</div>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<% if flash[:success] %>
|
9
|
+
<div class="notification is-success">
|
10
|
+
<%= flash[:success] %>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
|
1
15
|
<% if resource.errors.any? %>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
16
|
+
<div id="error_explanation" data-turbo-cache="false">
|
17
|
+
<h5 class="is-size-5">
|
18
|
+
<%= I18n.t("errors.messages.not_saved",
|
19
|
+
count: resource.errors.count,
|
20
|
+
resource: resource.class.model_name.human.downcase)
|
21
|
+
%>
|
22
|
+
</h5>
|
23
|
+
<ul>
|
24
|
+
<% resource.errors.full_messages.each do |message| %>
|
25
|
+
<li class="has-text-danger"><%= message %></li>
|
26
|
+
<% end %>
|
27
|
+
</ul>
|
28
|
+
</div>
|
15
29
|
<% end %>
|
@@ -37,7 +37,7 @@ Building a better future, one line of code at a time.
|
|
37
37
|
<% magic_link = defined?(magic_link) ? magic_link : false %>
|
38
38
|
<% otp = defined?(otp) ? otp : false %>
|
39
39
|
|
40
|
-
<div class="links">
|
40
|
+
<div class="links mt-4">
|
41
41
|
|
42
42
|
<% if login %>
|
43
43
|
<%= link_to(new_user_session_path) do %>
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
<%= render("/lesli/shared/dashboards/show") %>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<%
|
2
|
+
=begin
|
3
|
+
|
4
|
+
Lesli
|
5
|
+
|
6
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
7
|
+
|
8
|
+
This program is free software: you can redistribute it and/or modify
|
9
|
+
it under the terms of the GNU General Public License as published by
|
10
|
+
the Free Software Foundation, either version 3 of the License, or
|
11
|
+
(at your option) any later version.
|
12
|
+
|
13
|
+
This program is distributed in the hope that it will be useful,
|
14
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
GNU General Public License for more details.
|
17
|
+
|
18
|
+
You should have received a copy of the GNU General Public License
|
19
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
20
|
+
|
21
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
22
|
+
|
23
|
+
Made with ♥ by https://www.lesli.tech
|
24
|
+
Building a better future, one line of code at a time.
|
25
|
+
|
26
|
+
@contact hello@lesli.tech
|
27
|
+
@website https://www.lesli.tech
|
28
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
29
|
+
|
30
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
31
|
+
// ·
|
32
|
+
=end
|
33
|
+
%>
|
34
|
+
|
35
|
+
<%= navigation_item(lesli_shield.dashboard_path, "Dashboard", "ri-dashboard-3-line"); %>
|
36
|
+
<%= navigation_item(lesli_shield.users_path, "Users", "ri-user-line"); %>
|
37
|
+
<%= navigation_item(lesli_shield.sessions_path, "Sessions", "ri-lock-line") %>
|
38
|
+
<%= navigation_item(lesli_shield.roles_path, "Roles", "ri-shield-user-line") %>
|
39
|
+
<%= navigation_item(lesli_shield.settings_path, "Settings", "ri-settings-3-line") %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<%= form_with(model: @role, builder: LesliView::Forms::Builder) do |form| %>
|
2
|
+
<%= form.fieldset do %>
|
3
|
+
<%= form.field_control(:name) %>
|
4
|
+
<div class="columns">
|
5
|
+
<div class="column">
|
6
|
+
<%= form.field_control_select(:active, [["Activo", true], ["Desactivado", false]], label: "Status") %>
|
7
|
+
</div>
|
8
|
+
<div class="column">
|
9
|
+
<%#= form.field_control_select(:isolated, LesliBabel::Label.prefixes) %>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
<%= form.field_control(:description) %>
|
13
|
+
<%= form.field_control(:active) %>
|
14
|
+
<%= form.field_control(:path_default) %>
|
15
|
+
<%= form.field_control(:path_limited) %>
|
16
|
+
<%= form.field_control(:isolated) %>
|
17
|
+
<%= form.field_control(:permission_level) %>
|
18
|
+
<hr/>
|
19
|
+
<%= form.field_control_submit %>
|
20
|
+
<% end %>
|
21
|
+
<% end %>
|
@@ -0,0 +1,104 @@
|
|
1
|
+
|
2
|
+
<%
|
3
|
+
columns = [{
|
4
|
+
label: "Controller"
|
5
|
+
}, {
|
6
|
+
label: "List"
|
7
|
+
}, {
|
8
|
+
label: "Index"
|
9
|
+
}, {
|
10
|
+
label: "Show"
|
11
|
+
}, {
|
12
|
+
label: "Create"
|
13
|
+
}, {
|
14
|
+
label: "Update"
|
15
|
+
}, {
|
16
|
+
label: "Destroy"
|
17
|
+
}, {
|
18
|
+
label: ""
|
19
|
+
}]
|
20
|
+
%>
|
21
|
+
|
22
|
+
|
23
|
+
<style>
|
24
|
+
.mini-toggle {
|
25
|
+
position: relative;
|
26
|
+
width: 40px;
|
27
|
+
height: 20px;
|
28
|
+
background: #ccc;
|
29
|
+
border-radius: 9999px;
|
30
|
+
border: none;
|
31
|
+
cursor: pointer;
|
32
|
+
padding: 0;
|
33
|
+
transition: background 0.25s ease;
|
34
|
+
display: inline-block;
|
35
|
+
}
|
36
|
+
|
37
|
+
.mini-toggle.active {
|
38
|
+
background: #22c55e; /* green */
|
39
|
+
background: var(--lesli-color-primary)
|
40
|
+
}
|
41
|
+
|
42
|
+
.mini-toggle-slider {
|
43
|
+
position: absolute;
|
44
|
+
top: 2px;
|
45
|
+
left: 2px;
|
46
|
+
width: 16px;
|
47
|
+
height: 16px;
|
48
|
+
background: white;
|
49
|
+
border-radius: 50%;
|
50
|
+
transition: transform 0.25s ease;
|
51
|
+
}
|
52
|
+
|
53
|
+
.mini-toggle.active .mini-toggle-slider {
|
54
|
+
transform: translateX(20px);
|
55
|
+
}
|
56
|
+
</style>
|
57
|
+
|
58
|
+
<%= render LesliView::Elements::Table.new(:columns => columns) do |table| %>
|
59
|
+
<% @role_actions.each do |controller_name, actions| %>
|
60
|
+
<% table.with_row do |row| %>
|
61
|
+
<% row.with_cell do %>
|
62
|
+
<%= controller_name %>
|
63
|
+
<% end %>
|
64
|
+
<% actions.each do |action_name, action| %>
|
65
|
+
<% row.with_cell do %>
|
66
|
+
<% if action %>
|
67
|
+
<%= button_to role_action_path(action),
|
68
|
+
method: :delete,
|
69
|
+
class: "mini-toggle #{action[:active] == 1 ? 'active' : ''}",
|
70
|
+
form: { "x-data" => "toggleForm", "x-on:submit.prevent" => "submit($el)" } do %>
|
71
|
+
<span class="mini-toggle-slider"></span>
|
72
|
+
<% end %>
|
73
|
+
<% end %>
|
74
|
+
<% end %>
|
75
|
+
<% end %>
|
76
|
+
<% end %>
|
77
|
+
<% end %>
|
78
|
+
<% end %>
|
79
|
+
<script>
|
80
|
+
document.addEventListener('alpine:init', () => {
|
81
|
+
Alpine.data('toggleForm', () => ({
|
82
|
+
submit(form) {
|
83
|
+
const method = form.querySelector('input[name="_method"]')?.value?.toUpperCase() || form.method.toUpperCase();
|
84
|
+
fetch(form.action, {
|
85
|
+
method: method,
|
86
|
+
headers: {
|
87
|
+
'X-CSRF-Token': document.querySelector('meta[name="csrf-token"]').content,
|
88
|
+
'Accept': 'text/vnd.turbo-stream.html' // or 'application/json'
|
89
|
+
},
|
90
|
+
body: new URLSearchParams(new FormData(form))
|
91
|
+
}).then(response => {
|
92
|
+
if (!response.ok) throw new Error("Request failed");
|
93
|
+
return response.text();
|
94
|
+
}).then(() => {
|
95
|
+
// Success! Toggle the class
|
96
|
+
form.querySelector('button')?.classList.toggle('active');
|
97
|
+
}).catch(err => {
|
98
|
+
console.error("Error:", err);
|
99
|
+
alert("Something went wrong");
|
100
|
+
});
|
101
|
+
}
|
102
|
+
}))
|
103
|
+
});
|
104
|
+
</script>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
|
2
|
+
<%
|
3
|
+
columns = [{
|
4
|
+
field: "id",
|
5
|
+
label: "ID"
|
6
|
+
},{
|
7
|
+
field: "name",
|
8
|
+
label: "Name",
|
9
|
+
sort: true
|
10
|
+
}, {
|
11
|
+
field: "users",
|
12
|
+
label: "Users",
|
13
|
+
align: "center",
|
14
|
+
sort: true
|
15
|
+
}, {
|
16
|
+
field: "actions",
|
17
|
+
label: "Actions",
|
18
|
+
align: "center",
|
19
|
+
sort: true
|
20
|
+
}, {
|
21
|
+
field: "isolated",
|
22
|
+
label: "Isolated",
|
23
|
+
sort: true
|
24
|
+
}, {
|
25
|
+
field: "active",
|
26
|
+
label: "Active",
|
27
|
+
sort: true
|
28
|
+
}]
|
29
|
+
%>
|
30
|
+
<%= render LesliView::Layout::Container.new("shield-roles") do %>
|
31
|
+
<%= render LesliView::Components::Header.new("Roles") do %>
|
32
|
+
<%= render(LesliView::Elements::Button.new(icon: "add", solid:true)) do %>
|
33
|
+
Add new
|
34
|
+
<% end %>
|
35
|
+
<%= render(LesliView::Elements::Button.new(icon: "refresh")) do %>
|
36
|
+
Reload
|
37
|
+
<% end %>
|
38
|
+
<% end %>
|
39
|
+
<%= render LesliView::Components::Toolbar.new() %>
|
40
|
+
<%= render(LesliView::Elements::Table.new(
|
41
|
+
columns: columns,
|
42
|
+
records: @roles[:records],
|
43
|
+
link: lambda {|role| role_path(role.id) }
|
44
|
+
)) %>
|
45
|
+
<% end %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= render LesliView::Layout::Container.new("shield-roles-show") do %>
|
2
|
+
<%= render LesliView::Components::Header.new(@role.name) do %>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<%= render LesliView::Components::Tabs.new() do |tabs| %>
|
6
|
+
<% tabs.with_tab(title:"privileges", icon:"security") do %>
|
7
|
+
<%= render "form-privileges" %>
|
8
|
+
<% end %>
|
9
|
+
<% tabs.with_tab(title:"information", icon:"info_outline") do %>
|
10
|
+
<%= render "form-information" %>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|