solid_web_ui 0.1.0 → 0.2.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/LICENSE +21 -0
- data/README.md +5 -0
- data/app/components/solid_web_ui/ui/page_component.html.erb +18 -14
- data/app/controllers/solid_web_ui/cable/application_controller.rb +1 -1
- data/app/controllers/solid_web_ui/cache/application_controller.rb +1 -1
- data/app/controllers/solid_web_ui/queue/application_controller.rb +1 -1
- data/app/views/layouts/solid_web_ui.html.erb +2 -22
- data/lib/solid_web_ui/configurable.rb +6 -0
- data/lib/solid_web_ui/engine.rb +7 -0
- data/lib/solid_web_ui/head_helper.rb +38 -0
- data/lib/solid_web_ui/version.rb +1 -1
- data/lib/solid_web_ui.rb +1 -0
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 71e641147c603c1191aefc81cd3cf538ce2ba6efb861bbf3e8f83c648abcce9c
|
|
4
|
+
data.tar.gz: 2c3ba40caa7d3c98c9d7af92f42bdc40e01fd4ff2a2634ea8577946212a688af
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 199f01433b9facbcb155570bdc8e3724985f6b7c4cd5013db94e2067ad2c97c3e6634e5b86cfc54f09808c2600ffd835bf9ab54802fb7dd4df2493ecd83d813d
|
|
7
|
+
data.tar.gz: 923d50e464295107a7fbd2139d3971b19683a3ee4bd31e939c58c4eb9a7e4540ffd67f458394e229e7657b31baa6d7eab106248b3f060b881bcac667015423e3
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Anton Radushev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# solid_web_ui
|
|
2
2
|
|
|
3
|
+
[](https://rubygems.org/gems/solid_web_ui)
|
|
4
|
+
[](https://rubygems.org/gems/solid_web_ui)
|
|
5
|
+
[](https://github.com/doromones/solid-web/actions/workflows/ci.yml)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
3
8
|
Web dashboards for Rails' **Solid Queue**, **Solid Cache** and **Solid Cable** — one gem
|
|
4
9
|
(`solid_web_ui`) with three independently mountable Rails engines sharing one design system.
|
|
5
10
|
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
<%# Self-scoping under .solid-web-ui so the dashboard is themed correctly whether %>
|
|
2
|
+
<%# it renders in the gem's standalone layout or inside a host layout. %>
|
|
3
|
+
<div class="solid-web-ui" data-color-scheme="<%= SolidWebUi.config.color_scheme %>">
|
|
4
|
+
<div class="swui-page">
|
|
5
|
+
<header class="swui-page__header">
|
|
6
|
+
<h1 class="swui-page__title"><%= title %></h1>
|
|
7
|
+
<% if nav.any? %>
|
|
8
|
+
<nav class="swui-nav">
|
|
9
|
+
<% nav.each do |item| %>
|
|
10
|
+
<%= link_to item[:label], item[:href], class: nav_link_class(item) %>
|
|
11
|
+
<% end %>
|
|
12
|
+
</nav>
|
|
13
|
+
<% end %>
|
|
14
|
+
</header>
|
|
15
|
+
<main class="swui-page__body">
|
|
16
|
+
<%= content %>
|
|
17
|
+
</main>
|
|
18
|
+
</div>
|
|
15
19
|
</div>
|
|
@@ -5,7 +5,7 @@ module SolidWebUi::Queue
|
|
|
5
5
|
# so host authentication/authorization applies. Resolved lazily at autoload
|
|
6
6
|
# time, after host initializers have set `base_controller_class`.
|
|
7
7
|
class ApplicationController < SolidWebUi.resolve_base_controller(SolidWebUi::Queue.config.base_controller_class)
|
|
8
|
-
layout
|
|
8
|
+
layout -> { SolidWebUi::Queue.config.layout }
|
|
9
9
|
helper SolidWebUi::ComponentHelper
|
|
10
10
|
|
|
11
11
|
private
|
|
@@ -5,29 +5,9 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
6
|
<title><%= content_for?(:title) ? yield(:title) : "Solid Web" %></title>
|
|
7
7
|
<%= csrf_meta_tags %>
|
|
8
|
-
|
|
9
|
-
<% if SolidWebUi.config.stylesheet %>
|
|
10
|
-
<%= stylesheet_link_tag "solid_web_ui", "data-turbo-track": "reload" %>
|
|
11
|
-
<% end %>
|
|
12
|
-
<% Array(SolidWebUi.config.extra_stylesheets).each do |sheet| %>
|
|
13
|
-
<%= stylesheet_link_tag sheet, "data-turbo-track": "reload" %>
|
|
14
|
-
<% end %>
|
|
15
|
-
|
|
16
|
-
<%# Theme tokens (host re-themes by overriding these values, never the stylesheet). %>
|
|
17
|
-
<style>
|
|
18
|
-
.solid-web-ui { <%= SolidWebUi::Theme.css_vars(SolidWebUi.config.theme).html_safe %> }
|
|
19
|
-
<% if SolidWebUi.config.color_scheme.to_s == "dark" %>
|
|
20
|
-
.solid-web-ui { <%= SolidWebUi::Theme.dark_css_vars(SolidWebUi.config.theme).html_safe %> }
|
|
21
|
-
<% elsif SolidWebUi.config.color_scheme.to_s == "auto" %>
|
|
22
|
-
@media (prefers-color-scheme: dark) {
|
|
23
|
-
.solid-web-ui { <%= SolidWebUi::Theme.dark_css_vars(SolidWebUi.config.theme).html_safe %> }
|
|
24
|
-
}
|
|
25
|
-
<% end %>
|
|
26
|
-
</style>
|
|
8
|
+
<%= solid_web_ui_head_tags %>
|
|
27
9
|
</head>
|
|
28
10
|
<body>
|
|
29
|
-
|
|
30
|
-
<%= yield %>
|
|
31
|
-
</div>
|
|
11
|
+
<%= yield %>
|
|
32
12
|
</body>
|
|
33
13
|
</html>
|
|
@@ -15,6 +15,12 @@ module SolidWebUi
|
|
|
15
15
|
base.setting :per_page, default: 25
|
|
16
16
|
base.setting :time_zone, default: "UTC"
|
|
17
17
|
base.setting :page_title, default: base.respond_to?(:name) ? base.name : "Solid Web"
|
|
18
|
+
# Which layout the dashboards render in. Default is the gem's standalone,
|
|
19
|
+
# full-page layout. Point it at a host layout (e.g. "admin") to render the
|
|
20
|
+
# dashboards inside the host's chrome (sidebar/header). The host layout must
|
|
21
|
+
# then include `<%= solid_web_ui_head_tags %>` and reference its own routes
|
|
22
|
+
# via `main_app.` (so they resolve from the isolated engine's context).
|
|
23
|
+
base.setting :layout, default: "solid_web_ui"
|
|
18
24
|
end
|
|
19
25
|
end
|
|
20
26
|
end
|
data/lib/solid_web_ui/engine.rb
CHANGED
|
@@ -9,5 +9,12 @@ module SolidWebUi
|
|
|
9
9
|
# three web engines (queue/cache/cable) resolve the shared layout, components
|
|
10
10
|
# and the single precompiled stylesheet without any manual view-path wiring.
|
|
11
11
|
class Engine < ::Rails::Engine
|
|
12
|
+
# Expose solid_web_ui_head_tags to every host view, so a host layout can pull
|
|
13
|
+
# in the dashboards' stylesheet + theme tokens when embedding them.
|
|
14
|
+
initializer "solid_web_ui.head_helper" do
|
|
15
|
+
ActiveSupport.on_load(:action_view) do
|
|
16
|
+
include SolidWebUi::HeadHelper
|
|
17
|
+
end
|
|
18
|
+
end
|
|
12
19
|
end
|
|
13
20
|
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SolidWebUi
|
|
4
|
+
# Emits the dashboards' stylesheet + theme tokens. Included into ActionView
|
|
5
|
+
# app-wide (see SolidWebUi::Engine) so a host layout can drop
|
|
6
|
+
# `<%= solid_web_ui_head_tags %>` into its <head> when rendering the dashboards
|
|
7
|
+
# inside its own chrome (config.layout = "your_layout").
|
|
8
|
+
#
|
|
9
|
+
# Defined in lib/ (not app/helpers) because it is mixed into ActionView during
|
|
10
|
+
# boot, before the engine's autoload paths are ready.
|
|
11
|
+
module HeadHelper
|
|
12
|
+
def solid_web_ui_head_tags
|
|
13
|
+
tags = []
|
|
14
|
+
if SolidWebUi.config.stylesheet
|
|
15
|
+
tags << stylesheet_link_tag("solid_web_ui", "data-turbo-track": "reload")
|
|
16
|
+
end
|
|
17
|
+
Array(SolidWebUi.config.extra_stylesheets).each do |sheet|
|
|
18
|
+
tags << stylesheet_link_tag(sheet, "data-turbo-track": "reload")
|
|
19
|
+
end
|
|
20
|
+
tags << solid_web_ui_theme_style_tag
|
|
21
|
+
safe_join(tags)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def solid_web_ui_theme_style_tag
|
|
27
|
+
theme = SolidWebUi.config.theme
|
|
28
|
+
css = +".solid-web-ui { #{SolidWebUi::Theme.css_vars(theme)} }"
|
|
29
|
+
case SolidWebUi.config.color_scheme.to_s
|
|
30
|
+
when "dark"
|
|
31
|
+
css << " .solid-web-ui { #{SolidWebUi::Theme.dark_css_vars(theme)} }"
|
|
32
|
+
when "auto"
|
|
33
|
+
css << " @media (prefers-color-scheme: dark) { .solid-web-ui { #{SolidWebUi::Theme.dark_css_vars(theme)} } }"
|
|
34
|
+
end
|
|
35
|
+
content_tag(:style, css.html_safe) # rubocop:disable Rails/OutputSafety
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
data/lib/solid_web_ui/version.rb
CHANGED
data/lib/solid_web_ui.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: solid_web_ui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Anton Radushev
|
|
@@ -114,6 +114,7 @@ executables: []
|
|
|
114
114
|
extensions: []
|
|
115
115
|
extra_rdoc_files: []
|
|
116
116
|
files:
|
|
117
|
+
- LICENSE
|
|
117
118
|
- README.md
|
|
118
119
|
- app/assets/stylesheets/solid_web_ui.css
|
|
119
120
|
- app/components/solid_web_ui/ui/page_component.html.erb
|
|
@@ -163,6 +164,7 @@ files:
|
|
|
163
164
|
- lib/solid_web_ui/cache/routes.rb
|
|
164
165
|
- lib/solid_web_ui/configurable.rb
|
|
165
166
|
- lib/solid_web_ui/engine.rb
|
|
167
|
+
- lib/solid_web_ui/head_helper.rb
|
|
166
168
|
- lib/solid_web_ui/paginator.rb
|
|
167
169
|
- lib/solid_web_ui/queue.rb
|
|
168
170
|
- lib/solid_web_ui/queue/engine.rb
|