Merge branch 'master' into amazon-ses
This commit is contained in:
@@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
if ($(".paginator").length && (Danbooru.meta("enable-js-navigation") === "true")) {
|
if ($(".paginator").length && (Danbooru.meta("enable-js-navigation") === "true")) {
|
||||||
$(document).bind("keydown.right", Danbooru.Paginator.next_page);
|
$(document).bind("keydown.d", Danbooru.Paginator.next_page);
|
||||||
$(document).bind("keydown.left", Danbooru.Paginator.prev_page);
|
$(document).bind("keydown.a", Danbooru.Paginator.prev_page);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
Danbooru.Post.initialize_similar = function() {
|
Danbooru.Post.initialize_similar = function() {
|
||||||
$("#similar-button").click(function(e) {
|
$("#similar-button").click(function(e) {
|
||||||
var old_source_name = $("#post_source").attr("name");
|
var old_source_name = $("#post_source").attr("name");
|
||||||
var old_target = $("#form").attr("target");
|
|
||||||
var old_action = $("#form").attr("action");
|
var old_action = $("#form").attr("action");
|
||||||
|
|
||||||
$("#post_source").attr("name", "url");
|
$("#post_source").attr("name", "url");
|
||||||
@@ -43,14 +42,14 @@
|
|||||||
$("#form").trigger("submit");
|
$("#form").trigger("submit");
|
||||||
|
|
||||||
$("#post_source").attr("name", old_source_name);
|
$("#post_source").attr("name", old_source_name);
|
||||||
$("#form").attr("target", old_target);
|
$("#form").attr("target", "");
|
||||||
$("#form").attr("action", old_action);
|
$("#form").attr("action", old_action);
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Danbooru.Post.nav_pool_prev = function() {
|
Danbooru.Post.nav_prev = function() {
|
||||||
if ($("#search-seq-nav").length) {
|
if ($("#search-seq-nav").length) {
|
||||||
var href = $("#search-seq-nav a[rel=prev]").attr("href");
|
var href = $("#search-seq-nav a[rel=prev]").attr("href");
|
||||||
if (href) {
|
if (href) {
|
||||||
@@ -64,7 +63,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Danbooru.Post.nav_pool_next = function() {
|
Danbooru.Post.nav_next = function() {
|
||||||
if ($("#search-seq-nav").length) {
|
if ($("#search-seq-nav").length) {
|
||||||
var href = $("#search-seq-nav a[rel=next]").attr("href");
|
var href = $("#search-seq-nav a[rel=next]").attr("href");
|
||||||
location.href = href;
|
location.href = href;
|
||||||
@@ -76,17 +75,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Danbooru.Post.nav_pool_scroll = function() {
|
Danbooru.Post.nav_scroll_down = function() {
|
||||||
var scroll_top = $(window).scrollTop() + $(window).height();
|
var scroll_top = $(window).scrollTop() + ($(window).height() * 0.85);
|
||||||
|
Danbooru.scroll_to(scroll_top);
|
||||||
if (scroll_top > $("#image").height() + $("#image").offset().top + ($("#image").height() / 2)) {
|
}
|
||||||
Danbooru.Post.nav_pool_next();
|
|
||||||
return;
|
Danbooru.Post.nav_scroll_up = function() {
|
||||||
|
var scroll_top = $(window).scrollTop() - ($(window).height() * 0.85);
|
||||||
|
if (scroll_top < 0) {
|
||||||
|
scroll_top = 0;
|
||||||
}
|
}
|
||||||
|
Danbooru.scroll_to(scroll_top);
|
||||||
}
|
}
|
||||||
|
|
||||||
Danbooru.Post.initialize_shortcuts = function() {
|
Danbooru.Post.initialize_shortcuts = function() {
|
||||||
$(document).bind("keydown./", function(e) {
|
$(document).bind("keydown.q", function(e) {
|
||||||
$("#tags").trigger("focus");
|
$("#tags").trigger("focus");
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
@@ -98,20 +101,24 @@
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).bind("keydown.left", function(e) {
|
$(document).bind("keydown.a", function(e) {
|
||||||
Danbooru.Post.nav_pool_prev();
|
Danbooru.Post.nav_prev();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).bind("keydown.right", function(e) {
|
$(document).bind("keydown.d", function(e) {
|
||||||
Danbooru.Post.nav_pool_next();
|
Danbooru.Post.nav_next();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).bind("keydown.space", function(e) {
|
|
||||||
Danbooru.Post.nav_pool_scroll();
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(document).bind("keydown.s", function(e) {
|
||||||
|
Danbooru.Post.nav_scroll_down();
|
||||||
|
})
|
||||||
|
|
||||||
|
$(document).bind("keydown.w", function(e) {
|
||||||
|
Danbooru.Post.nav_scroll_up();
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
Danbooru.Post.initialize_links = function() {
|
Danbooru.Post.initialize_links = function() {
|
||||||
@@ -229,9 +236,7 @@
|
|||||||
$("#comments").hide();
|
$("#comments").hide();
|
||||||
$("#share").hide();
|
$("#share").hide();
|
||||||
$("#post_tag_string").focus();
|
$("#post_tag_string").focus();
|
||||||
if (Danbooru.meta("favorite-tags")) {
|
$("#related-tags-button").trigger("click");
|
||||||
$("#related-tags-button").trigger("click");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$("#edit").hide();
|
$("#edit").hide();
|
||||||
$("#comments").hide();
|
$("#comments").hide();
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
this.initialize_image();
|
this.initialize_image();
|
||||||
this.initialize_info();
|
this.initialize_info();
|
||||||
this.initialize_similar();
|
this.initialize_similar();
|
||||||
|
$("#related-tags-button").trigger("click");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,7 +26,6 @@
|
|||||||
$("#similar-button").click(function(e) {
|
$("#similar-button").click(function(e) {
|
||||||
var old_source_name = $("#upload_source").attr("name");
|
var old_source_name = $("#upload_source").attr("name");
|
||||||
var old_file_name = $("#upload_file").attr("name")
|
var old_file_name = $("#upload_file").attr("name")
|
||||||
var old_target = $("#form").attr("target");
|
|
||||||
var old_action = $("#form").attr("action");
|
var old_action = $("#form").attr("action");
|
||||||
|
|
||||||
$("#upload_source").attr("name", "url");
|
$("#upload_source").attr("name", "url");
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
$("#upload_source").attr("name", old_source_name);
|
$("#upload_source").attr("name", old_source_name);
|
||||||
$("#upload_file").attr("name", old_file_name);
|
$("#upload_file").attr("name", old_file_name);
|
||||||
$("#form").attr("target", old_target);
|
$("#form").attr("target", "");
|
||||||
$("#form").attr("action", old_action);
|
$("#form").attr("action", old_action);
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|||||||
@@ -4,9 +4,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
Danbooru.scroll_to = function(element) {
|
Danbooru.scroll_to = function(element) {
|
||||||
|
var top = null;
|
||||||
|
if (typeof(element) === "number") {
|
||||||
|
top = element;
|
||||||
|
} else {
|
||||||
|
top = element.offset().top - 10;
|
||||||
|
}
|
||||||
$('html, body').animate({
|
$('html, body').animate({
|
||||||
scrollTop: element.offset().top - 10
|
scrollTop: top
|
||||||
}, 250);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Danbooru.notice = function(msg) {
|
Danbooru.notice = function(msg) {
|
||||||
|
|||||||
@@ -16,6 +16,12 @@ class PostsController < ApplicationController
|
|||||||
|
|
||||||
def show
|
def show
|
||||||
@post = Post.find(params[:id])
|
@post = Post.find(params[:id])
|
||||||
|
|
||||||
|
if !Danbooru.config.can_user_see_post?(CurrentUser.user, @post)
|
||||||
|
redirect_to(:back, :notice => "Post #{@post.id} is not available")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
@post_flag = PostFlag.new(:post_id => @post.id)
|
@post_flag = PostFlag.new(:post_id => @post.id)
|
||||||
@post_appeal = PostAppeal.new(:post_id => @post.id)
|
@post_appeal = PostAppeal.new(:post_id => @post.id)
|
||||||
respond_with(@post)
|
respond_with(@post)
|
||||||
@@ -32,7 +38,11 @@ class PostsController < ApplicationController
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
@post = Post.find(params[:id])
|
@post = Post.find(params[:id])
|
||||||
@post.update_attributes(params[:post], :as => CurrentUser.role)
|
|
||||||
|
if Danbooru.config.can_user_see_post?(CurrentUser.user, @post)
|
||||||
|
@post.update_attributes(params[:post], :as => CurrentUser.role)
|
||||||
|
end
|
||||||
|
|
||||||
respond_with(@post) do |format|
|
respond_with(@post) do |format|
|
||||||
format.html do
|
format.html do
|
||||||
if @post.errors.any?
|
if @post.errors.any?
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ module PostAppealsHelper
|
|||||||
html << '<ul>'
|
html << '<ul>'
|
||||||
|
|
||||||
post.appeals.each do |appeal|
|
post.appeals.each do |appeal|
|
||||||
html << '<li>' + appeal.reason + ' - ' + link_to(appeal.creator.name, user_path(appeal.creator)) + ' ' + time_ago_in_words_tagged(appeal.created_at) + '</li>'
|
html << '<li>' + DText.parse_inline(appeal.reason).html_safe + ' - ' + link_to(appeal.creator.name, user_path(appeal.creator)) + ' ' + time_ago_in_words_tagged(appeal.created_at) + '</li>'
|
||||||
end
|
end
|
||||||
|
|
||||||
html << '</ul>'
|
html << '</ul>'
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ module PostFlagsHelper
|
|||||||
|
|
||||||
post.flags.each do |flag|
|
post.flags.each do |flag|
|
||||||
html << '<li>'
|
html << '<li>'
|
||||||
html << flag.reason
|
html << DText.parse_inline(flag.reason).html_safe
|
||||||
|
|
||||||
if CurrentUser.is_janitor?
|
if CurrentUser.is_janitor?
|
||||||
html << ' - ' + link_to(flag.creator.name, user_path(flag.creator))
|
html << ' - ' + link_to(flag.creator.name, user_path(flag.creator))
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class Post < ActiveRecord::Base
|
|||||||
validates_presence_of :parent, :if => lambda {|rec| !rec.parent_id.nil?}
|
validates_presence_of :parent, :if => lambda {|rec| !rec.parent_id.nil?}
|
||||||
# validate :validate_parent_does_not_have_a_parent
|
# validate :validate_parent_does_not_have_a_parent
|
||||||
attr_accessible :source, :rating, :tag_string, :old_tag_string, :last_noted_at, :parent_id, :as => [:member, :builder, :privileged, :platinum, :contributor, :janitor, :moderator, :admin, :default]
|
attr_accessible :source, :rating, :tag_string, :old_tag_string, :last_noted_at, :parent_id, :as => [:member, :builder, :privileged, :platinum, :contributor, :janitor, :moderator, :admin, :default]
|
||||||
attr_accessible :is_rating_locked, :is_note_locked, :as => [:builder, :janitor, :moderator, :admin]
|
attr_accessible :is_rating_locked, :is_note_locked, :as => [:builder, :contributor, :janitor, :moderator, :admin]
|
||||||
attr_accessible :is_status_locked, :as => [:admin]
|
attr_accessible :is_status_locked, :as => [:admin]
|
||||||
|
|
||||||
module FileMethods
|
module FileMethods
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ class Tag < ActiveRecord::Base
|
|||||||
def update_category_cache_for_all(force = false)
|
def update_category_cache_for_all(force = false)
|
||||||
if category_changed? || force
|
if category_changed? || force
|
||||||
update_category_cache
|
update_category_cache
|
||||||
|
delay(:queue => "default").update_category_post_counts if category_changed?
|
||||||
|
|
||||||
Danbooru.config.other_server_hosts.each do |host|
|
Danbooru.config.other_server_hosts.each do |host|
|
||||||
delay(:queue => host).update_category_cache
|
delay(:queue => host).update_category_cache
|
||||||
@@ -94,6 +95,14 @@ class Tag < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update_category_post_counts
|
||||||
|
old_field = "tag_count_#{Danbooru.config.reverse_tag_category_mapping[category_was]}".downcase
|
||||||
|
new_field = "tag_count_#{category_name}".downcase
|
||||||
|
Post.without_timeout do
|
||||||
|
Post.raw_tag_match(name).update_all("#{old_field} = #{old_field} - 1, #{new_field} = #{new_field} + 1")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def update_category_cache
|
def update_category_cache
|
||||||
Cache.put("tc:#{Cache.sanitize(name)}", category, 1.hour)
|
Cache.put("tc:#{Cache.sanitize(name)}", category, 1.hour)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -77,7 +77,11 @@ class Upload < ActiveRecord::Base
|
|||||||
validate_md5_uniqueness
|
validate_md5_uniqueness
|
||||||
validate_md5_confirmation
|
validate_md5_confirmation
|
||||||
calculate_file_size(file_path)
|
calculate_file_size(file_path)
|
||||||
calculate_dimensions(file_path) if has_dimensions?
|
add_file_size_tags!(file_path)
|
||||||
|
if has_dimensions?
|
||||||
|
calculate_dimensions(file_path)
|
||||||
|
add_dimension_tags!
|
||||||
|
end
|
||||||
generate_resizes(file_path)
|
generate_resizes(file_path)
|
||||||
move_file
|
move_file
|
||||||
post = convert_to_post
|
post = convert_to_post
|
||||||
@@ -172,7 +176,17 @@ class Upload < ActiveRecord::Base
|
|||||||
self.image_width = image_size.get_width
|
self.image_width = image_size.get_width
|
||||||
self.image_height = image_size.get_height
|
self.image_height = image_size.get_height
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def add_dimension_tags!
|
||||||
|
if image_width >= 10_000 || image_height >= 10_000
|
||||||
|
self.tag_string = "#{tag_string} insanely_absurdres".strip
|
||||||
|
elsif image_width >= 3200 || image_height >= 2400
|
||||||
|
self.tag_string = "#{tag_string} absurdres".strip
|
||||||
|
elsif image_width >= 1600 && image_height >= 1200
|
||||||
|
self.tag_string = "#{tag_string} highres".strip
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Does this file have image dimensions?
|
# Does this file have image dimensions?
|
||||||
def has_dimensions?
|
def has_dimensions?
|
||||||
%w(jpg gif png swf).include?(file_ext)
|
%w(jpg gif png swf).include?(file_ext)
|
||||||
@@ -363,6 +377,12 @@ class Upload < ActiveRecord::Base
|
|||||||
include UploaderMethods
|
include UploaderMethods
|
||||||
extend SearchMethods
|
extend SearchMethods
|
||||||
|
|
||||||
|
def add_file_size_tags!(file_path)
|
||||||
|
if file_size >= 10.megabytes
|
||||||
|
self.tag_string = "#{tag_string} huge_filesize".strip
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def presenter
|
def presenter
|
||||||
@presenter ||= UploadPresenter.new(self)
|
@presenter ||= UploadPresenter.new(self)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -443,10 +443,6 @@ class User < ActiveRecord::Base
|
|||||||
limit = 10 + (approved_count / 10) - (deleted_count / 4) - pending_count
|
limit = 10 + (approved_count / 10) - (deleted_count / 4) - pending_count
|
||||||
end
|
end
|
||||||
|
|
||||||
if limit > 20
|
|
||||||
limit = 20
|
|
||||||
end
|
|
||||||
|
|
||||||
if limit < 0
|
if limit < 0
|
||||||
limit = 0
|
limit = 0
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -50,12 +50,9 @@ class UserPresenter
|
|||||||
string = "base:10 + approved:(#{approved_count} / 10) - deleted:(#{deleted_count}) / 4 - pending:#{pending_count}"
|
string = "base:10 + approved:(#{approved_count} / 10) - deleted:(#{deleted_count}) / 4 - pending:#{pending_count}"
|
||||||
end
|
end
|
||||||
|
|
||||||
if limit >= 20
|
if limit < 0
|
||||||
limit = 20
|
|
||||||
string += " = capped:20"
|
|
||||||
elsif limit < 0
|
|
||||||
limit = 0
|
limit = 0
|
||||||
string += " = capped:0"
|
string += " = 0"
|
||||||
else
|
else
|
||||||
string += " = #{limit}"
|
string += " = #{limit}"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<%= sequential_paginator(@mod_actions) %>
|
<%= numbered_paginator(@mod_actions) %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -7,12 +7,13 @@
|
|||||||
|
|
||||||
<%= render "posts/partials/index/mode_menu" %>
|
<%= render "posts/partials/index/mode_menu" %>
|
||||||
|
|
||||||
|
<%= render "posts/partials/index/blacklist" %>
|
||||||
|
|
||||||
<section id="tag-box">
|
<section id="tag-box">
|
||||||
<h1>Tags</h1>
|
<h1>Tags</h1>
|
||||||
<%= @post_set.presenter.tag_list_html(self) %>
|
<%= @post_set.presenter.tag_list_html(self) %>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<%= render "posts/partials/index/blacklist" %>
|
|
||||||
<%= render "posts/partials/index/related" %>
|
<%= render "posts/partials/index/related" %>
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
This post is rating locked.
|
This post is rating locked.
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= f.label :blank, "Rating" %>
|
<%= f.label :blank, "Rating" %>
|
||||||
|
|
||||||
<fieldset class="ratings">
|
<fieldset class="ratings">
|
||||||
<%= f.radio_button :rating, :e %>
|
<%= f.radio_button :rating, :e %>
|
||||||
<%= f.label :rating_e, "Explicit" %>
|
<%= f.label :rating_e, "Explicit" %>
|
||||||
@@ -26,18 +26,18 @@
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if CurrentUser.is_builder? %>
|
<% if CurrentUser.is_builder? %>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<%= f.label :blank, "Lock" %>
|
<%= f.label :blank, "Lock" %>
|
||||||
|
|
||||||
<fieldset class="locks">
|
<fieldset class="locks">
|
||||||
<%= f.check_box :is_note_locked %>
|
<%= f.check_box :is_note_locked %>
|
||||||
<%= f.label :is_note_locked, "Notes" %>
|
<%= f.label :is_note_locked, "Notes" %>
|
||||||
|
|
||||||
<%= f.check_box :is_rating_locked %>
|
<%= f.check_box :is_rating_locked %>
|
||||||
<%= f.label :is_rating_locked, "Rating" %>
|
<%= f.label :is_rating_locked, "Rating" %>
|
||||||
|
|
||||||
<% if CurrentUser.is_admin? %>
|
<% if CurrentUser.is_admin? %>
|
||||||
<%= f.check_box :is_status_locked %>
|
<%= f.check_box :is_status_locked %>
|
||||||
<%= f.label :is_status_locked, "Status" %>
|
<%= f.label :is_status_locked, "Status" %>
|
||||||
@@ -45,25 +45,25 @@
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<%= f.label :parent_id, "Parent" %>
|
<%= f.label :parent_id, "Parent" %>
|
||||||
<%= f.text_field :parent_id, :size => 5 %>
|
<%= f.text_field :parent_id, :size => 5 %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<%= f.label :source %>
|
<%= f.label :source %>
|
||||||
<%= f.text_field :source %>
|
<%= f.text_field :source %>
|
||||||
<%= button_tag "Similar", :id => "similar-button", :type => "button" %>
|
<%= button_tag "Similar", :id => "similar-button", :type => "button" %>
|
||||||
<%= button_tag "Artist", :id => "find-artist-button", :type => "button" %>
|
<%= button_tag "Artist", :id => "find-artist-button", :type => "button" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<div>
|
<div>
|
||||||
<%= f.label :tag_string, "Tags" %>
|
<%= f.label :tag_string, "Tags" %>
|
||||||
<%= f.text_area :tag_string , :size => "50x3" %>
|
<%= f.text_area :tag_string , :size => "50x3" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= button_tag "Related tags", :id => "related-tags-button", :type => "button" %>
|
<%= button_tag "Related tags", :id => "related-tags-button", :type => "button" %>
|
||||||
<%= button_tag "Artists", :id => "related-artists-button", :type => "button" %>
|
<%= button_tag "Artists", :id => "related-artists-button", :type => "button" %>
|
||||||
<%= button_tag "Characters", :id => "related-characters-button", :type => "button" %>
|
<%= button_tag "Characters", :id => "related-characters-button", :type => "button" %>
|
||||||
@@ -73,11 +73,11 @@
|
|||||||
<div class="input">
|
<div class="input">
|
||||||
<%= submit_tag "Submit" %>
|
<%= submit_tag "Submit" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="related-tags-container">
|
<div id="related-tags-container">
|
||||||
<h1>Related Tags</h1>
|
<h1>Related Tags</h1>
|
||||||
<div id="related-tags">
|
<div id="related-tags">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
<section>
|
<section>
|
||||||
<h1>Listing</h1>
|
<h1>Listing</h1>
|
||||||
<ul>
|
<ul>
|
||||||
<li><span class="key">←</span> Previous page</li>
|
<li><span class="key">a</span> Previous page</li>
|
||||||
<li><span class="key">→</span> Next page</li>
|
<li><span class="key">d</span> Next page</li>
|
||||||
<li><span class="key">/</span> Search</li>
|
<li><span class="key">q</span> Search</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -16,10 +16,11 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li><span class="key">n</span> New note</li>
|
<li><span class="key">n</span> New note</li>
|
||||||
<li><span class="key">e</span> Edit tags</li>
|
<li><span class="key">e</span> Edit tags</li>
|
||||||
<li><span class="key">/</span> Search</li>
|
<li><span class="key">q</span> Search</li>
|
||||||
<li><span class="key">space</span> Scroll down/next post</li>
|
<li><span class="key">w</span> Scroll up</li>
|
||||||
<li><span class="key">←</span> Previous post</li>
|
<li><span class="key">s</span> Scroll down</li>
|
||||||
<li><span class="key">→</span> Next post</li>
|
<li><span class="key">a</span> Previous post</li>
|
||||||
|
<li><span class="key">d</span> Next post</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
$("#favorite_tags").val(<%= raw @user.favorite_tags.to_json %>);
|
$("#user_favorite_tags").val(<%= raw @user.favorite_tags.to_json %>);
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class CommentTest < ActiveSupport::TestCase
|
|||||||
comment_vote = c1.vote!("up")
|
comment_vote = c1.vote!("up")
|
||||||
assert_equal([], comment_vote.errors.full_messages)
|
assert_equal([], comment_vote.errors.full_messages)
|
||||||
comment_vote = c1.vote!("up")
|
comment_vote = c1.vote!("up")
|
||||||
assert_equal(["User has already voted for this comment"], comment_vote.errors.full_messages)
|
assert_equal(["You have already voted for this comment"], comment_vote.errors.full_messages)
|
||||||
assert_equal(1, CommentVote.count)
|
assert_equal(1, CommentVote.count)
|
||||||
assert_equal(1, CommentVote.last.score)
|
assert_equal(1, CommentVote.last.score)
|
||||||
|
|
||||||
|
|||||||
@@ -373,6 +373,12 @@ class PostTest < ActiveSupport::TestCase
|
|||||||
should "update the category cache of the tag" do
|
should "update the category cache of the tag" do
|
||||||
assert_equal(Tag.categories.copyright, Cache.get("tc:abc"))
|
assert_equal(Tag.categories.copyright, Cache.get("tc:abc"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "update the tag counts of the posts" do
|
||||||
|
assert_equal(0, @post.tag_count_artist)
|
||||||
|
assert_equal(1, @post.tag_count_copyright)
|
||||||
|
assert_equal(0, @post.tag_count_general)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "tagged with a metatag" do
|
context "tagged with a metatag" do
|
||||||
|
|||||||
@@ -22,6 +22,31 @@ class UploadTest < ActiveSupport::TestCase
|
|||||||
teardown do
|
teardown do
|
||||||
FileUtils.rm_f(Dir.glob("#{Rails.root}/tmp/test.*"))
|
FileUtils.rm_f(Dir.glob("#{Rails.root}/tmp/test.*"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "that has insanely absurd res dimensions" do
|
||||||
|
setup do
|
||||||
|
@upload = FactoryGirl.build(:jpg_upload, :tag_string => "")
|
||||||
|
@upload.image_width = 10_000
|
||||||
|
@upload.image_height = 10
|
||||||
|
@upload.add_dimension_tags!
|
||||||
|
end
|
||||||
|
|
||||||
|
should "have the insanely_absurdres tag" do
|
||||||
|
assert_match(/insanely_absurdres/, @upload.tag_string)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "that has a large flie size" do
|
||||||
|
setup do
|
||||||
|
@upload = FactoryGirl.build(:jpg_upload, :tag_string => "")
|
||||||
|
@upload.file_size = 11.megabytes
|
||||||
|
@upload.add_file_size_tags!(@upload.file_path)
|
||||||
|
end
|
||||||
|
|
||||||
|
should "have the huge_filesize tag" do
|
||||||
|
assert_match(/huge_filesize/, @upload.tag_string)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "image size calculator" do
|
context "image size calculator" do
|
||||||
should "discover the dimensions for a JPG" do
|
should "discover the dimensions for a JPG" do
|
||||||
@@ -81,17 +106,17 @@ class UploadTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
context "determining if a file is downloadable" do
|
context "determining if a file is downloadable" do
|
||||||
should "classify HTTP sources as downloadable" do
|
should "classify HTTP sources as downloadable" do
|
||||||
@upload = FactoryGirl.create(:source_upload, source: "http://www.example.com/1.jpg")
|
@upload = FactoryGirl.create(:source_upload, :source => "http://www.example.com/1.jpg")
|
||||||
assert_not_nil(@upload.is_downloadable?)
|
assert_not_nil(@upload.is_downloadable?)
|
||||||
end
|
end
|
||||||
|
|
||||||
should "classify HTTPS sources as downloadable" do
|
should "classify HTTPS sources as downloadable" do
|
||||||
@upload = FactoryGirl.create(:source_upload, source: "https://www.example.com/1.jpg")
|
@upload = FactoryGirl.create(:source_upload, :source => "https://www.example.com/1.jpg")
|
||||||
assert_not_nil(@upload.is_downloadable?)
|
assert_not_nil(@upload.is_downloadable?)
|
||||||
end
|
end
|
||||||
|
|
||||||
should "classify non-HTTP/HTTPS sources as not downloadable" do
|
should "classify non-HTTP/HTTPS sources as not downloadable" do
|
||||||
@upload = FactoryGirl.create(:source_upload, source: "ftp://www.example.com/1.jpg")
|
@upload = FactoryGirl.create(:source_upload, :source => "ftp://www.example.com/1.jpg")
|
||||||
assert_nil(@upload.is_downloadable?)
|
assert_nil(@upload.is_downloadable?)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user