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:
@@ -1,6 +1,7 @@
|
|||||||
class PostsController < ApplicationController
|
class PostsController < ApplicationController
|
||||||
before_action :member_only, :except => [:show, :show_seq, :index, :home, :random]
|
before_action :member_only, :except => [:show, :show_seq, :index, :home, :random]
|
||||||
respond_to :html, :xml, :json
|
respond_to :html, :xml, :json
|
||||||
|
layout "sidebar"
|
||||||
|
|
||||||
def index
|
def index
|
||||||
if params[:md5].present?
|
if params[:md5].present?
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
class WikiPageVersionsController < ApplicationController
|
class WikiPageVersionsController < ApplicationController
|
||||||
respond_to :html, :xml, :json
|
respond_to :html, :xml, :json
|
||||||
|
layout "sidebar"
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@wiki_page_versions = WikiPageVersion.search(search_params).paginate(params[:page], :limit => params[:limit], :search_count => params[:search])
|
@wiki_page_versions = WikiPageVersion.search(search_params).paginate(params[:page], :limit => params[:limit], :search_count => params[:search])
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ class WikiPagesController < ApplicationController
|
|||||||
before_action :member_only, :except => [:index, :search, :show, :show_or_new]
|
before_action :member_only, :except => [:index, :search, :show, :show_or_new]
|
||||||
before_action :builder_only, :only => [:destroy]
|
before_action :builder_only, :only => [:destroy]
|
||||||
before_action :normalize_search_params, :only => [:index]
|
before_action :normalize_search_params, :only => [:index]
|
||||||
|
layout "sidebar"
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@wiki_page = WikiPage.new(wiki_page_params(:create))
|
@wiki_page = WikiPage.new(wiki_page_params(:create))
|
||||||
@@ -30,6 +31,7 @@ class WikiPagesController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def search
|
def search
|
||||||
|
render layout: "default"
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|||||||
@@ -187,6 +187,7 @@ module ApplicationHelper
|
|||||||
data: {
|
data: {
|
||||||
controller: controller_param,
|
controller: controller_param,
|
||||||
action: action_param,
|
action: action_param,
|
||||||
|
layout: controller.class.send(:_layout),
|
||||||
**data_attributes_for(user, "user", attributes)
|
**data_attributes_for(user, "user", attributes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
15
app/views/layouts/sidebar.html.erb
Normal file
15
app/views/layouts/sidebar.html.erb
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<% content_for(:layout) do %>
|
||||||
|
<div id="c-<%= params[:controller].parameterize.dasherize %>">
|
||||||
|
<div id="a-<%= params[:action].parameterize.dasherize %>">
|
||||||
|
<aside id="sidebar">
|
||||||
|
<%= yield :sidebar %>
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
<section id="content">
|
||||||
|
<%= yield :content %>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= render template: "layouts/default" %>
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
<div id="c-posts">
|
<% content_for(:sidebar) do %>
|
||||||
<div id="a-index">
|
|
||||||
<aside id="sidebar">
|
|
||||||
<%= render "posts/partials/common/search", :path => posts_path, :tags => params[:tags], :tags_dom_id => "tags" %>
|
<%= render "posts/partials/common/search", :path => posts_path, :tags => params[:tags], :tags_dom_id => "tags" %>
|
||||||
|
|
||||||
<%= render "posts/partials/index/mode_menu" %>
|
<%= render "posts/partials/index/mode_menu" %>
|
||||||
@@ -20,9 +18,9 @@
|
|||||||
<%= render "posts/partials/index/options" %>
|
<%= render "posts/partials/index/options" %>
|
||||||
|
|
||||||
<%= render "posts/partials/index/related" %>
|
<%= render "posts/partials/index/related" %>
|
||||||
</aside>
|
<% end %>
|
||||||
|
|
||||||
<section id="content">
|
<% content_for(:content) do %>
|
||||||
<menu id="post-sections">
|
<menu id="post-sections">
|
||||||
<li class="active"><a href="#" id="show-posts-link">Posts</a></li>
|
<li class="active"><a href="#" id="show-posts-link">Posts</a></li>
|
||||||
|
|
||||||
@@ -44,16 +42,13 @@
|
|||||||
<%= render "posts/partials/index/edit" %>
|
<%= render "posts/partials/index/edit" %>
|
||||||
<%= render "posts/partials/index/excerpt", :post_set => @post_set %>
|
<%= render "posts/partials/index/excerpt", :post_set => @post_set %>
|
||||||
<%= render "posts/partials/index/posts", :post_set => @post_set %>
|
<%= render "posts/partials/index/posts", :post_set => @post_set %>
|
||||||
</section>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
<%= post_search_count_js %>
|
<%= post_search_count_js %>
|
||||||
|
|
||||||
<div id="saved-searches-nav">
|
<div id="saved-searches-nav">
|
||||||
<%= render "saved_searches/interface" %>
|
<%= render "saved_searches/interface" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% if params[:tags] =~ /search:/ %>
|
<% if params[:tags] =~ /search:/ %>
|
||||||
<%= render "saved_searches/secondary_links" %>
|
<%= render "saved_searches/secondary_links" %>
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
<div id="c-posts">
|
<% content_for(:sidebar) do %>
|
||||||
<div id="a-show">
|
|
||||||
<aside id="sidebar">
|
|
||||||
<%= render "posts/partials/common/search", :path => posts_path, :tags => params[:q], :tags_dom_id => "tags" %>
|
<%= render "posts/partials/common/search", :path => posts_path, :tags => params[:q], :tags_dom_id => "tags" %>
|
||||||
|
|
||||||
<%= render "posts/partials/index/blacklist" %>
|
<%= render "posts/partials/index/blacklist" %>
|
||||||
@@ -35,9 +33,9 @@
|
|||||||
<li id="post-history-replacements"><%= link_to "Replacements", post_replacements_path(search: {post_id: @post.id }) %></li>
|
<li id="post-history-replacements"><%= link_to "Replacements", post_replacements_path(search: {post_id: @post.id }) %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
</aside>
|
<% end %>
|
||||||
|
|
||||||
<section id="content">
|
<% content_for(:content) do %>
|
||||||
<% if @post.presenter.has_nav_links?(self) %>
|
<% if @post.presenter.has_nav_links?(self) %>
|
||||||
<%= render "posts/partials/show/nav_links", :post => @post, :position => "top" %>
|
<%= render "posts/partials/show/nav_links", :post => @post, :position => "top" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -133,8 +131,7 @@
|
|||||||
<%= render "posts/partials/show/edit", :post => @post %>
|
<%= render "posts/partials/show/edit", :post => @post %>
|
||||||
</section>
|
</section>
|
||||||
<% end %>
|
<% end %>
|
||||||
</section>
|
<% end %>
|
||||||
</div>
|
|
||||||
|
|
||||||
<% if CurrentUser.is_member? %>
|
<% if CurrentUser.is_member? %>
|
||||||
<div id="add-to-pool-dialog" title="Add to pool" style="display: none;">
|
<div id="add-to-pool-dialog" title="Add to pool" style="display: none;">
|
||||||
@@ -149,7 +146,6 @@
|
|||||||
<%= render "favorite_groups/add_to_favgroup_dialog", :post => @post %>
|
<%= render "favorite_groups/add_to_favgroup_dialog", :post => @post %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
|
||||||
|
|
||||||
<%= post_view_count_js %>
|
<%= post_view_count_js %>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<div id="c-wiki-page-versions">
|
<%= render "wiki_pages/sidebar" %>
|
||||||
<div id="a-diff">
|
|
||||||
|
<% content_for(:content) do %>
|
||||||
<h1>Wiki Page: <%= @thispage.title %></h1>
|
<h1>Wiki Page: <%= @thispage.title %></h1>
|
||||||
|
|
||||||
<% if @thispage.visible? %>
|
<% if @thispage.visible? %>
|
||||||
@@ -11,8 +12,7 @@
|
|||||||
<% else %>
|
<% else %>
|
||||||
<p>The artist requested removal of this page.</p>
|
<p>The artist requested removal of this page.</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
<% end %>
|
||||||
</div>
|
|
||||||
|
|
||||||
<%= render "wiki_pages/secondary_links" %>
|
<%= render "wiki_pages/secondary_links" %>
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
<div id="c-wiki-page-versions">
|
|
||||||
<div id="a-index">
|
|
||||||
<%= render "wiki_pages/sidebar" %>
|
<%= render "wiki_pages/sidebar" %>
|
||||||
|
|
||||||
<section id="content">
|
<% content_for(:content) do %>
|
||||||
<h1>Wiki Page History</h1>
|
<h1>Wiki Page History</h1>
|
||||||
|
|
||||||
<% if params.dig(:search, :wiki_page_id).present? %>
|
<% if params.dig(:search, :wiki_page_id).present? %>
|
||||||
@@ -12,8 +10,6 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= numbered_paginator(@wiki_page_versions) %>
|
<%= numbered_paginator(@wiki_page_versions) %>
|
||||||
</section>
|
<% end %>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<%= render "wiki_pages/secondary_links" %>
|
<%= render "wiki_pages/secondary_links" %>
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
<div id="c-wiki-page-versions">
|
|
||||||
<div id="a-show">
|
|
||||||
<%= render "wiki_pages/sidebar" %>
|
<%= render "wiki_pages/sidebar" %>
|
||||||
|
|
||||||
<section id="content">
|
<% content_for(:content) do %>
|
||||||
<h1 id="wiki-page-title"><%= @wiki_page_version.pretty_title %></h1>
|
<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>
|
<p class="fineprint"><%= time_ago_in_words_tagged(@wiki_page_version.updated_at) %></p>
|
||||||
|
|
||||||
@@ -17,8 +15,6 @@
|
|||||||
<p>The artist has requested removal of this page.</p>
|
<p>The artist has requested removal of this page.</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
<% end %>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<%= render "wiki_pages/secondary_links" %>
|
<%= render "wiki_pages/secondary_links" %>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<aside id="sidebar">
|
<% content_for(:sidebar) do %>
|
||||||
<%= render "posts/partials/index/blacklist" %>
|
<%= render "posts/partials/index/blacklist" %>
|
||||||
<%= render "wiki_pages/recent_changes" %>
|
<%= render "wiki_pages/recent_changes" %>
|
||||||
</aside>
|
<% end %>
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
<div id="c-wiki-pages">
|
|
||||||
<div id="a-edit">
|
|
||||||
<%= render "sidebar" %>
|
<%= render "sidebar" %>
|
||||||
|
|
||||||
<section id="content">
|
<% content_for(:content) do %>
|
||||||
<h1>Edit Wiki</h1>
|
<h1>Edit Wiki</h1>
|
||||||
|
|
||||||
<% if @wiki_page.visible? %>
|
<% if @wiki_page.visible? %>
|
||||||
@@ -10,8 +8,6 @@
|
|||||||
<% else %>
|
<% else %>
|
||||||
<p>The artist requested removal of this page.</p>
|
<p>The artist requested removal of this page.</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
</section>
|
<% end %>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<%= render "secondary_links" %>
|
<%= render "secondary_links" %>
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
<div id="c-wiki-pages">
|
|
||||||
<div id="a-index">
|
|
||||||
<%= render "sidebar" %>
|
<%= render "sidebar" %>
|
||||||
|
|
||||||
<section id="content">
|
<% content_for(:content) do %>
|
||||||
<h1>Wiki</h1>
|
<h1>Wiki</h1>
|
||||||
|
|
||||||
<table class="striped" width="100%">
|
<table class="striped" width="100%">
|
||||||
@@ -23,8 +21,6 @@
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<%= numbered_paginator(@wiki_pages) %>
|
<%= numbered_paginator(@wiki_pages) %>
|
||||||
</section>
|
<% end %>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<%= render "secondary_links" %>
|
<%= render "secondary_links" %>
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
<div id="c-wiki-pages">
|
|
||||||
<div id="a-new">
|
|
||||||
<%= render "sidebar" %>
|
<%= render "sidebar" %>
|
||||||
|
|
||||||
<section id="content">
|
<% content_for(:content) do %>
|
||||||
<h1>New Wiki Page</h1>
|
<h1>New Wiki Page</h1>
|
||||||
|
|
||||||
<% if @wiki_page.title.present? %>
|
<% if @wiki_page.title.present? %>
|
||||||
@@ -12,15 +10,8 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= render "form" %>
|
<%= render "form" %>
|
||||||
|
|
||||||
<%= wiki_page_alias_and_implication_list(@wiki_page)%>
|
<%= wiki_page_alias_and_implication_list(@wiki_page)%>
|
||||||
|
|
||||||
<%= wiki_page_post_previews(@wiki_page) %>
|
<%= wiki_page_post_previews(@wiki_page) %>
|
||||||
|
<% end %>
|
||||||
<div class="clearfix"></div>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<%= render "secondary_links" %>
|
<%= render "secondary_links" %>
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
<div id="c-wiki-pages">
|
|
||||||
<div id="a-show">
|
|
||||||
<%= render "sidebar" %>
|
<%= render "sidebar" %>
|
||||||
|
|
||||||
<section id="content">
|
<% content_for(:content) do %>
|
||||||
<h1 id="wiki-page-title">
|
<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? %>
|
<% if @wiki_page.is_locked? %>
|
||||||
@@ -35,9 +32,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= wiki_page_post_previews(@wiki_page) %>
|
<%= wiki_page_post_previews(@wiki_page) %>
|
||||||
</section>
|
<% end %>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% content_for(:page_title) do %>
|
<% content_for(:page_title) do %>
|
||||||
Wiki - <%= @wiki_page.pretty_title %> - <%= Danbooru.config.app_name %>
|
Wiki - <%= @wiki_page.pretty_title %> - <%= Danbooru.config.app_name %>
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
<div id="c-wiki-pages">
|
|
||||||
<div id="a-show">
|
|
||||||
<%= render "sidebar" %>
|
<%= render "sidebar" %>
|
||||||
|
|
||||||
<section id="content">
|
<% content_for(:content) do %>
|
||||||
<h1 id="wiki-page-title">
|
<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}" %>
|
||||||
</h1>
|
</h1>
|
||||||
@@ -17,9 +15,7 @@
|
|||||||
<%= wiki_page_alias_and_implication_list(@wiki_page)%>
|
<%= wiki_page_alias_and_implication_list(@wiki_page)%>
|
||||||
|
|
||||||
<%= wiki_page_post_previews(@wiki_page) %>
|
<%= wiki_page_post_previews(@wiki_page) %>
|
||||||
</section>
|
<% end %>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<%= render "secondary_links" %>
|
<%= render "secondary_links" %>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user