]> gitweb.mndrdr.org Git - arelpe.git/commitdiff
limit and order pages in header; header consistent on pages
authorAidan Cornelius-Bell <[email protected]>
Mon, 23 Sep 2024 02:28:31 +0000 (11:58 +0930)
committerAidan Cornelius-Bell <[email protected]>
Mon, 23 Sep 2024 02:28:31 +0000 (11:58 +0930)
app/controllers/pubview_controller.rb
app/views/pubview/show_public.html.erb

index 2e84fbe237dab5f5e904b70284e24781378fafef..be512d5049d1deb74fad5977473e3ee20ccc27d5 100644 (file)
@@ -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
index 68de395171872789dda4dcfaa329c88d442b3ef5..39493fc6ef05fe3af800bf3ec332c2e3a9b6871e 100644 (file)
@@ -2,9 +2,18 @@
   <%= link_to root_path do %>
     <%= image_tag "icon-512.png", class: "logo" %>
   <% end %>
-  <% content_for :title, @page.title %>
-  <h1><%= @page.title %></h1>
-  <%= link_to "↼ Back home...", root_path %>
+  <% content_for :title, "#{@page.title} :: mind reader" %>
+  <h1><%= @page.title.downcase %></h1>
+  <p class="subheading"><small>Aidan’s anti-capitalist posting and sharing project</small></p> 
+</div>
+
+<div class="filter-buttons">
+  <%= 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 %>
 </div>
 
 <div class="post">