keystone_ui-pages 0.12.0 → 0.13.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/app/controllers/keystone_ui/pages/manage/sequence_pages_controller.rb +11 -1
- data/app/views/keystone_ui/pages/manage/sequence_pages/new.html.erb +3 -0
- data/lib/keystone_ui/pages/version.rb +1 -1
- data/the_local/agents/keystone_ui-pages-develop.md +6 -2
- data/the_local/agents/keystone_ui-pages-info.md +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c7e660c90fb7940307bee416e82c4a265af0a39d61c976ca4ac79d451e582100
|
|
4
|
+
data.tar.gz: 924ea703420c95dabe0fcad9baed0303ee92236532a8f94730a1672dea7ac268
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d6423a67ac8e4c6dcca9f545be0595554ba542ecea798b482ccfe5b3ec04b680dff80884ea08d499264b78200300b661f4c2dd8039af98c8e0e9264d831d144f
|
|
7
|
+
data.tar.gz: 25c849878d32e676cffc59b712fe36a4b3104c22558ba2512eb921d628dad1f339feb069e098e72027e02c27ea28f79b100b127a8643beb3c43608f3bd8444cc
|
|
@@ -9,11 +9,12 @@ module KeystoneUi
|
|
|
9
9
|
|
|
10
10
|
def new
|
|
11
11
|
@default_name = Page.new(place: params[:place], owner: page_owner).default_name
|
|
12
|
+
@copyable_pages = copyable_pages
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
def create
|
|
15
16
|
open_page = @sequence.pages.find { |page| page.id.to_s == params[:after_id].to_s }
|
|
16
|
-
page = Page.create!(params.require(:page).permit(:name).merge(place: params[:place], sequence_key: params[:key], owner: page_owner))
|
|
17
|
+
page = Page.create!(params.require(:page).permit(:name).merge(place: params[:place], sequence_key: params[:key], owner: page_owner, **copied_document))
|
|
17
18
|
send(KeystoneUi::Pages.place_settings.dig(params[:place], :adds_page_method), params[:key], page, open_page)
|
|
18
19
|
redirect_to manage_sequence_path(params[:place], params[:key], page_id: page.id)
|
|
19
20
|
end
|
|
@@ -42,6 +43,15 @@ module KeystoneUi
|
|
|
42
43
|
refuse unless removes_page_method && @page
|
|
43
44
|
end
|
|
44
45
|
|
|
46
|
+
def copyable_pages
|
|
47
|
+
owned_pages.current.where(place: params[:place])
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def copied_document
|
|
51
|
+
source = copyable_pages.find_by(id: params[:copy_of_id]) if params[:copy_of_id].present?
|
|
52
|
+
source ? { document: source.document } : {}
|
|
53
|
+
end
|
|
54
|
+
|
|
45
55
|
def removes_page_method
|
|
46
56
|
KeystoneUi::Pages.place_settings.dig(params[:place], :removes_page_method)
|
|
47
57
|
end
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
<label class="ks-label mb-1">Name</label>
|
|
8
8
|
<%= ui_input(name: "page[name]", placeholder: @default_name) %>
|
|
9
9
|
|
|
10
|
+
<label class="ks-label mb-1">Start from</label>
|
|
11
|
+
<%= ui_select(name: "copy_of_id", options: [ [ "Blank page", "" ] ] + @copyable_pages.map { |page| [ page.name, page.id ] }) %>
|
|
12
|
+
|
|
10
13
|
<%= ui_button(label: "Create", type: :submit) %>
|
|
11
14
|
<% end %>
|
|
12
15
|
<% end %>
|
|
@@ -269,8 +269,12 @@ inherit from the base controller, so define it there.
|
|
|
269
269
|
list has an Add page button, shown with or without pages in the sequence.
|
|
270
270
|
- `/manage/sequences/:place/:key/pages/new` under the engine's mount path — the
|
|
271
271
|
Add page form, or `keystone_ui_pages.new_manage_sequence_page_path("funnel", "abc123")`
|
|
272
|
-
from the host. It runs behind the edit check and asks
|
|
273
|
-
the place's next default name, such as "Step 3", as its placeholder
|
|
272
|
+
from the host. It runs behind the edit check and asks for a name, with
|
|
273
|
+
the place's next default name, such as "Step 3", as its placeholder, and for
|
|
274
|
+
Start from: Blank page, or a copy of any page in the same place that
|
|
275
|
+
`owner_method`'s record owns and that is not archived, including pages of
|
|
276
|
+
other sequences. A copy takes that page's document and nothing else, starts
|
|
277
|
+
as a draft, and changes apart from it afterwards. Creating
|
|
274
278
|
makes a page with the name given, or the default name when it is left blank,
|
|
275
279
|
in the sequence's place, with the sequence's key, owned by `owner_method`'s
|
|
276
280
|
record, and with a random slug. The engine then calls the place's
|
|
@@ -80,7 +80,8 @@ Keystone UI itself must be installed first. Its own install local,
|
|
|
80
80
|
key, which cannot be changed later.
|
|
81
81
|
- **Adding a page to a sequence.** The sequence screen has an Add page button
|
|
82
82
|
that asks for a name, with the place's default name used when it is left
|
|
83
|
-
blank
|
|
83
|
+
blank, and whether to start blank or as a copy of another page in the same
|
|
84
|
+
place. The gem makes the page and tells the host which sequence it joins and
|
|
84
85
|
which page was open, so the host decides where it goes in the order. The new
|
|
85
86
|
page then opens in the builder beside the list. A place that answers
|
|
86
87
|
sequences must also handle pages added this way.
|