added share links, moved image resize back to notice banner style
This commit is contained in:
@@ -15,11 +15,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($("#c-posts").length && $("#a-show").length) {
|
if ($("#c-posts").length && $("#a-show").length) {
|
||||||
this.initialize_resize_links();
|
|
||||||
this.initialize_links();
|
this.initialize_links();
|
||||||
this.initialize_post_sections();
|
this.initialize_post_sections();
|
||||||
this.initialize_post_image_resize_links();
|
this.initialize_post_image_resize_links();
|
||||||
this.initialize_image_resize();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,24 +44,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Danbooru.Post.initialize_resize_links = function() {
|
|
||||||
$("#resize-links").hide();
|
|
||||||
|
|
||||||
$("#resize-links a").click(function(e) {
|
|
||||||
var image = $("#image");
|
|
||||||
var target = $(e.target);
|
|
||||||
image.attr("src", target.data("src"));
|
|
||||||
image.attr("width", target.data("width"));
|
|
||||||
image.attr("height", target.data("height"));
|
|
||||||
e.preventDefault();
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#resize-link a").click(function(e) {
|
|
||||||
$("#resize-links").toggle();
|
|
||||||
e.preventDefault();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Danbooru.Post.initialize_titles = function() {
|
Danbooru.Post.initialize_titles = function() {
|
||||||
$(".post-preview").each(function(i, v) {
|
$(".post-preview").each(function(i, v) {
|
||||||
Danbooru.Post.initialize_title_for(v);
|
Danbooru.Post.initialize_title_for(v);
|
||||||
@@ -93,37 +73,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Danbooru.Post.initialize_image_resize = function() {
|
Danbooru.Post.initialize_post_image_resize_links = function() {
|
||||||
var default_image_size = Danbooru.meta("default-image-size");
|
$("#image-resize-link").click(function(e) {
|
||||||
var original_width = parseInt($("#image").data("original-width"));
|
|
||||||
var large_width = parseInt(Danbooru.meta("config-large-width"));
|
|
||||||
|
|
||||||
if ((default_image_size === "large") && (original_width > large_width)) {
|
|
||||||
$("#large-file-link").trigger("click");
|
|
||||||
} else {
|
|
||||||
$("#original-file-link").trigger("click");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Danbooru.Post.build_resize_function = function(size) {
|
|
||||||
return function(e) {
|
|
||||||
Danbooru.Note.Box.descale_all();
|
Danbooru.Note.Box.descale_all();
|
||||||
var $link = $(e.target);
|
var $link = $(e.target);
|
||||||
var $image = $("#image");
|
var $image = $("#image");
|
||||||
$("#large-file-link").removeClass("active");
|
|
||||||
$("#original-file-link").removeClass("active");
|
|
||||||
$link.addClass("active");
|
|
||||||
$image.attr("src", $link.attr("href"));
|
$image.attr("src", $link.attr("href"));
|
||||||
$image.width($image.data(size + "-width"));
|
$image.width($image.data("original-width"));
|
||||||
$image.height($image.data(size + "-height"));
|
$image.height($image.data("original-height"));
|
||||||
Danbooru.Note.Box.scale_all();
|
Danbooru.Note.Box.scale_all();
|
||||||
|
$("#image-resize-notice").hide();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
});
|
||||||
}
|
|
||||||
|
|
||||||
Danbooru.Post.initialize_post_image_resize_links = function() {
|
|
||||||
$("#large-file-link").click(Danbooru.Post.build_resize_function("large"));
|
|
||||||
$("#original-file-link").click(Danbooru.Post.build_resize_function("original"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Danbooru.Post.initialize_wiki_page_excerpt = function() {
|
Danbooru.Post.initialize_wiki_page_excerpt = function() {
|
||||||
@@ -149,11 +110,17 @@
|
|||||||
Danbooru.Post.initialize_post_sections = function() {
|
Danbooru.Post.initialize_post_sections = function() {
|
||||||
$("#post-sections li a").click(function(e) {
|
$("#post-sections li a").click(function(e) {
|
||||||
if (e.target.hash === "#comments") {
|
if (e.target.hash === "#comments") {
|
||||||
$("#comments").fadeIn("fast");
|
$("#comments").show();
|
||||||
$("#edit").hide();
|
$("#edit").hide();
|
||||||
} else {
|
$("#share").hide();
|
||||||
$("#edit").fadeIn("fast");
|
} else if (e.target.hash === "#edit") {
|
||||||
|
$("#edit").show();
|
||||||
$("#comments").hide();
|
$("#comments").hide();
|
||||||
|
$("#share").hide();
|
||||||
|
} else {
|
||||||
|
$("#edit").hide();
|
||||||
|
$("#comments").hide();
|
||||||
|
$("#share").show();
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#post-sections li").removeClass("active");
|
$("#post-sections li").removeClass("active");
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
$("#upload_source").attr("name", "url");
|
$("#upload_source").attr("name", "url");
|
||||||
$("#upload_file").attr("name", "file");
|
$("#upload_file").attr("name", "file");
|
||||||
$("#form").attr("target", "_blank");
|
$("#form").attr("target", "_blank");
|
||||||
$("#form").attr("action", "http://danbooru.iqdb.hanyuu.net/");
|
$("#form").attr("action", "http://danbooru.iqdb.org/");
|
||||||
|
|
||||||
$("form").trigger("submit");
|
$("form").trigger("submit");
|
||||||
|
|
||||||
|
|||||||
@@ -215,6 +215,10 @@ class Post < ActiveRecord::Base
|
|||||||
image_height
|
image_height
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def resize_percentage
|
||||||
|
100 * large_image_width.to_f / image_width.to_f
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module ApprovalMethods
|
module ApprovalMethods
|
||||||
|
|||||||
@@ -1 +1,5 @@
|
|||||||
<%= image_tag(post.file_url_for(CurrentUser.user), :width => post.image_width_for(CurrentUser.user), :height => post.image_height_for(CurrentUser.user), :id => "image", "data-original-width" => post.image_width, "data-original-height" => post.image_height, "data-large-width" => post.large_image_width, "data-large-height" => post.large_image_height) %>
|
<%= image_tag(post.file_url_for(CurrentUser.user), :width => post.image_width_for(CurrentUser.user), :height => post.image_height_for(CurrentUser.user), :id => "image", "data-original-width" => post.image_width, "data-original-height" => post.image_height, "data-large-width" => post.large_image_width, "data-large-height" => post.large_image_height) %>
|
||||||
|
|
||||||
|
<% if post.has_large? && CurrentUser.default_image_size == "large" %>
|
||||||
|
<p id="image-resize-notice">Resized to <%= number_to_percentage post.resize_percentage, :precision => 0 %> of original (<%= link_to "view original", post.file_url, :id => "image-resize-link" %>)</p>
|
||||||
|
<% end %>
|
||||||
@@ -6,7 +6,9 @@
|
|||||||
|
|
||||||
<% if (post.is_flagged? || post.is_deleted?) && post.flags.any? %>
|
<% if (post.is_flagged? || post.is_deleted?) && post.flags.any? %>
|
||||||
<div class="ui-corner-all ui-state-highlight notice">
|
<div class="ui-corner-all ui-state-highlight notice">
|
||||||
This post has been flagged for deletion: <%= post_flag_reasons(post) %>
|
<p>This post has been flagged for deletion: </p>
|
||||||
|
|
||||||
|
<%= post_flag_reasons(post) %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
@@ -19,7 +21,7 @@
|
|||||||
<% unless post.is_status_locked? %>
|
<% unless post.is_status_locked? %>
|
||||||
<%= link_to "Approve", moderator_post_approval_path(:post_id => post.id), :method => :post, :remote => true, :class => "btn" %>
|
<%= link_to "Approve", moderator_post_approval_path(:post_id => post.id), :method => :post, :remote => true, :class => "btn" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= link_to "Disapprove", moderator_post_disapproval_path(:post_id => post.id), :method => :post, :remote => true, :class => "btn" %>
|
<%= link_to "Hide from queue", moderator_post_disapproval_path(:post_id => post.id), :method => :post, :remote => true, :class => "btn" %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
@@ -27,7 +29,8 @@
|
|||||||
|
|
||||||
<% if (post.is_flagged? || post.is_deleted?) && post.appeals.any? %>
|
<% if (post.is_flagged? || post.is_deleted?) && post.appeals.any? %>
|
||||||
<div class="ui-corner-all ui-state-highlight notice">
|
<div class="ui-corner-all ui-state-highlight notice">
|
||||||
This post has been appealed: <%= post_appeal_reasons(post) %>
|
<p>This post has been appealed:</p>
|
||||||
|
<%= post_appeal_reasons(post) %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<% if post.is_image? %>
|
|
||||||
<%= resize_image_links(post, CurrentUser.user) %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if CurrentUser.is_member? %>
|
<% if CurrentUser.is_member? %>
|
||||||
<li><%= link_to "Favorite", favorites_path(:post_id => post.id), :remote => true, :method => :post, :id => "add-to-favorites" %></li>
|
<li><%= link_to "Favorite", favorites_path(:post_id => post.id), :remote => true, :method => :post, :id => "add-to-favorites" %></li>
|
||||||
<li><%= link_to "Unfavorite", favorite_path(post), :remote => true, :method => :delete, :id => "remove-from-favorites" %></li>
|
<li><%= link_to "Unfavorite", favorite_path(post), :remote => true, :method => :delete, :id => "remove-from-favorites" %></li>
|
||||||
<li><%= link_to "Pool", "#", :id => "pool" %></li>
|
<li><%= link_to "Pool", "#", :id => "pool" %></li>
|
||||||
<li><%= link_to "Translate", "#", :id => "translate", :title => "Shortcut is CTRL+N" %></li>
|
<li><%= link_to "Translate", "#", :id => "translate", :title => "Shortcut is CTRL+N" %></li>
|
||||||
<li><%= link_to "Find similar", "http://danbooru.iqdb.org/db-search.php?url=#{post.preview_url}" %></li>
|
<li><%= link_to "Find similar", "http://danbooru.iqdb.org/db-search.php?url=#{post.preview_file_url}" %></li>
|
||||||
|
|
||||||
<% unless post.is_status_locked? %>
|
<% unless post.is_status_locked? %>
|
||||||
<% if !post.is_deleted? %>
|
<% if !post.is_deleted? %>
|
||||||
@@ -41,4 +37,4 @@
|
|||||||
<% if CurrentUser.is_admin? %>
|
<% if CurrentUser.is_admin? %>
|
||||||
<li><%= link_to "Annihilate", annihilate_moderator_post_post_path(:post_id => post.id), :remote => true, :method => :post, :id => "annihilate", :confirm => "This will permanently delete this post (meaning the file will be deleted). Are you sure you want to annihilate this post?" %></li>
|
<li><%= link_to "Annihilate", annihilate_moderator_post_post_path(:post_id => post.id), :remote => true, :method => :post, :id => "annihilate", :confirm => "This will permanently delete this post (meaning the file will be deleted). Are you sure you want to annihilate this post?" %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ulS
|
</ul>
|
||||||
34
app/views/posts/partials/show/_share.html.erb
Normal file
34
app/views/posts/partials/show/_share.html.erb
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<div style="margin-bottom: 5em; overflow: hidden;">
|
||||||
|
<div style="float: left;">
|
||||||
|
<!-- Twitter -->
|
||||||
|
<a href="https://twitter.com/share" class="twitter-share-button" data-text="<%= post.essential_tag_string %>" data-count="none" data-hashtags="danbooru">Tweet</a>
|
||||||
|
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="float: left; margin-left: 0.5em;">
|
||||||
|
<!-- Facebook -->
|
||||||
|
<a name="fb_share"></a>
|
||||||
|
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript">
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="float: left; margin-left: 0.5em;">
|
||||||
|
<!-- Tumblr -->
|
||||||
|
<a href="http://www.tumblr.com/share" title="Share on Tumblr" style="display:inline-block; text-indent:-9999px; overflow:hidden; width:61px; height:20px; background:url('http://platform.tumblr.com/v1/share_2.png') top left no-repeat transparent;">Share on Tumblr</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="float: left; margin-left: 0.5em">
|
||||||
|
<!-- StumbleUpon -->
|
||||||
|
<!-- Place this tag where you want the su badge to render -->
|
||||||
|
<su:badge layout="3"></su:badge>
|
||||||
|
|
||||||
|
<!-- Place this snippet wherever appropriate -->
|
||||||
|
<script type="text/javascript">
|
||||||
|
(function() {
|
||||||
|
var li = document.createElement('script'); li.type = 'text/javascript'; li.async = true;
|
||||||
|
li.src = window.location.protocol + '//platform.stumbleupon.com/1/widgets.js';
|
||||||
|
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(li, s);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -46,7 +46,6 @@
|
|||||||
<menu id="post-sections">
|
<menu id="post-sections">
|
||||||
<li><a href="#comments">Comments</a></li>
|
<li><a href="#comments">Comments</a></li>
|
||||||
<li><a href="#edit" id="post-edit-link">Edit</a></li>
|
<li><a href="#edit" id="post-edit-link">Edit</a></li>
|
||||||
<li><a href="#favorite-tab">Favorite</a></li>
|
|
||||||
<li><a href="#share">Share</a></li>
|
<li><a href="#share">Share</a></li>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
||||||
@@ -62,12 +61,8 @@
|
|||||||
<%= render "posts/partials/show/edit", :post => @post %>
|
<%= render "posts/partials/show/edit", :post => @post %>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="favorite-tab" style="display: none;">
|
<section id="share" style="display: none;">
|
||||||
<p>Favoriting...</p>
|
<%= render "posts/partials/show/share", :post => @post %>
|
||||||
</section>
|
|
||||||
|
|
||||||
<section id="share-tab" style="display: none;">
|
|
||||||
<h1>Share</h1>
|
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
@@ -98,6 +93,9 @@
|
|||||||
<meta name="post-is-deleted" content="<%= @post.is_deleted? %>">
|
<meta name="post-is-deleted" content="<%= @post.is_deleted? %>">
|
||||||
<meta name="post-is-flagged" content="<%= @post.is_flagged? %>">
|
<meta name="post-is-flagged" content="<%= @post.is_flagged? %>">
|
||||||
<meta name="config-large-width" content="<%= Danbooru.config.large_image_width %>">
|
<meta name="config-large-width" content="<%= Danbooru.config.large_image_width %>">
|
||||||
|
<meta property="og:title" content="<%= @post.essential_tag_string %>">
|
||||||
|
<meta property="og:description" content="<%= @post.tag_string %>">
|
||||||
|
<meta property="og:image" content="<%= @post.preview_file_url %>">
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= render "posts/partials/common/secondary_links" %>
|
<%= render "posts/partials/common/secondary_links" %>
|
||||||
|
|||||||
5503
db/structure.sql
Normal file
5503
db/structure.sql
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user