better_ui 0.1.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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +195 -0
- data/Rakefile +8 -0
- data/app/assets/stylesheets/better_ui/application.css +371 -0
- data/app/controllers/better_ui/application_controller.rb +4 -0
- data/app/controllers/better_ui/docs_controller.rb +41 -0
- data/app/helpers/better_ui/application_helper.rb +183 -0
- data/app/jobs/better_ui/application_job.rb +4 -0
- data/app/mailers/better_ui/application_mailer.rb +6 -0
- data/app/models/better_ui/application_record.rb +5 -0
- data/app/views/better_ui/docs/component.html.erb +365 -0
- data/app/views/better_ui/docs/index.html.erb +100 -0
- data/app/views/better_ui/docs/show.html.erb +60 -0
- data/app/views/layouts/better_ui/application.html.erb +135 -0
- data/config/routes.rb +10 -0
- data/lib/better_ui/engine.rb +29 -0
- data/lib/better_ui/version.rb +3 -0
- data/lib/better_ui.rb +25 -0
- data/lib/tasks/better_ui_tasks.rake +4 -0
- metadata +151 -0
@@ -0,0 +1,60 @@
|
|
1
|
+
<div class="better-ui-doc-content">
|
2
|
+
<%= better_ui_markdown(@content) %>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<style>
|
6
|
+
.better-ui-doc-content {
|
7
|
+
max-width: 100%;
|
8
|
+
}
|
9
|
+
|
10
|
+
.better-ui-doc-content h1 {
|
11
|
+
margin-bottom: 1.5rem;
|
12
|
+
padding-bottom: 0.5rem;
|
13
|
+
border-bottom: 1px solid #e0e0e0;
|
14
|
+
}
|
15
|
+
|
16
|
+
.better-ui-doc-content h2 {
|
17
|
+
margin-top: 2rem;
|
18
|
+
margin-bottom: 1rem;
|
19
|
+
padding-bottom: 0.5rem;
|
20
|
+
border-bottom: 1px solid #f0f0f0;
|
21
|
+
}
|
22
|
+
|
23
|
+
.better-ui-doc-content pre {
|
24
|
+
background-color: #f5f5f5;
|
25
|
+
padding: 1rem;
|
26
|
+
border-radius: 4px;
|
27
|
+
overflow-x: auto;
|
28
|
+
margin: 1rem 0;
|
29
|
+
}
|
30
|
+
|
31
|
+
.better-ui-doc-content code {
|
32
|
+
font-family: monospace;
|
33
|
+
}
|
34
|
+
|
35
|
+
.better-ui-doc-content ul, .better-ui-doc-content ol {
|
36
|
+
margin-left: 1.5rem;
|
37
|
+
margin-bottom: 1rem;
|
38
|
+
}
|
39
|
+
|
40
|
+
.better-ui-doc-content p {
|
41
|
+
margin-bottom: 1rem;
|
42
|
+
line-height: 1.6;
|
43
|
+
}
|
44
|
+
|
45
|
+
.better-ui-doc-content a {
|
46
|
+
color: #007bff;
|
47
|
+
text-decoration: none;
|
48
|
+
}
|
49
|
+
|
50
|
+
.better-ui-doc-content a:hover {
|
51
|
+
text-decoration: underline;
|
52
|
+
}
|
53
|
+
|
54
|
+
.better-ui-doc-content blockquote {
|
55
|
+
border-left: 4px solid #e0e0e0;
|
56
|
+
padding-left: 1rem;
|
57
|
+
margin-left: 0;
|
58
|
+
color: #666;
|
59
|
+
}
|
60
|
+
</style>
|
@@ -0,0 +1,135 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>BetterUI - <%= yield(:title) || 'Componenti UI per Rails' %></title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<%= csrf_meta_tags %>
|
7
|
+
<%= csp_meta_tag %>
|
8
|
+
|
9
|
+
<%= stylesheet_link_tag "better_ui/application" %>
|
10
|
+
|
11
|
+
<style>
|
12
|
+
body {
|
13
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
14
|
+
line-height: 1.5;
|
15
|
+
color: #333;
|
16
|
+
margin: 0;
|
17
|
+
padding: 0;
|
18
|
+
}
|
19
|
+
|
20
|
+
.better-ui-container {
|
21
|
+
width: 100%;
|
22
|
+
max-width: 1200px;
|
23
|
+
margin: 0 auto;
|
24
|
+
padding: 1rem;
|
25
|
+
}
|
26
|
+
|
27
|
+
.better-ui-sidebar {
|
28
|
+
width: 250px;
|
29
|
+
padding: 1rem;
|
30
|
+
background-color: #f5f5f5;
|
31
|
+
border-right: 1px solid #e0e0e0;
|
32
|
+
position: fixed;
|
33
|
+
top: 0;
|
34
|
+
left: 0;
|
35
|
+
bottom: 0;
|
36
|
+
overflow-y: auto;
|
37
|
+
}
|
38
|
+
|
39
|
+
.better-ui-content {
|
40
|
+
margin-left: 250px;
|
41
|
+
padding: 2rem;
|
42
|
+
}
|
43
|
+
|
44
|
+
.better-ui-nav-title {
|
45
|
+
font-size: 1.25rem;
|
46
|
+
font-weight: 600;
|
47
|
+
margin-bottom: 1rem;
|
48
|
+
}
|
49
|
+
|
50
|
+
.better-ui-nav-list {
|
51
|
+
list-style: none;
|
52
|
+
padding: 0;
|
53
|
+
margin: 0;
|
54
|
+
}
|
55
|
+
|
56
|
+
.better-ui-nav-item {
|
57
|
+
margin-bottom: 0.5rem;
|
58
|
+
}
|
59
|
+
|
60
|
+
.better-ui-nav-link {
|
61
|
+
color: #333;
|
62
|
+
text-decoration: none;
|
63
|
+
padding: 0.5rem;
|
64
|
+
display: block;
|
65
|
+
border-radius: 4px;
|
66
|
+
}
|
67
|
+
|
68
|
+
.better-ui-nav-link:hover {
|
69
|
+
background-color: #e0e0e0;
|
70
|
+
}
|
71
|
+
|
72
|
+
.better-ui-nav-link.active {
|
73
|
+
background-color: #007bff;
|
74
|
+
color: white;
|
75
|
+
}
|
76
|
+
</style>
|
77
|
+
</head>
|
78
|
+
|
79
|
+
<body>
|
80
|
+
<div class="better-ui-container">
|
81
|
+
<div class="better-ui-sidebar">
|
82
|
+
<div class="better-ui-nav-title">BetterUI</div>
|
83
|
+
<nav>
|
84
|
+
<div class="better-ui-nav-section">
|
85
|
+
<h3>Documentazione</h3>
|
86
|
+
<ul class="better-ui-nav-list">
|
87
|
+
<li class="better-ui-nav-item">
|
88
|
+
<%= link_to "Guida all'installazione", better_ui.docs_page_path('installation'), class: "better-ui-nav-link" %>
|
89
|
+
</li>
|
90
|
+
<li class="better-ui-nav-item">
|
91
|
+
<%= link_to "Personalizzazione", better_ui.docs_page_path('customization'), class: "better-ui-nav-link" %>
|
92
|
+
</li>
|
93
|
+
</ul>
|
94
|
+
</div>
|
95
|
+
|
96
|
+
<div class="better-ui-nav-section">
|
97
|
+
<h3>Componenti</h3>
|
98
|
+
<ul class="better-ui-nav-list">
|
99
|
+
<% if @components %>
|
100
|
+
<% @components.each do |component| %>
|
101
|
+
<li class="better-ui-nav-item">
|
102
|
+
<%= link_to component[:name], component[:path], class: "better-ui-nav-link" %>
|
103
|
+
</li>
|
104
|
+
<% end %>
|
105
|
+
<% else %>
|
106
|
+
<li class="better-ui-nav-item">
|
107
|
+
<%= link_to "Button", better_ui.docs_component_path('button'), class: "better-ui-nav-link" %>
|
108
|
+
</li>
|
109
|
+
<li class="better-ui-nav-item">
|
110
|
+
<%= link_to "Alert", better_ui.docs_component_path('alert'), class: "better-ui-nav-link" %>
|
111
|
+
</li>
|
112
|
+
<li class="better-ui-nav-item">
|
113
|
+
<%= link_to "Card", better_ui.docs_component_path('card'), class: "better-ui-nav-link" %>
|
114
|
+
</li>
|
115
|
+
<li class="better-ui-nav-item">
|
116
|
+
<%= link_to "Modal", better_ui.docs_component_path('modal'), class: "better-ui-nav-link" %>
|
117
|
+
</li>
|
118
|
+
<li class="better-ui-nav-item">
|
119
|
+
<%= link_to "Tabs", better_ui.docs_component_path('tabs'), class: "better-ui-nav-link" %>
|
120
|
+
</li>
|
121
|
+
<li class="better-ui-nav-item">
|
122
|
+
<%= link_to "Form Elements", better_ui.docs_component_path('form_elements'), class: "better-ui-nav-link" %>
|
123
|
+
</li>
|
124
|
+
<% end %>
|
125
|
+
</ul>
|
126
|
+
</div>
|
127
|
+
</nav>
|
128
|
+
</div>
|
129
|
+
|
130
|
+
<div class="better-ui-content">
|
131
|
+
<%= yield %>
|
132
|
+
</div>
|
133
|
+
</div>
|
134
|
+
</body>
|
135
|
+
</html>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
BetterUi::Engine.routes.draw do
|
2
|
+
# Route principale per la documentazione
|
3
|
+
root to: 'docs#index'
|
4
|
+
|
5
|
+
# Route per le pagine di documentazione generiche
|
6
|
+
get 'docs/:page', to: 'docs#show', as: :docs_page
|
7
|
+
|
8
|
+
# Route per la documentazione dei componenti specifici
|
9
|
+
get 'docs/components/:component', to: 'docs#component', as: :docs_component
|
10
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'view_component'
|
2
|
+
require 'redcarpet'
|
3
|
+
require 'tailwindcss-rails'
|
4
|
+
|
5
|
+
module BetterUi
|
6
|
+
class Engine < ::Rails::Engine
|
7
|
+
isolate_namespace BetterUi
|
8
|
+
|
9
|
+
# Configurazione per rendere disponibili gli assets all'applicazione host
|
10
|
+
initializer 'better_ui.assets' do |app|
|
11
|
+
app.config.assets.paths << root.join('app', 'assets', 'stylesheets')
|
12
|
+
app.config.assets.paths << root.join('app', 'assets', 'images')
|
13
|
+
end
|
14
|
+
|
15
|
+
# Configurazione per rendere disponibili i componenti all'applicazione host
|
16
|
+
initializer 'better_ui.view_helpers' do
|
17
|
+
ActiveSupport.on_load :action_controller do
|
18
|
+
helper BetterUi::ApplicationHelper
|
19
|
+
end
|
20
|
+
|
21
|
+
ActiveSupport.on_load :action_view do
|
22
|
+
include BetterUi::ApplicationHelper
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# Configurazione per ViewComponent
|
27
|
+
config.view_component.preview_paths << root.join('spec', 'components', 'previews')
|
28
|
+
end
|
29
|
+
end
|
data/lib/better_ui.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require "better_ui/version"
|
2
|
+
require "better_ui/engine"
|
3
|
+
|
4
|
+
module BetterUi
|
5
|
+
class Configuration
|
6
|
+
attr_accessor :button_defaults, :alert_defaults, :card_defaults, :tabs_defaults
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@button_defaults = {}
|
10
|
+
@alert_defaults = {}
|
11
|
+
@card_defaults = {}
|
12
|
+
@tabs_defaults = {}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class << self
|
17
|
+
def configuration
|
18
|
+
@configuration ||= Configuration.new
|
19
|
+
end
|
20
|
+
|
21
|
+
def configure
|
22
|
+
yield(configuration) if block_given?
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: better_ui
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- alessiobussolari
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2025-05-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 7.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 7.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: view_component
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.0.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.0.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: redcarpet
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.6'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.6'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: tailwindcss-rails
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sqlite3
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: puma
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Una gem Rails che funziona come engine montabile contenente componenti
|
98
|
+
UI riutilizzabili e pagine di documentazione
|
99
|
+
email:
|
100
|
+
- alessio.bussolari@pandev.it
|
101
|
+
executables: []
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- MIT-LICENSE
|
106
|
+
- README.md
|
107
|
+
- Rakefile
|
108
|
+
- app/assets/stylesheets/better_ui/application.css
|
109
|
+
- app/controllers/better_ui/application_controller.rb
|
110
|
+
- app/controllers/better_ui/docs_controller.rb
|
111
|
+
- app/helpers/better_ui/application_helper.rb
|
112
|
+
- app/jobs/better_ui/application_job.rb
|
113
|
+
- app/mailers/better_ui/application_mailer.rb
|
114
|
+
- app/models/better_ui/application_record.rb
|
115
|
+
- app/views/better_ui/docs/component.html.erb
|
116
|
+
- app/views/better_ui/docs/index.html.erb
|
117
|
+
- app/views/better_ui/docs/show.html.erb
|
118
|
+
- app/views/layouts/better_ui/application.html.erb
|
119
|
+
- config/routes.rb
|
120
|
+
- lib/better_ui.rb
|
121
|
+
- lib/better_ui/engine.rb
|
122
|
+
- lib/better_ui/version.rb
|
123
|
+
- lib/tasks/better_ui_tasks.rake
|
124
|
+
homepage: https://github.com/alessiobussolari/better_ui
|
125
|
+
licenses:
|
126
|
+
- MIT
|
127
|
+
metadata:
|
128
|
+
allowed_push_host: https://rubygems.org
|
129
|
+
homepage_uri: https://github.com/alessiobussolari/better_ui
|
130
|
+
source_code_uri: https://github.com/alessiobussolari/better_ui
|
131
|
+
changelog_uri: https://github.com/alessiobussolari/better_ui/blob/main/CHANGELOG.md
|
132
|
+
post_install_message:
|
133
|
+
rdoc_options: []
|
134
|
+
require_paths:
|
135
|
+
- lib
|
136
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
requirements: []
|
147
|
+
rubygems_version: 3.5.11
|
148
|
+
signing_key:
|
149
|
+
specification_version: 4
|
150
|
+
summary: Componenti UI riutilizzabili per Rails con documentazione integrata
|
151
|
+
test_files: []
|