lesli_admin 1.1.3 → 1.1.4
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_admin/application.css +176 -219
- data/app/controllers/lesli_admin/accounts_controller.rb +3 -1
- data/app/controllers/lesli_admin/settings_controller.rb +24 -55
- data/app/models/lesli_admin/account/setting.rb +12 -0
- data/app/operators/lesli_admin/theme_operator.rb +16 -0
- data/app/services/lesli_admin/account_service.rb +5 -1
- data/app/services/lesli_admin/setting_service.rb +19 -0
- data/app/views/lesli_admin/accounts/show.html.erb +11 -2
- data/app/views/lesli_admin/dashboards/_component-account-metadata.html.erb +15 -15
- data/app/views/lesli_admin/partials/_navigation.html.erb +3 -3
- data/app/views/lesli_admin/settings/_appearance.html.erb +21 -0
- data/app/views/lesli_admin/settings/_configuration_value.html.erb +13 -13
- data/app/views/lesli_admin/settings/_defaults.html.erb +28 -28
- data/app/views/lesli_admin/settings/_modules.html.erb +3 -3
- data/app/views/lesli_admin/settings/show.html.erb +3 -0
- data/config/locales/appearance.yml +55 -0
- data/config/locales/translations.en.yml +4 -1
- data/config/locales/translations.es.yml +4 -1
- data/lib/lesli_admin/version.rb +2 -2
- metadata +6 -2
|
@@ -1,58 +1,27 @@
|
|
|
1
1
|
module LesliAdmin
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if @setting.save
|
|
27
|
-
redirect_to @setting, notice: "Setting was successfully created."
|
|
28
|
-
else
|
|
29
|
-
render :new, status: :unprocessable_entity
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# PATCH/PUT /settings/1
|
|
34
|
-
def update
|
|
35
|
-
if @setting.update(setting_params)
|
|
36
|
-
redirect_to @setting, notice: "Setting was successfully updated.", status: :see_other
|
|
37
|
-
else
|
|
38
|
-
render :edit, status: :unprocessable_entity
|
|
39
|
-
end
|
|
2
|
+
class SettingsController < ApplicationController
|
|
3
|
+
def show
|
|
4
|
+
@setting = SettingService.new(current_user).show.result
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def update
|
|
8
|
+
attributes = params.require(:setting).permit(:value)
|
|
9
|
+
attributes[:value] = nil if params[:restore_primary_color] == "1"
|
|
10
|
+
service = SettingService.new(current_user).update(attributes)
|
|
11
|
+
@setting = service.result
|
|
12
|
+
|
|
13
|
+
if service.successful?
|
|
14
|
+
flash[:notice] = t("lesli_admin.settings.appearance.saved") unless request.format.json?
|
|
15
|
+
# Reload the full page so the layout applies the saved account theme.
|
|
16
|
+
respond_with_lesli(redirect: settings_path, json: { primary_color: @setting.value })
|
|
17
|
+
else
|
|
18
|
+
respond_with_lesli(
|
|
19
|
+
html: :show,
|
|
20
|
+
turbo: turbo_stream.replace("account-appearance", partial: "lesli_admin/settings/appearance"),
|
|
21
|
+
json: { errors: @setting.errors.to_hash },
|
|
22
|
+
status: :unprocessable_content
|
|
23
|
+
)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
40
26
|
end
|
|
41
|
-
|
|
42
|
-
# DELETE /settings/1
|
|
43
|
-
def destroy
|
|
44
|
-
@setting.destroy!
|
|
45
|
-
redirect_to settings_path, notice: "Setting was successfully destroyed.", status: :see_other
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
private
|
|
49
|
-
# Use callbacks to share common setup or constraints between actions.
|
|
50
|
-
def set_setting
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
# Only allow a list of trusted parameters through.
|
|
54
|
-
def setting_params
|
|
55
|
-
params.fetch(:setting, {})
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
27
|
end
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
module LesliAdmin
|
|
2
2
|
class Account::Setting < ApplicationRecord
|
|
3
|
+
validates :value, format: {
|
|
4
|
+
with: /\A#(?:\h{3}|\h{6})\z/,
|
|
5
|
+
message: ->(*) { I18n.t("lesli_admin.settings.appearance.invalid_color") }
|
|
6
|
+
}, allow_blank: true, if: -> { name == "lesli_theme_color_primary" }
|
|
7
|
+
|
|
8
|
+
# Native color inputs require six digits; the preview matches LesliAssets primary-700.
|
|
9
|
+
# Restoring the theme saves nil and lets LesliAssets provide the real fallback.
|
|
10
|
+
def color_input_value
|
|
11
|
+
color = value.presence || "#194A99"
|
|
12
|
+
color.length == 4 ? "##{color.delete_prefix('#').chars.map { |digit| digit * 2 }.join}" : color
|
|
13
|
+
end
|
|
14
|
+
|
|
3
15
|
belongs_to :account, class_name: "LesliAdmin::Account", inverse_of: :settings
|
|
4
16
|
belongs_to :user, class_name: "Lesli::User", optional: true
|
|
5
17
|
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module LesliAdmin
|
|
2
|
+
class ThemeOperator
|
|
3
|
+
def initialize(current_user)
|
|
4
|
+
@current_user = current_user
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def primary_color
|
|
8
|
+
# Join the engine account directly; no account objects need loading.
|
|
9
|
+
Account::Setting.joins(:account).where(
|
|
10
|
+
lesli_admin_accounts: { account_id: @current_user.account_id },
|
|
11
|
+
name: "lesli_theme_color_primary",
|
|
12
|
+
user_id: nil
|
|
13
|
+
).pick(:value)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -34,7 +34,7 @@ module LesliAdmin
|
|
|
34
34
|
class AccountService < Lesli::ApplicationLesliService
|
|
35
35
|
def show
|
|
36
36
|
account = Lesli::Account
|
|
37
|
-
.includes(:user, admin: :detail)
|
|
37
|
+
.includes(:user, logo_attachment: :blob, admin: :detail)
|
|
38
38
|
.find(current_user.account.id)
|
|
39
39
|
|
|
40
40
|
account.admin.build_detail unless account.admin.detail
|
|
@@ -45,6 +45,10 @@ module LesliAdmin
|
|
|
45
45
|
account = current_user.account
|
|
46
46
|
account_attributes = attributes.to_h.deep_symbolize_keys
|
|
47
47
|
detail_attributes = account_attributes.delete(:detail_attributes)
|
|
48
|
+
remove_logo = ActiveModel::Type::Boolean.new.cast(account_attributes.delete(:remove_logo))
|
|
49
|
+
|
|
50
|
+
# A removal is saved with the account, so invalid forms keep the current logo.
|
|
51
|
+
account_attributes[:logo] = nil if remove_logo && account_attributes[:logo].blank?
|
|
48
52
|
|
|
49
53
|
ActiveRecord::Base.transaction do
|
|
50
54
|
account.update!(account_attributes)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module LesliAdmin
|
|
2
|
+
class SettingService < Lesli::ApplicationLesliService
|
|
3
|
+
def show
|
|
4
|
+
response(current_user.account.admin.settings.find_or_initialize_by(
|
|
5
|
+
name: "lesli_theme_color_primary",
|
|
6
|
+
user_id: nil
|
|
7
|
+
))
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def update(attributes)
|
|
11
|
+
show
|
|
12
|
+
resource.update!(attributes)
|
|
13
|
+
response(resource)
|
|
14
|
+
rescue ActiveRecord::RecordInvalid
|
|
15
|
+
resource.errors.full_messages.each { |message| error(message) }
|
|
16
|
+
response(resource)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
) %>
|
|
8
8
|
|
|
9
9
|
<% if @account.errors.any? %>
|
|
10
|
-
<div class="mb-6 rounded-xl border border-
|
|
10
|
+
<div class="mb-6 rounded-xl border border-danger-200 bg-danger-50 px-4 py-3 text-sm text-danger-700" role="alert">
|
|
11
11
|
<p class="font-semibold">The account could not be updated.</p>
|
|
12
12
|
<ul class="mt-2 list-disc space-y-1 pl-5">
|
|
13
13
|
<% @account.errors.full_messages.each do |message| %>
|
|
@@ -21,10 +21,19 @@
|
|
|
21
21
|
<% tabs.with_tab(id: "general", title: "General", icon: "business") do %>
|
|
22
22
|
<%= form_with(model: @account, url: account_path, builder: LesliView::Forms::Builder) do |form| %>
|
|
23
23
|
<%= form.fieldset("Core account") do %>
|
|
24
|
-
<p class="mb-5 text-sm leading-6 text-
|
|
24
|
+
<p class="mb-5 text-sm leading-6 text-neutral-500">
|
|
25
25
|
These values identify the account throughout every installed Lesli engine.
|
|
26
26
|
</p>
|
|
27
27
|
|
|
28
|
+
<%= render LesliView::Components::ImageUpload.new(
|
|
29
|
+
form: form,
|
|
30
|
+
attribute: :logo,
|
|
31
|
+
label: t("lesli_admin.accounts.logo_label"),
|
|
32
|
+
help: t("lesli_admin.accounts.logo_help"),
|
|
33
|
+
remove_label: t("lesli_admin.accounts.logo_remove"),
|
|
34
|
+
remove_attribute: :remove_logo
|
|
35
|
+
) %>
|
|
36
|
+
|
|
28
37
|
<div class="grid grid-cols-1 gap-x-5 md:grid-cols-2">
|
|
29
38
|
<%= form.field_control(
|
|
30
39
|
:name,
|
|
@@ -5,21 +5,21 @@
|
|
|
5
5
|
account = @account_summary[:account]
|
|
6
6
|
status_classes = case account.status
|
|
7
7
|
when "active"
|
|
8
|
-
"bg-
|
|
8
|
+
"bg-success-100 text-success-700"
|
|
9
9
|
when "suspended"
|
|
10
|
-
"bg-
|
|
10
|
+
"bg-danger-100 text-danger-700"
|
|
11
11
|
when "onboarding"
|
|
12
|
-
"bg-
|
|
12
|
+
"bg-warning-100 text-warning-700"
|
|
13
13
|
else
|
|
14
|
-
"bg-
|
|
14
|
+
"bg-info-100 text-info-700"
|
|
15
15
|
end
|
|
16
16
|
%>
|
|
17
17
|
|
|
18
|
-
<section class="h-full rounded-2xl border border-
|
|
18
|
+
<section class="h-full rounded-2xl border border-neutral-200 bg-white p-5 shadow-sm sm:p-6" aria-labelledby="account-metadata-title">
|
|
19
19
|
<div class="flex flex-wrap items-start justify-between gap-4">
|
|
20
20
|
<div>
|
|
21
|
-
<h2 id="account-metadata-title" class="text-base font-semibold text-
|
|
22
|
-
<p class="mt-1 text-sm text-
|
|
21
|
+
<h2 id="account-metadata-title" class="text-base font-semibold text-neutral-900">Account metadata</h2>
|
|
22
|
+
<p class="mt-1 text-sm text-neutral-500">Read-only identifiers and lifecycle information.</p>
|
|
23
23
|
</div>
|
|
24
24
|
<span class="inline-flex items-center rounded-full px-2.5 py-1 text-xs font-semibold <%= status_classes %>">
|
|
25
25
|
<%= account.status.humanize %>
|
|
@@ -28,20 +28,20 @@
|
|
|
28
28
|
|
|
29
29
|
<dl class="mt-5 grid grid-cols-1 gap-x-6 gap-y-5 sm:grid-cols-2 xl:grid-cols-4">
|
|
30
30
|
<div>
|
|
31
|
-
<dt class="text-sm font-medium text-
|
|
32
|
-
<dd class="mt-1 break-all text-sm text-
|
|
31
|
+
<dt class="text-sm font-medium text-neutral-500">Account ID</dt>
|
|
32
|
+
<dd class="mt-1 break-all text-sm text-neutral-900"><%= account.id %></dd>
|
|
33
33
|
</div>
|
|
34
34
|
<div>
|
|
35
|
-
<dt class="text-sm font-medium text-
|
|
36
|
-
<dd class="mt-1 break-all text-sm text-
|
|
35
|
+
<dt class="text-sm font-medium text-neutral-500">Owner</dt>
|
|
36
|
+
<dd class="mt-1 break-all text-sm text-neutral-900"><%= account.user&.email || "Not assigned" %></dd>
|
|
37
37
|
</div>
|
|
38
38
|
<div>
|
|
39
|
-
<dt class="text-sm font-medium text-
|
|
40
|
-
<dd class="mt-1 text-sm text-
|
|
39
|
+
<dt class="text-sm font-medium text-neutral-500">Created</dt>
|
|
40
|
+
<dd class="mt-1 text-sm text-neutral-900"><%= l(account.created_at, format: :long) %></dd>
|
|
41
41
|
</div>
|
|
42
42
|
<div>
|
|
43
|
-
<dt class="text-sm font-medium text-
|
|
44
|
-
<dd class="mt-1 text-sm text-
|
|
43
|
+
<dt class="text-sm font-medium text-neutral-500">Last updated</dt>
|
|
44
|
+
<dd class="mt-1 text-sm text-neutral-900"><%= l(account.updated_at, format: :long) %></dd>
|
|
45
45
|
</div>
|
|
46
46
|
</dl>
|
|
47
47
|
</section>
|
|
@@ -32,9 +32,9 @@ Building a better future, one line of code at a time.
|
|
|
32
32
|
=end
|
|
33
33
|
%>
|
|
34
34
|
|
|
35
|
-
<%= navigation_item(lesli_admin.dashboard_path, "Dashboard", "ri-dashboard-3-line"); %>
|
|
36
|
-
<%= navigation_item(lesli_admin.account_path, "Account", "ri-building-4-line"); %>
|
|
37
|
-
<%= navigation_item(lesli_admin.settings_path, "Settings", "ri-settings-4-line"); %>
|
|
35
|
+
<%= navigation_item(lesli_admin.dashboard_path, "Dashboard", "ri-dashboard-3-line", access: ["lesli_admin/dashboards", :show]); %>
|
|
36
|
+
<%= navigation_item(lesli_admin.account_path, "Account", "ri-building-4-line", access: ["lesli_admin/accounts", :show]); %>
|
|
37
|
+
<%= navigation_item(lesli_admin.settings_path, "Settings", "ri-settings-4-line", access: ["lesli_admin/settings", :show]); %>
|
|
38
38
|
|
|
39
39
|
<%#= navigation_item(lesli.account_path, "Localization", "ri-time-line"); %>
|
|
40
40
|
<%#= navigation_item(lesli.account_path, "Theming", "ri-paint-brush-line"); %>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<section id="account-appearance">
|
|
2
|
+
<%= form_with(model: @setting, scope: :setting, url: settings_path, method: :patch,
|
|
3
|
+
builder: LesliView::Forms::Builder, data: { turbo_frame: "_top" }) do |form| %>
|
|
4
|
+
<%= form.fieldset(t("lesli_admin.settings.appearance.title")) do %>
|
|
5
|
+
<%= form.field_control(:value,
|
|
6
|
+
type: "color",
|
|
7
|
+
value: @setting.color_input_value,
|
|
8
|
+
label: t("lesli_admin.settings.appearance.primary_color"),
|
|
9
|
+
message: @setting.errors[:value].presence&.to_sentence || t("lesli_admin.settings.appearance.help"),
|
|
10
|
+
category: @setting.errors[:value].any? ? "danger" : nil,
|
|
11
|
+
class: "h-14 cursor-pointer",
|
|
12
|
+
aria: { invalid: @setting.errors[:value].any? }) %>
|
|
13
|
+
<div class="flex flex-wrap gap-3">
|
|
14
|
+
<%= form.field_control_button(t("lesli_admin.settings.appearance.save"), icon: "save") %>
|
|
15
|
+
<%= form.field_control_button(t("lesli_admin.settings.appearance.restore"),
|
|
16
|
+
{ name: "restore_primary_color", value: "1", formnovalidate: true },
|
|
17
|
+
icon: "restart_alt") %>
|
|
18
|
+
</div>
|
|
19
|
+
<% end %>
|
|
20
|
+
<% end %>
|
|
21
|
+
</section>
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
%>
|
|
4
4
|
|
|
5
5
|
<% if sensitive_key %>
|
|
6
|
-
<span class="inline-flex items-center gap-1.5 rounded-full bg-
|
|
6
|
+
<span class="inline-flex items-center gap-1.5 rounded-full bg-neutral-200 px-2.5 py-1 text-xs font-semibold text-neutral-600">
|
|
7
7
|
<span class="material-symbols-outlined text-sm" aria-hidden="true">lock</span>
|
|
8
8
|
Filtered
|
|
9
9
|
</span>
|
|
10
10
|
<% elsif value.is_a?(Hash) %>
|
|
11
11
|
<dl class="space-y-2">
|
|
12
12
|
<% value.each do |nested_key, nested_value| %>
|
|
13
|
-
<div class="rounded-lg border border-
|
|
14
|
-
<dt class="text-xs font-medium text-
|
|
13
|
+
<div class="rounded-lg border border-neutral-200 bg-white p-3">
|
|
14
|
+
<dt class="text-xs font-medium text-neutral-500"><%= nested_key.to_s.humanize %></dt>
|
|
15
15
|
<dd class="mt-1.5">
|
|
16
16
|
<%= render("configuration_value", setting_key: nested_key, value: nested_value) %>
|
|
17
17
|
</dd>
|
|
@@ -20,33 +20,33 @@
|
|
|
20
20
|
</dl>
|
|
21
21
|
<% elsif value.is_a?(Array) %>
|
|
22
22
|
<% if value.empty? %>
|
|
23
|
-
<span class="text-
|
|
23
|
+
<span class="text-neutral-400">Empty list</span>
|
|
24
24
|
<% else %>
|
|
25
25
|
<ul class="flex flex-wrap gap-2">
|
|
26
26
|
<% value.each do |item| %>
|
|
27
|
-
<li class="rounded-lg border border-
|
|
27
|
+
<li class="rounded-lg border border-neutral-200 bg-white px-2.5 py-1 text-xs text-neutral-700">
|
|
28
28
|
<%= render("configuration_value", setting_key: :item, value: item) %>
|
|
29
29
|
</li>
|
|
30
30
|
<% end %>
|
|
31
31
|
</ul>
|
|
32
32
|
<% end %>
|
|
33
33
|
<% elsif value == true %>
|
|
34
|
-
<span class="inline-flex items-center gap-1.5 rounded-full bg-
|
|
35
|
-
<span class="h-1.5 w-1.5 rounded-full bg-
|
|
34
|
+
<span class="inline-flex items-center gap-1.5 rounded-full bg-success-100 px-2.5 py-1 text-xs font-semibold text-success-700">
|
|
35
|
+
<span class="h-1.5 w-1.5 rounded-full bg-success-500" aria-hidden="true"></span>
|
|
36
36
|
Enabled
|
|
37
37
|
</span>
|
|
38
38
|
<% elsif value == false %>
|
|
39
|
-
<span class="inline-flex items-center gap-1.5 rounded-full bg-
|
|
40
|
-
<span class="h-1.5 w-1.5 rounded-full bg-
|
|
39
|
+
<span class="inline-flex items-center gap-1.5 rounded-full bg-neutral-100 px-2.5 py-1 text-xs font-semibold text-neutral-700">
|
|
40
|
+
<span class="h-1.5 w-1.5 rounded-full bg-neutral-500" aria-hidden="true"></span>
|
|
41
41
|
Disabled
|
|
42
42
|
</span>
|
|
43
43
|
<% elsif value.nil? %>
|
|
44
|
-
<span class="italic text-
|
|
44
|
+
<span class="italic text-neutral-400">Not configured</span>
|
|
45
45
|
<% elsif value.to_s.match?(/\A#[0-9a-f]{3,8}\z/i) %>
|
|
46
46
|
<span class="inline-flex items-center gap-2">
|
|
47
|
-
<span class="h-5 w-5 rounded-md border border-
|
|
48
|
-
<code class="break-all rounded-md bg-
|
|
47
|
+
<span class="h-5 w-5 rounded-md border border-neutral-300 shadow-sm" style="background-color: <%= value %>" aria-hidden="true"></span>
|
|
48
|
+
<code class="break-all rounded-md bg-neutral-200 px-2 py-1 text-xs text-neutral-700"><%= value %></code>
|
|
49
49
|
</span>
|
|
50
50
|
<% else %>
|
|
51
|
-
<code class="break-all rounded-md bg-
|
|
51
|
+
<code class="break-all rounded-md bg-neutral-200 px-2 py-1 text-xs leading-5 text-neutral-700"><%= value %></code>
|
|
52
52
|
<% end %>
|
|
@@ -77,36 +77,36 @@
|
|
|
77
77
|
|
|
78
78
|
<section aria-labelledby="lesli-configuration-title">
|
|
79
79
|
|
|
80
|
-
<div class="rounded-2xl border border-
|
|
80
|
+
<div class="rounded-2xl border border-neutral-200 bg-white p-5 shadow-sm sm:p-6">
|
|
81
81
|
<div class="flex items-center gap-3">
|
|
82
|
-
<span class="material-symbols-outlined rounded-xl bg-
|
|
82
|
+
<span class="material-symbols-outlined rounded-xl bg-primary-soft p-2.5 text-2xl text-primary-strong" aria-hidden="true">settings</span>
|
|
83
83
|
<div>
|
|
84
|
-
<h2 id="lesli-configuration-title" class="text-xl font-semibold tracking-tight text-
|
|
84
|
+
<h2 id="lesli-configuration-title" class="text-xl font-semibold tracking-tight text-neutral-900">
|
|
85
85
|
Lesli configuration
|
|
86
86
|
</h2>
|
|
87
|
-
<p class="mt-1 text-sm leading-6 text-
|
|
87
|
+
<p class="mt-1 text-sm leading-6 text-neutral-500">
|
|
88
88
|
Effective read-only values loaded by this application instance.
|
|
89
89
|
</p>
|
|
90
90
|
</div>
|
|
91
91
|
</div>
|
|
92
92
|
|
|
93
93
|
<dl class="mt-6 grid grid-cols-2 gap-3 lg:grid-cols-4">
|
|
94
|
-
<div class="rounded-xl bg-
|
|
95
|
-
<dt class="text-xs font-medium uppercase tracking-wide text-
|
|
96
|
-
<dd class="mt-1 text-sm font-semibold text-
|
|
94
|
+
<div class="rounded-xl bg-neutral-50 px-4 py-3">
|
|
95
|
+
<dt class="text-xs font-medium uppercase tracking-wide text-neutral-500">Environment</dt>
|
|
96
|
+
<dd class="mt-1 text-sm font-semibold text-neutral-900"><%= Rails.env.to_s.humanize %></dd>
|
|
97
97
|
</div>
|
|
98
|
-
<div class="rounded-xl bg-
|
|
99
|
-
<dt class="text-xs font-medium uppercase tracking-wide text-
|
|
100
|
-
<dd class="mt-1 text-sm font-semibold text-
|
|
98
|
+
<div class="rounded-xl bg-neutral-50 px-4 py-3">
|
|
99
|
+
<dt class="text-xs font-medium uppercase tracking-wide text-neutral-500">Sections</dt>
|
|
100
|
+
<dd class="mt-1 text-sm font-semibold text-neutral-900"><%= sections.size %></dd>
|
|
101
101
|
</div>
|
|
102
|
-
<div class="rounded-xl bg-
|
|
103
|
-
<dt class="text-xs font-medium uppercase tracking-wide text-
|
|
104
|
-
<dd class="mt-1 text-sm font-semibold text-
|
|
102
|
+
<div class="rounded-xl bg-neutral-50 px-4 py-3">
|
|
103
|
+
<dt class="text-xs font-medium uppercase tracking-wide text-neutral-500">Values</dt>
|
|
104
|
+
<dd class="mt-1 text-sm font-semibold text-neutral-900"><%= total_settings %></dd>
|
|
105
105
|
</div>
|
|
106
|
-
<div class="rounded-xl bg-
|
|
107
|
-
<dt class="text-xs font-medium uppercase tracking-wide text-
|
|
106
|
+
<div class="rounded-xl bg-neutral-50 px-4 py-3">
|
|
107
|
+
<dt class="text-xs font-medium uppercase tracking-wide text-neutral-500">Demo mode</dt>
|
|
108
108
|
<dd class="mt-1">
|
|
109
|
-
<span class="inline-flex items-center rounded-full px-2 py-0.5 text-xs font-semibold <%= Lesli.config.demo ? "bg-
|
|
109
|
+
<span class="inline-flex items-center rounded-full px-2 py-0.5 text-xs font-semibold <%= Lesli.config.demo ? "bg-warning-100 text-warning-700" : "bg-success-100 text-success-700" %>">
|
|
110
110
|
<%= Lesli.config.demo ? "Enabled" : "Disabled" %>
|
|
111
111
|
</span>
|
|
112
112
|
</dd>
|
|
@@ -117,29 +117,29 @@
|
|
|
117
117
|
<div class="mt-5 space-y-4">
|
|
118
118
|
<% sections.each_with_index do |section, index| %>
|
|
119
119
|
<details
|
|
120
|
-
class="group rounded-2xl border border-
|
|
120
|
+
class="group rounded-2xl border border-neutral-200 bg-white shadow-sm"
|
|
121
121
|
<%= "open" if index < 2 %>>
|
|
122
122
|
<summary class="flex cursor-pointer list-none items-center gap-4 px-5 py-4 marker:hidden sm:px-6">
|
|
123
|
-
<span class="material-symbols-outlined rounded-xl bg-
|
|
123
|
+
<span class="material-symbols-outlined rounded-xl bg-neutral-100 p-2.5 text-2xl text-neutral-600" aria-hidden="true"><%= section[:icon] %></span>
|
|
124
124
|
<span class="min-w-0 flex-1">
|
|
125
|
-
<span class="block text-base font-semibold text-
|
|
126
|
-
<span class="mt-0.5 block text-sm leading-5 text-
|
|
125
|
+
<span class="block text-base font-semibold text-neutral-900"><%= section[:title] %></span>
|
|
126
|
+
<span class="mt-0.5 block text-sm leading-5 text-neutral-500"><%= section[:description] %></span>
|
|
127
127
|
</span>
|
|
128
|
-
<span class="hidden rounded-full bg-
|
|
128
|
+
<span class="hidden rounded-full bg-neutral-100 px-2.5 py-1 text-xs font-semibold text-neutral-600 sm:inline-flex">
|
|
129
129
|
<%= pluralize(section[:config].size, "group") %>
|
|
130
130
|
</span>
|
|
131
|
-
<span class="material-symbols-outlined text-
|
|
131
|
+
<span class="material-symbols-outlined text-neutral-400 transition-transform group-open:rotate-180" aria-hidden="true">expand_more</span>
|
|
132
132
|
</summary>
|
|
133
133
|
|
|
134
|
-
<div class="border-t border-
|
|
134
|
+
<div class="border-t border-neutral-100 px-5 py-5 sm:px-6">
|
|
135
135
|
<% if section[:config].empty? %>
|
|
136
|
-
<p class="text-sm text-
|
|
136
|
+
<p class="text-sm text-neutral-500">No values are configured for this section.</p>
|
|
137
137
|
<% else %>
|
|
138
138
|
<dl class="grid grid-cols-1 gap-4 lg:grid-cols-2">
|
|
139
139
|
<% section[:config].each do |key, value| %>
|
|
140
|
-
<div class="min-w-0 rounded-xl border border-
|
|
141
|
-
<dt class="text-xs font-semibold uppercase tracking-wide text-
|
|
142
|
-
<dd class="mt-2 text-sm text-
|
|
140
|
+
<div class="min-w-0 rounded-xl border border-neutral-100 bg-neutral-50/60 p-4">
|
|
141
|
+
<dt class="text-xs font-semibold uppercase tracking-wide text-neutral-500"><%= key.to_s.humanize %></dt>
|
|
142
|
+
<dd class="mt-2 text-sm text-neutral-900">
|
|
143
143
|
<%= render("configuration_value", setting_key: key, value: value) %>
|
|
144
144
|
</dd>
|
|
145
145
|
</div>
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
<% end %>
|
|
152
152
|
</div>
|
|
153
153
|
|
|
154
|
-
<p class="mt-5 flex items-start gap-2 text-xs leading-5 text-
|
|
154
|
+
<p class="mt-5 flex items-start gap-2 text-xs leading-5 text-neutral-500">
|
|
155
155
|
<span class="material-symbols-outlined text-base" aria-hidden="true">lock</span>
|
|
156
156
|
Sensitive values are filtered on the server and are never included in this page.
|
|
157
157
|
</p>
|
|
@@ -40,16 +40,16 @@
|
|
|
40
40
|
|
|
41
41
|
<% engine_key = engine[:path].delete("/") %>
|
|
42
42
|
|
|
43
|
-
<article class="module-engine-card flex min-w-0 flex-col rounded-2xl border border-
|
|
43
|
+
<article class="module-engine-card flex min-w-0 flex-col rounded-2xl border border-neutral-200 bg-white p-5 shadow-sm sm:p-6">
|
|
44
44
|
<div class="min-w-0 flex-1">
|
|
45
45
|
<%= render(LesliView::Partials::EngineSpec.new(engine)) %>
|
|
46
46
|
</div>
|
|
47
47
|
|
|
48
48
|
<button
|
|
49
49
|
type="button"
|
|
50
|
-
class="mt-5 inline-flex w-fit items-center justify-center rounded-lg px-3 py-2 text-sm font-semibold
|
|
50
|
+
class="mt-5 inline-flex w-fit items-center justify-center rounded-lg px-3 py-2 text-sm font-semibold shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2"
|
|
51
51
|
@click="toggleEngine(<%= engine_key.to_json %>)"
|
|
52
|
-
:class="data.engines.includes(<%= engine_key.to_json %>) ? 'bg-
|
|
52
|
+
:class="data.engines.includes(<%= engine_key.to_json %>) ? 'bg-primary text-white hover:bg-primary-strong focus-visible:ring-primary/30' : 'bg-warning-500 text-warning-900 hover:bg-warning-600 focus-visible:ring-warning-500/30'"
|
|
53
53
|
x-text="data.engines.includes(<%= engine_key.to_json %>) ? 'Activar módulo' : 'Desactivar módulo'">
|
|
54
54
|
</button>
|
|
55
55
|
</article>
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
<%= render(LesliView::Components::Header.new("Settings")) %>
|
|
5
5
|
|
|
6
6
|
<%= render LesliView::Components::Tabs.new(:vertical => true) do |tabs| %>
|
|
7
|
+
<% tabs.with_tab(title: t("lesli_admin.settings.appearance.title"), icon: "palette") do %>
|
|
8
|
+
<%= render("appearance") %>
|
|
9
|
+
<% end %>
|
|
7
10
|
<% tabs.with_tab(title: "Default", icon: "component_exchange") do %>
|
|
8
11
|
<%= render("defaults") %>
|
|
9
12
|
<% end %>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
en:
|
|
2
|
+
lesli_admin:
|
|
3
|
+
settings:
|
|
4
|
+
appearance:
|
|
5
|
+
title: "Appearance"
|
|
6
|
+
primary_color: "Primary color"
|
|
7
|
+
help: "Used for buttons, links and selection throughout this account."
|
|
8
|
+
save: "Save color"
|
|
9
|
+
restore: "Restore Lesli color"
|
|
10
|
+
saved: "Account appearance updated."
|
|
11
|
+
invalid_color: "must be a hexadecimal color such as #276AD6"
|
|
12
|
+
es:
|
|
13
|
+
lesli_admin:
|
|
14
|
+
settings:
|
|
15
|
+
appearance:
|
|
16
|
+
title: "Apariencia"
|
|
17
|
+
primary_color: "Color primario"
|
|
18
|
+
help: "Se usa en botones, enlaces y selección en toda esta cuenta."
|
|
19
|
+
save: "Guardar color"
|
|
20
|
+
restore: "Restaurar color de Lesli"
|
|
21
|
+
saved: "Apariencia de la cuenta actualizada."
|
|
22
|
+
invalid_color: "debe ser un color hexadecimal como #276AD6"
|
|
23
|
+
fr:
|
|
24
|
+
lesli_admin:
|
|
25
|
+
settings:
|
|
26
|
+
appearance:
|
|
27
|
+
title: "Apparence"
|
|
28
|
+
primary_color: "Couleur principale"
|
|
29
|
+
help: "Utilisée pour les boutons, liens et sélections de ce compte."
|
|
30
|
+
save: "Enregistrer la couleur"
|
|
31
|
+
restore: "Restaurer la couleur Lesli"
|
|
32
|
+
saved: "Apparence du compte mise à jour."
|
|
33
|
+
invalid_color: "doit être une couleur hexadécimale comme #276AD6"
|
|
34
|
+
it:
|
|
35
|
+
lesli_admin:
|
|
36
|
+
settings:
|
|
37
|
+
appearance:
|
|
38
|
+
title: "Aspetto"
|
|
39
|
+
primary_color: "Colore principale"
|
|
40
|
+
help: "Usato per pulsanti, collegamenti e selezioni di questo account."
|
|
41
|
+
save: "Salva colore"
|
|
42
|
+
restore: "Ripristina il colore Lesli"
|
|
43
|
+
saved: "Aspetto dell’account aggiornato."
|
|
44
|
+
invalid_color: "deve essere un colore esadecimale come #276AD6"
|
|
45
|
+
pt:
|
|
46
|
+
lesli_admin:
|
|
47
|
+
settings:
|
|
48
|
+
appearance:
|
|
49
|
+
title: "Aparência"
|
|
50
|
+
primary_color: "Cor principal"
|
|
51
|
+
help: "Usada nos botões, links e seleções desta conta."
|
|
52
|
+
save: "Salvar cor"
|
|
53
|
+
restore: "Restaurar a cor Lesli"
|
|
54
|
+
saved: "Aparência da conta atualizada."
|
|
55
|
+
invalid_color: "deve ser uma cor hexadecimal como #276AD6"
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
en:
|
|
3
3
|
lesli_admin:
|
|
4
|
-
accounts:
|
|
4
|
+
accounts:
|
|
5
|
+
logo_label: "Logo"
|
|
6
|
+
logo_help: "JPEG, PNG or WebP, up to 5 MB. Used in the application header."
|
|
7
|
+
logo_remove: "Remove logo and restore the default"
|
|
5
8
|
dashboards: {}
|
|
6
9
|
items/attachments: {}
|
|
7
10
|
items/discussions: {}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
es:
|
|
3
3
|
lesli_admin:
|
|
4
|
-
accounts:
|
|
4
|
+
accounts:
|
|
5
|
+
logo_label: "Logo"
|
|
6
|
+
logo_help: "JPEG, PNG o WebP, hasta 5 MB. Se muestra en el encabezado de la aplicación."
|
|
7
|
+
logo_remove: "Quitar logo y restaurar el predeterminado"
|
|
5
8
|
dashboards: {}
|
|
6
9
|
items/attachments: {}
|
|
7
10
|
items/discussions: {}
|
data/lib/lesli_admin/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lesli_admin
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- The Lesli Development Team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: lesli
|
|
@@ -60,7 +60,9 @@ files:
|
|
|
60
60
|
- app/models/lesli_admin/application_record.rb
|
|
61
61
|
- app/models/lesli_admin/dashboard.rb
|
|
62
62
|
- app/models/lesli_admin/setting.rb
|
|
63
|
+
- app/operators/lesli_admin/theme_operator.rb
|
|
63
64
|
- app/services/lesli_admin/account_service.rb
|
|
65
|
+
- app/services/lesli_admin/setting_service.rb
|
|
64
66
|
- app/views/lesli_admin/account/currencies/_currency.html.erb
|
|
65
67
|
- app/views/lesli_admin/account/currencies/_form.html.erb
|
|
66
68
|
- app/views/lesli_admin/account/currencies/edit.html.erb
|
|
@@ -95,6 +97,7 @@ files:
|
|
|
95
97
|
- app/views/lesli_admin/dashboards/new.html.erb
|
|
96
98
|
- app/views/lesli_admin/dashboards/show.html.erb
|
|
97
99
|
- app/views/lesli_admin/partials/_navigation.html.erb
|
|
100
|
+
- app/views/lesli_admin/settings/_appearance.html.erb
|
|
98
101
|
- app/views/lesli_admin/settings/_configuration_value.html.erb
|
|
99
102
|
- app/views/lesli_admin/settings/_defaults.html.erb
|
|
100
103
|
- app/views/lesli_admin/settings/_form.html.erb
|
|
@@ -108,6 +111,7 @@ files:
|
|
|
108
111
|
- app/views/lesli_admin/users/index.html.erb
|
|
109
112
|
- app/views/lesli_admin/users/new.html.erb
|
|
110
113
|
- app/views/lesli_admin/users/show.html.erb
|
|
114
|
+
- config/locales/appearance.yml
|
|
111
115
|
- config/locales/translations.en.yml
|
|
112
116
|
- config/locales/translations.es.yml
|
|
113
117
|
- config/locales/translations.fr.yml
|