lesli_view 0.1.0 → 1.0.0
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/lib/lesli_view/charts/bar.rb +41 -0
- data/lib/lesli_view/charts/general.html.erb +94 -0
- data/lib/lesli_view/charts/general.rb +71 -0
- data/lib/lesli_view/charts/line.rb +41 -0
- data/lib/lesli_view/{element → components}/header.html.erb +5 -2
- data/lib/lesli_view/{element → components}/header.rb +1 -1
- data/lib/lesli_view/components/header.scss +69 -0
- data/lib/lesli_view/components/panel.html.erb +37 -0
- data/lib/lesli_view/{element/form.rb → components/panel.rb} +8 -12
- data/lib/lesli_view/components/panel.scss +37 -0
- data/lib/lesli_view/components/tabs.html.erb +35 -0
- data/lib/lesli_view/components/tabs.rb +58 -0
- data/lib/lesli_view/components/tabs_spec.rb +0 -0
- data/lib/lesli_view/components/timeline.html.erb +23 -0
- data/lib/lesli_view/components/timeline.rb +45 -0
- data/lib/lesli_view/components/timeline.scss +218 -0
- data/lib/lesli_view/{element → components}/toolbar.rb +1 -1
- data/lib/lesli_view/components/toolbar.scss +54 -0
- data/lib/lesli_view/elements/avatar.html.erb +7 -0
- data/lib/lesli_view/elements/avatar.rb +76 -0
- data/lib/lesli_view/elements/avatar.scss +50 -0
- data/lib/lesli_view/elements/button.html.erb +24 -0
- data/lib/lesli_view/{element → elements}/button.rb +26 -5
- data/lib/lesli_view/elements/empty.html.erb +8 -0
- data/lib/lesli_view/elements/empty.rb +40 -0
- data/lib/lesli_view/elements/table.html.erb +48 -0
- data/lib/lesli_view/{element → elements}/table.rb +29 -21
- data/lib/lesli_view/elements/table.scss +153 -0
- data/lib/lesli_view/forms/builder.rb +47 -0
- data/lib/lesli_view/forms/builder_horizontal.rb +25 -0
- data/lib/lesli_view/forms/fields.rb +144 -0
- data/lib/lesli_view/forms/fieldset.rb +15 -0
- data/lib/lesli_view/forms/form.scss +87 -0
- data/lib/lesli_view/forms/inputs.rb +46 -0
- data/lib/lesli_view/layout/container.html.erb +5 -3
- data/lib/lesli_view/version.rb +2 -1
- data/lib/lesli_view.rb +27 -5
- data/readme.md +2 -2
- metadata +39 -17
- data/lib/lesli_view/element/button.html.erb +0 -12
- data/lib/lesli_view/element/form.html.erb +0 -10
- data/lib/lesli_view/element/table.full.rb +0 -43
- data/lib/lesli_view/element/table.html.erb +0 -39
- data/lib/lesli_view/element/table.html.full.erb +0 -101
- data/lib/lesli_view/lesli_view.scss +0 -3
- /data/lib/lesli_view/{element → components}/toolbar.html.erb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31a5258e0bd9bdf4d2872495e1f0d7b3b6220620173f0f384409143f13d38c09
|
4
|
+
data.tar.gz: 6c23c359228c5e18e6ef49d29b3e2ef1bc766a95ec871e18767fa903b2f66e36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1387bd68d4f9ddff6fa36b567263ef2c529561fa4fe80c758379baaba3cca5f67e57b963a1638a6ecd00df96fa0078c44e57a7c594132afbd6e58fd0b3816ce8
|
7
|
+
data.tar.gz: edcb88a38f0517edd977dd5970be57a4b10e3026e723952df110ed2742c5457b3d854c0c09bef67425990dfaf9bbdc11bbc8e27c0cf332636cb996480af9b728
|
@@ -0,0 +1,41 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
Lesli
|
4
|
+
|
5
|
+
Copyright (c) 2025, Lesli Technologies, S. A.
|
6
|
+
|
7
|
+
This program is free software: you can redistribute it and/or modify
|
8
|
+
it under the terms of the GNU General Public License as published by
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
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.
|
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
|
+
=end
|
32
|
+
|
33
|
+
module LesliView
|
34
|
+
module Charts
|
35
|
+
class Bar < General
|
36
|
+
def type
|
37
|
+
"bar"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
<script>
|
2
|
+
document.addEventListener("turbo:load", () => {
|
3
|
+
const chartId = "<%= id %>";
|
4
|
+
const chartElement = document.getElementById(chartId);
|
5
|
+
|
6
|
+
if (!chartElement) {
|
7
|
+
console.warn("Chart element not found:", chartId);
|
8
|
+
return;
|
9
|
+
}
|
10
|
+
|
11
|
+
// Clear previous chart instance (important for Turbo re-renders)
|
12
|
+
chartElement.innerHTML = "";
|
13
|
+
|
14
|
+
var options = {
|
15
|
+
series: <%= raw(series.to_json) %>,
|
16
|
+
labels: <%= raw(labels.to_json) %>,
|
17
|
+
grid: {
|
18
|
+
show: false,
|
19
|
+
padding: { top: 0, right: 0, bottom: 0, left: 0 }
|
20
|
+
},
|
21
|
+
chart: {
|
22
|
+
type: "<%= type %>",
|
23
|
+
height: "<%= height %>",
|
24
|
+
toolbar: { show: false },
|
25
|
+
events: {
|
26
|
+
markerClick: function(event, chartContext, { seriesIndex, dataPointIndex }) {
|
27
|
+
emit("markerClick", { seriesIndex, dataPointIndex });
|
28
|
+
}
|
29
|
+
}
|
30
|
+
},
|
31
|
+
legend: {
|
32
|
+
show: true,
|
33
|
+
position: "top",
|
34
|
+
horizontalAlign: "center"
|
35
|
+
},
|
36
|
+
plotOptions: {
|
37
|
+
bar: {
|
38
|
+
borderRadius: 6,
|
39
|
+
borderRadiusApplication: 'end',
|
40
|
+
dataLabels: {
|
41
|
+
position: 'top', // top, center, bottom
|
42
|
+
},
|
43
|
+
}
|
44
|
+
},
|
45
|
+
dataLabels: { enabled: true, offsetY: 20 },
|
46
|
+
stroke: {
|
47
|
+
show: true,
|
48
|
+
curve: "smooth",
|
49
|
+
lineCap: "round"
|
50
|
+
},
|
51
|
+
xaxis: {
|
52
|
+
categories: <%= raw(labels.to_json) %>,
|
53
|
+
tickPlacement: "between",
|
54
|
+
labels: {
|
55
|
+
show: true,
|
56
|
+
rotate: -65,
|
57
|
+
rotateAlways: false,
|
58
|
+
trim: false,
|
59
|
+
offsetY: 5,
|
60
|
+
style: { fontSize: "15px" }
|
61
|
+
}
|
62
|
+
},
|
63
|
+
yaxis: { show: true }
|
64
|
+
};
|
65
|
+
|
66
|
+
// Overrides for compact view
|
67
|
+
<% if compact %>
|
68
|
+
options.chart.sparkline = { enabled: true };
|
69
|
+
|
70
|
+
<% if type == "bar" %>
|
71
|
+
options.dataLabels.formatter= function (value, { seriesIndex, dataPointIndex, w }) {
|
72
|
+
const label = w.globals.labels[dataPointIndex];
|
73
|
+
return `${label}: ${value}`;
|
74
|
+
}
|
75
|
+
<% end %>
|
76
|
+
<% end %>
|
77
|
+
|
78
|
+
const chart = new ApexCharts(chartElement, options);
|
79
|
+
chart.render()
|
80
|
+
});
|
81
|
+
</script>
|
82
|
+
|
83
|
+
<div class="lesli-charts lesli-charts-<%= type %> section box mb-0 p-0 pt-1">
|
84
|
+
|
85
|
+
<% if title.present? %>
|
86
|
+
<%= tag.h3(title, class: (compact ? "is-size-7 has-text-centered" : "ml-2")) %>
|
87
|
+
<% end %>
|
88
|
+
|
89
|
+
<% if subtitle.present? %>
|
90
|
+
<p class="ml-2"><b><%= subtitle %></b></p>
|
91
|
+
<% end %>
|
92
|
+
|
93
|
+
<div id="<%= id %>"></div>
|
94
|
+
</div>
|
@@ -0,0 +1,71 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
Lesli
|
4
|
+
|
5
|
+
Copyright (c) 2025, Lesli Technologies, S. A.
|
6
|
+
|
7
|
+
This program is free software: you can redistribute it and/or modify
|
8
|
+
it under the terms of the GNU General Public License as published by
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
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.
|
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
|
+
=end
|
32
|
+
|
33
|
+
module LesliView
|
34
|
+
module Charts
|
35
|
+
class General < ViewComponent::Base
|
36
|
+
|
37
|
+
attr_reader(
|
38
|
+
:id,
|
39
|
+
:title,
|
40
|
+
:subtitle,
|
41
|
+
:labels,
|
42
|
+
:series,
|
43
|
+
:height,
|
44
|
+
:compact
|
45
|
+
)
|
46
|
+
|
47
|
+
def initialize(
|
48
|
+
id: nil,
|
49
|
+
title: nil,
|
50
|
+
subtitle: nil,
|
51
|
+
labels:nil,
|
52
|
+
series:nil,
|
53
|
+
serie: nil,
|
54
|
+
height: "300px",
|
55
|
+
compact: false
|
56
|
+
)
|
57
|
+
@id = id || "lesli-chart-#{rand(100)}"
|
58
|
+
@title = title
|
59
|
+
@subtitle = subtitle
|
60
|
+
@labels = labels
|
61
|
+
@series = series || [{ name: title, data: serie }]
|
62
|
+
@height = height
|
63
|
+
@compact = compact
|
64
|
+
end
|
65
|
+
|
66
|
+
def type
|
67
|
+
nil
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
Lesli
|
4
|
+
|
5
|
+
Copyright (c) 2025, Lesli Technologies, S. A.
|
6
|
+
|
7
|
+
This program is free software: you can redistribute it and/or modify
|
8
|
+
it under the terms of the GNU General Public License as published by
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
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.
|
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
|
+
=end
|
32
|
+
|
33
|
+
module LesliView
|
34
|
+
module Charts
|
35
|
+
class Line < General
|
36
|
+
def type
|
37
|
+
"line"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -1,9 +1,12 @@
|
|
1
1
|
<section class="lesli-element-header is-flex">
|
2
2
|
<div class="lesli-element-header-title is-flex is-align-items-center">
|
3
3
|
<% if back %>
|
4
|
-
|
4
|
+
<%= link_to(
|
5
|
+
back || request.referer || root_path,
|
6
|
+
class: "button is-info is-outlined mr-4",
|
7
|
+
data: { turbo_frame: '_top' }) do %>
|
5
8
|
<span class="material-icons">arrow_back</span>
|
6
|
-
|
9
|
+
<% end %>
|
7
10
|
<% end %>
|
8
11
|
<% if title.present? %>
|
9
12
|
<h1 class="subtitle is-size-3"><%= title %></h1>
|
@@ -0,0 +1,69 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Lesli
|
4
|
+
|
5
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
6
|
+
|
7
|
+
This program is free software: you can redistribute it and/or modify
|
8
|
+
it under the terms of the GNU General Public License as published by
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
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 platform.
|
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
|
+
|
34
|
+
// ·
|
35
|
+
@use "lesli-css/sass/helpers/breakpoint";
|
36
|
+
|
37
|
+
|
38
|
+
// ·
|
39
|
+
.lesli-element-header {
|
40
|
+
margin: 30px auto 30px;
|
41
|
+
|
42
|
+
.lesli-element-header-items {
|
43
|
+
gap: 0.5rem;
|
44
|
+
display: flex;
|
45
|
+
align-items: center;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
|
50
|
+
// ·
|
51
|
+
@include breakpoint.lesli-breakpoint-mobile {
|
52
|
+
section.lesli-element-header {
|
53
|
+
flex-direction: column;
|
54
|
+
|
55
|
+
.lesli-element-header-title {
|
56
|
+
width: 100%;
|
57
|
+
margin-bottom: 1rem;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
@include breakpoint.lesli-breakpoint-small {
|
63
|
+
section.lesli-element-header {
|
64
|
+
.lesli-element-header-title,
|
65
|
+
.lesli-element-header-items {
|
66
|
+
justify-content: center !important;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
|
2
|
+
<% attributes = {} %>
|
3
|
+
<% attributes[:class] = "lesli-panel" %>
|
4
|
+
<% attributes[:"x-data"] = "{ status: false }" %>
|
5
|
+
<% attributes[:"x-cloak"] = true %>
|
6
|
+
<% attributes[:"@#{id}.window"] = "status = !status" %>
|
7
|
+
|
8
|
+
<%= content_tag(:section, **attributes) do %>
|
9
|
+
<% if overlay %>
|
10
|
+
<div
|
11
|
+
class="lesli-panel-background overlay"
|
12
|
+
x-transition
|
13
|
+
x-show="status"
|
14
|
+
x-on:click="status = !status">
|
15
|
+
</div>
|
16
|
+
<% end %>
|
17
|
+
<div
|
18
|
+
class="lesli-panel-container box p-0"
|
19
|
+
x-show="status"
|
20
|
+
x-transition>
|
21
|
+
<div class="lesli-panel-header is-flex">
|
22
|
+
<div class="is-flex-grow-1">
|
23
|
+
<h5 class="is-size-5">
|
24
|
+
<%= title %>
|
25
|
+
</h5>
|
26
|
+
</div>
|
27
|
+
<div class="hover" x-on:click="status = !status">
|
28
|
+
<span class="material-icons md-24">
|
29
|
+
arrow_forward_ios
|
30
|
+
</span>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
<div class="lesli-panel-body p-4">
|
34
|
+
<%= content %>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
<% end %>
|
@@ -33,18 +33,14 @@ Building a better future, one line of code at a time.
|
|
33
33
|
=end
|
34
34
|
|
35
35
|
module LesliView
|
36
|
-
module
|
37
|
-
class
|
38
|
-
attr_reader :
|
39
|
-
|
40
|
-
def initialize(
|
41
|
-
@
|
42
|
-
@title = title
|
43
|
-
@
|
44
|
-
end
|
45
|
-
|
46
|
-
def form_with_tag_options
|
47
|
-
{ onsubmit: 'event.preventDefault(); submitForm();' }.map { |key, value| "#{key}=\"#{value}\"" }.join(' ').html_safe
|
36
|
+
module Components
|
37
|
+
class Panel < ViewComponent::Base
|
38
|
+
attr_reader :id, :title, :overlay
|
39
|
+
|
40
|
+
def initialize(title, id="panel", overlay:true)
|
41
|
+
@id = id
|
42
|
+
@title = title
|
43
|
+
@overlay = overlay
|
48
44
|
end
|
49
45
|
end
|
50
46
|
end
|
@@ -0,0 +1,37 @@
|
|
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
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<div class="lesli-tabs" x-data="{ activeTab: '<%= tabs[0].tab_id %>' }">
|
2
|
+
<div class="tabs mb-0">
|
3
|
+
<ul>
|
4
|
+
<% tabs.each_with_index do |tab, index| %>
|
5
|
+
<% tab.set_tab_id(tab.tab_id, index) %>
|
6
|
+
<li :class="{ 'is-active': activeTab === '<%= tab.tab_id %>' }">
|
7
|
+
<a @click="activeTab = '<%= tab.tab_id %>'" data-turbo="false">
|
8
|
+
<% if tab.icon %>
|
9
|
+
<span class="icon is-small">
|
10
|
+
<span class="material-icons">
|
11
|
+
<%= tab.icon %>
|
12
|
+
</span>
|
13
|
+
</span>
|
14
|
+
<% end %>
|
15
|
+
<span>
|
16
|
+
<%= tab.title %>
|
17
|
+
</span>
|
18
|
+
</a>
|
19
|
+
</li>
|
20
|
+
<% end %>
|
21
|
+
</ul>
|
22
|
+
</div>
|
23
|
+
<div class="tab-items">
|
24
|
+
<% tabs.each_with_index do |tab, index| %>
|
25
|
+
<div
|
26
|
+
id="<%= tab.tab_id %>"
|
27
|
+
class="tab-item"
|
28
|
+
x-show="activeTab === '<%= tab.tab_id %>'"
|
29
|
+
x-transition
|
30
|
+
x-cloak>
|
31
|
+
<%= tab %>
|
32
|
+
</div>
|
33
|
+
<% end %>
|
34
|
+
</div>
|
35
|
+
</div>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
=begin
|
2
|
+
<%= render LesliView::Elements::Tabs.new(active_tab: "tab1") do |tabs| %>
|
3
|
+
<% tabs.with_tab(tab_id: "tab1", title: "Tab 1") do %>
|
4
|
+
hola
|
5
|
+
<% end %>
|
6
|
+
<% tabs.with_tab(tab_id: "tab2", title: "Tab 2") %>
|
7
|
+
<% tabs.with_tab(tab_id: "tab3", title: "Tab 3") %>
|
8
|
+
<% tabs.with_tab(tab_id: "tab4", title: "Tab 4", icon: "save") %>
|
9
|
+
<% tabs.with_tab(tab_id: "tab5", title: "Tab 5", icon: "edit") %>
|
10
|
+
<% tabs.with_tab(tab_id: "tab6", title: "Tab 6", icon: "delete") %>
|
11
|
+
<% end %>
|
12
|
+
=end
|
13
|
+
|
14
|
+
module LesliView
|
15
|
+
module Components
|
16
|
+
class Tabs < ViewComponent::Base
|
17
|
+
renders_many :tabs, "TabComponent"
|
18
|
+
|
19
|
+
attr_reader :active_tab
|
20
|
+
|
21
|
+
def initialize(active_tab: nil)
|
22
|
+
@active_tab = active_tab
|
23
|
+
end
|
24
|
+
|
25
|
+
class TabComponent < ViewComponent::Base
|
26
|
+
attr_reader :tab_id, :title, :icon
|
27
|
+
|
28
|
+
def initialize(id:nil, title: nil, icon: nil)
|
29
|
+
|
30
|
+
@tab_id = nil
|
31
|
+
|
32
|
+
if title
|
33
|
+
@tab_id = title
|
34
|
+
.downcase # string to lowercase
|
35
|
+
.gsub(/[^0-9A-Za-z\s\-\_]/, '') # remove special characters from string
|
36
|
+
.gsub(/_/, '-') # replace underscores with dashes
|
37
|
+
.gsub(/\s+/, '-') # replace spaces or spaces with single dash
|
38
|
+
end
|
39
|
+
|
40
|
+
if id
|
41
|
+
@tab_id = id
|
42
|
+
end
|
43
|
+
|
44
|
+
@title = title
|
45
|
+
@icon = icon
|
46
|
+
end
|
47
|
+
|
48
|
+
def set_tab_id(tab_id, index)
|
49
|
+
@tab_id = tab_id || "tab-#{index}"
|
50
|
+
end
|
51
|
+
|
52
|
+
def call
|
53
|
+
content_tag :div, content
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
<div class="lesli-timelines">
|
3
|
+
<div class="py-6 pl-4">
|
4
|
+
<ul class="lesli-timeline lesli-timeline-split">
|
5
|
+
<% @activities.each do |activity| %>
|
6
|
+
<li class="lesli-timeline-item">
|
7
|
+
<div class="lesli-timeline-info">
|
8
|
+
<span><%= activity[:date] %></span>
|
9
|
+
</div>
|
10
|
+
<div class="lesli-timeline-marker"></div>
|
11
|
+
<div class="lesli-timeline-content">
|
12
|
+
<h3 class="lesli-timeline-title">
|
13
|
+
<%= activity[:title] %>
|
14
|
+
</h3>
|
15
|
+
<p>
|
16
|
+
<%= activity[:description] %>
|
17
|
+
</p>
|
18
|
+
</div>
|
19
|
+
</li>
|
20
|
+
<% end %>
|
21
|
+
</ul>
|
22
|
+
</div>
|
23
|
+
</div>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
=begin
|
4
|
+
|
5
|
+
Lesli
|
6
|
+
|
7
|
+
Copyright (c) 2025, Lesli Technologies, S. A.
|
8
|
+
|
9
|
+
This program is free software: you can redistribute it and/or modify
|
10
|
+
it under the terms of the GNU General Public License as published by
|
11
|
+
the Free Software Foundation, either version 3 of the License, or
|
12
|
+
(at your option) any later version.
|
13
|
+
|
14
|
+
This program is distributed in the hope that it will be useful,
|
15
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17
|
+
GNU General Public License for more details.
|
18
|
+
|
19
|
+
You should have received a copy of the GNU General Public License
|
20
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
21
|
+
|
22
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
23
|
+
|
24
|
+
Made with ♥ by LesliTech
|
25
|
+
Building a better future, one line of code at a time.
|
26
|
+
|
27
|
+
@contact hello@lesli.tech
|
28
|
+
@website https://www.lesli.tech
|
29
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
30
|
+
|
31
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
32
|
+
// ·
|
33
|
+
=end
|
34
|
+
|
35
|
+
module LesliView
|
36
|
+
module Components
|
37
|
+
class Timeline < ViewComponent::Base
|
38
|
+
attr_reader :activities
|
39
|
+
|
40
|
+
def initialize(activities: nil)
|
41
|
+
@activities = activities
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|