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
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
<%= 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">