Merge branch 'master' of github.com:r888888888/danbooru
This commit is contained in:
@@ -57,7 +57,7 @@
|
||||
var link = $("<a/>");
|
||||
var count = $("<span/>");
|
||||
|
||||
link.html(entry.tags);
|
||||
link.text(entry.tags);
|
||||
link.click(Danbooru.Blacklist.toggle_entry);
|
||||
count.html(entry.hits);
|
||||
item.append(link);
|
||||
|
||||
@@ -15,6 +15,11 @@ $(function() {
|
||||
Danbooru.Cookie.put('hide_upgrade_account_notice', '1', 7);
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$("#close-notice-link").click(function(e) {
|
||||
$('#notice').fadeOut("fast");
|
||||
e.preventDefault();
|
||||
});
|
||||
});
|
||||
|
||||
var Danbooru = {};
|
||||
|
||||
@@ -89,25 +89,36 @@ Danbooru.Note = {
|
||||
|
||||
scale: function($note_box) {
|
||||
var $image = $("#image");
|
||||
var ratio = $image.width() / parseFloat($("#image").data("original-width"));
|
||||
var $note = $("#notes > article[data-id=" + $note_box.data("id") + "]");
|
||||
var ratio = $image.width() / parseFloat($image.data("original-width"));
|
||||
var MIN_SIZE = 5;
|
||||
$note_box.css({
|
||||
top: Math.ceil(parseFloat($note.data("y")) * ratio),
|
||||
left: Math.ceil(parseFloat($note.data("x")) * ratio),
|
||||
width: Math.ceil(parseFloat($note.data("width")) * ratio),
|
||||
height: Math.ceil(parseFloat($note.data("height")) * ratio)
|
||||
top: Math.ceil(parseFloat($note_box.data("y")) * ratio),
|
||||
left: Math.ceil(parseFloat($note_box.data("x")) * ratio),
|
||||
width: Math.max(MIN_SIZE, Math.ceil(parseFloat($note_box.data("width")) * ratio)),
|
||||
height: Math.max(MIN_SIZE, Math.ceil(parseFloat($note_box.data("height")) * ratio))
|
||||
});
|
||||
Danbooru.Note.Box.resize_inner_border($note_box);
|
||||
},
|
||||
|
||||
scale_all: function() {
|
||||
var container = document.getElementById('note-container');
|
||||
// Hide notes while rescaling, to prevent unnecessary reflowing
|
||||
var was_visible = container.style.display != 'none';
|
||||
if (was_visible) container.style.display = 'none';
|
||||
$(".note-box").each(function(i, v) {
|
||||
Danbooru.Note.Box.scale($(v));
|
||||
});
|
||||
if (was_visible) container.style.display = 'block';
|
||||
},
|
||||
|
||||
toggle_all: function() {
|
||||
$(".note-box").toggle();
|
||||
// Ignore the click event when adding a note
|
||||
if ((new Date).getTime() < Danbooru.Note.ignore_click_until) {
|
||||
return;
|
||||
}
|
||||
var is_hidden = document.getElementById('note-container').style.display == 'none';
|
||||
// Why does toggle() not work here?
|
||||
$("#note-container").toggle(is_hidden);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -158,6 +169,10 @@ Danbooru.Note = {
|
||||
Danbooru.Note.Body.hide_all();
|
||||
Danbooru.Note.clear_timeouts();
|
||||
var $note_body = Danbooru.Note.Body.find(id);
|
||||
if (!$note_body.data('resized')) {
|
||||
Danbooru.Note.Body.resize($note_body);
|
||||
$note_body.data('resized', 'true');
|
||||
}
|
||||
$note_body.show();
|
||||
Danbooru.Note.Body.initialize($note_body);
|
||||
},
|
||||
@@ -212,7 +227,7 @@ Danbooru.Note = {
|
||||
}
|
||||
} while ((hi - lo) > 4)
|
||||
if ($note_body.height() > h) {
|
||||
$note_body.css("minWidth", hi);
|
||||
$note_body.css("min-width", hi);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -419,7 +434,6 @@ Danbooru.Note = {
|
||||
|
||||
Danbooru.Note.TranslationMode.active = true;
|
||||
$("#original-file-link").click();
|
||||
$("#image").one("click", function() { $(".note-box").show() }); /* override the 'hide all note boxes' click event */
|
||||
$("#image").one("mousedown", Danbooru.Note.TranslationMode.Drag.start);
|
||||
$(window).bind("mouseup", Danbooru.Note.TranslationMode.Drag.stop);
|
||||
Danbooru.notice('Click or drag on the image to create a note (shortcut is <span class="key">n</span>)');
|
||||
@@ -433,17 +447,26 @@ Danbooru.Note = {
|
||||
Danbooru.Note.TranslationMode.active = false;
|
||||
var offset = $("#image").offset();
|
||||
|
||||
if(dragged) {
|
||||
if(w > 9 && h > 9) { /* minimum note size: 10px */
|
||||
Danbooru.Note.new(x-offset.left,y-offset.top,w,h);
|
||||
if (dragged) {
|
||||
if (w > 9 || h > 9) { /* minimum note size: 10px */
|
||||
if (w <= 9) {
|
||||
w = 10;
|
||||
} else if (h <= 9) {
|
||||
h = 10;
|
||||
}
|
||||
Danbooru.Note.new(x - offset.left, y - offset.top, w, h);
|
||||
}
|
||||
} else {
|
||||
Danbooru.Note.new(e.pageX - offset.left, e.pageY - offset.top);
|
||||
}
|
||||
Danbooru.Note.TranslationMode.stop();
|
||||
$(".note-box").show();
|
||||
$("#note-container").show();
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
// Hack to ignore clicks for some milliseconds
|
||||
// The mouseup event is executed before the click event, so it's hard to do this properly
|
||||
Danbooru.Note.ignore_click_until = (new Date).getTime() + 200;
|
||||
},
|
||||
|
||||
Drag: {
|
||||
@@ -506,10 +529,10 @@ Danbooru.Note = {
|
||||
Danbooru.Note.TranslationMode.Drag.h = -Danbooru.Note.TranslationMode.Drag.dragDistanceY;
|
||||
}
|
||||
|
||||
$('#note-helper').css({ /* preview of the note you are dragging */
|
||||
$('#note-preview').css({
|
||||
display: 'block',
|
||||
left: (Danbooru.Note.TranslationMode.Drag.x - offset.left + 1),
|
||||
top: (Danbooru.Note.TranslationMode.Drag.y - offset.top + 1),
|
||||
left: (Danbooru.Note.TranslationMode.Drag.x + 1),
|
||||
top: (Danbooru.Note.TranslationMode.Drag.y + 1),
|
||||
width: (Danbooru.Note.TranslationMode.Drag.w - 3),
|
||||
height: (Danbooru.Note.TranslationMode.Drag.h - 3)
|
||||
});
|
||||
@@ -523,7 +546,7 @@ Danbooru.Note = {
|
||||
$(window).unbind("mousemove");
|
||||
|
||||
if(Danbooru.Note.TranslationMode.Drag.dragging) {
|
||||
$('#note-helper').css({display:'none'});
|
||||
$('#note-preview').css({display:'none'});
|
||||
Danbooru.Note.TranslationMode.create_note(e, true, Danbooru.Note.TranslationMode.Drag.x, Danbooru.Note.TranslationMode.Drag.y, Danbooru.Note.TranslationMode.Drag.w-1, Danbooru.Note.TranslationMode.Drag.h-1);
|
||||
Danbooru.Note.TranslationMode.Drag.dragging = false; /* border of the note is pixel-perfect on the preview border */
|
||||
} else { /* no dragging -> create a normal note */
|
||||
@@ -541,24 +564,21 @@ Danbooru.Note = {
|
||||
editing: false,
|
||||
timeouts: [],
|
||||
pending: {},
|
||||
ignore_click_until: 0,
|
||||
|
||||
add: function(id, x, y, w, h, text) {
|
||||
add: function(container, id, x, y, w, h, text) {
|
||||
var $note_box = Danbooru.Note.Box.create(id);
|
||||
var $note_body = Danbooru.Note.Body.create(id);
|
||||
|
||||
$note_box.css({
|
||||
left: x,
|
||||
top: y,
|
||||
width: w,
|
||||
height: h,
|
||||
display: 'none'
|
||||
});
|
||||
|
||||
$("#note-container").append($note_box);
|
||||
$("#note-container").append($note_body);
|
||||
$note_box.data('x', x);
|
||||
$note_box.data('y', y);
|
||||
$note_box.data('width', w);
|
||||
$note_box.data('height', h);
|
||||
container.appendChild($note_box[0]);
|
||||
container.appendChild($note_body[0]);
|
||||
$note_body.data("original-body", text);
|
||||
Danbooru.Note.Box.scale($note_box);
|
||||
Danbooru.Note.Body.set_text($note_body, text);
|
||||
Danbooru.Note.Body.display_text($note_body, text);
|
||||
},
|
||||
|
||||
new: function(x, y, w, h) {
|
||||
@@ -574,7 +594,6 @@ Danbooru.Note = {
|
||||
$note_body.html("<em>Click to edit</em>");
|
||||
$("#note-container").append($note_box);
|
||||
$("#note-container").append($note_body);
|
||||
Danbooru.Note.Body.resize($note_body);
|
||||
Danbooru.Note.Box.resize_inner_border($note_box);
|
||||
Danbooru.Note.id += "x";
|
||||
},
|
||||
@@ -588,9 +607,11 @@ Danbooru.Note = {
|
||||
},
|
||||
|
||||
load_all: function() {
|
||||
var fragment = document.createDocumentFragment();
|
||||
$.each($("#notes article"), function(i, article) {
|
||||
var $article = $(article);
|
||||
Danbooru.Note.add(
|
||||
fragment,
|
||||
$article.data("id"),
|
||||
$article.data("x"),
|
||||
$article.data("y"),
|
||||
@@ -599,12 +620,7 @@ Danbooru.Note = {
|
||||
$article.html()
|
||||
);
|
||||
});
|
||||
|
||||
$('#note-container').css('display','none');
|
||||
$('.note-box').each(function(i, v) {
|
||||
$(v).css('display','block')
|
||||
});
|
||||
$('#note-container').css('display','block');
|
||||
$("#note-container").append(fragment);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Danbooru.Post.pending_update_count = 0;
|
||||
|
||||
Danbooru.Post.initialize_all = function() {
|
||||
this.initialize_titles();
|
||||
this.initialize_post_previews();
|
||||
|
||||
if ($("#c-posts").length) {
|
||||
if (Danbooru.meta("enable-js-navigation") === "true") {
|
||||
@@ -182,9 +182,10 @@
|
||||
});
|
||||
}
|
||||
|
||||
Danbooru.Post.initialize_titles = function() {
|
||||
Danbooru.Post.initialize_post_previews = function() {
|
||||
$(".post-preview").each(function(i, v) {
|
||||
Danbooru.Post.initialize_title_for(v);
|
||||
Danbooru.Post.initialize_preview_borders_for(v);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -194,6 +195,36 @@
|
||||
$img.attr("title", $post.attr("data-tags") + " user:" + $post.attr("data-uploader") + " rating:" + $post.data("rating") + " score:" + $post.data("score"));
|
||||
}
|
||||
|
||||
Danbooru.Post.initialize_preview_borders_for = function(post) {
|
||||
var $post = $(post);
|
||||
var $img = $post.find("img");
|
||||
|
||||
var border_colors = [];
|
||||
|
||||
if ($post.hasClass("post-status-has-children")) {
|
||||
border_colors.push("#0F0");
|
||||
}
|
||||
if ($post.hasClass("post-status-has-parent")) {
|
||||
border_colors.push("#CC0");
|
||||
}
|
||||
if ($post.hasClass("post-status-deleted")) {
|
||||
border_colors.push("#000");
|
||||
} else if ($post.hasClass("post-status-pending")) {
|
||||
border_colors.push("#00F");
|
||||
} else if ($post.hasClass("post-status-flagged")) {
|
||||
border_colors.push("#F00");
|
||||
}
|
||||
|
||||
if (border_colors.length > 1) {
|
||||
$img.css("border", "2px solid");
|
||||
if (border_colors.length === 3) {
|
||||
$img.css("border-color", border_colors[0] + " " + border_colors[2] + " " + border_colors[2] + " " + border_colors[1]);
|
||||
} else if (border_colors.length === 2) {
|
||||
$img.css("border-color", border_colors[0] + " " + border_colors[1] + " " + border_colors[1] + " " + border_colors[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Danbooru.Post.initialize_post_image_resize_links = function() {
|
||||
$("#image-resize-link").click(function(e) {
|
||||
var $link = $(e.target);
|
||||
|
||||
@@ -164,7 +164,7 @@
|
||||
var $ul = $("<ul/>");
|
||||
$ul.append(
|
||||
$("<li/>").append(
|
||||
$("<em/>").html(
|
||||
$("<em/>").text(
|
||||
query.replace(/_/g, " ")
|
||||
)
|
||||
)
|
||||
@@ -173,7 +173,7 @@
|
||||
$.each(related_tags, function(i, tag) {
|
||||
if (tag[0][0] !== " ") {
|
||||
var $link = $("<a/>");
|
||||
$link.html(tag[0].replace(/_/g, " "));
|
||||
$link.text(tag[0].replace(/_/g, " "));
|
||||
$link.addClass("tag-type-" + tag[1]);
|
||||
$link.attr("href", "/posts?tags=" + encodeURIComponent(tag[0]));
|
||||
$link.click(Danbooru.RelatedTag.toggle_tag);
|
||||
@@ -184,7 +184,7 @@
|
||||
$("<li/>").append($link)
|
||||
);
|
||||
} else {
|
||||
$ul.append($("<li/>").html(tag[0]));
|
||||
$ul.append($("<li/>").text(tag[0]));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
}
|
||||
|
||||
Danbooru.notice = function(msg) {
|
||||
$('#notice').html(msg).addClass("ui-state-highlight").removeClass("ui-state-error").fadeIn("fast");
|
||||
$('#notice').addClass("ui-state-highlight").removeClass("ui-state-error").fadeIn("fast").children("span").html(msg);
|
||||
}
|
||||
|
||||
Danbooru.error = function(msg) {
|
||||
$('#notice').html(msg).removeClass("ui-state-highlight").addClass("ui-state-error").fadeIn("fast");
|
||||
$('#notice').removeClass("ui-state-highlight").addClass("ui-state-error").fadeIn("fast").children("span").html(msg);
|
||||
Danbooru.scroll_to($("#notice"));
|
||||
}
|
||||
|
||||
|
||||
@@ -12,3 +12,7 @@ div#notice {
|
||||
margin: 1em 0;
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
a#close-notice-link {
|
||||
float: right;
|
||||
}
|
||||
|
||||
7
app/assets/stylesheets/specific/news_updates.css.scss
Normal file
7
app/assets/stylesheets/specific/news_updates.css.scss
Normal file
@@ -0,0 +1,7 @@
|
||||
div#c-news-updates {
|
||||
div#a-edit, div#a-new {
|
||||
.hint {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,14 +55,14 @@ div#note-container {
|
||||
border: 1px solid red;
|
||||
}
|
||||
}
|
||||
|
||||
div#note-helper {
|
||||
position: absolute;
|
||||
border: 1px solid red;
|
||||
opacity: 0.6;
|
||||
display: none;
|
||||
background: white;
|
||||
}
|
||||
}
|
||||
|
||||
div#note-preview {
|
||||
position: absolute;
|
||||
border: 1px solid red;
|
||||
opacity: 0.6;
|
||||
display: none;
|
||||
background: white;
|
||||
}
|
||||
|
||||
div.note-edit-dialog {
|
||||
|
||||
@@ -134,8 +134,8 @@ body.mode-tag-script {
|
||||
div#c-posts {
|
||||
div.notice {
|
||||
font-size: 0.8em;
|
||||
padding: 1em;
|
||||
margin-bottom: 1em;
|
||||
padding: 0.5em;
|
||||
margin-bottom: 0.5em;
|
||||
overflow: hidden;
|
||||
|
||||
ul {
|
||||
@@ -153,7 +153,7 @@ div#c-posts {
|
||||
}
|
||||
|
||||
div.nav-notice {
|
||||
padding: 1em;
|
||||
padding: 0.5em;
|
||||
margin-bottom: 1em;
|
||||
background: #EEE;
|
||||
border: 1px solid #AAA;
|
||||
@@ -249,7 +249,7 @@ div#c-posts {
|
||||
|
||||
#nav-links {
|
||||
margin: 1em 0;
|
||||
padding: 1em 0.5em;
|
||||
padding: 0.5em;
|
||||
}
|
||||
|
||||
#content.with-ads {
|
||||
@@ -262,6 +262,8 @@ div#c-posts {
|
||||
}
|
||||
|
||||
#pool-nav, #search-seq-nav, #nav-help {
|
||||
margin: 0px 0px 0.5em 0px;
|
||||
|
||||
li {
|
||||
position: relative;
|
||||
text-align: center;
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
class FavoritesController < ApplicationController
|
||||
before_filter :member_only
|
||||
respond_to :html, :xml, :json
|
||||
|
||||
def index
|
||||
if params[:tags]
|
||||
redirect_to(posts_path(:tags => params[:tags]))
|
||||
elsif params[:user_id]
|
||||
@favorite_set = PostSets::Favorite.new(User.find(params[:user_id]), params[:page], params)
|
||||
else
|
||||
@favorite_set = PostSets::Favorite.new(CurrentUser.user, params[:page], params)
|
||||
user_id = params[:user_id] || CurrentUser.user.id
|
||||
@favorite_set = PostSets::Favorite.new(user_id, params[:page], params)
|
||||
respond_with(@favorite_set.posts) do |format|
|
||||
format.xml do
|
||||
render :xml => @favorite_set.posts.to_xml(:root => "posts")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ module ArtistsHelper
|
||||
if artist
|
||||
link_to(artist.name, artist_path(artist))
|
||||
else
|
||||
link_to(name, new_artist_path(:name => name)) + " " + content_tag("span", "*", :class => "new-artist")
|
||||
link_to(name, new_artist_path(:name => name)) + " " + content_tag("span", "*", :class => "new-artist", :title => "No artist with this name currently exists.")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,2 +1,36 @@
|
||||
module WikiPagesHelper
|
||||
def wiki_page_alias_and_implication_list(wiki_page)
|
||||
antecedent_alias = wiki_page.presenter.antecedent_tag_alias
|
||||
consequent_aliases = wiki_page.presenter.consequent_tag_aliases
|
||||
antecedent_implications = wiki_page.presenter.antecedent_tag_implications
|
||||
consequent_implications = wiki_page.presenter.consequent_tag_implications
|
||||
|
||||
html = ""
|
||||
|
||||
if antecedent_alias
|
||||
html << "<p class='hint'>This tag has been aliased to "
|
||||
html << link_to(antecedent_alias.consequent_name, show_or_new_wiki_pages_path(:title => antecedent_alias.consequent_name))
|
||||
html << ".</p>"
|
||||
end
|
||||
|
||||
if consequent_aliases.any?
|
||||
html << "<p class='hint'>The following tags are aliased to this tag: "
|
||||
html << raw(consequent_aliases.map {|x| link_to(x.antecedent_name, show_or_new_wiki_pages_path(:title => x.antecedent_name))}.join(", "))
|
||||
html << ".</p>"
|
||||
end
|
||||
|
||||
if antecedent_implications.any?
|
||||
html << "<p class='hint'>This tag implicates "
|
||||
html << raw(antecedent_implications.map {|x| link_to(x.consequent_name, show_or_new_wiki_pages_path(:title => x.consequent_name))}.join(", "))
|
||||
html << ".</p>"
|
||||
end
|
||||
|
||||
if consequent_implications.any?
|
||||
html << "<p class='hint'>The following tags implicate this tag: "
|
||||
html << raw(consequent_implications.map {|x| link_to(x.antecedent_name, show_or_new_wiki_pages_path(:title => x.antecedent_name))}.join(", "))
|
||||
html << ".</p>"
|
||||
end
|
||||
|
||||
html.html_safe
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class NewsUpdate < ActiveRecord::Base
|
||||
belongs_to :creator, :class_name => "User"
|
||||
belongs_to :udpater, :class_name => "User"
|
||||
belongs_to :updater, :class_name => "User"
|
||||
scope :recent, order("created_at desc").limit(5)
|
||||
before_validation :initialize_creator, :on => :create
|
||||
before_validation :initialize_updater
|
||||
|
||||
@@ -68,9 +68,6 @@ class PostFlag < ActiveRecord::Base
|
||||
if post.is_deleted?
|
||||
errors[:post] << "is deleted"
|
||||
false
|
||||
elsif post.is_pending?
|
||||
errors[:post] << "is pending"
|
||||
false
|
||||
else
|
||||
true
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ class TagSubscription < ActiveRecord::Base
|
||||
before_save :limit_tag_count
|
||||
attr_accessible :name, :tag_query, :post_ids, :is_public, :is_visible_on_profile
|
||||
validates_presence_of :name, :tag_query, :creator_id
|
||||
validates_format_of :tag_query, :with => /^(?:\S+\s*){1,20}$/m, :message => "can have up to 20 tags"
|
||||
validates_format_of :tag_query, :with => /\A(?:\S*\s*){1,20}\Z/, :message => "can have up to 20 tags"
|
||||
validate :creator_can_create_subscriptions, :on => :create
|
||||
|
||||
def normalize_name
|
||||
|
||||
@@ -510,13 +510,15 @@ class User < ActiveRecord::Base
|
||||
|
||||
module ApiMethods
|
||||
def hidden_attributes
|
||||
super + [:password_hash, :bcrypt_password_hash, :email, :email_verification_key, :time_zone, :created_at, :updated_at, :receive_email_notifications, :last_logged_in_at, :last_forum_read_at, :has_mail, :default_image_size, :comment_threshold, :always_resize_images, :favorite_tags, :blacklisted_tags, :base_upload_limit, :recent_tags, :enable_privacy_mode, :enable_post_navigation, :new_post_navigation_layout, :enable_sequential_post_navigation, :hide_deleted_posts, :per_page, :style_usernames]
|
||||
super + [:password_hash, :bcrypt_password_hash, :email, :email_verification_key, :time_zone, :updated_at, :receive_email_notifications, :last_logged_in_at, :last_forum_read_at, :has_mail, :default_image_size, :comment_threshold, :always_resize_images, :favorite_tags, :blacklisted_tags, :recent_tags, :enable_privacy_mode, :enable_post_navigation, :new_post_navigation_layout, :enable_sequential_post_navigation, :hide_deleted_posts, :per_page, :style_usernames]
|
||||
end
|
||||
|
||||
def serializable_hash(options = {})
|
||||
options ||= {}
|
||||
options[:except] ||= []
|
||||
options[:except] += hidden_attributes
|
||||
options[:methods] ||= []
|
||||
options[:methods] += [:wiki_page_version_count, :artist_version_count, :pool_version_count, :forum_post_count, :comment_count]
|
||||
super(options)
|
||||
end
|
||||
|
||||
@@ -525,6 +527,8 @@ class User < ActiveRecord::Base
|
||||
options ||= {}
|
||||
options[:except] ||= []
|
||||
options[:except] += hidden_attributes
|
||||
options[:methods] ||= []
|
||||
options[:methods] += [:wiki_page_version_count, :artist_version_count, :pool_version_count, :forum_post_count, :comment_count]
|
||||
super(options, &block)
|
||||
end
|
||||
|
||||
@@ -538,6 +542,28 @@ class User < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
module CountMethods
|
||||
def wiki_page_version_count
|
||||
WikiPageVersion.for_user(id).count
|
||||
end
|
||||
|
||||
def artist_version_count
|
||||
ArtistVersion.for_user(id).count
|
||||
end
|
||||
|
||||
def pool_version_count
|
||||
PoolVersion.for_user(id).count
|
||||
end
|
||||
|
||||
def forum_post_count
|
||||
ForumPost.for_user(id).count
|
||||
end
|
||||
|
||||
def comment_count
|
||||
Comment.for_creator(id).count
|
||||
end
|
||||
end
|
||||
|
||||
module SearchMethods
|
||||
def named(name)
|
||||
where("lower(name) = ?", name)
|
||||
@@ -628,6 +654,7 @@ class User < ActiveRecord::Base
|
||||
include LimitMethods
|
||||
include InvitationMethods
|
||||
include ApiMethods
|
||||
include CountMethods
|
||||
extend SearchMethods
|
||||
|
||||
def initialize_default_image_size
|
||||
|
||||
@@ -181,7 +181,7 @@ class PostPresenter < Presenter
|
||||
end
|
||||
|
||||
def pool_link_html(template, pool, options = {})
|
||||
pool_html = ['<li id="nav-link-for-pool-#{pool.id}">']
|
||||
pool_html = ["<li id='nav-link-for-pool-#{pool.id}'>"]
|
||||
match_found = false
|
||||
|
||||
if options[:include_rel]
|
||||
|
||||
@@ -80,7 +80,7 @@ class UserPresenter
|
||||
end
|
||||
|
||||
def comment_count(template)
|
||||
template.link_to(Comment.for_creator(user.id).count, template.comments_path(:search => {:creator_id => user.id}, :group_by => "comment"))
|
||||
template.link_to(user.comment_count, template.comments_path(:search => {:creator_id => user.id}, :group_by => "comment"))
|
||||
end
|
||||
|
||||
def commented_posts_count(template)
|
||||
@@ -100,19 +100,19 @@ class UserPresenter
|
||||
end
|
||||
|
||||
def wiki_page_version_count(template)
|
||||
template.link_to(WikiPageVersion.for_user(user.id).count, template.wiki_page_versions_path(:search => {:updater_id => user.id}))
|
||||
template.link_to(user.wiki_page_version_count, template.wiki_page_versions_path(:search => {:updater_id => user.id}))
|
||||
end
|
||||
|
||||
def artist_version_count(template)
|
||||
template.link_to(ArtistVersion.for_user(user.id).count, template.artist_versions_path(:search => {:updater_id => user.id}))
|
||||
template.link_to(user.artist_version_count, template.artist_versions_path(:search => {:updater_id => user.id}))
|
||||
end
|
||||
|
||||
def forum_post_count(template)
|
||||
template.link_to(ForumPost.for_user(user.id).count, template.forum_posts_path(:search => {:creator_id => user.id}))
|
||||
template.link_to(user.forum_post_count, template.forum_posts_path(:search => {:creator_id => user.id}))
|
||||
end
|
||||
|
||||
def pool_version_count(template)
|
||||
template.link_to(PoolVersion.for_user(user.id).count, template.pool_versions_path(:search => {:updater_id => user.id}))
|
||||
template.link_to(user.pool_version_count, template.pool_versions_path(:search => {:updater_id => user.id}))
|
||||
end
|
||||
|
||||
def inviter(template)
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<% end %>
|
||||
<li><%= link_to "History", artist_versions_path(:search => {:artist_id => @artist.id}) %></li>
|
||||
<% if CurrentUser.is_admin? %>
|
||||
<%= link_to "Ban", ban_artist_path(@artist), :method => :put %>
|
||||
<%= link_to "Ban", ban_artist_path(@artist), :method => :put, :confirm => "Are you sure you want to ban this artist?" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</menu>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<% if @post || @posts %>
|
||||
<li><%= link_to "Reply", new_comment_path(:post_id => comment.post_id), :class => "reply-link", "data-comment-id" => comment.id %></li>
|
||||
<% if comment.editable_by?(CurrentUser.user) %>
|
||||
<li><%= link_to "Delete", comment_path(comment.id), :confirm => "Do you really want to delete this comment?", :method => :delete, :remote => true %></li>
|
||||
<li><%= link_to "Delete", comment_path(comment.id), :confirm => "Are you sure you want to delete this comment?", :method => :delete, :remote => true %></li>
|
||||
<li><%= link_to "Edit", edit_comment_path(comment.id) %></li>
|
||||
<% end %>
|
||||
<li id="comment-vote-up-link-for-<%= comment.id %>"><%= link_to "Vote up", comment_votes_path(:comment_id => comment.id, :score => "up"), :method => :post, :remote => true %></li>
|
||||
|
||||
@@ -34,3 +34,7 @@
|
||||
</table>
|
||||
|
||||
<%= numbered_paginator(@delayed_jobs) %>
|
||||
|
||||
<% content_for(:page_title) do %>
|
||||
Delayed Jobs - <%= Danbooru.config.app_name %>
|
||||
<% end %>
|
||||
|
||||
@@ -56,11 +56,10 @@
|
||||
<%= render "users/tos" %>
|
||||
<% end %>
|
||||
|
||||
<%- if flash[:notice] -%>
|
||||
<div class="ui-corner-all ui-state-highlight" id="notice"><%= flash[:notice] %></div>
|
||||
<%- else -%>
|
||||
<div class="ui-corner-all ui-state-highlight" id="notice" style="display: none;"></div>
|
||||
<%- end -%>
|
||||
<div class="ui-corner-all ui-state-highlight" id="notice" style="<%= "display: none;" unless flash[:notice] %>">
|
||||
<span><%= flash[:notice] %></span>
|
||||
<a href="#" id="close-notice-link">close</a>
|
||||
</div>
|
||||
|
||||
<%= yield :layout %>
|
||||
</div>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<tbody>
|
||||
<% @news_updates.each do |news_update| %>
|
||||
<tr id="news-update-<%= news_update.id %>">
|
||||
<td><%= news_update.creator.name %></td>
|
||||
<td><%= link_to_user news_update.creator %></td>
|
||||
<td><%= news_update.message %></td>
|
||||
<td><%= link_to "Edit", edit_news_update_path(news_update) %> | <%= link_to "Delete", news_update_path(news_update), :method => :delete %></td>
|
||||
</tr>
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<div class="input">
|
||||
<div>
|
||||
<%= f.label :tag_string, "Tags" %>
|
||||
<%= f.text_area :tag_string , :size => "50x5", :value => post.presenter.categorized_tag_string + " " %>
|
||||
<%= f.text_area :tag_string, :size => "50x5", :value => post.presenter.categorized_tag_string + " " %>
|
||||
</div>
|
||||
|
||||
<%= button_tag "Related tags", :id => "related-tags-button", :type => "button" %>
|
||||
|
||||
@@ -41,7 +41,8 @@
|
||||
<%= render "posts/partials/show/notices", :post => @post %>
|
||||
|
||||
<section id="image-container" data-tags="<%= @post.tag_string %>" data-user="<%= @post.uploader_name %>" data-rating="<%= @post.rating %>" data-flags="<%= @post.status_flags %>">
|
||||
<div id="note-container"><div id="note-helper"></div></div>
|
||||
<div id="note-container"></div>
|
||||
<div id="note-preview"></div>
|
||||
<%= @post.presenter.image_html(self) %>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= simple_form_for(@tag_subscription) do |f| %>
|
||||
<%= f.input :name %>
|
||||
<%= f.input :tag_query, :as => :string %>
|
||||
<%= f.input :tag_query %>
|
||||
<div class="input">
|
||||
<label for="tag_subscription_is_public">
|
||||
<%= check_box "tag_subscription", "is_public" %>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<div id="c-user-feedbacks">
|
||||
<div id="a-show">
|
||||
<h1>User Feedback For <%= @user_feedback.user_name %></h1>
|
||||
<h1>User Feedback For <%= link_to_user @user_feedback.user %></h1>
|
||||
|
||||
<ul>
|
||||
<li><strong>Creator</strong> <%= @user_feedback.creator.name %></li>
|
||||
<li><strong>Creator</strong> <%= link_to_user @user_feedback.creator %></li>
|
||||
<li><strong>Date</strong> <%= @user_feedback.created_at %></li>
|
||||
<li><strong>Category</strong> <%= @user_feedback.category %></li>
|
||||
<li><strong>Message</strong> <%= format_text @user_feedback.body %></li>
|
||||
|
||||
@@ -13,21 +13,7 @@
|
||||
|
||||
<%= render "form" %>
|
||||
|
||||
<% if @wiki_page.presenter.antecedent_tag_alias %>
|
||||
<p class="hint">This tag has been aliased to <%= link_to @wiki_page.presenter.antecedent_tag_alias.consequent_name, show_or_new_wiki_pages_path(:title => @wiki_page.presenter.antecedent_tag_alias.consequent_name) %>.</p>
|
||||
<% end %>
|
||||
|
||||
<% if @wiki_page.presenter.consequent_tag_aliases.any? %>
|
||||
<p class="hint">The following tags are aliased to this tag: <%= raw @wiki_page.presenter.consequent_tag_aliases.map {|x| link_to(x.antecedent_name, show_or_new_wiki_pages_path(:title => x.antecedent_name))}.join(", ") %>.</p>
|
||||
<% end %>
|
||||
|
||||
<% if @wiki_page.presenter.antecedent_tag_implications.any? %>
|
||||
<p class="hint">This tag has been implicated to <%= raw @wiki_page.presenter.antecedent_tag_implications.map {|x| link_to(x.consequent_name, show_or_new_wiki_pages_path(:title => x.consequent_name))}.join(", ") %>.</p>
|
||||
<% end %>
|
||||
|
||||
<% if @wiki_page.presenter.consequent_tag_implications.any? %>
|
||||
<p class="hint">The following tags are implicated to this tag: <%= raw @wiki_page.presenter.consequent_tag_implications.map {|x| link_to(x.antecedent_name, show_or_new_wiki_pages_path(:title => x.antecedent_name))}.join(", ") %>.</p>
|
||||
<% end %>
|
||||
<%= wiki_page_alias_and_implication_list(@wiki_page)%>
|
||||
|
||||
<div id="wiki-page-posts">
|
||||
<% if Post.fast_count(@wiki_page.title) > 0 %>
|
||||
|
||||
@@ -15,21 +15,7 @@
|
||||
<div id="wiki-page-body" class="prose">
|
||||
<%= format_text(@wiki_page.body) %>
|
||||
|
||||
<% if @wiki_page.presenter.antecedent_tag_alias %>
|
||||
<p class="hint">This tag has been aliased to <%= link_to @wiki_page.presenter.antecedent_tag_alias.consequent_name, show_or_new_wiki_pages_path(:title => @wiki_page.presenter.antecedent_tag_alias.consequent_name) %>.</p>
|
||||
<% end %>
|
||||
|
||||
<% if @wiki_page.presenter.consequent_tag_aliases.any? %>
|
||||
<p class="hint">The following tags are aliased to this tag: <%= raw @wiki_page.presenter.consequent_tag_aliases.map {|x| link_to(x.antecedent_name, show_or_new_wiki_pages_path(:title => x.antecedent_name))}.join(", ") %>.</p>
|
||||
<% end %>
|
||||
|
||||
<% if @wiki_page.presenter.antecedent_tag_implications.any? %>
|
||||
<p class="hint">This tag has been implicated to <%= raw @wiki_page.presenter.antecedent_tag_implications.map {|x| link_to(x.consequent_name, show_or_new_wiki_pages_path(:title => x.consequent_name))}.join(", ") %>.</p>
|
||||
<% end %>
|
||||
|
||||
<% if @wiki_page.presenter.consequent_tag_implications.any? %>
|
||||
<p class="hint">The following tags are implicated to this tag: <%= raw @wiki_page.presenter.consequent_tag_implications.map {|x| link_to(x.antecedent_name, show_or_new_wiki_pages_path(:title => x.antecedent_name))}.join(", ") %>.</p>
|
||||
<% end %>
|
||||
<%= wiki_page_alias_and_implication_list(@wiki_page) %>
|
||||
</div>
|
||||
|
||||
<div id="wiki-page-posts">
|
||||
|
||||
Reference in New Issue
Block a user