diff --git a/README.md b/README.md
index 848b893c..20417456 100644
--- a/README.md
+++ b/README.md
@@ -6,6 +6,12 @@ Writebook is an easy-to-use application for publishing content on the web.
Content is authored in Markdown, and books can contain picture pages, chapters, and title pages.
Books can be published privately or publicly, and are searchable.
+## Creating book pages
+
+Editors create pages, picture pages, and sections from the controls in the book.
+The controls create a page and show an inline editor. Existing pages retain autosave and Markdown image uploads.
+Separate creation forms are not supported. The `/books/:book_id/pages/new`, `/books/:book_id/pictures/new`, and `/books/:book_id/sections/new` URLs return HTTP 404.
+
## How to get Writebook
Writebook is distributed as a Docker image.
diff --git a/app/controllers/leafables_controller.rb b/app/controllers/leafables_controller.rb
index c1aa3915..73b1a1a8 100644
--- a/app/controllers/leafables_controller.rb
+++ b/app/controllers/leafables_controller.rb
@@ -6,10 +6,6 @@ class LeafablesController < ApplicationController
before_action :ensure_editable, except: :show
before_action :broadcast_being_edited_indicator, only: :update
- def new
- @leafable = new_leafable
- end
-
def create
@leaf = @book.press new_leafable, leaf_params
position_new_leaf @leaf
diff --git a/app/views/pages/new.html.erb b/app/views/pages/new.html.erb
deleted file mode 100644
index 0973a0b4..00000000
--- a/app/views/pages/new.html.erb
+++ /dev/null
@@ -1,19 +0,0 @@
-<% content_for(:title) { "New page" } %>
-
-<% content_for :header do %>
-
-<% end %>
-
-
- <%= render "pages/form", book: @book, page: @page %>
-
diff --git a/app/views/pictures/new.html.erb b/app/views/pictures/new.html.erb
deleted file mode 100644
index e4fdd2a3..00000000
--- a/app/views/pictures/new.html.erb
+++ /dev/null
@@ -1,19 +0,0 @@
-<% content_for(:title) { "New image page" } %>
-
-<% content_for :header do %>
-
-<% end %>
-
-
diff --git a/config/routes.rb b/config/routes.rb
index 6a759da6..fc5b4177 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -31,9 +31,9 @@
resource :search
end
- resources :sections
- resources :pictures
- resources :pages
+ resources :sections, except: :new
+ resources :pictures, except: :new
+ resources :pages, except: :new
end
get "/:id/:slug", to: "books#show", constraints: { id: /\d+/ }, as: :slugged_book
diff --git a/test/controllers/pages_controller_test.rb b/test/controllers/pages_controller_test.rb
index 0b0ccec8..9f5ec7a8 100644
--- a/test/controllers/pages_controller_test.rb
+++ b/test/controllers/pages_controller_test.rb
@@ -5,6 +5,12 @@ class PagesControllerTest < ActionDispatch::IntegrationTest
sign_in :kevin
end
+ test "new is not available" do
+ get "#{book_pages_path(books(:handbook))}/new"
+
+ assert_response :not_found
+ end
+
test "show" do
get leafable_path(sample_page_leaf("## Hello"))
diff --git a/test/controllers/pictures_controller_test.rb b/test/controllers/pictures_controller_test.rb
index 1c439a49..37218445 100644
--- a/test/controllers/pictures_controller_test.rb
+++ b/test/controllers/pictures_controller_test.rb
@@ -5,6 +5,24 @@ class PicturesControllerTest < ActionDispatch::IntegrationTest
sign_in :kevin
end
+ test "new is not available" do
+ get "#{book_pictures_path(books(:handbook))}/new"
+
+ assert_response :not_found
+ end
+
+ test "create from the book controls" do
+ assert_difference [ "Picture.count", "Leaf.count" ], 1 do
+ post book_pictures_path(books(:handbook), format: :turbo_stream), params: {
+ picture: { caption: "A new picture." }
+ }
+ end
+
+ assert_response :success
+ assert_equal "A new picture.", Picture.last.caption
+ assert_equal books(:handbook), Picture.last.leaf.book
+ end
+
test "update picture" do
get edit_leafable_path(leaves(:reading_picture))
assert_response :ok
diff --git a/test/controllers/sections_controller_test.rb b/test/controllers/sections_controller_test.rb
index 70c64dad..4c0a27c0 100644
--- a/test/controllers/sections_controller_test.rb
+++ b/test/controllers/sections_controller_test.rb
@@ -5,6 +5,12 @@ class SectionsControllerTest < ActionDispatch::IntegrationTest
sign_in :kevin
end
+ test "new is not available" do
+ get "#{book_sections_path(books(:handbook))}/new"
+
+ assert_response :not_found
+ end
+
test "create" do
post book_sections_path(books(:handbook), format: :turbo_stream)
assert_response :success