lesli_view 0.1.0 → 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/lib/lesli_view/charts/bar.rb +41 -0
- data/lib/lesli_view/charts/general.html.erb +97 -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 +10 -2
- data/lib/lesli_view/{element → components}/header.rb +4 -3
- 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 +29 -32
- 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
@@ -0,0 +1,153 @@
|
|
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" as lesli;
|
36
|
+
|
37
|
+
|
38
|
+
// ·
|
39
|
+
table.lesli-table {
|
40
|
+
display: table;
|
41
|
+
@include lesli.lesli-shadow();
|
42
|
+
|
43
|
+
// standard padding
|
44
|
+
// normally used in tables for index views
|
45
|
+
--table-cell-padding: 1rem;
|
46
|
+
|
47
|
+
// narrow padding
|
48
|
+
// normally used in panels or components where the table is secondary
|
49
|
+
&.is-narrow {
|
50
|
+
--table-cell-padding: 0.25em 0.5em;
|
51
|
+
}
|
52
|
+
|
53
|
+
thead {
|
54
|
+
border-radius: 10px 10px 0 0;
|
55
|
+
background-color: #E2E6F6;
|
56
|
+
|
57
|
+
th {
|
58
|
+
border: none;
|
59
|
+
font-weight: 700;
|
60
|
+
vertical-align: middle;
|
61
|
+
}
|
62
|
+
|
63
|
+
// keep text and icons in the same line
|
64
|
+
.icon-text {
|
65
|
+
flex-wrap: nowrap;
|
66
|
+
span {
|
67
|
+
white-space: nowrap;
|
68
|
+
}
|
69
|
+
&:hover {
|
70
|
+
cursor: pointer;
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
tbody {
|
76
|
+
|
77
|
+
tr.is-danger {
|
78
|
+
--bulma-table-cell-background-color: var(--bulma-danger-90);
|
79
|
+
}
|
80
|
+
|
81
|
+
tr.is-warning {
|
82
|
+
--bulma-table-cell-background-color: var(--bulma-warning-90);
|
83
|
+
}
|
84
|
+
|
85
|
+
tr.is-info {
|
86
|
+
--bulma-table-cell-background-color: var(--bulma-info-90);
|
87
|
+
}
|
88
|
+
|
89
|
+
// default styles for cell containers
|
90
|
+
td {
|
91
|
+
vertical-align: middle;
|
92
|
+
|
93
|
+
// if cell has a child link, remove padding
|
94
|
+
// due <a> will include the corresponding padding
|
95
|
+
// currently only supported by webkit, bug this is part
|
96
|
+
// of the standard so other engines will support soon
|
97
|
+
// ** currently not supported by firefox **
|
98
|
+
&:has(a) {
|
99
|
+
padding: 0 !important;
|
100
|
+
|
101
|
+
// apply styles only to direct anchor elements
|
102
|
+
& > a {
|
103
|
+
display: block;
|
104
|
+
padding: var(--table-cell-padding);
|
105
|
+
}
|
106
|
+
}
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
// icon to show detail row if detail slot is provided
|
111
|
+
td.detail-row {
|
112
|
+
width: 40px;
|
113
|
+
}
|
114
|
+
|
115
|
+
td.options {
|
116
|
+
.dropdown {
|
117
|
+
.button {
|
118
|
+
background-color: transparent;
|
119
|
+
border: none;
|
120
|
+
}
|
121
|
+
.dropdown-content {
|
122
|
+
padding: 0;
|
123
|
+
}
|
124
|
+
.dropdown-item {
|
125
|
+
display: flex;
|
126
|
+
padding: .8rem;
|
127
|
+
.material-icons {
|
128
|
+
margin-right: 8px;
|
129
|
+
}
|
130
|
+
}
|
131
|
+
}
|
132
|
+
}
|
133
|
+
}
|
134
|
+
|
135
|
+
|
136
|
+
@include lesli.lesli-breakpoint-until-tablet {
|
137
|
+
.lesli-table-container {
|
138
|
+
overflow: auto;
|
139
|
+
overflow-y: auto;
|
140
|
+
overflow-y: hidden;
|
141
|
+
max-width: 100%;
|
142
|
+
margin-bottom: .8rem;
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
/*
|
147
|
+
td:has(~ td:hover), / * previous sibling cells * /
|
148
|
+
table:has(td:nth-of-type(3):hover) / * column cells * /
|
149
|
+
tr:not(:first-of-type):has(~ tr:hover)
|
150
|
+
td:nth-of-type(3) {
|
151
|
+
background: silver !important;
|
152
|
+
}
|
153
|
+
*/
|
@@ -0,0 +1,47 @@
|
|
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 Forms
|
37
|
+
class Builder < ActionView::Helpers::FormBuilder
|
38
|
+
def css_category category=nil
|
39
|
+
return "is-#{category}"
|
40
|
+
end
|
41
|
+
|
42
|
+
include LesliView::Forms::Fields
|
43
|
+
include LesliView::Forms::Inputs
|
44
|
+
include LesliView::Forms::Fieldset
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module LesliView
|
2
|
+
module Forms
|
3
|
+
class BuilderHorizontal < Builder
|
4
|
+
def field_control(attribute, label: nil, message:nil, category:nil, icon:nil)
|
5
|
+
super(attribute, label:label, message:message, category:category, icon:icon, horizontal:true)
|
6
|
+
end
|
7
|
+
|
8
|
+
def field_select(attribute, choices, options = {}, html_options = {}, label: nil, humanize: true)
|
9
|
+
super(attribute, choices, options, html_options, label: label, humanize: humanize, horizontal: true)
|
10
|
+
end
|
11
|
+
|
12
|
+
def field_control_submit(value = nil, options = {})
|
13
|
+
super(value, options, horizontal:true)
|
14
|
+
end
|
15
|
+
|
16
|
+
def field_control_button(value = nil, options = {}, icon:nil, horizontal: false)
|
17
|
+
super(value, options, icon:icon, horizontal:true)
|
18
|
+
end
|
19
|
+
|
20
|
+
def field_control_select(attribute, choices, label: nil, message:nil, category:nil, icon:nil, humanize:true)
|
21
|
+
super(attribute, choices, label:label, message:message, category:category, icon:icon, horizontal:true, humanize:humanize)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,144 @@
|
|
1
|
+
module LesliView
|
2
|
+
module Forms
|
3
|
+
module Fields
|
4
|
+
def field_control(attribute, label: nil, message:nil, category:nil, icon:nil, horizontal: false)
|
5
|
+
field_control_text(attribute, label:label, message:message, category:category, icon:icon, horizontal:horizontal)
|
6
|
+
end
|
7
|
+
|
8
|
+
def field_control_checkbox(attribute, label: nil, message:nil, category:nil, icon:nil, horizontal: false)
|
9
|
+
label_html = label(attribute, label)
|
10
|
+
text_field_html = check_box(attribute, {}, true, false)
|
11
|
+
|
12
|
+
field_control_builder(
|
13
|
+
label_html: label_html,
|
14
|
+
control_html: text_field_html,
|
15
|
+
horizontal: horizontal
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
def field_control_text(attribute, label: nil, message:nil, category:nil, icon:nil, horizontal: false)
|
20
|
+
label_html = label(attribute, label)
|
21
|
+
text_field_html = text_field(attribute)
|
22
|
+
|
23
|
+
field_control_builder(
|
24
|
+
label_html: label_html,
|
25
|
+
control_html: text_field_html,
|
26
|
+
horizontal: horizontal
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
def field_control_email(attribute, label: nil, message:nil, category:nil, icon:nil, horizontal: false)
|
31
|
+
label_html = label(attribute, label)
|
32
|
+
control_html = email_field(attribute)
|
33
|
+
|
34
|
+
field_control_builder(
|
35
|
+
label_html: label_html,
|
36
|
+
control_html: control_html,
|
37
|
+
horizontal: horizontal,
|
38
|
+
icon:icon
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
def field_text_editor(attribute, label:nil, message:nil, category:nil, icon:nil, horizontal: false)
|
43
|
+
|
44
|
+
label_html = label(attribute, label)
|
45
|
+
control_html = text_editor(attribute)
|
46
|
+
|
47
|
+
field_control_builder(
|
48
|
+
label_html: label_html,
|
49
|
+
control_html: control_html,
|
50
|
+
horizontal: horizontal,
|
51
|
+
icon:icon
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
def field_control_select(attribute, choices, label: nil, message:nil, category:nil, icon:nil, horizontal: false, humanize:true)
|
56
|
+
choices = choices.map { |k, v| [k.humanize.capitalize, v] } if humanize
|
57
|
+
value = @object.send(attribute)
|
58
|
+
label_html = label(attribute, label)
|
59
|
+
select_html = select(attribute, choices, {}, { value: value })
|
60
|
+
|
61
|
+
field_control_builder(
|
62
|
+
label_html: label_html,
|
63
|
+
control_html: @template.content_tag(:div, select_html, class: "select is-fullwidth"),
|
64
|
+
horizontal: horizontal
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
def field_control_submit(value = nil, options = {}, horizontal: false)
|
69
|
+
submit_html = submit(value, options)
|
70
|
+
field_control_builder(control_html: submit_html, horizontal: horizontal)
|
71
|
+
end
|
72
|
+
|
73
|
+
def field_control_button(value = nil, options = {}, category:"primary", icon:nil, type:"submit", horizontal: false)
|
74
|
+
# Merge user-provided classes with default button classes
|
75
|
+
button_classes = ["button", "is-#{category}"]
|
76
|
+
|
77
|
+
button_html = @template.content_tag(:button, class: button_classes, type: type, **options.except(:class)) do
|
78
|
+
html = "".html_safe
|
79
|
+
if icon.present?
|
80
|
+
html << @template.content_tag(:span, class: "icon") do
|
81
|
+
@template.content_tag(:span, icon, class: "material-icons")
|
82
|
+
end
|
83
|
+
end
|
84
|
+
html << @template.content_tag(:span, value) if value.present?
|
85
|
+
html
|
86
|
+
end
|
87
|
+
field_control_builder(control_html: button_html, icon:nil, horizontal: horizontal)
|
88
|
+
end
|
89
|
+
|
90
|
+
def field_control_builder(
|
91
|
+
label_html:nil,
|
92
|
+
control_html:nil,
|
93
|
+
message_text:nil,
|
94
|
+
horizontal:false,
|
95
|
+
category:nil,
|
96
|
+
icon:nil,
|
97
|
+
&block
|
98
|
+
)
|
99
|
+
|
100
|
+
icon_left = icon
|
101
|
+
icon_right = nil
|
102
|
+
|
103
|
+
# Conditionally add 'is-horizontal' if horizontal is true
|
104
|
+
field_classes = ['field']
|
105
|
+
field_classes << 'is-horizontal' if horizontal
|
106
|
+
|
107
|
+
control_classes = ['control']
|
108
|
+
control_classes << 'has-icons-left' if icon_left
|
109
|
+
control_classes << 'has-icons-right' if icon_right
|
110
|
+
|
111
|
+
help_class = ""
|
112
|
+
|
113
|
+
@template.content_tag(:div, class: 'lesli-form-field mb-3') do
|
114
|
+
@template.content_tag(:div, class: field_classes.join(' ')) do
|
115
|
+
@template.content_tag(:div, label_html, class: 'field-label is-normal mb-1') +
|
116
|
+
@template.content_tag(:div, class: 'field-body') do
|
117
|
+
@template.content_tag(:div, class: 'field') do
|
118
|
+
control_html = @template.content_tag(:div, class: control_classes.join(' ')) do
|
119
|
+
content = ''.html_safe
|
120
|
+
content << (block_given? ? @template.capture(&block) : control_html)
|
121
|
+
content << icon_html(icon_left, 'left') if icon_left
|
122
|
+
content << icon_html(icon_right, 'right') if icon_right
|
123
|
+
content
|
124
|
+
end
|
125
|
+
control_html + @template.content_tag(:p, message_text, class: "help #{css_category(category)}")
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
private
|
133
|
+
|
134
|
+
def icon_html(icon_class, position)
|
135
|
+
return ''.html_safe unless icon_class
|
136
|
+
|
137
|
+
@template.content_tag(:span, class: "icon is-small is-#{position}") do
|
138
|
+
#@template.content_tag(:i, '', class: icon_class)
|
139
|
+
@template.content_tag(:span, icon_class, class: "material-icons")
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module LesliView
|
2
|
+
module Forms
|
3
|
+
module Fieldset
|
4
|
+
def fieldset(legend = "", options = {}, category: nil, &block)
|
5
|
+
options[:class] = ["lesli-form-fieldset", "box", "pr-6", "is-#{category}"]
|
6
|
+
options[:class].push("pt-5") unless legend.present?
|
7
|
+
|
8
|
+
@template.content_tag(:fieldset, options) do
|
9
|
+
legend_html = legend.present? ? @template.content_tag(:h5, legend, class: ["is-size-5", "mb-5", "ml-2"]) : nil
|
10
|
+
@template.safe_join([legend_html, @template.capture(&block)].compact)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,87 @@
|
|
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 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
|
+
*/
|
32
|
+
|
33
|
+
|
34
|
+
// ·
|
35
|
+
.lesli-form-field {
|
36
|
+
.field:not(.is-horizontal) {
|
37
|
+
.field-label {
|
38
|
+
text-align: left;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
|
44
|
+
.lesli-form-fieldset {
|
45
|
+
padding: 2.5rem 2rem;
|
46
|
+
border-radius: 5px;
|
47
|
+
//border: 1px solid #ccc;
|
48
|
+
background-color: #fff;
|
49
|
+
box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
|
50
|
+
|
51
|
+
fieldset {
|
52
|
+
padding: 1.2rem;
|
53
|
+
border-radius: 5px;
|
54
|
+
border: 1px solid #ccc;
|
55
|
+
margin-bottom: 1rem;
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
|
60
|
+
form fieldset.is-warning {
|
61
|
+
border: 2px solid var(--bulma-warning);
|
62
|
+
background-color: var(--bulma-warning-95);
|
63
|
+
}
|
64
|
+
form fieldset.is-warning h5 {
|
65
|
+
color: var(--bulma-warning-bold);
|
66
|
+
font-weight: 600;
|
67
|
+
}
|
68
|
+
|
69
|
+
|
70
|
+
form fieldset.is-info {
|
71
|
+
border: 2px solid var(--bulma-info);
|
72
|
+
background-color: var(--bulma-info-95);
|
73
|
+
}
|
74
|
+
form fieldset.is-info h5 {
|
75
|
+
color: var(--bulma-info-bold);
|
76
|
+
font-weight: 600;
|
77
|
+
}
|
78
|
+
|
79
|
+
|
80
|
+
form fieldset.is-danger {
|
81
|
+
border: 2px solid var(--bulma-danger);
|
82
|
+
background-color: var(--bulma-danger-95);
|
83
|
+
}
|
84
|
+
form fieldset.is-danger h5 {
|
85
|
+
color: var(--bulma-danger-bold);
|
86
|
+
font-weight: 600;
|
87
|
+
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module LesliView
|
2
|
+
module Forms
|
3
|
+
module Inputs
|
4
|
+
def label(method, text = nil, options = {})
|
5
|
+
super(method, text, options.merge(class: 'label'))
|
6
|
+
end
|
7
|
+
|
8
|
+
def check_box(method, options = {}, checked_value = "1", unchecked_value = "0")
|
9
|
+
value = @object.send(method)
|
10
|
+
super(method, options, checked_value, unchecked_value)
|
11
|
+
end
|
12
|
+
|
13
|
+
def text_field(method, options = {})
|
14
|
+
value = @object.send(method)
|
15
|
+
super(method, options.merge(value: value, class: 'input'))
|
16
|
+
end
|
17
|
+
|
18
|
+
def text_editor(method, options = {})
|
19
|
+
input_id = "#{object_name}_#{method}"
|
20
|
+
editor_id = "#{input_id}_editor"
|
21
|
+
|
22
|
+
hidden_field(method) +
|
23
|
+
@template.content_tag("trix-toolbar", "", id: editor_id) +
|
24
|
+
@template.content_tag("trix-editor", "", toolbar: editor_id, input: input_id)
|
25
|
+
end
|
26
|
+
|
27
|
+
def email_field(method, options = {})
|
28
|
+
value = @object.send(method)
|
29
|
+
super(method, options.merge(value: value, class: 'input'))
|
30
|
+
end
|
31
|
+
|
32
|
+
def password_field(method, options = {})
|
33
|
+
value = @object.send(method)
|
34
|
+
super(method, options.merge(value: value, class: 'input'))
|
35
|
+
end
|
36
|
+
|
37
|
+
def submit(value=nil, options = {})
|
38
|
+
# Extract and merge classes properly
|
39
|
+
default_classes = "button is-primary is-outlined"
|
40
|
+
custom_classes = options[:class] || ""
|
41
|
+
merged_classes = "#{default_classes} #{custom_classes}".strip
|
42
|
+
super(value, options.merge(class: merged_classes))
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
|
2
2
|
<!-- app/components/lesli_application_container_component.html.erb -->
|
3
|
-
<turbo-frame
|
4
|
-
<%=
|
5
|
-
|
3
|
+
<turbo-frame
|
4
|
+
id="<%= turbo_frame_id %>"
|
5
|
+
class="lesli-application-container container <%= 'is-fluid' if dashboard %>">
|
6
|
+
<%= content %>
|
7
|
+
</turbo-frame>
|
data/lib/lesli_view/version.rb
CHANGED
data/lib/lesli_view.rb
CHANGED
@@ -12,12 +12,34 @@ require "lesli_view/engine"
|
|
12
12
|
require "lesli_view/layout/container"
|
13
13
|
|
14
14
|
|
15
|
+
# loading components
|
16
|
+
require "lesli_view/components/tabs"
|
17
|
+
require "lesli_view/components/panel"
|
18
|
+
require "lesli_view/components/header"
|
19
|
+
require "lesli_view/components/toolbar"
|
20
|
+
require "lesli_view/components/timeline"
|
21
|
+
|
22
|
+
|
15
23
|
# loading elements
|
16
|
-
require "lesli_view/
|
17
|
-
require "lesli_view/
|
18
|
-
require "lesli_view/
|
19
|
-
require "lesli_view/
|
20
|
-
|
24
|
+
require "lesli_view/elements/empty"
|
25
|
+
require "lesli_view/elements/table"
|
26
|
+
require "lesli_view/elements/avatar"
|
27
|
+
require "lesli_view/elements/button"
|
28
|
+
|
29
|
+
|
30
|
+
# loading charts
|
31
|
+
require "lesli_view/charts/general"
|
32
|
+
require "lesli_view/charts/bar"
|
33
|
+
require "lesli_view/charts/line"
|
34
|
+
|
35
|
+
|
36
|
+
# loading forms
|
37
|
+
require "lesli_view/forms/fields"
|
38
|
+
require "lesli_view/forms/inputs"
|
39
|
+
require "lesli_view/forms/fieldset"
|
40
|
+
|
41
|
+
require "lesli_view/forms/builder"
|
42
|
+
require "lesli_view/forms/builder_horizontal"
|
21
43
|
|
22
44
|
module LesliView
|
23
45
|
class Error < StandardError; end
|
data/readme.md
CHANGED
@@ -1,13 +1,12 @@
|
|
1
|
-
|
2
|
-
<
|
3
|
-
<
|
4
|
-
<h3 align="center">View elements & components for The Lesli Framework.</h3>
|
1
|
+
<div align="center" class="documentation-header">
|
2
|
+
<img width="100" alt="LesliView logo" src="./docs/images/view-logo.svg" />
|
3
|
+
<h3 align="center">Web Elements & Components for The Lesli Framework.</h3>
|
5
4
|
</div>
|
6
5
|
|
7
6
|
<br />
|
8
7
|
<hr/>
|
9
8
|
|
10
|
-
<
|
9
|
+
<div align="center" class="documentation-statics">
|
11
10
|
<a target="blank" href="https://rubygems.org/gems/lesli">
|
12
11
|
<img height="22" alt="Gem Version" src="https://badge.fury.io/rb/lesli.svg"/>
|
13
12
|
</a>
|
@@ -17,11 +16,12 @@
|
|
17
16
|
<a href="https://codecov.io/github/LesliTech/LesliBabel">
|
18
17
|
<img height="22" src="https://sonarcloud.io/api/project_badges/measure?project=LesliTech_LesliBabel&metric=sqale_rating"/>
|
19
18
|
</a>
|
20
|
-
</
|
19
|
+
</div>
|
21
20
|
|
22
21
|
<hr/>
|
23
22
|
<br />
|
24
23
|
|
24
|
+
|
25
25
|
### Quick start
|
26
26
|
|
27
27
|
```shell
|
@@ -29,35 +29,33 @@
|
|
29
29
|
bundle add lesli_view
|
30
30
|
```
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
<%= render LesliView::Layout::Container.new("shield-sessions") do %>
|
35
|
-
<%= render LesliView::Element::Header.new(title: "Sessions", back: true) do %>
|
36
|
-
<%= render(LesliView::Element::Button.new(icon: "add", solid:true)) do %>
|
37
|
-
Add new
|
38
|
-
<% end %>
|
39
|
-
<%= render(LesliView::Element::Button.new(icon: "refresh")) do %>
|
40
|
-
Reload
|
41
|
-
<% end %>
|
42
|
-
<% end %>
|
43
|
-
<%= render LesliView::Element::Toolbar.new() %>
|
44
|
-
<%= render(LesliView::Element::Table.new(
|
45
|
-
columns: columns,
|
46
|
-
records: @sessions[:records]
|
47
|
-
)) %>
|
48
|
-
<% end %>
|
49
|
-
```
|
32
|
+
|
33
|
+
### Usage
|
50
34
|
|
51
35
|
```erb
|
52
|
-
|
53
|
-
|
54
|
-
|
36
|
+
# app/views/lesli_support/tickets/index.html.erb
|
37
|
+
|
38
|
+
<%= render(LesliView::Layout::Container.new("support-tickets")) do %>
|
39
|
+
|
40
|
+
<%= render(LesliView::Components::Header.new("Tickets")) %>
|
41
|
+
<%= render(LesliView::Components::Toolbar.new()) %>
|
42
|
+
|
43
|
+
<%= render(LesliView::Elements::Table.new(
|
44
|
+
:columns => columns,
|
45
|
+
:records => @tickets.dig(:records),
|
46
|
+
link: -> (ticket) { ticket_path(ticket.id) }
|
47
|
+
)) %>
|
55
48
|
<% end %>
|
56
49
|
```
|
57
50
|
|
51
|
+
|
58
52
|
### Documentation
|
53
|
+
- **Components:**
|
54
|
+
- [Header](https://www.lesli.dev/gems/view/component-header)
|
55
|
+
|
56
|
+
|
57
|
+
### Lesli Documentation
|
59
58
|
* [website](https://www.lesli.dev/)
|
60
|
-
* [database](./docs/database.md)
|
61
59
|
* [documentation](https://www.lesli.dev/gems/view/)
|
62
60
|
|
63
61
|
|
@@ -88,8 +86,7 @@ along with this program. If not, see http://www.gnu.org/licenses/.
|
|
88
86
|
<hr />
|
89
87
|
<br />
|
90
88
|
|
91
|
-
<
|
89
|
+
<div align="center" class="has-text-centered">
|
92
90
|
<img width="200" alt="Lesli logo" src="https://cdn.lesli.tech/lesli/brand/app-logo.svg" />
|
93
|
-
<h4 align="center">Ruby on Rails SaaS Development Framework.</h4>
|
94
|
-
</
|
95
|
-
|
91
|
+
<h4 align="center" class="mt-0">Ruby on Rails SaaS Development Framework.</h4>
|
92
|
+
</div>
|