From: Aidan Cornelius-Bell Date: Mon, 23 Sep 2024 02:28:31 +0000 (+0930) Subject: limit and order pages in header; header consistent on pages X-Git-Url: https://gitweb.mndrdr.org/?a=commitdiff_plain;h=11a1802d150bb8d6477ab18fb3d6edda69647b7b;p=arelpe.git limit and order pages in header; header consistent on pages --- diff --git a/app/controllers/pubview_controller.rb b/app/controllers/pubview_controller.rb index 2e84fbe..be512d5 100644 --- a/app/controllers/pubview_controller.rb +++ b/app/controllers/pubview_controller.rb @@ -1,6 +1,6 @@ class PubviewController < ApplicationController def index - @pages = Page.where(visibility: :visible) + @pages = Page.where(visibility: :visible).order(created_at: :asc).limit(2) @per_page = 15 @page = params[:page].to_i || 1 @@ -12,6 +12,8 @@ class PubviewController < ApplicationController end def show_public + @pages = Page.where(visibility: :visible).order(created_at: :asc).limit(2) + if current_user&.admin? @page = Page.find_by(slug: params[:slug], visibility: ['visible', 'user_only', 'admin_only']) elsif current_user diff --git a/app/views/pubview/show_public.html.erb b/app/views/pubview/show_public.html.erb index 68de395..39493fc 100644 --- a/app/views/pubview/show_public.html.erb +++ b/app/views/pubview/show_public.html.erb @@ -2,9 +2,18 @@ <%= link_to root_path do %> <%= image_tag "icon-512.png", class: "logo" %> <% end %> - <% content_for :title, @page.title %> -

<%= @page.title %>

- <%= link_to "↼ Back home...", root_path %> + <% content_for :title, "#{@page.title} :: mind reader" %> +

<%= @page.title.downcase %>

+

Aidan’s anti-capitalist posting and sharing project

+ + +
+ <%= link_to "Home", root_path(filter: 'all'), class: "button #{@filter == 'all' ? 'active' : ''}" %> + <%= link_to "Dispatches", root_path(filter: 'posts'), class: "button #{@filter == 'posts' ? 'active' : ''}" %> + <%= link_to "Bookmarks", root_path(filter: 'bookmarks'), class: "button #{@filter == 'bookmarks' ? 'active' : ''}" %> + <% @pages.each do |pg| %> + <%= link_to "#{pg.title}", public_page_path(pg.slug), class: "button #{params[:slug] == pg.slug ? 'active' : ''}" %> + <% end %>