This commit is contained in:
Toks
2013-04-24 15:27:40 -04:00
parent 05a6ec6fc5
commit 56436aec08
4 changed files with 32 additions and 2 deletions

View File

@@ -133,6 +133,31 @@
$("#post_tag_string").trigger("focus");
e.preventDefault();
});
$("#parent-relationship-preview").hide();
$("#child-relationship-preview").hide();
$("#parent-relationship-preview-link").click(function(e) {
$("#parent-relationship-preview").toggle();
if ($("#parent-relationship-preview").is(":visible")) {
$(this).html("« hide");
}
else {
$(this).html("show »");
}
e.preventDefault();
});
$("#child-relationship-preview-link").click(function(e) {
$("#child-relationship-preview").toggle();
if ($("#child-relationship-preview").is(":visible")) {
$(this).html("« hide");
}
else {
$(this).html("show »");
}
e.preventDefault();
});
}
Danbooru.Post.initialize_favlist = function() {

View File

@@ -128,6 +128,7 @@ div#c-posts {
font-size: 0.8em;
padding: 1em;
margin-bottom: 1em;
overflow: hidden;
ul {
margin-left: 1em;

View File

@@ -22,6 +22,8 @@ class PostsController < ApplicationController
@post = Post.find(params[:id])
@post_flag = PostFlag.new(:post_id => @post.id)
@post_appeal = PostAppeal.new(:post_id => @post.id)
@parent_post_set = PostSets::Post.new("parent:#{@post.id}")
@child_post_set = PostSets::Post.new("parent:#{@post.parent_id}")
respond_with(@post)
end

View File

@@ -48,13 +48,15 @@
<% if post.parent_id %>
<div class="ui-corner-all ui-state-highlight notice notice-child">
This post belongs to a <%= link_to "parent", post_path(post.parent_id) %> (<%= link_to "learn more", wiki_pages_path(:title => "help:post_relationships") %>)
This post belongs to a <%= link_to "parent", post_path(post.parent_id) %> (<%= link_to "learn more", wiki_pages_path(:title => "help:post_relationships") %>) <%= link_to "show &raquo;".html_safe, "#", :id => "child-relationship-preview-link" %>
<div id="child-relationship-preview"><%= @child_post_set.presenter.post_previews_html(self) %></div>
</div>
<% end %>
<% if post.has_children? %>
<div class="ui-corner-all ui-state-highlight notice notice-parent">
This post has <%= link_to "children", posts_path(:tags => "parent:#{post.id}") %> (<%= link_to "learn more", wiki_pages_path(:title => "help:post_relationships") %>)
This post has <%= link_to "children", posts_path(:tags => "parent:#{post.id}") %> (<%= link_to "learn more", wiki_pages_path(:title => "help:post_relationships") %>) <%= link_to "show &raquo;".html_safe, "#", :id => "parent-relationship-preview-link" %>
<div id="parent-relationship-preview"><%= @parent_post_set.presenter.post_previews_html(self) %></div>
</div>
<% end %>