keystone_ui-pages 0.2.0 → 0.3.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/pages_controller.rb +11 -0
- data/app/models/keystone_ui/pages/page.rb +1 -0
- data/app/views/keystone_ui/pages/manage/pages/edit.html.erb +22 -0
- data/app/views/keystone_ui/pages/manage/pages/index.html.erb +1 -0
- data/config/routes.rb +1 -1
- data/lib/keystone_ui/pages/version.rb +1 -1
- data/the_local/agents/keystone_ui-pages-develop.md +9 -4
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 72deae8926c2af3bcd7b85fe5d09744cfb486f2ba3702d6a05133d6f81eded88
|
|
4
|
+
data.tar.gz: a0150d0d30a3ee59f591dfa368a54ffc69c9f19ce341df1d1a7dfbc08de6a921
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a70364b0416360be80d7a291a20baedd2542fa3fb395cd7290a572058ce5f5b2fec332268e7935f02006b55b5d4d90951b72826f4602f2b906b6b497948a7787
|
|
7
|
+
data.tar.gz: 8fa30dbffcd2714ebc9486cf43e65260591edd4175e11f1ea52475ee40e94d9bf1bf17900d493204003a897f6023b37774a8425762cdb80ce3f04503abd8cd03
|
|
@@ -25,6 +25,17 @@ module KeystoneUi
|
|
|
25
25
|
(session[:keystone_ui_pages_return_to] ||= {})[@page.id.to_s] = params[:return_to] if local_address?(params[:return_to])
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
+
def edit
|
|
29
|
+
@page = owned_pages.find(params[:id])
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def update
|
|
33
|
+
@page = owned_pages.find(params[:id])
|
|
34
|
+
return render(:edit, status: :unprocessable_entity) unless @page.update(params.require(:page).permit(:name, :slug, :place))
|
|
35
|
+
|
|
36
|
+
redirect_to manage_pages_path
|
|
37
|
+
end
|
|
38
|
+
|
|
28
39
|
def publish
|
|
29
40
|
page = owned_pages.find(params[:id])
|
|
30
41
|
page.publish
|
|
@@ -18,6 +18,7 @@ module KeystoneUi
|
|
|
18
18
|
scope :current, -> { where(archived_at: nil) }
|
|
19
19
|
|
|
20
20
|
validates :name, :slug, presence: true
|
|
21
|
+
validates :slug, uniqueness: { scope: %i[owner_type owner_id] }
|
|
21
22
|
validates :place, inclusion: { in: -> { KeystoneUi::Pages.places.keys } }, allow_nil: true, if: -> { KeystoneUi::Pages.places.any? }
|
|
22
23
|
validates :access_exception, inclusion: { in: -> { KeystoneUi::Pages.access_exceptions.keys } }, allow_nil: true, if: -> { KeystoneUi::Pages.access_exceptions.any? }
|
|
23
24
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<%= ui_page(max_width: :xl) do %>
|
|
2
|
+
<%= ui_page_header(title: "Settings") %>
|
|
3
|
+
|
|
4
|
+
<% if @page.errors.any? %>
|
|
5
|
+
<%= ui_alert(message: @page.errors.full_messages.to_sentence, type: :error) %>
|
|
6
|
+
<% end %>
|
|
7
|
+
|
|
8
|
+
<%= ui_form(action: manage_page_path(@page), method: :patch) do %>
|
|
9
|
+
<label class="ks-label mb-1">Name</label>
|
|
10
|
+
<%= ui_input(name: "page[name]", value: @page.name) %>
|
|
11
|
+
|
|
12
|
+
<label class="ks-label mb-1">Address</label>
|
|
13
|
+
<%= ui_input(name: "page[slug]", value: @page.slug) %>
|
|
14
|
+
|
|
15
|
+
<% if KeystoneUi::Pages.places.any? %>
|
|
16
|
+
<label class="ks-label mb-1">Place</label>
|
|
17
|
+
<%= ui_select(name: "page[place]", options: KeystoneUi::Pages.places.invert.to_a, selected: @page.place) %>
|
|
18
|
+
<% end %>
|
|
19
|
+
|
|
20
|
+
<%= ui_button(label: "Save", type: :submit) %>
|
|
21
|
+
<% end %>
|
|
22
|
+
<% end %>
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
<% end %>
|
|
39
39
|
<td class="ks-table-cell-middle text-sm whitespace-nowrap text-right">
|
|
40
40
|
<%= link_to "Edit", manage_page_path(page) %>
|
|
41
|
+
<%= link_to "Settings", edit_manage_page_path(page), class: "ml-4" %>
|
|
41
42
|
<% if live %>
|
|
42
43
|
<%= link_to "View live", manage_page_live_path(page), class: "ml-4" %>
|
|
43
44
|
<% if @printable %>
|
data/config/routes.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
KeystoneUi::Pages::Engine.routes.draw do
|
|
4
4
|
namespace :manage do
|
|
5
|
-
resources :pages, only: %i[index new create show] do
|
|
5
|
+
resources :pages, only: %i[index new create show edit update] do
|
|
6
6
|
post :publish, on: :member
|
|
7
7
|
post :unpublish, on: :member
|
|
8
8
|
post :archive, on: :member
|
|
@@ -274,10 +274,15 @@ The catalog offers these Keystone UI components by default: `button`,
|
|
|
274
274
|
turns symbol keys into strings, so either works, but the names must match.
|
|
275
275
|
- **The editor's page list** at `/pages/manage/pages` shows each page's name,
|
|
276
276
|
its state, and when it was last published, plus its place and access
|
|
277
|
-
exception when the host names any. Each row links to Edit and
|
|
278
|
-
button, and a published page also links to View live and, when
|
|
279
|
-
Chromium is found, to its PDF. Show archived lists archived pages
|
|
280
|
-
each with a Restore button.
|
|
277
|
+
exception when the host names any. Each row links to Edit and Settings and has
|
|
278
|
+
an Archive button, and a published page also links to View live and, when
|
|
279
|
+
Chrome or Chromium is found, to its PDF. Show archived lists archived pages
|
|
280
|
+
instead, each with a Restore button.
|
|
281
|
+
- **A page's settings** at `/pages/manage/pages/:id/edit` change its name, slug
|
|
282
|
+
and place after it is created. A slug another page of the same owner uses, or
|
|
283
|
+
a place the host does not name, is refused with a message and changes nothing.
|
|
284
|
+
A changed slug moves the published page to its new address, and the old
|
|
285
|
+
address is not redirected.
|
|
281
286
|
- **A page's state** is Draft before its first publish, Published while it has
|
|
282
287
|
a live version, Unpublished once that version is taken down, and Archived.
|
|
283
288
|
The builder's Unpublish button, shown next to Publish on a published page,
|
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
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tyler Schneider
|
|
@@ -115,6 +115,7 @@ files:
|
|
|
115
115
|
- app/models/keystone_ui/pages/page.rb
|
|
116
116
|
- app/models/keystone_ui/pages/pdf.rb
|
|
117
117
|
- app/models/keystone_ui/pages/version.rb
|
|
118
|
+
- app/views/keystone_ui/pages/manage/pages/edit.html.erb
|
|
118
119
|
- app/views/keystone_ui/pages/manage/pages/index.html.erb
|
|
119
120
|
- app/views/keystone_ui/pages/manage/pages/new.html.erb
|
|
120
121
|
- app/views/keystone_ui/pages/manage/pages/show.html.erb
|