keystone_ui-app 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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 67c87934361d6537cdce1f3d4f5e396bc145f4c92323d0502cc3f3196ba0f971
|
|
4
|
+
data.tar.gz: 24130a558aad621ccaa91a12932c88a7e3c727a88628e88ffa20d293caa2db21
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 858c67fc899028021b28e7e37cd2ec61cc03fa8181c6fa10d8610307d11891e5917a400045a4a36b7cba81620b118376449782e5bde30cebc9752ad22d623daa
|
|
7
|
+
data.tar.gz: 46274d47c64621263d8171a04fa376896fd6daeadd87324e65b4ce8ce4ccf89e97ec7ac54fda92d046af8b12beb2d8d648761f43c02768984d30e9704ebf1b54
|
data/README.md
CHANGED
|
@@ -16,11 +16,12 @@ The gem requires keystone_ui-styles 0.30.0 or later, which defines the `hotwire-
|
|
|
16
16
|
Replace the layout with one call to `ui_app_shell`, filling its slots and putting the page inside it:
|
|
17
17
|
|
|
18
18
|
```erb
|
|
19
|
-
<%= ui_app_shell do |shell| %>
|
|
19
|
+
<%= ui_app_shell(body: { data: { controller: "trail", trail_url_value: request.fullpath } }) do |shell| %>
|
|
20
20
|
<% shell.with_head do %><%= render "head" %><% end %>
|
|
21
21
|
<% shell.with_flash do %><%= render "flash" %><% end %>
|
|
22
22
|
<% shell.with_logo do %><%= link_to "Shop", root_path %><% end %>
|
|
23
23
|
<% shell.with_menus do %><%= render "user_menu" %><% end %>
|
|
24
|
+
<% shell.with_phone_menus do %><%= render "phone_navbar" %><% end %>
|
|
24
25
|
<% shell.with_footer do %><%= render "footer" %><% end %>
|
|
25
26
|
<%= yield %>
|
|
26
27
|
<% end %>
|
|
@@ -33,16 +34,21 @@ import { registerControllers as registerKeystoneUiAppControllers } from "keyston
|
|
|
33
34
|
registerKeystoneUiAppControllers(application)
|
|
34
35
|
```
|
|
35
36
|
|
|
37
|
+
`body:` takes the attributes for the page's `body` element, in the form `tag.body` takes them, such as the `data` attributes of the Stimulus controllers that read their settings from the body. It is optional.
|
|
38
|
+
|
|
36
39
|
Every slot is optional. The shell writes the `<!DOCTYPE html>`, the `html`, `head` and `body` elements and the viewport meta tag, so the app's head leaves out its own viewport tag.
|
|
37
40
|
|
|
38
41
|
## What it draws
|
|
39
42
|
|
|
40
43
|
- The `html` element carries keystone_ui's theme attributes and the current locale.
|
|
44
|
+
- The `html` element carries the `dark` class when the theme mode keystone_ui chooses for the person is dark, and leaves it off for any other mode.
|
|
45
|
+
- The `body` element carries the attributes the layout passes as `body:`.
|
|
41
46
|
- On a desktop browser, keystone_ui's navigation bar with the logo and the menus.
|
|
47
|
+
- On a phone browser, the phone menus at the top of the header on every page, including form and show pages, inside an element hidden from the `lg` breakpoint up.
|
|
42
48
|
- On a phone browser, keystone_ui's phone header for a page drawn with `ui_form_page` or `ui_show_page`, with its back link, title and subtitle.
|
|
43
49
|
- On a phone browser, a page that is not a form or show page shows a menu of the current section's tabs, with the tab the page belongs to marked as active. The section is the navigation group holding the tab keystone_ui's current tab supplier names, and the menu leaves out tabs the person is not permitted to see. A page in no section shows no menu.
|
|
44
50
|
- Inside the native app, the `menu-button` bridge component sends the section's label and tabs to the native menu button, and choosing a tab opens its page in place of the current one. A page in no section sends an empty list.
|
|
45
|
-
- Inside the native app, no navigation bar, no phone header and no footer, the `hotwire-native` class on the `html` element, and a viewport that cannot be pinch-zoomed.
|
|
51
|
+
- Inside the native app, no navigation bar, no phone menus, no phone header and no footer, the `hotwire-native` class on the `html` element, and a viewport that cannot be pinch-zoomed.
|
|
46
52
|
- In a browser, the footer, unless the page calls `content_for :hide_footer, true`.
|
|
47
53
|
|
|
48
54
|
## Licence
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
|
-
<html <%= helpers.keystone_theme_attributes %> class="<%= class_names("hotwire-native": native_app?) %>" lang="<%= I18n.locale %>">
|
|
2
|
+
<html <%= helpers.keystone_theme_attributes %> class="<%= class_names(dark: dark_mode?, "hotwire-native": native_app?) %>" lang="<%= I18n.locale %>">
|
|
3
3
|
<head>
|
|
4
4
|
<%= tag.meta name: "viewport", content: viewport %>
|
|
5
5
|
<%= head %>
|
|
6
6
|
</head>
|
|
7
|
-
|
|
7
|
+
<%= tag.body(**body) do %>
|
|
8
8
|
<header>
|
|
9
9
|
<%= flash %>
|
|
10
|
+
<%= tag.div(phone_menus, class: PHONE_ONLY) if phone_menus? && !native_app? %>
|
|
10
11
|
<% if phone_header_shown? %>
|
|
11
12
|
<%= helpers.ui_mobile_header(title: page_signalled(:title), back_url: page_signalled(:back_url), subtitle: page_signalled(:subtitle)) %>
|
|
12
13
|
<% elsif !native_app? %>
|
|
@@ -25,5 +26,5 @@
|
|
|
25
26
|
<% end %>
|
|
26
27
|
<% end %>
|
|
27
28
|
<%= footer if footer_shown? %>
|
|
28
|
-
|
|
29
|
+
<% end %>
|
|
29
30
|
</html>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "keystone_ui/theme_choice"
|
|
4
|
+
|
|
3
5
|
module KeystoneUi
|
|
4
6
|
module App
|
|
5
7
|
class ShellComponent < ViewComponent::Base
|
|
@@ -7,18 +9,34 @@ module KeystoneUi
|
|
|
7
9
|
renders_one :flash
|
|
8
10
|
renders_one :logo
|
|
9
11
|
renders_one :menus
|
|
12
|
+
renders_one :phone_menus
|
|
10
13
|
renders_one :footer
|
|
11
14
|
|
|
15
|
+
PHONE_ONLY = "lg:hidden"
|
|
12
16
|
PAGE_SIGNALS = %i[show_page form_page].freeze
|
|
13
17
|
VIEWPORT = "width=device-width, initial-scale=1"
|
|
14
18
|
NATIVE_APP_VIEWPORT = "#{VIEWPORT}, maximum-scale=1.0, user-scalable=0"
|
|
15
19
|
|
|
20
|
+
attr_reader :body
|
|
21
|
+
|
|
22
|
+
def initialize(body: {})
|
|
23
|
+
@body = body
|
|
24
|
+
end
|
|
25
|
+
|
|
16
26
|
def native_app?
|
|
17
27
|
return @native_app if defined?(@native_app)
|
|
18
28
|
|
|
19
29
|
@native_app = helpers.hotwire_native_app?
|
|
20
30
|
end
|
|
21
31
|
|
|
32
|
+
def dark_mode?
|
|
33
|
+
theme_choice.mode == "dark"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def theme_choice
|
|
37
|
+
KeystoneUi::ThemeChoice.new(helpers.cookies[KeystoneUi::ThemeChoice::COOKIE], supplied: KeystoneUi.configuration.supplied_theme_mode(helpers))
|
|
38
|
+
end
|
|
39
|
+
|
|
22
40
|
def viewport
|
|
23
41
|
native_app? ? NATIVE_APP_VIEWPORT : VIEWPORT
|
|
24
42
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: keystone_ui-app
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tyler Schneider
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: keystone_ui
|
|
@@ -101,7 +100,6 @@ metadata:
|
|
|
101
100
|
bug_tracker_uri: https://github.com/DYB-Development/keystone_ui-app/issues
|
|
102
101
|
documentation_uri: https://github.com/DYB-Development/keystone_ui-app#readme
|
|
103
102
|
rubygems_mfa_required: 'true'
|
|
104
|
-
post_install_message:
|
|
105
103
|
rdoc_options: []
|
|
106
104
|
require_paths:
|
|
107
105
|
- lib
|
|
@@ -116,8 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
116
114
|
- !ruby/object:Gem::Version
|
|
117
115
|
version: '0'
|
|
118
116
|
requirements: []
|
|
119
|
-
rubygems_version:
|
|
120
|
-
signing_key:
|
|
117
|
+
rubygems_version: 4.0.20
|
|
121
118
|
specification_version: 4
|
|
122
119
|
summary: The page frame for a Rails app built on Keystone UI.
|
|
123
120
|
test_files: []
|