lesli_view 1.1.6 → 1.1.7
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_view/view.css +213 -1516
- data/lib/lesli_view/components/header.html.erb +2 -2
- data/lib/lesli_view/components/panel.html.erb +44 -26
- data/lib/lesli_view/components/toolbar.css +12 -8
- data/lib/lesli_view/components/toolbar.html.erb +3 -1
- data/lib/lesli_view/elements/button.html.erb +2 -0
- data/lib/lesli_view/elements/button.rb +4 -0
- data/lib/lesli_view/items/activities.rb +5 -5
- data/lib/lesli_view/items/attachment.html.erb +3 -3
- data/lib/lesli_view/items/attachments.html.erb +5 -5
- data/lib/lesli_view/items/discussion.rb +1 -1
- data/lib/lesli_view/items/discussions.html.erb +2 -2
- data/lib/lesli_view/items/task.rb +2 -2
- data/lib/lesli_view/items/tasks.html.erb +2 -2
- data/lib/lesli_view/layout/navigation_sidebar.css +19 -0
- data/lib/lesli_view/layout/navigation_sidebar.html.erb +52 -0
- data/lib/lesli_view/layout/navigation_sidebar.rb +24 -0
- data/lib/lesli_view/version.rb +2 -2
- data/lib/lesli_view.rb +1 -0
- data/readme.md +2 -0
- metadata +7 -5
- data/lib/lesli_view/components/panel.scss +0 -37
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
<section
|
|
3
|
-
class="mx-auto mt-
|
|
3
|
+
class="mx-auto mt-16 mb-12 grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-5"
|
|
4
4
|
<% if title.present? %>aria-labelledby="<%= title_id %>"<% end %>>
|
|
5
5
|
|
|
6
6
|
<div class="min-w-0">
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
|
|
37
37
|
<% if actions? %>
|
|
38
38
|
<div
|
|
39
|
-
class="flex flex-wrap items-
|
|
39
|
+
class="flex flex-wrap items-start justify-self-end gap-3"
|
|
40
40
|
role="group"
|
|
41
41
|
aria-label="<%= I18n.t('actions.label', default: 'Page actions') %>">
|
|
42
42
|
<% if new_path.present? %>
|
|
@@ -1,36 +1,54 @@
|
|
|
1
1
|
|
|
2
|
-
<%
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
<%
|
|
3
|
+
panel_title_id = "#{id}-title"
|
|
4
|
+
attributes = {
|
|
5
|
+
id: "#{id}-panel",
|
|
6
|
+
class: "lesli-panel relative z-50",
|
|
7
|
+
"x-data": "{ open: false, trigger: null, openPanel() { this.trigger = document.activeElement; this.open = true; this.$nextTick(() => this.$refs.closeButton.focus()) }, closePanel() { this.open = false; this.$nextTick(() => this.trigger?.focus()) } }",
|
|
8
|
+
"x-cloak": true,
|
|
9
|
+
"@#{id}.window": "openPanel()",
|
|
10
|
+
"@keydown.escape.window": "if (open) closePanel()"
|
|
11
|
+
}
|
|
12
|
+
%>
|
|
7
13
|
|
|
8
14
|
<%= content_tag(:section, **attributes) do %>
|
|
9
15
|
<% if overlay %>
|
|
10
|
-
<div
|
|
11
|
-
class="
|
|
12
|
-
|
|
13
|
-
x-show="
|
|
14
|
-
x-
|
|
16
|
+
<div
|
|
17
|
+
class="fixed inset-0 z-40 bg-slate-950/25"
|
|
18
|
+
aria-hidden="true"
|
|
19
|
+
x-show="open"
|
|
20
|
+
x-transition.opacity
|
|
21
|
+
@click="closePanel()">
|
|
15
22
|
</div>
|
|
16
23
|
<% end %>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
|
|
25
|
+
<div
|
|
26
|
+
class="fixed inset-y-0 right-0 z-50 flex h-dvh max-h-dvh w-full flex-col overflow-y-auto overscroll-contain bg-white shadow-2xl sm:max-w-2xl lg:max-w-3xl"
|
|
27
|
+
role="dialog"
|
|
28
|
+
aria-modal="<%= overlay %>"
|
|
29
|
+
aria-labelledby="<%= panel_title_id %>"
|
|
30
|
+
x-show="open"
|
|
31
|
+
x-transition:enter="transform transition ease-out duration-150"
|
|
32
|
+
x-transition:enter-start="translate-x-8 opacity-0"
|
|
33
|
+
x-transition:enter-end="translate-x-0 opacity-100"
|
|
34
|
+
x-transition:leave="transform transition ease-in duration-100"
|
|
35
|
+
x-transition:leave-start="translate-x-0 opacity-100"
|
|
36
|
+
x-transition:leave-end="translate-x-8 opacity-0">
|
|
37
|
+
<div class="sticky top-0 z-10 flex items-center justify-between gap-4 border-b border-slate-200 bg-white px-4 py-3 sm:px-6">
|
|
38
|
+
<h2 id="<%= panel_title_id %>" class="min-w-0 truncate text-lg font-semibold text-slate-900">
|
|
39
|
+
<%= title %>
|
|
40
|
+
</h2>
|
|
41
|
+
<button
|
|
42
|
+
type="button"
|
|
43
|
+
class="inline-flex size-11 shrink-0 items-center justify-center rounded-lg text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-700 focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-sky-500/20"
|
|
44
|
+
aria-label="Close panel"
|
|
45
|
+
x-ref="closeButton"
|
|
46
|
+
@click="closePanel()">
|
|
47
|
+
<span class="material-symbols text-xl leading-none" aria-hidden="true">arrow_forward_ios</span>
|
|
48
|
+
</button>
|
|
32
49
|
</div>
|
|
33
|
-
|
|
50
|
+
|
|
51
|
+
<div class="min-w-0 flex-1 p-4 sm:p-6">
|
|
34
52
|
<%= content %>
|
|
35
53
|
</div>
|
|
36
54
|
</div>
|
|
@@ -2,23 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
@layer components {
|
|
4
4
|
.lesli-toolbar {
|
|
5
|
-
@apply mb-6 flex w-full flex-
|
|
5
|
+
@apply mb-6 flex w-full flex-wrap items-center gap-2;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
.lesli-toolbar__form {
|
|
9
|
-
@apply flex min-w-0 flex-
|
|
9
|
+
@apply flex min-w-0 flex-[1_1_24rem] flex-wrap items-center gap-2;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.lesli-toolbar__search {
|
|
13
|
-
@apply relative min-w-0 flex-
|
|
13
|
+
@apply relative min-w-0 flex-[1_1_14rem];
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.lesli-toolbar__input {
|
|
17
|
-
@apply h-10 w-full rounded-lg border border-slate-300 bg-white py-2 pl-10 pr-10 text-sm text-slate-900 outline-none transition placeholder:text-slate-400 hover:border-slate-400 focus:border-sky-500 focus:ring-2 focus:ring-sky-500/10;
|
|
17
|
+
@apply block h-10 w-full rounded-lg border border-slate-300 bg-white py-2 pl-10 pr-10 text-sm text-slate-900 outline-none transition placeholder:text-slate-400 hover:border-slate-400 focus:border-sky-500 focus:ring-2 focus:ring-sky-500/10;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
.lesli-toolbar__search-icon {
|
|
21
|
-
@apply pointer-events-none absolute
|
|
21
|
+
@apply pointer-events-none absolute inset-y-0 left-3 flex items-center text-slate-400;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.lesli-toolbar__search-icon .material-symbols {
|
|
25
|
+
@apply text-lg leading-none;
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
.lesli-toolbar__clear {
|
|
@@ -30,12 +34,12 @@
|
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
.lesli-toolbar__filters {
|
|
33
|
-
@apply flex flex-wrap items-center gap-2;
|
|
37
|
+
@apply flex max-w-full flex-wrap items-center gap-2;
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
.lesli-toolbar__filters select,
|
|
37
41
|
.lesli-toolbar__filters input {
|
|
38
|
-
@apply h-10 rounded-lg border border-slate-300 bg-white px-3 text-sm text-slate-700 outline-none transition hover:border-slate-400 focus:border-sky-500 focus:ring-2 focus:ring-sky-500/10;
|
|
42
|
+
@apply h-10 min-w-0 max-w-full rounded-lg border border-slate-300 bg-white px-3 text-sm text-slate-700 outline-none transition hover:border-slate-400 focus:border-sky-500 focus:ring-2 focus:ring-sky-500/10;
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
.lesli-toolbar__submit {
|
|
@@ -47,6 +51,6 @@
|
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
.lesli-toolbar__actions {
|
|
50
|
-
@apply flex
|
|
54
|
+
@apply ml-auto flex max-w-full flex-wrap items-center justify-end gap-2;
|
|
51
55
|
}
|
|
52
56
|
}
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
<div class="lesli-toolbar__search">
|
|
4
4
|
<%= label_tag(search_name, search_label, class: "sr-only") %>
|
|
5
5
|
|
|
6
|
-
<span class="lesli-toolbar__search-icon
|
|
6
|
+
<span class="lesli-toolbar__search-icon" aria-hidden="true">
|
|
7
|
+
<span class="material-symbols">search</span>
|
|
8
|
+
</span>
|
|
7
9
|
|
|
8
10
|
<%= text_field_tag(
|
|
9
11
|
search_name,
|
|
@@ -59,6 +59,8 @@ module LesliView
|
|
|
59
59
|
aria_label: nil,
|
|
60
60
|
disabled: false,
|
|
61
61
|
type: :button,
|
|
62
|
+
name: nil,
|
|
63
|
+
value: nil,
|
|
62
64
|
data: {}
|
|
63
65
|
)
|
|
64
66
|
@label = label
|
|
@@ -79,6 +81,8 @@ module LesliView
|
|
|
79
81
|
@aria_label = aria_label
|
|
80
82
|
@disabled = disabled
|
|
81
83
|
@button_type = type
|
|
84
|
+
@name = name
|
|
85
|
+
@value = value
|
|
82
86
|
@data = data
|
|
83
87
|
end
|
|
84
88
|
|
|
@@ -51,7 +51,7 @@ module LesliView
|
|
|
51
51
|
activity_to_timeline(activity)
|
|
52
52
|
end
|
|
53
53
|
@empty_text = empty_text || I18n.t(
|
|
54
|
-
"#{i18n_scope}
|
|
54
|
+
"#{i18n_scope}_empty",
|
|
55
55
|
default: "No activities have been recorded yet."
|
|
56
56
|
)
|
|
57
57
|
end
|
|
@@ -72,7 +72,7 @@ module LesliView
|
|
|
72
72
|
|
|
73
73
|
def activity_description(activity, metadata)
|
|
74
74
|
I18n.t(
|
|
75
|
-
"#{activity_i18n_key(activity)}
|
|
75
|
+
"#{activity_i18n_key(activity)}_#{description_key(metadata)}",
|
|
76
76
|
from: snapshot_name(metadata_value(metadata, :from)),
|
|
77
77
|
to: snapshot_name(metadata_value(metadata, :to)),
|
|
78
78
|
default: activity.description.to_s
|
|
@@ -80,12 +80,12 @@ module LesliView
|
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
def activity_i18n_key(activity)
|
|
83
|
-
"#{i18n_scope}
|
|
83
|
+
"#{i18n_scope}_events_#{activity.activity_code}"
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
def activity_operation(activity)
|
|
87
87
|
I18n.t(
|
|
88
|
-
"#{activity_i18n_key(activity)}
|
|
88
|
+
"#{activity_i18n_key(activity)}_operation",
|
|
89
89
|
default: activity.activity_code.to_s.humanize
|
|
90
90
|
)
|
|
91
91
|
end
|
|
@@ -102,7 +102,7 @@ module LesliView
|
|
|
102
102
|
name = actor.name if actor.respond_to?(:name)
|
|
103
103
|
|
|
104
104
|
full_name.presence || name.presence || I18n.t(
|
|
105
|
-
"#{i18n_scope}
|
|
105
|
+
"#{i18n_scope}_unknown_actor",
|
|
106
106
|
default: "Unknown user"
|
|
107
107
|
)
|
|
108
108
|
end
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
|
|
21
21
|
<div class="flex shrink-0 items-center gap-2">
|
|
22
22
|
<%= link_to(
|
|
23
|
-
I18n.t("lesli.items.
|
|
23
|
+
I18n.t("lesli.items.attachments_download", default: "Download"),
|
|
24
24
|
path,
|
|
25
25
|
class: "inline-flex items-center gap-2 rounded-lg border border-slate-300 px-3 py-2 text-sm font-medium text-slate-700 transition-colors hover:border-slate-400 hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--lesli-color-primary)]",
|
|
26
26
|
data: { turbo: false }
|
|
27
27
|
) %>
|
|
28
28
|
|
|
29
29
|
<%= button_to(
|
|
30
|
-
I18n.t("lesli.items.
|
|
30
|
+
I18n.t("lesli.items.attachments_remove", default: "Remove"),
|
|
31
31
|
path,
|
|
32
32
|
method: :delete,
|
|
33
33
|
class: "inline-flex items-center rounded-lg px-3 py-2 text-sm font-medium text-red-600 transition-colors hover:bg-red-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-500/40",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
class: "inline-flex",
|
|
36
36
|
data: {
|
|
37
37
|
turbo_confirm: I18n.t(
|
|
38
|
-
"lesli.items.
|
|
38
|
+
"lesli.items.attachments_confirm_remove",
|
|
39
39
|
default: "Remove this file?"
|
|
40
40
|
)
|
|
41
41
|
}
|
|
@@ -43,7 +43,7 @@ Building a better future, one line of code at a time.
|
|
|
43
43
|
<div>
|
|
44
44
|
<%= form.label(
|
|
45
45
|
:file,
|
|
46
|
-
I18n.t("lesli.items.
|
|
46
|
+
I18n.t("lesli.items.attachments_choose_file", default: "Choose a file"),
|
|
47
47
|
class: "mb-2 block text-sm font-medium text-slate-700"
|
|
48
48
|
) %>
|
|
49
49
|
<%= form.file_field(
|
|
@@ -61,16 +61,16 @@ Building a better future, one line of code at a time.
|
|
|
61
61
|
|
|
62
62
|
<%= form.field_control_text(
|
|
63
63
|
:label,
|
|
64
|
-
label: I18n.t("lesli.items.
|
|
64
|
+
label: I18n.t("lesli.items.attachments_label", default: "Label"),
|
|
65
65
|
maxlength: 255
|
|
66
66
|
) %>
|
|
67
67
|
|
|
68
68
|
<%= form.field_control_button(
|
|
69
|
-
I18n.t("lesli.items.
|
|
69
|
+
I18n.t("lesli.items.attachments_add", default: "Add file"),
|
|
70
70
|
{
|
|
71
71
|
data: {
|
|
72
72
|
turbo_submits_with: I18n.t(
|
|
73
|
-
"lesli.items.
|
|
73
|
+
"lesli.items.attachments_uploading",
|
|
74
74
|
default: "Uploading..."
|
|
75
75
|
)
|
|
76
76
|
}
|
|
@@ -94,7 +94,7 @@ Building a better future, one line of code at a time.
|
|
|
94
94
|
<% else %>
|
|
95
95
|
<p class="py-6 text-center text-sm text-slate-500">
|
|
96
96
|
<%= I18n.t(
|
|
97
|
-
"lesli.items.
|
|
97
|
+
"lesli.items.attachments_empty",
|
|
98
98
|
default: "No files have been attached yet."
|
|
99
99
|
) %>
|
|
100
100
|
</p>
|
|
@@ -46,7 +46,7 @@ Building a better future, one line of code at a time.
|
|
|
46
46
|
</p>
|
|
47
47
|
<% end %>
|
|
48
48
|
<%= form.field_control_submit I18n.t(
|
|
49
|
-
"lesli.items.
|
|
49
|
+
"lesli.items.discussions_add",
|
|
50
50
|
default: "Add comment"
|
|
51
51
|
) %>
|
|
52
52
|
<% end %>
|
|
@@ -65,7 +65,7 @@ Building a better future, one line of code at a time.
|
|
|
65
65
|
<% else %>
|
|
66
66
|
<p class="py-6 text-center text-sm text-slate-500">
|
|
67
67
|
<%= I18n.t(
|
|
68
|
-
"lesli.items.
|
|
68
|
+
"lesli.items.discussions_empty",
|
|
69
69
|
default: "No comments have been added yet."
|
|
70
70
|
) %>
|
|
71
71
|
</p>
|
|
@@ -43,12 +43,12 @@ module LesliView
|
|
|
43
43
|
def toggle_label
|
|
44
44
|
if resource.done?
|
|
45
45
|
I18n.t(
|
|
46
|
-
"lesli.items.
|
|
46
|
+
"lesli.items.tasks_reopen_action",
|
|
47
47
|
default: "Mark task as incomplete"
|
|
48
48
|
)
|
|
49
49
|
else
|
|
50
50
|
I18n.t(
|
|
51
|
-
"lesli.items.
|
|
51
|
+
"lesli.items.tasks_complete_action",
|
|
52
52
|
default: "Mark task as complete"
|
|
53
53
|
)
|
|
54
54
|
end
|
|
@@ -46,7 +46,7 @@ Building a better future, one line of code at a time.
|
|
|
46
46
|
</p>
|
|
47
47
|
<% end %>
|
|
48
48
|
<%= form.field_control_submit I18n.t(
|
|
49
|
-
"lesli.items.
|
|
49
|
+
"lesli.items.tasks_add",
|
|
50
50
|
default: "Add task"
|
|
51
51
|
) %>
|
|
52
52
|
<% end %>
|
|
@@ -65,7 +65,7 @@ Building a better future, one line of code at a time.
|
|
|
65
65
|
<% else %>
|
|
66
66
|
<p class="py-6 text-center text-sm text-slate-500">
|
|
67
67
|
<%= I18n.t(
|
|
68
|
-
"lesli.items.
|
|
68
|
+
"lesli.items.tasks_empty",
|
|
69
69
|
default: "No tasks have been added yet."
|
|
70
70
|
) %>
|
|
71
71
|
</p>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* Component-owned visibility avoids collisions with engine utility bundles,
|
|
2
|
+
which load after LesliView and may redefine .hidden or .block. */
|
|
3
|
+
.lesli-navigation-sidebar-mobile {
|
|
4
|
+
display: block;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.lesli-navigation-sidebar-desktop {
|
|
8
|
+
display: none;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@media (min-width: 64rem) {
|
|
12
|
+
.lesli-navigation-sidebar-mobile {
|
|
13
|
+
display: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.lesli-navigation-sidebar-desktop {
|
|
17
|
+
display: block;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<%
|
|
2
|
+
selected_icon = items.find { |item| item[:selected] }&.dig(:icon) || "ri-folder-line"
|
|
3
|
+
|
|
4
|
+
navigation_items = capture do
|
|
5
|
+
items.each do |item|
|
|
6
|
+
selected = item[:selected]
|
|
7
|
+
%>
|
|
8
|
+
<li>
|
|
9
|
+
<%= link_to item[:path],
|
|
10
|
+
class: class_names(
|
|
11
|
+
"flex min-h-11 items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-sky-500/20",
|
|
12
|
+
"bg-sky-50 text-sky-700" => selected,
|
|
13
|
+
"text-slate-700 hover:bg-slate-100" => !selected
|
|
14
|
+
),
|
|
15
|
+
aria: { current: ("page" if selected) },
|
|
16
|
+
data: { turbo_frame: "_top" } do %>
|
|
17
|
+
<span class="<%= item[:icon] || 'ri-folder-line' %> text-lg" aria-hidden="true"></span>
|
|
18
|
+
<span class="min-w-0 flex-1 truncate"><%= item[:label] %></span>
|
|
19
|
+
<% if item[:count] %><span class="text-xs text-slate-500"><%= item[:count] %></span><% end %>
|
|
20
|
+
<% end %>
|
|
21
|
+
</li>
|
|
22
|
+
<%
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
%>
|
|
26
|
+
|
|
27
|
+
<details class="lesli-navigation-sidebar-mobile group overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm">
|
|
28
|
+
<summary
|
|
29
|
+
class="flex min-h-11 cursor-pointer list-none items-center justify-between gap-3 px-4 py-2.5 text-sm font-semibold text-slate-700 focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-inset focus-visible:ring-sky-500/20 [&::-webkit-details-marker]:hidden"
|
|
30
|
+
aria-label="<%= selected_label %>">
|
|
31
|
+
<span class="flex min-w-0 items-center gap-3">
|
|
32
|
+
<span class="<%= selected_icon %> shrink-0 text-lg text-slate-400" aria-hidden="true"></span>
|
|
33
|
+
<span class="truncate"><%= selected_label %></span>
|
|
34
|
+
</span>
|
|
35
|
+
<span class="material-symbols shrink-0 text-xl text-slate-400 transition-transform group-open:rotate-180" aria-hidden="true">expand_more</span>
|
|
36
|
+
</summary>
|
|
37
|
+
|
|
38
|
+
<nav class="max-h-72 overflow-y-auto border-t border-slate-200 p-2" aria-label="<%= label %>">
|
|
39
|
+
<ul class="space-y-1">
|
|
40
|
+
<%= navigation_items %>
|
|
41
|
+
</ul>
|
|
42
|
+
</nav>
|
|
43
|
+
</details>
|
|
44
|
+
|
|
45
|
+
<nav class="lesli-navigation-sidebar-desktop rounded-xl border border-slate-200 bg-white p-3 shadow-sm lg:sticky lg:top-4 lg:w-60 lg:shrink-0" aria-label="<%= label %>">
|
|
46
|
+
<p class="px-3 pb-2 text-xs font-semibold uppercase tracking-wide text-slate-500">
|
|
47
|
+
<%= label %>
|
|
48
|
+
</p>
|
|
49
|
+
<ul class="space-y-1">
|
|
50
|
+
<%= navigation_items %>
|
|
51
|
+
</ul>
|
|
52
|
+
</nav>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LesliView
|
|
4
|
+
module Layout
|
|
5
|
+
# Page-level navigation: sticky on desktop, native disclosure on mobile.
|
|
6
|
+
# Callers own translations, routes, authorization, and selected state.
|
|
7
|
+
class NavigationSidebar < ViewComponent::Base
|
|
8
|
+
attr_reader :items, :label
|
|
9
|
+
|
|
10
|
+
# Each item has :label, :path, :selected, and optional :count and :icon (a Remix Icon CSS class).
|
|
11
|
+
# empty_selection_label describes pages without a selected item.
|
|
12
|
+
def initialize(items:, label:, empty_selection_label: nil)
|
|
13
|
+
@items = items
|
|
14
|
+
@label = label
|
|
15
|
+
@empty_selection_label = empty_selection_label
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def selected_label
|
|
19
|
+
selected = items.find { |item| item[:selected] }
|
|
20
|
+
selected ? selected.fetch(:label) : (@empty_selection_label || label)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
data/lib/lesli_view/version.rb
CHANGED
data/lib/lesli_view.rb
CHANGED
data/readme.md
CHANGED
|
@@ -178,6 +178,8 @@ Then run `bundle install` from the host application so changes to the local gem
|
|
|
178
178
|
|
|
179
179
|
## Documentation
|
|
180
180
|
|
|
181
|
+
For page-level sidebars, follow the [navigation sidebar standard](docs/layout/navigation_sidebar.md).
|
|
182
|
+
|
|
181
183
|
- [Lesli website](https://www.lesli.dev/)
|
|
182
184
|
- [LesliView documentation](https://www.lesli.dev/gems/view/)
|
|
183
185
|
- [Releases and changelog](https://github.com/LesliTech/LesliView/releases)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lesli_view
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- The Lesli Development Team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: view_component
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 4.
|
|
19
|
+
version: 4.24.0
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 4.
|
|
26
|
+
version: 4.24.0
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: lexxy
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -58,7 +58,6 @@ files:
|
|
|
58
58
|
- lib/lesli_view/components/header.rb
|
|
59
59
|
- lib/lesli_view/components/panel.html.erb
|
|
60
60
|
- lib/lesli_view/components/panel.rb
|
|
61
|
-
- lib/lesli_view/components/panel.scss
|
|
62
61
|
- lib/lesli_view/components/tabs.html.erb
|
|
63
62
|
- lib/lesli_view/components/tabs.rb
|
|
64
63
|
- lib/lesli_view/components/timeline.html.erb
|
|
@@ -103,6 +102,9 @@ files:
|
|
|
103
102
|
- lib/lesli_view/items/tasks.rb
|
|
104
103
|
- lib/lesli_view/layout/container.html.erb
|
|
105
104
|
- lib/lesli_view/layout/container.rb
|
|
105
|
+
- lib/lesli_view/layout/navigation_sidebar.css
|
|
106
|
+
- lib/lesli_view/layout/navigation_sidebar.html.erb
|
|
107
|
+
- lib/lesli_view/layout/navigation_sidebar.rb
|
|
106
108
|
- lib/lesli_view/partials/engine_spec.html.erb
|
|
107
109
|
- lib/lesli_view/partials/engine_spec.rb
|
|
108
110
|
- lib/lesli_view/version.rb
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
@use "lesli-css/sass/color";
|
|
3
|
-
@use "lesli-css/sass/layout/scrollbar";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
section.lesli-panel {
|
|
7
|
-
|
|
8
|
-
div.lesli-panel-background {
|
|
9
|
-
position: fixed;
|
|
10
|
-
z-index: 38;
|
|
11
|
-
height: 100%;
|
|
12
|
-
width: 100%;
|
|
13
|
-
top: 0;
|
|
14
|
-
left: 0;
|
|
15
|
-
&.overlay {
|
|
16
|
-
background: rgba(230, 230, 230, .5);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
div.lesli-panel-container {
|
|
21
|
-
background-color: white;
|
|
22
|
-
position: fixed;
|
|
23
|
-
z-index: 40;
|
|
24
|
-
right: 0;
|
|
25
|
-
top: 0;
|
|
26
|
-
width: 600px;
|
|
27
|
-
height: 100%;
|
|
28
|
-
overflow-y: scroll;
|
|
29
|
-
|
|
30
|
-
@include scrollbar.lesli-scrollbar(hide);
|
|
31
|
-
|
|
32
|
-
.lesli-panel-header {
|
|
33
|
-
padding: 1rem 1rem .6rem;
|
|
34
|
-
border-bottom: 1px solid color.lesli-color(slate);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|