better_ui 0.4.0 → 0.5.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/README.md +165 -105
- data/app/components/better_ui/application/alert_component.html.erb +1 -1
- data/app/components/better_ui/application/alert_component.rb +95 -89
- data/app/components/better_ui/application/card_component.html.erb +24 -0
- data/app/components/better_ui/application/card_component.rb +53 -0
- data/app/components/better_ui/application/card_container_component.html.erb +8 -0
- data/app/components/better_ui/application/card_container_component.rb +14 -0
- data/app/components/better_ui/application/toast_component.rb +92 -57
- data/app/components/better_ui/general/avatar_component.html.erb +19 -0
- data/app/components/better_ui/general/avatar_component.rb +171 -0
- data/app/components/better_ui/general/badge_component.html.erb +19 -0
- data/app/components/better_ui/general/badge_component.rb +123 -0
- data/app/components/better_ui/general/breadcrumb_component.html.erb +7 -31
- data/app/components/better_ui/general/breadcrumb_component.rb +64 -66
- data/app/components/better_ui/general/button_component.html.erb +4 -4
- data/app/components/better_ui/general/button_component.rb +64 -95
- data/app/components/better_ui/general/heading_component.html.erb +3 -3
- data/app/components/better_ui/general/heading_component.rb +76 -70
- data/app/components/better_ui/general/icon_component.html.erb +1 -1
- data/app/components/better_ui/general/icon_component.rb +22 -23
- data/app/components/better_ui/general/link_component.html.erb +17 -0
- data/app/components/better_ui/general/link_component.rb +132 -0
- data/app/components/better_ui/general/panel_component.rb +62 -56
- data/app/components/better_ui/general/spinner_component.html.erb +15 -0
- data/app/components/better_ui/general/spinner_component.rb +79 -0
- data/app/components/better_ui/general/table_component.html.erb +56 -20
- data/app/components/better_ui/general/table_component.rb +106 -80
- data/app/components/better_ui/theme_helper.rb +77 -75
- data/app/views/components/better_ui/general/table/_custom_body_row.html.erb +17 -0
- data/app/views/components/better_ui/general/table/_custom_footer_rows.html.erb +17 -0
- data/app/views/components/better_ui/general/table/_custom_header_rows.html.erb +12 -0
- data/lib/better_ui/engine.rb +4 -10
- data/lib/better_ui/version.rb +1 -1
- data/lib/better_ui.rb +4 -0
- data/lib/generators/better_ui/stylesheet_generator.rb +96 -0
- data/lib/generators/better_ui/templates/README +56 -0
- data/lib/generators/better_ui/templates/components/_avatar.scss +151 -0
- data/lib/generators/better_ui/templates/components/_badge.scss +142 -0
- data/lib/generators/better_ui/templates/components/_breadcrumb.scss +107 -0
- data/lib/generators/better_ui/templates/components/_button.scss +106 -0
- data/lib/generators/better_ui/templates/components/_card.scss +69 -0
- data/lib/generators/better_ui/templates/components/_heading.scss +180 -0
- data/lib/generators/better_ui/templates/components/_icon.scss +90 -0
- data/lib/generators/better_ui/templates/components/_link.scss +130 -0
- data/lib/generators/better_ui/templates/components/_panel.scss +144 -0
- data/lib/generators/better_ui/templates/components/_spinner.scss +132 -0
- data/lib/generators/better_ui/templates/components/_table.scss +105 -0
- data/lib/generators/better_ui/templates/components/_variables.scss +33 -0
- data/lib/generators/better_ui/templates/components_stylesheet.scss +66 -0
- metadata +51 -22
- data/app/helpers/better_ui_application_helper.rb +0 -99
@@ -0,0 +1,105 @@
|
|
1
|
+
/* ==============================
|
2
|
+
* Table Component
|
3
|
+
* ============================== */
|
4
|
+
|
5
|
+
/* Contenitore e base */
|
6
|
+
.bui-table-container {
|
7
|
+
@apply overflow-hidden;
|
8
|
+
}
|
9
|
+
|
10
|
+
.bui-table-base {
|
11
|
+
@apply w-full;
|
12
|
+
}
|
13
|
+
|
14
|
+
.bui-table-bordered {
|
15
|
+
@apply border-collapse;
|
16
|
+
}
|
17
|
+
|
18
|
+
/* Bordi arrotondati */
|
19
|
+
.bui-table-radius-none { @apply rounded-none; }
|
20
|
+
.bui-table-radius-small { @apply rounded-md; }
|
21
|
+
.bui-table-radius-medium { @apply rounded-lg; }
|
22
|
+
.bui-table-radius-large { @apply rounded-xl; }
|
23
|
+
.bui-table-radius-full { @apply rounded-3xl; }
|
24
|
+
|
25
|
+
/* Celle e righe */
|
26
|
+
.bui-table-cell {
|
27
|
+
@apply px-4 py-3;
|
28
|
+
}
|
29
|
+
|
30
|
+
.bui-table-cell-compact {
|
31
|
+
@apply px-2 py-1 text-sm;
|
32
|
+
}
|
33
|
+
|
34
|
+
.bui-table-cell-bordered {
|
35
|
+
@apply border;
|
36
|
+
}
|
37
|
+
|
38
|
+
/* Stili per le righe */
|
39
|
+
.bui-table-row-hover tr:hover td {
|
40
|
+
@apply bg-opacity-10 bg-gray-500;
|
41
|
+
}
|
42
|
+
|
43
|
+
.bui-table-row-striped tr:nth-child(odd) td {
|
44
|
+
@apply bg-gray-50;
|
45
|
+
}
|
46
|
+
|
47
|
+
.bui-table-row-alternate {
|
48
|
+
@apply bg-gray-50;
|
49
|
+
}
|
50
|
+
|
51
|
+
/* Caption */
|
52
|
+
.bui-table-caption {
|
53
|
+
@apply p-3 font-medium;
|
54
|
+
}
|
55
|
+
|
56
|
+
.bui-table-caption-bordered {
|
57
|
+
@apply border-b;
|
58
|
+
}
|
59
|
+
|
60
|
+
/* Header */
|
61
|
+
.bui-table-header th {
|
62
|
+
@apply font-semibold;
|
63
|
+
}
|
64
|
+
|
65
|
+
/* Footer */
|
66
|
+
.bui-table-footer td {
|
67
|
+
@apply font-semibold;
|
68
|
+
}
|
69
|
+
|
70
|
+
.bui-table-footer-cell {
|
71
|
+
@apply bg-opacity-90;
|
72
|
+
}
|
73
|
+
|
74
|
+
/* Varianti bordi */
|
75
|
+
.bui-table-border-default { @apply border-gray-900; }
|
76
|
+
.bui-table-border-white { @apply border-gray-200; }
|
77
|
+
.bui-table-border-red { @apply border-red-600; }
|
78
|
+
.bui-table-border-rose { @apply border-rose-600; }
|
79
|
+
.bui-table-border-orange { @apply border-orange-600; }
|
80
|
+
.bui-table-border-green { @apply border-green-600; }
|
81
|
+
.bui-table-border-blue { @apply border-blue-600; }
|
82
|
+
.bui-table-border-yellow { @apply border-yellow-600; }
|
83
|
+
.bui-table-border-violet { @apply border-violet-600; }
|
84
|
+
|
85
|
+
/* Varianti background */
|
86
|
+
.bui-table-bg-default { @apply bg-black; }
|
87
|
+
.bui-table-bg-white { @apply bg-white; }
|
88
|
+
.bui-table-bg-red { @apply bg-red-500; }
|
89
|
+
.bui-table-bg-rose { @apply bg-rose-500; }
|
90
|
+
.bui-table-bg-orange { @apply bg-orange-500; }
|
91
|
+
.bui-table-bg-green { @apply bg-green-500; }
|
92
|
+
.bui-table-bg-blue { @apply bg-blue-500; }
|
93
|
+
.bui-table-bg-yellow { @apply bg-yellow-500; }
|
94
|
+
.bui-table-bg-violet { @apply bg-violet-500; }
|
95
|
+
|
96
|
+
/* Varianti testo */
|
97
|
+
.bui-table-text-default { @apply text-white; }
|
98
|
+
.bui-table-text-white { @apply text-black; }
|
99
|
+
.bui-table-text-red { @apply text-white; }
|
100
|
+
.bui-table-text-rose { @apply text-white; }
|
101
|
+
.bui-table-text-orange { @apply text-white; }
|
102
|
+
.bui-table-text-green { @apply text-white; }
|
103
|
+
.bui-table-text-blue { @apply text-white; }
|
104
|
+
.bui-table-text-yellow { @apply text-black; }
|
105
|
+
.bui-table-text-violet { @apply text-white; }
|
@@ -0,0 +1,33 @@
|
|
1
|
+
/* ==============================
|
2
|
+
* Variables
|
3
|
+
* ============================== */
|
4
|
+
|
5
|
+
/* Colori principali - usa i colori di Tailwind */
|
6
|
+
$bui-primary: theme('colors.blue.500') !default;
|
7
|
+
$bui-primary-hover: theme('colors.blue.600') !default;
|
8
|
+
$bui-secondary: theme('colors.gray.500') !default;
|
9
|
+
$bui-secondary-hover: theme('colors.gray.600') !default;
|
10
|
+
$bui-success: theme('colors.emerald.500') !default;
|
11
|
+
$bui-warning: theme('colors.amber.500') !default;
|
12
|
+
$bui-danger: theme('colors.red.500') !default;
|
13
|
+
$bui-info: theme('colors.blue.500') !default;
|
14
|
+
|
15
|
+
/* Spaziature - usa gli spacing di Tailwind */
|
16
|
+
$bui-spacing-xs: theme('spacing.1') !default;
|
17
|
+
$bui-spacing-sm: theme('spacing.2') !default;
|
18
|
+
$bui-spacing-md: theme('spacing.4') !default;
|
19
|
+
$bui-spacing-lg: theme('spacing.6') !default;
|
20
|
+
$bui-spacing-xl: theme('spacing.8') !default;
|
21
|
+
|
22
|
+
/* Tipografia - usa i font di Tailwind */
|
23
|
+
$bui-font-family: theme('fontFamily.sans') !default;
|
24
|
+
$bui-font-size-sm: theme('fontSize.sm[0]') !default;
|
25
|
+
$bui-font-size-base: theme('fontSize.base[0]') !default;
|
26
|
+
$bui-font-size-lg: theme('fontSize.lg[0]') !default;
|
27
|
+
$bui-font-size-xl: theme('fontSize.xl[0]') !default;
|
28
|
+
|
29
|
+
/* Border radius - usa i radius di Tailwind */
|
30
|
+
$bui-radius-sm: theme('borderRadius.sm') !default;
|
31
|
+
$bui-radius-md: theme('borderRadius.md') !default;
|
32
|
+
$bui-radius-lg: theme('borderRadius.lg') !default;
|
33
|
+
$bui-radius-full: theme('borderRadius.full') !default;
|
@@ -0,0 +1,66 @@
|
|
1
|
+
/*
|
2
|
+
* <%= options[:prefix] %>_better_ui_components.scss
|
3
|
+
* Foglio di stile SCSS per la personalizzazione dei componenti di BetterUi
|
4
|
+
* Generato il: <%= Time.now.strftime('%d/%m/%Y %H:%M') %>
|
5
|
+
*/
|
6
|
+
|
7
|
+
/**
|
8
|
+
* INDICE:
|
9
|
+
* 1. Variabili
|
10
|
+
* 2. Componenti generali
|
11
|
+
* 3. Componenti applicativi
|
12
|
+
* 4. Personalizzazioni
|
13
|
+
*/
|
14
|
+
|
15
|
+
/*==================================
|
16
|
+
IMPORTAZIONE COMPONENTI E VARIABILI
|
17
|
+
====================================*/
|
18
|
+
/* Importa le variabili */
|
19
|
+
@import "components/variables";
|
20
|
+
|
21
|
+
@layer components {
|
22
|
+
/*==================================
|
23
|
+
COMPONENTI GENERALI
|
24
|
+
====================================*/
|
25
|
+
|
26
|
+
/* Importa il componente Bottone */
|
27
|
+
@import "components/button";
|
28
|
+
|
29
|
+
/* Importa il componente Heading */
|
30
|
+
@import "components/heading";
|
31
|
+
|
32
|
+
/* Importa il componente Breadcrumb */
|
33
|
+
@import "components/breadcrumb";
|
34
|
+
|
35
|
+
/* Importa il componente Link */
|
36
|
+
@import "components/link";
|
37
|
+
|
38
|
+
/* Importa il componente Panel */
|
39
|
+
@import "components/panel";
|
40
|
+
|
41
|
+
/* Importa il componente Icon */
|
42
|
+
@import "components/icon";
|
43
|
+
|
44
|
+
/* Importa il componente Table */
|
45
|
+
@import "components/table";
|
46
|
+
|
47
|
+
/* Importa il componente Spinner */
|
48
|
+
@import "components/spinner";
|
49
|
+
|
50
|
+
/* Importa il componente Badge */
|
51
|
+
@import "components/badge";
|
52
|
+
|
53
|
+
/* Importa il componente Avatar */
|
54
|
+
@import "components/avatar";
|
55
|
+
|
56
|
+
/*==================================
|
57
|
+
COMPONENTI APPLICATIVI
|
58
|
+
====================================*/
|
59
|
+
/* Importa il componente Card */
|
60
|
+
@import "components/card";
|
61
|
+
|
62
|
+
/*==================================
|
63
|
+
PERSONALIZZAZIONI
|
64
|
+
====================================*/
|
65
|
+
/* Qui è possibile aggiungere personalizzazioni specifiche */
|
66
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: better_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alessiobussolari
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-05-
|
11
|
+
date: 2025-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -95,27 +95,27 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 6.5.1
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: lookbook
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
104
|
-
type: :
|
103
|
+
version: '2.1'
|
104
|
+
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '2.1'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: listen
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
|
-
type: :
|
118
|
+
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
@@ -123,21 +123,21 @@ dependencies:
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: actioncable
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
132
|
-
type: :
|
131
|
+
version: '0'
|
132
|
+
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - "
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
138
|
+
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: sqlite3
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - ">="
|
@@ -151,7 +151,7 @@ dependencies:
|
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
154
|
+
name: puma
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - ">="
|
@@ -164,8 +164,8 @@ dependencies:
|
|
164
164
|
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
|
-
description:
|
168
|
-
|
167
|
+
description: A Rails gem that works as a mountable engine containing reusable UI components
|
168
|
+
and documentation pages
|
169
169
|
email:
|
170
170
|
- alessio.bussolari@pandev.it
|
171
171
|
executables: []
|
@@ -183,6 +183,10 @@ files:
|
|
183
183
|
- app/assets/stylesheets/better_ui/application.css
|
184
184
|
- app/components/better_ui/application/alert_component.html.erb
|
185
185
|
- app/components/better_ui/application/alert_component.rb
|
186
|
+
- app/components/better_ui/application/card_component.html.erb
|
187
|
+
- app/components/better_ui/application/card_component.rb
|
188
|
+
- app/components/better_ui/application/card_container_component.html.erb
|
189
|
+
- app/components/better_ui/application/card_container_component.rb
|
186
190
|
- app/components/better_ui/application/header_component.html.erb
|
187
191
|
- app/components/better_ui/application/header_component.rb
|
188
192
|
- app/components/better_ui/application/navbar_component.html.erb
|
@@ -191,6 +195,10 @@ files:
|
|
191
195
|
- app/components/better_ui/application/sidebar_component.rb
|
192
196
|
- app/components/better_ui/application/toast_component.html.erb
|
193
197
|
- app/components/better_ui/application/toast_component.rb
|
198
|
+
- app/components/better_ui/general/avatar_component.html.erb
|
199
|
+
- app/components/better_ui/general/avatar_component.rb
|
200
|
+
- app/components/better_ui/general/badge_component.html.erb
|
201
|
+
- app/components/better_ui/general/badge_component.rb
|
194
202
|
- app/components/better_ui/general/breadcrumb_component.html.erb
|
195
203
|
- app/components/better_ui/general/breadcrumb_component.rb
|
196
204
|
- app/components/better_ui/general/button_component.html.erb
|
@@ -199,23 +207,44 @@ files:
|
|
199
207
|
- app/components/better_ui/general/heading_component.rb
|
200
208
|
- app/components/better_ui/general/icon_component.html.erb
|
201
209
|
- app/components/better_ui/general/icon_component.rb
|
210
|
+
- app/components/better_ui/general/link_component.html.erb
|
211
|
+
- app/components/better_ui/general/link_component.rb
|
202
212
|
- app/components/better_ui/general/panel_component.html.erb
|
203
213
|
- app/components/better_ui/general/panel_component.rb
|
214
|
+
- app/components/better_ui/general/spinner_component.html.erb
|
215
|
+
- app/components/better_ui/general/spinner_component.rb
|
204
216
|
- app/components/better_ui/general/table_component.html.erb
|
205
217
|
- app/components/better_ui/general/table_component.rb
|
206
218
|
- app/components/better_ui/theme_helper.rb
|
207
219
|
- app/controllers/better_ui/application_controller.rb
|
208
220
|
- app/controllers/better_ui/docs_controller.rb
|
209
|
-
- app/helpers/better_ui_application_helper.rb
|
210
221
|
- app/jobs/better_ui/application_job.rb
|
211
222
|
- app/mailers/better_ui/application_mailer.rb
|
212
223
|
- app/models/better_ui/application_record.rb
|
224
|
+
- app/views/components/better_ui/general/table/_custom_body_row.html.erb
|
225
|
+
- app/views/components/better_ui/general/table/_custom_footer_rows.html.erb
|
226
|
+
- app/views/components/better_ui/general/table/_custom_header_rows.html.erb
|
213
227
|
- app/views/layouts/component_preview.html.erb
|
214
228
|
- config/initializers/lookbook.rb
|
215
229
|
- config/routes.rb
|
216
230
|
- lib/better_ui.rb
|
217
231
|
- lib/better_ui/engine.rb
|
218
232
|
- lib/better_ui/version.rb
|
233
|
+
- lib/generators/better_ui/stylesheet_generator.rb
|
234
|
+
- lib/generators/better_ui/templates/README
|
235
|
+
- lib/generators/better_ui/templates/components/_avatar.scss
|
236
|
+
- lib/generators/better_ui/templates/components/_badge.scss
|
237
|
+
- lib/generators/better_ui/templates/components/_breadcrumb.scss
|
238
|
+
- lib/generators/better_ui/templates/components/_button.scss
|
239
|
+
- lib/generators/better_ui/templates/components/_card.scss
|
240
|
+
- lib/generators/better_ui/templates/components/_heading.scss
|
241
|
+
- lib/generators/better_ui/templates/components/_icon.scss
|
242
|
+
- lib/generators/better_ui/templates/components/_link.scss
|
243
|
+
- lib/generators/better_ui/templates/components/_panel.scss
|
244
|
+
- lib/generators/better_ui/templates/components/_spinner.scss
|
245
|
+
- lib/generators/better_ui/templates/components/_table.scss
|
246
|
+
- lib/generators/better_ui/templates/components/_variables.scss
|
247
|
+
- lib/generators/better_ui/templates/components_stylesheet.scss
|
219
248
|
- lib/tasks/better_ui_tasks.rake
|
220
249
|
homepage: https://github.com/alessiobussolari/better_ui
|
221
250
|
licenses:
|
@@ -243,5 +272,5 @@ requirements: []
|
|
243
272
|
rubygems_version: 3.5.11
|
244
273
|
signing_key:
|
245
274
|
specification_version: 4
|
246
|
-
summary:
|
275
|
+
summary: Reusable UI components for Rails with integrated documentation
|
247
276
|
test_files: []
|
@@ -1,99 +0,0 @@
|
|
1
|
-
module BetterUi
|
2
|
-
module ApplicationHelper
|
3
|
-
# Render markdown
|
4
|
-
def better_ui_markdown(text)
|
5
|
-
return '' if text.blank?
|
6
|
-
|
7
|
-
renderer = Redcarpet::Render::HTML.new(
|
8
|
-
filter_html: false,
|
9
|
-
hard_wrap: true,
|
10
|
-
link_attributes: { target: '_blank', rel: 'noopener noreferrer' }
|
11
|
-
)
|
12
|
-
|
13
|
-
markdown = Redcarpet::Markdown.new(
|
14
|
-
renderer,
|
15
|
-
autolink: true,
|
16
|
-
tables: true,
|
17
|
-
fenced_code_blocks: true,
|
18
|
-
strikethrough: true,
|
19
|
-
superscript: true,
|
20
|
-
underline: true,
|
21
|
-
highlight: true,
|
22
|
-
quote: true,
|
23
|
-
footnotes: true
|
24
|
-
)
|
25
|
-
|
26
|
-
rendered_html = markdown.render(text).html_safe
|
27
|
-
|
28
|
-
# Applica classi Tailwind agli elementi HTML generati dal markdown
|
29
|
-
rendered_html
|
30
|
-
.gsub(/<h1>/i, '<h1 class="text-3xl font-bold mb-6 pb-2 border-b border-gray-200">')
|
31
|
-
.gsub(/<h2>/i, '<h2 class="text-2xl font-semibold mt-8 mb-4 pb-2 border-b border-gray-100">')
|
32
|
-
.gsub(/<h3>/i, '<h3 class="text-xl font-medium mt-6 mb-3">')
|
33
|
-
.gsub(/<pre>/i, '<pre class="bg-gray-100 p-4 rounded-md overflow-x-auto my-4">')
|
34
|
-
.gsub(/<code>/i, '<code class="font-mono">')
|
35
|
-
.gsub(/<ul>/i, '<ul class="ml-6 mb-4">')
|
36
|
-
.gsub(/<ol>/i, '<ol class="ml-6 mb-4">')
|
37
|
-
.gsub(/<p>/i, '<p class="mb-4 leading-relaxed">')
|
38
|
-
.gsub(/<a /i, '<a class="text-blue-600 no-underline hover:underline" ')
|
39
|
-
.gsub(/<blockquote>/i, '<blockquote class="border-l-4 border-gray-200 pl-4 ml-0 text-gray-600">')
|
40
|
-
.html_safe
|
41
|
-
end
|
42
|
-
|
43
|
-
# Determina se il path corrente corrisponde a quello dato
|
44
|
-
def current_page?(path)
|
45
|
-
request.path == path
|
46
|
-
end
|
47
|
-
|
48
|
-
# Helper per i componenti General
|
49
|
-
def better_ui_general_button(label = nil, **options)
|
50
|
-
render BetterUi::General::ButtonComponent.new(label: label, **options)
|
51
|
-
end
|
52
|
-
|
53
|
-
def better_ui_general_panel(**options, &block)
|
54
|
-
render BetterUi::General::PanelComponent.new(**options), &block
|
55
|
-
end
|
56
|
-
|
57
|
-
def better_ui_general_table(**options)
|
58
|
-
render BetterUi::General::TableComponent.new(**options)
|
59
|
-
end
|
60
|
-
|
61
|
-
def better_ui_general_icon(name, **options)
|
62
|
-
render BetterUi::General::IconComponent.new(name: name, **options)
|
63
|
-
end
|
64
|
-
|
65
|
-
# Helper per i componenti Application
|
66
|
-
def better_ui_application_button(label = nil, **options)
|
67
|
-
render BetterUi::Application::ButtonComponent.new(label: label, **options)
|
68
|
-
end
|
69
|
-
|
70
|
-
def better_ui_application_panel(**options, &block)
|
71
|
-
render BetterUi::Application::PanelComponent.new(**options), &block
|
72
|
-
end
|
73
|
-
|
74
|
-
def better_ui_application_table(**options)
|
75
|
-
render BetterUi::Application::TableComponent.new(**options)
|
76
|
-
end
|
77
|
-
|
78
|
-
def better_ui_application_icon(name, **options)
|
79
|
-
render BetterUi::Application::IconComponent.new(name: name, **options)
|
80
|
-
end
|
81
|
-
|
82
|
-
# Helper per i componenti Website
|
83
|
-
def better_ui_website_button(label = nil, **options)
|
84
|
-
render BetterUi::Website::ButtonComponent.new(label: label, **options)
|
85
|
-
end
|
86
|
-
|
87
|
-
def better_ui_website_panel(**options, &block)
|
88
|
-
render BetterUi::Website::PanelComponent.new(**options), &block
|
89
|
-
end
|
90
|
-
|
91
|
-
def better_ui_website_table(**options)
|
92
|
-
render BetterUi::Website::TableComponent.new(**options)
|
93
|
-
end
|
94
|
-
|
95
|
-
def better_ui_website_icon(name, **options)
|
96
|
-
render BetterUi::Website::IconComponent.new(name: name, **options)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|