keystone_ui-pages 0.4.1 → 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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8a26feddb5cd80b4e5a676159463899d2aa3f8956e0a9e3a2a7cfdc2a9645a61
|
|
4
|
+
data.tar.gz: 118357d59feb0e62eeb1aa9c04a327fc59ee13683e7878023990ec0388542939
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9aee570200cb37d2bf6be9c90dec6202087b85c4cefe4a448607df0b26f274f162f5c73a85a456659404b4508541d6e6fe53da3c227877bcde74acaaa75baafe
|
|
7
|
+
data.tar.gz: b1413f0fc7236cbfcc7769ba870726b4e79addd6d786705e1eaf5b10e6feb6f602d05a4ad5b68238b0bf67ac2a3aee9a83b24b260fa7a213d41569f3d767bc17
|
|
@@ -6,8 +6,8 @@ module KeystoneUi
|
|
|
6
6
|
include KeystoneUiHelper
|
|
7
7
|
include DrawingHelper
|
|
8
8
|
|
|
9
|
-
def keystone_ui_page(page, values: {})
|
|
10
|
-
version = page.live_version
|
|
9
|
+
def keystone_ui_page(page, values: {}, version: nil)
|
|
10
|
+
version = version ? page.versions.find_by(number: version) : page.live_version
|
|
11
11
|
return if version.nil?
|
|
12
12
|
|
|
13
13
|
tag.div(drawn_version(version, values: values), class: "@container")
|
|
@@ -111,10 +111,15 @@ inherit from the base controller, so define it there.
|
|
|
111
111
|
|
|
112
112
|
### Drawing and printing
|
|
113
113
|
|
|
114
|
-
- `keystone_ui_page(page, values: {})` — a view helper, available
|
|
115
|
-
view, that draws the page's live version with the values given,
|
|
116
|
-
`<div class="@container">`. It returns nil when
|
|
117
|
-
|
|
114
|
+
- `keystone_ui_page(page, values: {}, version: nil)` — a view helper, available
|
|
115
|
+
in every host view, that draws the page's live version with the values given,
|
|
116
|
+
inside a `<div class="@container">`. It returns nil when no version is live.
|
|
117
|
+
`values:` takes value names to values, with string or symbol keys.
|
|
118
|
+
`version:` takes a published version's number and draws that version
|
|
119
|
+
instead, whether it is live or superseded and whether the page is
|
|
120
|
+
unpublished or archived. It returns nil when the page has no version with
|
|
121
|
+
that number. A record made from a page keeps the number it was made with
|
|
122
|
+
and passes it here, so it keeps drawing the same way after later publishes.
|
|
118
123
|
- `KeystoneUi::Pages.pdf(page, values: {})` — returns a
|
|
119
124
|
`KeystoneUi::Pages::Pdf` record for the page's live version drawn with the
|
|
120
125
|
values given. Its `file` is an Active Storage attachment, ready to download,
|
|
@@ -271,7 +276,8 @@ The catalog offers these Keystone UI components by default: `button`,
|
|
|
271
276
|
layout and print rules together.
|
|
272
277
|
- **Only the live version leaves the builder.** The draft is what editors
|
|
273
278
|
change. Visitors, `keystone_ui_page` and PDFs show the live version, so an
|
|
274
|
-
unpublished change shows nowhere else.
|
|
279
|
+
unpublished change shows nowhere else. `keystone_ui_page` with `version:`
|
|
280
|
+
shows an earlier published version, never the draft.
|
|
275
281
|
- **Value names are strings.** `Values.names`, the provider's hash and the
|
|
276
282
|
`values:` passed to the helper and to PDFs all use the same names. The gem
|
|
277
283
|
turns symbol keys into strings, so either works, but the names must match.
|