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,4 +1,4 @@
<aside id="sidebar">
<% content_for(:sidebar) do %>
<%= render "posts/partials/index/blacklist" %>
<%= render "wiki_pages/recent_changes" %>
</aside>
<% end %>

View File

@@ -1,17 +1,13 @@
<div id="c-wiki-pages">
<div id="a-edit">
<%= render "sidebar" %>
<%= render "sidebar" %>
<section id="content">
<h1>Edit Wiki</h1>
<% content_for(:content) do %>
<h1>Edit Wiki</h1>
<% if @wiki_page.visible? %>
<%= render "form" %>
<% else %>
<p>The artist requested removal of this page.</p>
<% end %>
</section>
</div>
</div>
<% if @wiki_page.visible? %>
<%= render "form" %>
<% else %>
<p>The artist requested removal of this page.</p>
<% end %>
<% end %>
<%= render "secondary_links" %>

View File

@@ -1,30 +1,26 @@
<div id="c-wiki-pages">
<div id="a-index">
<%= render "sidebar" %>
<%= render "sidebar" %>
<section id="content">
<h1>Wiki</h1>
<% content_for(:content) do %>
<h1>Wiki</h1>
<table class="striped" width="100%">
<thead>
<tr>
<th>Title</th>
<th>Last edited</th>
</tr>
</thead>
<tbody>
<% @wiki_pages.each do |wiki_page| %>
<tr>
<td class="category-<%= wiki_page.category_name %>"><%= link_to wiki_page.pretty_title, wiki_page_path(wiki_page, :noredirect => 1) %></td>
<td><%= wiki_page.updated_at.strftime("%Y-%m-%d %H:%M") %> by <%= h link_to_user wiki_page.updater %></td>
</tr>
<% end %>
</tbody>
</table>
<table class="striped" width="100%">
<thead>
<tr>
<th>Title</th>
<th>Last edited</th>
</tr>
</thead>
<tbody>
<% @wiki_pages.each do |wiki_page| %>
<tr>
<td class="category-<%= wiki_page.category_name %>"><%= link_to wiki_page.pretty_title, wiki_page_path(wiki_page, :noredirect => 1) %></td>
<td><%= wiki_page.updated_at.strftime("%Y-%m-%d %H:%M") %> by <%= h link_to_user wiki_page.updater %></td>
</tr>
<% end %>
</tbody>
</table>
<%= numbered_paginator(@wiki_pages) %>
</section>
</div>
</div>
<%= numbered_paginator(@wiki_pages) %>
<% end %>
<%= render "secondary_links" %>

View File

@@ -1,26 +1,17 @@
<div id="c-wiki-pages">
<div id="a-new">
<%= render "sidebar" %>
<%= render "sidebar" %>
<section id="content">
<h1>New Wiki Page</h1>
<% content_for(:content) do %>
<h1>New Wiki Page</h1>
<% if @wiki_page.title.present? %>
<div class="notice notice-info notice-small" id="new-wiki-page-notice">
This wiki page does not yet exist. The form below will allow you to create a new page for <%= @wiki_page.title %>. It will act as an explanation on how to use the tag for other users on the site.
</div>
<% end %>
<% if @wiki_page.title.present? %>
<div class="notice notice-info notice-small" id="new-wiki-page-notice">
This wiki page does not yet exist. The form below will allow you to create a new page for <%= @wiki_page.title %>. It will act as an explanation on how to use the tag for other users on the site.
</div>
<% end %>
<%= render "form" %>
<%= wiki_page_alias_and_implication_list(@wiki_page)%>
<%= wiki_page_post_previews(@wiki_page) %>
<div class="clearfix"></div>
</section>
</div>
</div>
<%= render "form" %>
<%= wiki_page_alias_and_implication_list(@wiki_page)%>
<%= wiki_page_post_previews(@wiki_page) %>
<% end %>
<%= render "secondary_links" %>

View File

