views: factor out sidebar layout template.

* Factor out common sidebar layout template.
* Convert wiki pages and posts to use this template.
* Add data-layout attribute to <body> element indicating the current layout.
This commit is contained in:
evazion
2019-09-28 17:05:18 -05:00
parent f7d7ed4b23
commit 960e5d4ae0
16 changed files with 316 additions and 339 deletions

View File

@@ -1,18 +1,18 @@
<div id="c-wiki-page-versions">
<div id="a-diff">
<h1>Wiki Page: <%= @thispage.title %></h1>
<%= render "wiki_pages/sidebar" %>
<% if @thispage.visible? %>
<p>Showing differences between <%= compact_time @thispage.updated_at %> (<%= link_to_user @thispage.updater %>) and <%= compact_time @otherpage.updated_at %> (<%= link_to_user @otherpage.updater %>)</p>
<% content_for(:content) do %>
<h1>Wiki Page: <%= @thispage.title %></h1>
<div>
<%= wiki_page_diff(@thispage, @otherpage) %>
</div>
<% else %>
<p>The artist requested removal of this page.</p>
<% end %>
</div>
</div>
<% if @thispage.visible? %>
<p>Showing differences between <%= compact_time @thispage.updated_at %> (<%= link_to_user @thispage.updater %>) and <%= compact_time @otherpage.updated_at %> (<%= link_to_user @otherpage.updater %>)</p>
<div>
<%= wiki_page_diff(@thispage, @otherpage) %>
</div>
<% else %>
<p>The artist requested removal of this page.</p>
<% end %>
<% end %>
<%= render "wiki_pages/secondary_links" %>

View File

@@ -1,19 +1,15 @@
<div id="c-wiki-page-versions">
<div id="a-index">
<%= render "wiki_pages/sidebar" %>
<%= render "wiki_pages/sidebar" %>
<section id="content">
<h1>Wiki Page History</h1>
<% content_for(:content) do %>
<h1>Wiki Page History</h1>
<% if params.dig(:search, :wiki_page_id).present? %>
<%= render "page_listing" %>
<% else %>
<%= render "global_listing" %>
<% end %>
<% if params.dig(:search, :wiki_page_id).present? %>
<%= render "page_listing" %>
<% else %>
<%= render "global_listing" %>
<% end %>
<%= numbered_paginator(@wiki_page_versions) %>
</section>
</div>
</div>
<%= numbered_paginator(@wiki_page_versions) %>
<% end %>
<%= render "wiki_pages/secondary_links" %>

View File

@@ -1,24 +1,20 @@
<div id="c-wiki-page-versions">
<div id="a-show">
<%= render "wiki_pages/sidebar" %>
<%= render "wiki_pages/sidebar" %>
<section id="content">
<h1 id="wiki-page-title"><%= @wiki_page_version.pretty_title %></h1>
<p class="fineprint"><%= time_ago_in_words_tagged(@wiki_page_version.updated_at) %></p>
<% content_for(:content) do %>
<h1 id="wiki-page-title"><%= @wiki_page_version.pretty_title %></h1>
<p class="fineprint"><%= time_ago_in_words_tagged(@wiki_page_version.updated_at) %></p>
<div id="wiki-page-body" class="dtext prose">
<% if @wiki_page_version.visible? %>
<% if @wiki_page_version.other_names.present? %>
<p><%= wiki_page_other_names_list(@wiki_page_version) %></p>
<% end %>
<div id="wiki-page-body" class="dtext prose">
<% if @wiki_page_version.visible? %>
<% if @wiki_page_version.other_names.present? %>
<p><%= wiki_page_other_names_list(@wiki_page_version) %></p>
<% end %>
<%= format_text(@wiki_page_version.body) %>
<% else %>
<p>The artist has requested removal of this page.</p>
<% end %>
</div>
</section>
<%= format_text(@wiki_page_version.body) %>
<% else %>
<p>The artist has requested removal of this page.</p>
<% end %>
</div>
</div>
<% end %>
<%= render "wiki_pages/secondary_links" %>