* Renamed moderator/post/dashboard to moderator/post/queue

* Fixed bug with more overlay links being out of place if news listing is closed
This commit is contained in:
albert
2011-10-26 18:00:48 -04:00
parent 1fc7907374
commit a536a2699b
15 changed files with 94 additions and 65 deletions

View File

@@ -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();

View File

@@ -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.

View File

@@ -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;
});
}

View File

@@ -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);

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}

View File

@@ -1,6 +1,6 @@
module Moderator
module Post
class DashboardsController < ApplicationController
class QueuesController < ApplicationController
respond_to :html, :json
before_filter :janitor_only

View File

@@ -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

View File

@@ -36,9 +36,9 @@
<div id="page">
<%- if flash[:notice] -%>
<div class="ui-corner-all ui-state-highlight" id="notice"><span class="ui-icon ui-icon-info"></span> <%= flash[:notice] %></div>
<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;"><span class="ui-icon ui-icon-info"></span></div>
<div class="ui-corner-all ui-state-highlight" id="notice" style="display: none;"></div>
<%- end -%>
<%= yield :layout %>

View File

@@ -1,7 +1,7 @@
<div id="c-moderator-post-dashboards">
<div id="c-moderator-post-queues">
<div id="a-show">
<div id="search">
<%= form_tag(moderator_post_dashboard_path, :method => :get) do %>
<%= form_tag(moderator_post_queue_path, :method => :get) do %>
<%= text_field_tag "query", params[:query], :size => 40 %>
<%= submit_tag "Search" %>
<% end %>
@@ -9,6 +9,20 @@
<div>
<h1>Moderation Queue</h1>
<div id="moderation-guideline">
<h1>Deletion Guidelines</h1>
<p>
As a general rule, you should only approve of posts that you personally like. Posts that are not approved in three days will be automatically deleted. Posts with score -3 or lower are marked red. Posts with score 3 or higher are marked green.
<% if params[:hidden] %>
<%= link_to "View all posts", moderator_post_queue_path(:query => params[:query], :hidden => nil) %>.
<% else %>
<%= link_to "View hidden posts", moderator_post_queue_path(:query => params[:query], :hidden => true) %>.
<% end %>
</p>
<p><%= button_tag "Approve all", :id => "approve-all-button" %><%= button_tag "Hide all", :id => "hide-all-button" %></p>
</div>
<% @posts.each do |post| %>
<article id="post-<%= post.id %>">
@@ -41,5 +55,5 @@
<%= render "posts/partials/common/secondary_links" %>
<% content_for(:page_title) do %>
Mod Dashboard - <%= Danbooru.config.app_name %>
Mod Queue - <%= Danbooru.config.app_name %>
<% end %>

View File

@@ -1,8 +1,10 @@
<div id="news-ticker" data-updated-at="2011-09-01">
<ul>
<li>10/22: Database has been reset</li>
<li>Report issues on <a href="https://github.com/r888888888/danbooru/issues/new">Github</a> or the <a href="http://danbooru.donmai.us/forum/show/65870">forum</a></li>
</ul>
<% unless cookies["news-ticker"] == "2011-09-01" %>
<div id="news-ticker" data-updated-at="2011-09-01">
<ul>
<li>10/22: Database has been reset</li>
<li>Report issues on <a href="https://github.com/r888888888/danbooru/issues/new">Github</a> or the <a href="http://danbooru.donmai.us/forum/show/65870">forum</a></li>
</ul>
<a href="#" id="close-news-ticker-link">close</a>
</div>
<a href="#" id="close-news-ticker-link">close</a>
</div>
<% end %>

View File

@@ -10,7 +10,7 @@
<% end %>
<li><%= link_to "Changes", post_versions_path %></li>
<% if CurrentUser.is_janitor? %>
<li><%= link_to "Moderate", moderator_post_dashboard_path %></li>
<li><%= link_to "Moderate", moderator_post_queue_path %></li>
<% end %>
<li><%= link_to "Help", wiki_pages_path(:title => "help:posts") %></li>
</menu>

View File

@@ -12,7 +12,7 @@ Danbooru::Application.routes.draw do
resources :invitations, :only => [:new, :create, :index]
resource :tag, :only => [:edit, :update]
namespace :post do
resource :dashboard, :only => [:show]
resource :queue, :only => [:show]
resource :approval, :only => [:create]
resource :disapproval, :only => [:create]
resources :posts, :only => [:delete, :undelete] do

View File

@@ -1,6 +1,5 @@
#!/usr/bin/env bash
bundle exec rake db:drop db:create
createlang plpgsql danbooru2
bundle exec rake db:migrate
bundle exec rake db:seed

View File

@@ -2,8 +2,8 @@ require 'test_helper'
module Moderator
module Post
class DashboardsControllerTest < ActionController::TestCase
context "The moderator post dashboards controller" do
class QueuesControllerTest < ActionController::TestCase
context "The moderator post queues controller" do
setup do
@admin = Factory.create(:admin_user)
CurrentUser.user = @admin