upgraded jquery, restyled post wiki excerpts

This commit is contained in:
albert
2012-01-13 17:40:01 -05:00
parent 2c6f69e309
commit 08cfb3d637
14 changed files with 49 additions and 66 deletions

View File

@@ -1,4 +1,4 @@
//= require jquery-1.6.2.min.js
//= require jquery-1.7.1.min.js
//= require jquery-ui-1.8.12.custom.min.js
//= require keymaster.min.js
//= require jquery.hotkeys.js

View File

@@ -132,26 +132,21 @@
}
Danbooru.Post.initialize_wiki_page_excerpt = function() {
if (Danbooru.Cookie.get("hide-wiki-page-excerpt") === "1") {
$("#hide-wiki-page-excerpt").hide();
$("#wiki-page-excerpt-content").hide();
} else {
$("#show-wiki-page-excerpt").hide();
}
$("#wiki-page-excerpt").hide();
$("#hide-wiki-page-excerpt").click(function(e) {
$("#hide-wiki-page-excerpt").hide();
$("#wiki-page-excerpt-content").hide();
$("#show-wiki-page-excerpt").show();
Danbooru.Cookie.put("hide-wiki-page-excerpt", "1");
$("#show-posts-link").click(function(e) {
$("#show-posts-link").parent("li").addClass("active");
$("#show-wiki-excerpt-link").parent("li").removeClass("active");
$("#posts").show();
$("#wiki-page-excerpt").hide();
e.preventDefault();
});
$("#show-wiki-page-excerpt").click(function(e) {
$("#hide-wiki-page-excerpt").show();
$("#wiki-page-excerpt-content").show();
$("#show-wiki-page-excerpt").hide();
Danbooru.Cookie.put("hide-wiki-page-excerpt", "0");
$("#show-wiki-excerpt-link").click(function(e) {
$("#show-posts-link").parent("li").removeClass("active");
$("#show-wiki-excerpt-link").parent("li").addClass("active");
$("#posts").hide();
$("#wiki-page-excerpt").show();
e.preventDefault();
});
}

View File

@@ -102,32 +102,19 @@ div#c-posts {
font-size: $h3_size;
}
div#wiki-page-excerpt {
position: relative;
width: 40em;
background: #EEE;
padding: 0.5em 1em;
margin-bottom: 1em;
border: 1px solid #CCC;
@include border-radius(0.5em);
p:last-child {
margin-bottom: 0;
}
div#hide-or-show-wiki-page-excerpt {
font-size: 1em;
position: absolute;
top: 9px;
right: 9px;
div#a-index {
menu#post-sections {
margin-bottom: 0.5em;
font-size: $h3_size;
span {
cursor: pointer;
color: #AAA;
}
span:hover {
color: #333;
li {
padding: 0.25em 0.5em;
&.active {
background-color: $menu_color;
font-weight: bold;
@include border-radius(4px);
}
}
}
}

View File

@@ -14,6 +14,14 @@
</aside>
<section id="content">
<menu id="post-sections">
<li class="active"><a href="#posts" id="show-posts-link">Posts</a></li>
<% if params[:tags].present? %>
<li><a href="#wiki-except" id="show-wiki-excerpt-link">Wiki</a></li>
<% end %>
</menu>
<%= render "posts/partials/index/edit" %>
<%= render "wiki_pages/excerpt", :post_set => @post_set %>
<%= render "posts/partials/index/posts", :post_set => @post_set %>

View File

@@ -1,5 +1,5 @@
<h1>Posts</h1>
<div id="posts">
<%= post_set.presenter.post_previews_html(self) %>
<%= post_set.presenter.post_previews_html(self) %>
<%= numbered_paginator(post_set.posts) %>
<%= numbered_paginator(post_set.posts) %>
</div>

View File

@@ -2,25 +2,14 @@
- post_set
-->
<% if post_set.has_wiki? %>
<div id="wiki-page-excerpt">
<h1>Wiki</h1>
<div id="wiki-page-excerpt">
<% if post_set.wiki_page %>
<div class="prose">
<%= format_text(post_set.wiki_page.presenter.excerpt) %>
<div id="hide-or-show-wiki-page-excerpt">
<span id="hide-wiki-page-excerpt" class="ui-icon ui-icon-triangle-1-n"></span>
<span id="show-wiki-page-excerpt" class="ui-icon ui-icon-triangle-1-s"></span>
<p>Read the <%= link_to "full article", wiki_page_path(post_set.wiki_page.id) %>.</p>
</div>
<div id="wiki-page-excerpt-content">
<% if post_set.wiki_page %>
<div class="prose">
<%= format_text(post_set.wiki_page.presenter.excerpt) %>
<p>Read the <%= link_to "full article", wiki_page_path(post_set.wiki_page.id) %>.</p>
</div>
<% else %>
<p>There is currently no wiki page for the tag "<%= post_set.tag_string %>". You can <%= link_to "create one", new_wiki_page_path(:wiki_page => {:title => post_set.tag_string}) %>.</p>
<% end %>
</div>
</div>
<% end %>
<% else %>
<p>There is currently no wiki page for the tag "<%= post_set.tag_string %>". You can <%= link_to "create one", new_wiki_page_path(:wiki_page => {:title => post_set.tag_string}) %>.</p>
<% end %>
</div>