@@ -1,43 +1,38 @@
<div id="c-wiki-pages">
<div id="a-show">
<%= render "sidebar" %>
<%= render "sidebar" %>
<section id="content">
<h1 id="wiki-page-title">
<% content_for(:content) do %>
<h1 id="wiki-page-title">
<%= link_to @wiki_page.pretty_title, posts_path(:tags => @wiki_page.title), :class => "tag-type-#{@wiki_page.category_name}" %>
<%= link_to @wiki_page.pretty_title, posts_path(:tags => @wiki_page.title), :class => "tag-type-#{@wiki_page.category_name}" %>
<% if @wiki_page.is_locked? %>
(locked)
<% end %>
<% if @wiki_page.is_locked? %>
(locked)
<% end %>
<% if @wiki_page.is_deleted? %>
(deleted)
<% end %>
</h1>
<% if @wiki_page.is_deleted? %>
(deleted)
<% end %>
</h1>
<div id="wiki-page-body" class="prose">
<% if @wiki_page.visible? %>
<% if @wiki_page.other_names.present? %>
<p><%= wiki_page_other_names_list(@wiki_page) %></p>
<% end %>
<div id="wiki-page-body" class="prose">
<% if @wiki_page.visible? %>
<% if @wiki_page.other_names.present? %>
<p><%= wiki_page_other_names_list(@wiki_page) %></p>
<% end %>
<%= format_text(@wiki_page.body) %>
<%= format_text(@wiki_page.body) %>
<% if @wiki_page.artist %>
<p><%= link_to "View artist", @wiki_page.artist %></p>
<% end %>
<% if @wiki_page.artist %>
<p><%= link_to "View artist", @wiki_page.artist %></p>
<% end %>
<%= wiki_page_alias_and_implication_list(@wiki_page) %>
<% else %>
<p>This artist has requested removal of their information.</p>
<% end %>
</div>
<%= wiki_page_post_previews(@wiki_page) %>
</section>
<%= wiki_page_alias_and_implication_list(@wiki_page) %>
<% else %>
<p>This artist has requested removal of their information.</p>
<% end %>
</div>
</div>
<%= wiki_page_post_previews(@wiki_page) %>
<% end %>
<% content_for(:page_title) do %>
Wiki - <%= @wiki_page.pretty_title %> - <%= Danbooru.config.app_name %>

View File

@@ -1,25 +1,21 @@
<div id="c-wiki-pages">
<div id="a-show">
<%= render "sidebar" %>
<%= render "sidebar" %>
<section id="content">
<h1 id="wiki-page-title">
<%= link_to @wiki_page.pretty_title, posts_path(:tags => @wiki_page.title), :class => "tag-type-#{@wiki_page.category_name}" %>
</h1>
<div id="wiki-page-body" class="prose">
<p>This wiki page does not exist. <%= link_to "Create new wiki page", new_wiki_page_path(:wiki_page => {:title => params[:title]}) %>.</p>
</div>
<% if @wiki_page.artist.present? %>
<p><%= link_to "View artist", @wiki_page.artist %></p>
<% end %>
<%= wiki_page_alias_and_implication_list(@wiki_page)%>
<%= wiki_page_post_previews(@wiki_page) %>
</section>
<% content_for(:content) do %>
<h1 id="wiki-page-title">
<%= link_to @wiki_page.pretty_title, posts_path(:tags => @wiki_page.title), :class => "tag-type-#{@wiki_page.category_name}" %>
</h1>
<div id="wiki-page-body" class="prose">
<p>This wiki page does not exist. <%= link_to "Create new wiki page", new_wiki_page_path(:wiki_page => {:title => params[:title]}) %>.</p>
</div>
</div>
<% if @wiki_page.artist.present? %>
<p><%= link_to "View artist", @wiki_page.artist %></p>
<% end %>
<%= wiki_page_alias_and_implication_list(@wiki_page)%>
<%= wiki_page_post_previews(@wiki_page) %>
<% end %>
<%= render "secondary_links" %>