From 52b5bc672cb495fc5e5fbae159bf7c75ef694135 Mon Sep 17 00:00:00 2001 From: Aidan Cornelius-Bell Date: Sun, 15 Sep 2024 09:11:31 +0930 Subject: [PATCH] pages; error handling; links updated; logos more places --- .DS_Store | Bin 8196 -> 10244 bytes app/.DS_Store | Bin 6148 -> 6148 bytes app/assets/.DS_Store | Bin 6148 -> 6148 bytes .../images/{logo-192.png => icon-512.png} | Bin app/assets/images/missing.svg | 185 ++++++++++++++++++ app/assets/stylesheets/application.css | 10 +- app/controllers/pages_controller.rb | 59 ++++++ app/controllers/pubview_controller.rb | 21 +- app/helpers/pages_helper.rb | 2 + app/models/page.rb | 19 ++ app/views/devise/base_template.html.erb | 2 +- app/views/error/error.html.erb | 16 ++ app/views/layouts/application.html.erb | 18 +- app/views/pages/_form.html.erb | 48 +++++ app/views/pages/_page.html.erb | 22 +++ app/views/pages/edit.html.erb | 8 + app/views/pages/index.html.erb | 40 ++++ app/views/pages/new.html.erb | 8 + app/views/pages/show.html.erb | 13 ++ app/views/posts/_form.html.erb | 8 +- app/views/pubview/index.html.erb | 17 +- app/views/pubview/post.html.erb | 5 +- app/views/pubview/show_public.html.erb | 14 ++ config/application.rb | 5 - config/routes.rb | 2 + {app/controllers => db}/.DS_Store | Bin 6148 -> 6148 bytes db/migrate/20240914222256_create_pages.rb | 13 ++ ...07_rename_public_to_visibility_in_pages.rb | 6 + db/schema.rb | 13 +- {app/assets/images => lib}/.DS_Store | Bin lib/templates/erb/scaffold/_edit.html.erb.tt | 12 -- lib/templates/erb/scaffold/_form.html.erb.tt | 36 ---- lib/templates/erb/scaffold/_index.html.erb.tt | 41 ---- lib/templates/erb/scaffold/_new.html.erb.tt | 11 -- lib/templates/erb/scaffold/_show.html.erb.tt | 16 -- public/simplemde.min.css | 7 + public/simplemde.min.js | 15 ++ test/controllers/pages_controller_test.rb | 48 +++++ test/fixtures/pages.yml | 13 ++ test/models/{post_test.rb => page_test.rb} | 2 +- test/system/pages_test.rb | 47 +++++ 41 files changed, 660 insertions(+), 142 deletions(-) rename app/assets/images/{logo-192.png => icon-512.png} (100%) create mode 100644 app/assets/images/missing.svg create mode 100644 app/controllers/pages_controller.rb create mode 100644 app/helpers/pages_helper.rb create mode 100644 app/models/page.rb create mode 100644 app/views/error/error.html.erb create mode 100644 app/views/pages/_form.html.erb create mode 100644 app/views/pages/_page.html.erb create mode 100644 app/views/pages/edit.html.erb create mode 100644 app/views/pages/index.html.erb create mode 100644 app/views/pages/new.html.erb create mode 100644 app/views/pages/show.html.erb create mode 100644 app/views/pubview/show_public.html.erb copy {app/controllers => db}/.DS_Store (97%) create mode 100644 db/migrate/20240914222256_create_pages.rb create mode 100644 db/migrate/20240914223207_rename_public_to_visibility_in_pages.rb copy {app/assets/images => lib}/.DS_Store (100%) delete mode 100644 lib/templates/erb/scaffold/_edit.html.erb.tt delete mode 100644 lib/templates/erb/scaffold/_form.html.erb.tt delete mode 100644 lib/templates/erb/scaffold/_index.html.erb.tt delete mode 100644 lib/templates/erb/scaffold/_new.html.erb.tt delete mode 100644 lib/templates/erb/scaffold/_show.html.erb.tt create mode 100644 public/simplemde.min.css create mode 100644 public/simplemde.min.js create mode 100644 test/controllers/pages_controller_test.rb create mode 100644 test/fixtures/pages.yml copy test/models/{post_test.rb => page_test.rb} (65%) create mode 100644 test/system/pages_test.rb diff --git a/.DS_Store b/.DS_Store index 92ecf43fe5720d707c85feca2ddac237312cf676..0695b44182c33840f8d2c567c88b5f7e2104dcc3 100644 GIT binary patch literal 10244 zcmeHMTWl0n7(U;$v@>>~Qz%e|tt?bPv5}U0i^9?tEmACWTY5v5-JJm@OlOvz*)3Wd z8x!LNFVQFC?NuVtmoD{>;l|Y&S!-Gnw2B>qrqH z5FrpD5FrpD5Fzk?K!AR;d6KJyjJ^>95dskcR}kRmL!2^~iBL`m85|w-39bMn%Sjz1 zDr>wzG9JoAC?|xZ7D^DVB!w%&D+Yu+>EoeYB9s$C3U`L^@_}$l= zWb};?h!B{G0KdDJu{6uETxRs@`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F BQak_v delta 87 zcmZoMXfc=|#>B`mu~2NHo}wrR0|Nsi1A_nqLkUB1T1s(pQht8U#KPr_9Frd~$!wNj ne$TS`0rLmO&Fmcf96)WGFEW2;p3E;|3DOAC$+S5@WD7F@+7=co diff --git a/app/assets/.DS_Store b/app/assets/.DS_Store index 893ce86f37176531c698d5acc0dd0e12bc2c753c..648e73d5d549510412fad22f60482c6c1713abb0 100644 GIT binary patch delta 346 zcmZoMXfc=|#>B)qu~2NHo}wr-0|Nsi1A_nqLn=dYQh9MfQcix-#*NDv>p?PX44DkM z42cZs$g)839Z3Z_nZ+dr2G;i=7gSqCvcn{QR6G z7&|d3EHkw{UO>b-Kd&S)GcUCWtRXWc6{sX8JTosPzuYOmG%uwXsJ9+y6hwxTlY=u} zK%%U}m*0&Cd&(6us%kKg@4hR^5UIGJNC=H{! zfeaK+l?4~&<>cq31I0mlxEYEWN*F2`au_zw{KvAHor9kP7*-oMerKM{FQO{~G6tlq R0YZaq*&HIWfq7yB3jpyyRKEZK delta 86 zcmZoMXfc=|#>CJzu~2NHo}wrt0|NsP3otOGG88jp0LfH_l8J@tn}0L$ux>VBE@0Zs j&cV+C)Ua8R`8)Guei2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index f4e73da..9e8f4a2 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -260,11 +260,13 @@ footer p { .pagination { margin: 3em 0; + margin: 40px auto; + text-align: center; } -.pagination a { +.pagination a, .pagination .current, .pagination .gap { border: 1px solid var(--link-color); - padding: 2px 8px; + padding: 4px 8px; text-decoration: none; border-radius: 2px; } @@ -281,6 +283,10 @@ footer p { color: var(--link-color); } +.pagination .current, .pagination .gap { + margin-right: 1px; +} + ul li { list-style: none; margin-left: 2em; diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb new file mode 100644 index 0000000..73f7461 --- /dev/null +++ b/app/controllers/pages_controller.rb @@ -0,0 +1,59 @@ +class PagesController < ApplicationController + include AdminAuthenticatable + before_action :set_page, only: %i[ show edit update destroy ] + + # GET /pages + def index + @pages = Page.all + end + + # GET /pages/1 + def show + end + + # GET /pages/new + def new + @page = Page.new + end + + # GET /pages/1/edit + def edit + end + + # POST /pages + def create + @page = Page.new(page_params) + + if @page.save + redirect_to @page, notice: "Page was successfully created." + else + render :new, status: :unprocessable_entity + end + end + + # PATCH/PUT /pages/1 + def update + if @page.update(page_params) + redirect_to @page, notice: "Page was successfully updated.", status: :see_other + else + render :edit, status: :unprocessable_entity + end + end + + # DELETE /pages/1 + def destroy + @page.destroy! + redirect_to pages_url, notice: "Page was successfully destroyed.", status: :see_other + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_page + @page = Page.find(params[:id]) + end + + # Only allow a list of trusted parameters through. + def page_params + params.require(:page).permit(:title, :slug, :content, :visibility) + end +end diff --git a/app/controllers/pubview_controller.rb b/app/controllers/pubview_controller.rb index 269ca3d..2e84fbe 100644 --- a/app/controllers/pubview_controller.rb +++ b/app/controllers/pubview_controller.rb @@ -1,5 +1,7 @@ class PubviewController < ApplicationController def index + @pages = Page.where(visibility: :visible) + @per_page = 15 @page = params[:page].to_i || 1 @filter = params[:filter] || 'all' @@ -8,6 +10,22 @@ class PubviewController < ApplicationController @total_pages = @items.total_pages @current_page = @items.current_page end + + def show_public + if current_user&.admin? + @page = Page.find_by(slug: params[:slug], visibility: ['visible', 'user_only', 'admin_only']) + elsif current_user + @page = Page.find_by(slug: params[:slug], visibility: ['visible', 'user_only']) + else + @page = Page.find_by(slug: params[:slug], visibility: :visible) + end + if @page + render 'show_public' + else + @missing = "page" + render 'error/error', status: :not_found + end + end def post start_date = Date.new(params[:year].to_i, 1, 1) @@ -21,7 +39,8 @@ class PubviewController < ApplicationController @tags = @post.format_tags @rendered_content = @post.rendered_content else - render file: "#{Rails.root}/public/404.html", layout: false, status: :not_found + @missing = "post" + render 'error/error', status: :not_found, missing: 'post' end end diff --git a/app/helpers/pages_helper.rb b/app/helpers/pages_helper.rb new file mode 100644 index 0000000..2c057fd --- /dev/null +++ b/app/helpers/pages_helper.rb @@ -0,0 +1,2 @@ +module PagesHelper +end diff --git a/app/models/page.rb b/app/models/page.rb new file mode 100644 index 0000000..637c50e --- /dev/null +++ b/app/models/page.rb @@ -0,0 +1,19 @@ +class Page < ApplicationRecord + enum visibility: { + hidden: 0, + visible: 1, + user_only: 2, + admin_only: 3 + }, _default: :hidden + + validates :title, presence: true + validates :slug, presence: true, uniqueness: true, format: { with: /\A[a-z0-9]+(?:-[a-z0-9]+)*\z/, message: "can only contain lowercase letters, numbers, and hyphens" } + + before_validation :generate_slug, if: -> { slug.blank? && title.present? } + + private + + def generate_slug + self.slug = title.parameterize + end +end \ No newline at end of file diff --git a/app/views/devise/base_template.html.erb b/app/views/devise/base_template.html.erb index f26c9a3..318e63c 100644 --- a/app/views/devise/base_template.html.erb +++ b/app/views/devise/base_template.html.erb @@ -4,7 +4,7 @@ <%= yield(:form_content) %> diff --git a/app/views/error/error.html.erb b/app/views/error/error.html.erb new file mode 100644 index 0000000..040f76f --- /dev/null +++ b/app/views/error/error.html.erb @@ -0,0 +1,16 @@ +
+ <%= link_to root_path do %> + <%= image_tag "icon-512.png", class: "logo" %> + <% end %> +

Not found

+
+ +
+
+ <%= image_tag "missing.svg", class: "porter" %> +

Gone missing!

+

Terribly sorry, but the <%= @missing.present? ? @missing : "page" %> you have requested cannot be found (or, perhaps, may have lived up to its ephemeral status and vanished more recently).

+

If you desperately needed to have whatever this once was, <%= link_to "try logging in", new_user_session_path %>, or emailing me.

+

In the meanwhile, you can go back to the <%= link_to "home page", root_url %> to try some other content.

+
+
\ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 34210b6..b441a45 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -3,7 +3,7 @@ - <%= content_for?(:title) ? yield(:title) : "Aidan shares stuff" %> + <%= content_for?(:title) ? yield(:title) : "mind reader :: aidan's sharing project" %> <% if content_for?(:meta_description) %> @@ -18,14 +18,26 @@ <%= stylesheet_link_tag "application" %> - <%= auto_discovery_link_tag(:rss, rss_url, title: "Aidan has Ideas (Links+Posts)") %> + <%= auto_discovery_link_tag(:rss, rss_url, title: "mind reader (bookmarks and dispatch excerpts)") %> + <%= auto_discovery_link_tag(:rss, dispatches_rss_url, title: "mind reader (full dispatches)") %> + + <% if ['posts', 'pages'].include?(controller.controller_name) %> + + + <% end %> + <% if notice or alert %> +
+

Notice:

+

<%= notice or alert %>

+
+ <% end %> <%= yield %>
-

© <%= Time.current.year %> Aidan Cornelius-Bell, CC-NC-SA.

+

© <%= Time.current.year %> <%= link_to "Aidan Cornelius-Bell", "https://aidan.cornelius-bell.com" %>, CC-NC-SA. <% if current_user&.first_name? %>Welcome back, <%= link_to current_user.first_name, edit_user_registration_path %>. <% if current_user&.admin? %>You hold the keys to the kingdom.<% end %><% end %>

This site is managed from the sovereign Yarta of the Kaurna Miyurna, with respect and gratitude for the custodianship of Elders past and present of the many Countries it may appear upon.

For legal purposes: any views expressed directly on this website are my own and not reflective of those of any employers, colleagues or affiliates. Links provided remain the views and intellectual property of their respective owners.

diff --git a/app/views/pages/_form.html.erb b/app/views/pages/_form.html.erb new file mode 100644 index 0000000..7e50f8d --- /dev/null +++ b/app/views/pages/_form.html.erb @@ -0,0 +1,48 @@ +
+
+ <%= form_with(model: page) do |form| %> + <% if page.errors.any? %> +
+

<%= pluralize(page.errors.count, "error") %> prohibited this page from being saved:

+
    + <% page.errors.each do |error| %> +
  • <%= error.full_message %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= form.label :title, style: "display: block" %> + <%= form.text_field :title %> +
+ +
+ <%= form.label :slug, style: "display: block" %> + <%= form.text_field :slug %> +
+ +
+ <%= form.label :content, style: "display: block" %> + <%= form.text_area :content, class: 'markdown-editor' %> +
+ +
+ <%= form.label :visibility, style: "display: block" %> + <%= form.select :visibility, Page.visibilities.keys.map { |visibility| [visibility.titleize, visibility] } %> +
+ +
+ <%= form.submit %> +
+ <% end %> +
+
+ + \ No newline at end of file diff --git a/app/views/pages/_page.html.erb b/app/views/pages/_page.html.erb new file mode 100644 index 0000000..f666ff9 --- /dev/null +++ b/app/views/pages/_page.html.erb @@ -0,0 +1,22 @@ +
+

+ Title: + <%= page.title %> +

+ +

+ Slug: + <%= page.slug %> +

+ +

+ Content: + <%= page.content %> +

+ +

+ Visibility: + <%= page.visibility %> +

+ +
diff --git a/app/views/pages/edit.html.erb b/app/views/pages/edit.html.erb new file mode 100644 index 0000000..cae786a --- /dev/null +++ b/app/views/pages/edit.html.erb @@ -0,0 +1,8 @@ +
+ <% content_for :title, "Editing page" %> +

Editing page

+ <%= link_to "Show this page", @page, class: "button" %> + <%= link_to "Back to pages", pages_path, class: "button" %> +
+ +<%= render "form", page: @page %> diff --git a/app/views/pages/index.html.erb b/app/views/pages/index.html.erb new file mode 100644 index 0000000..0bd4b6b --- /dev/null +++ b/app/views/pages/index.html.erb @@ -0,0 +1,40 @@ +
+ <% content_for :title, "pages" %> +

Pages

+ <%= link_to "New page", new_page_path, class: "button" %> <%= link_to "Home", root_path, class: "button" %> +
+ +
+
+ + + + + + + + + + + <% @pages.each do |page| %> + + + + + + + <% end %> + +
TitleSlugCreatedActions
<%= page.title %><%= page.slug %><%= page.created_at.strftime("%Y-%m-%d %H:%M") %> + <%= link_to "View", page, class: "button small" %> + <%= link_to "Edit", edit_page_path(page), class: "button small" %> + <%= link_to "Delete", page, method: :delete, data: { confirm: "Are you sure you want to delete this page?" }, class: "button small danger" %> +
+
+
+ +<% if @pages.respond_to?(:total_pages) %> +
+ <%= paginate @pages %> +
+<% end %> \ No newline at end of file diff --git a/app/views/pages/new.html.erb b/app/views/pages/new.html.erb new file mode 100644 index 0000000..274e43b --- /dev/null +++ b/app/views/pages/new.html.erb @@ -0,0 +1,8 @@ +
+ <% content_for :title, "New page" %> +

New page

+ <%= link_to "Back to pages", pages_path, class: "button" %> +
+ +<%= render "form", page: @page %> + diff --git a/app/views/pages/show.html.erb b/app/views/pages/show.html.erb new file mode 100644 index 0000000..9d67ad1 --- /dev/null +++ b/app/views/pages/show.html.erb @@ -0,0 +1,13 @@ +
+ <% content_for :title, "Viewing page" %> +

Page details

+ <%= link_to "Edit this page", edit_page_path(@page), class: "button" %> + <%= link_to "Back to pages", pages_path, class: "button" %> + <%= button_to "Destroy this page", @page, method: :delete %> +
+ +
+
+ <%= render @page %> +
+
\ No newline at end of file diff --git a/app/views/posts/_form.html.erb b/app/views/posts/_form.html.erb index e9688af..dc31e1b 100644 --- a/app/views/posts/_form.html.erb +++ b/app/views/posts/_form.html.erb @@ -27,7 +27,7 @@
<%= form.label :content %> - <%= form.text_area :content, rows: 10 %> + <%= form.text_area :content, class: 'markdown-editor', rows: 10 %>
@@ -63,6 +63,12 @@ function toggleFields() { Array.from(dispatchFields).forEach(field => field.style.display = 'none'); Array.from(bookmarkFields).forEach(field => field.style.display = 'block'); } + + // Reinitialize SimpleMDE for newly displayed fields + var elements = document.querySelectorAll('.markdown-editor:not(.CodeMirror)') + elements.forEach(function(element) { + new SimpleMDE({ element: element }) + }) } function fetchTitle() { diff --git a/app/views/pubview/index.html.erb b/app/views/pubview/index.html.erb index f78ca14..aa7e646 100644 --- a/app/views/pubview/index.html.erb +++ b/app/views/pubview/index.html.erb @@ -1,12 +1,6 @@
-<% if notice or alert %> -
-

Notice:

-

<%= notice or alert %>

-
-<% end %> <%= link_to root_path do %> - <%= image_tag "logo-192.png", class: "logo" %> + <%= image_tag "icon-512.png", class: "logo" %> <% end %>

mind reader

Aidan’s anti-capitalist posting and sharing project

@@ -18,7 +12,12 @@ <%= link_to "Bookmarks", root_path(filter: 'bookmarks'), class: "button #{@filter == 'bookmarks' ? 'active' : ''}" %> <% if current_user&.admin? %> <%= link_to "Manage Posts", posts_path, class: "button" %> + <%= link_to "Manage Pages", pages_path, class: "button" %> <%= link_to "Manage API Keys", api_keys_path, class: "button" %> + <% else %> + <% @pages.each do |pg| %> + <%= link_to "#{pg.title}", public_page_path(pg.slug), class: "button" %> + <% end %> <% end %>
@@ -50,8 +49,8 @@
<%= paginate @items %>
\ No newline at end of file diff --git a/app/views/pubview/post.html.erb b/app/views/pubview/post.html.erb index d5d8cee..0751655 100644 --- a/app/views/pubview/post.html.erb +++ b/app/views/pubview/post.html.erb @@ -1,7 +1,10 @@
<%= link_to root_path do %> - <%= image_tag "logo-192.png", class: "logo" %> + <%= image_tag "icon-512.png", class: "logo" %> <% end %> + <% content_for :title, @post.title %> + <% content_for :meta_description, "#{@post.generate_excerpt(150)}." %> + <% content_for :meta_keywords, "#{@post.tags}" %>

<%= @post.title %>

<%= link_to "↼ Back to some other ideas...", root_path %>