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: 20dcd88a9a3339db1695fdf1d3c7597e60c3706f7686a3ca1bf9efeb130e0529
4
- data.tar.gz: ac4ebbcec505d877acaaaeef407246ef202f1e09884b9d6e7479d09a49faf977
3
+ metadata.gz: 8a26feddb5cd80b4e5a676159463899d2aa3f8956e0a9e3a2a7cfdc2a9645a61
4
+ data.tar.gz: 118357d59feb0e62eeb1aa9c04a327fc59ee13683e7878023990ec0388542939
5
5
  SHA512:
6
- metadata.gz: 1b7d8e2f3f4be7fbda39dac9e52b9b36824c1b8c5f2906e6502023fe10f6cab2ce5d6da1b355e08ca9abc8b144eb0b6cac580ac5d5c19cc699b3e6f6dd9ff0b0
7
- data.tar.gz: d50999cf89f1fb712ebeb7c1891dcf00edce95dfab8422115625198568444e3c7e2060a55a474594ec880e5913e6754ced5ea231b7592e5ab27f1340967d42d6
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")
@@ -2,6 +2,6 @@
2
2
 
3
3
  module KeystoneUi
4
4
  module Pages
5
- VERSION = "0.4.1"
5
+ VERSION = "0.5.0"
6
6
  end
7
7
  end
@@ -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 in every host
115
- view, that draws the page's live version with the values given, inside a
116
- `<div class="@container">`. It returns nil when the page has never been
117
- published. `values:` takes value names to values, with string or symbol keys.
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.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keystone_ui-pages
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Schneider