From a536a2699b30f6792baa5f063c4e1e9bfa9987f5 Mon Sep 17 00:00:00 2001 From: albert Date: Wed, 26 Oct 2011 18:00:48 -0400 Subject: [PATCH] * Renamed moderator/post/dashboard to moderator/post/queue * Fixed bug with more overlay links being out of place if news listing is closed --- app/assets/javascripts/comments.js | 10 +++++++ app/assets/javascripts/common.js | 25 ------------------ app/assets/javascripts/news.js | 4 +++ app/assets/javascripts/posts.js | 19 ++++++++++++++ .../stylesheets/specific/mod_queue.css.scss | 26 +++++++++++++++++++ .../stylesheets/specific/posts.css.scss | 16 ------------ ...rds_controller.rb => queues_controller.rb} | 2 +- app/models/upload.rb | 8 ++---- app/views/layouts/default.html.erb | 4 +-- .../post/{dashboards => queues}/show.html.erb | 20 +++++++++++--- app/views/news/_listing.html.erb | 16 +++++++----- .../partials/common/_secondary_links.html.erb | 2 +- config/routes.rb | 2 +- script/testing/reset_db.sh | 1 - ...ller_test.rb => queues_controller_test.rb} | 4 +-- 15 files changed, 94 insertions(+), 65 deletions(-) create mode 100644 app/assets/stylesheets/specific/mod_queue.css.scss rename app/controllers/moderator/post/{dashboards_controller.rb => queues_controller.rb} (86%) rename app/views/moderator/post/{dashboards => queues}/show.html.erb (61%) rename test/functional/moderator/post/{dashboards_controller_test.rb => queues_controller_test.rb} (79%) diff --git a/app/assets/javascripts/comments.js b/app/assets/javascripts/comments.js index 31b119d60..8f025c816 100644 --- a/app/assets/javascripts/comments.js +++ b/app/assets/javascripts/comments.js @@ -4,6 +4,7 @@ Danbooru.Comment.initialize_all = function() { this.initialize_response_link(); this.initialize_reply_links(); + this.initialize_expand_links(); } Danbooru.Comment.quote_message = function(data) { @@ -30,6 +31,15 @@ $(".reply-link").click(Danbooru.Comment.quote); } + Danbooru.Comment.initialize_expand_links = function() { + $(".comment-section form").hide(); + $(".comment-section input.expand-comment-response").click(function() { + var post_id = $(this).closest(".comment-section").data("post-id"); + $(".comment-section[data-post-id=" + post_id + "] form").show(); + $(this).hide(); + }); + } + Danbooru.Comment.initialize_response_link = function() { $("a.expand-comment-response").click(function(e) { e.preventDefault(); diff --git a/app/assets/javascripts/common.js b/app/assets/javascripts/common.js index a46217aa2..4ed12d1e3 100644 --- a/app/assets/javascripts/common.js +++ b/app/assets/javascripts/common.js @@ -8,14 +8,6 @@ $(document).ready(function() { $("table.striped tbody tr:even").addClass("even"); $("table.striped tbody tr:odd").addClass("odd"); - // Comment listing - $(".comment-section form").hide(); - $(".comment-section input.expand-comment-response").click(function() { - var post_id = $(this).closest(".comment-section").data("post-id"); - $(".comment-section[data-post-id=" + post_id + "] form").show(); - $(this).hide(); - }); - // More link $("#site-map-link").click(function(e) { $("#more-links").toggle(); @@ -37,23 +29,6 @@ $(document).ready(function() { Danbooru.ajax_stop(e.target); }) - // Image resize sidebar - $("#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(); - }); - // TOS link if (!location.href.match(/terms_of_service/) && Danbooru.Cookie.get("tos") !== "1") { // Setting location.pathname in Safari doesn't work, so manually extract the domain. diff --git a/app/assets/javascripts/news.js b/app/assets/javascripts/news.js index 048928056..9fba309c1 100644 --- a/app/assets/javascripts/news.js +++ b/app/assets/javascripts/news.js @@ -10,6 +10,10 @@ $("#close-news-ticker-link").click(function(e) { $("#news-ticker").hide(); Danbooru.Cookie.put("news-ticker", key); + + // need to reset the more link + $("#more-links").hide().offset({top: $("#site-map-link").offset().top + $("#site-map-link").height() + 10, left: $("#site-map-link").offset().left}); + return false; }); } diff --git a/app/assets/javascripts/posts.js b/app/assets/javascripts/posts.js index a880efc3c..ba1f0e716 100644 --- a/app/assets/javascripts/posts.js +++ b/app/assets/javascripts/posts.js @@ -10,6 +10,7 @@ this.initialize_image_resize(); this.initialize_titles(); this.initialize_links(); + this.initialize_resize_links(); } Danbooru.Post.initialize_links = function() { @@ -20,6 +21,24 @@ }); } + 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() { $("article.post-preview").each(function(i, v) { Danbooru.Post.initialize_title_for(v); diff --git a/app/assets/stylesheets/specific/mod_queue.css.scss b/app/assets/stylesheets/specific/mod_queue.css.scss new file mode 100644 index 000000000..1e4d84a84 --- /dev/null +++ b/app/assets/stylesheets/specific/mod_queue.css.scss @@ -0,0 +1,26 @@ +@import "../common/000_vars.css.scss"; + +div#c-moderator-post-queues { + article { + margin-bottom: 4em; + overflow: hidden; + } + + aside { + float: left; + width: 520px; + } + + section { + float: left; + width: 300px; + } + + div#moderation-guideline { + width: 60em; + + h1 { + font-size: $h2_size; + } + } +} \ No newline at end of file diff --git a/app/assets/stylesheets/specific/posts.css.scss b/app/assets/stylesheets/specific/posts.css.scss index f1997da73..fd9e6ea07 100644 --- a/app/assets/stylesheets/specific/posts.css.scss +++ b/app/assets/stylesheets/specific/posts.css.scss @@ -194,19 +194,3 @@ div#unapprove-dialog { } } -div#c-moderator-post-dashboards { - article { - margin-bottom: 4em; - overflow: hidden; - } - - aside { - float: left; - width: 520px; - } - - section { - float: left; - width: 300px; - } -} diff --git a/app/controllers/moderator/post/dashboards_controller.rb b/app/controllers/moderator/post/queues_controller.rb similarity index 86% rename from app/controllers/moderator/post/dashboards_controller.rb rename to app/controllers/moderator/post/queues_controller.rb index 59159c628..53871b453 100644 --- a/app/controllers/moderator/post/dashboards_controller.rb +++ b/app/controllers/moderator/post/queues_controller.rb @@ -1,6 +1,6 @@ module Moderator module Post - class DashboardsController < ApplicationController + class QueuesController < ApplicationController respond_to :html, :json before_filter :janitor_only diff --git a/app/models/upload.rb b/app/models/upload.rb index 4af725857..62e1d50c1 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -133,16 +133,12 @@ class Upload < ActiveRecord::Base def generate_resizes(source_path) if is_image? generate_resize_for(Danbooru.config.small_image_width, Danbooru.config.small_image_width, source_path, 85) - generate_resize_for(Danbooru.config.medium_image_width, nil, source_path) - generate_resize_for(Danbooru.config.large_image_width, nil, source_path) + generate_resize_for(Danbooru.config.medium_image_width, nil, source_path) if image_width > Danbooru.config.medium_image_width + generate_resize_for(Danbooru.config.large_image_width, nil, source_path) if image_width > Danbooru.config.large_image_width end end def generate_resize_for(width, height, source_path, quality = 90) - return if width.nil? - return unless image_width > width - return unless height.nil? || image_height > height - unless File.exists?(source_path) raise Error.new("file not found") end diff --git a/app/views/layouts/default.html.erb b/app/views/layouts/default.html.erb index dbf86973e..0058b85c5 100644 --- a/app/views/layouts/default.html.erb +++ b/app/views/layouts/default.html.erb @@ -36,9 +36,9 @@
<%- if flash[:notice] -%> -
<%= flash[:notice] %>
+
<%= flash[:notice] %>
<%- else -%> - + <%- end -%> <%= yield :layout %> diff --git a/app/views/moderator/post/dashboards/show.html.erb b/app/views/moderator/post/queues/show.html.erb similarity index 61% rename from app/views/moderator/post/dashboards/show.html.erb rename to app/views/moderator/post/queues/show.html.erb index 01946145e..c0026792f 100644 --- a/app/views/moderator/post/dashboards/show.html.erb +++ b/app/views/moderator/post/queues/show.html.erb @@ -1,7 +1,7 @@ -
+