* Created js popup for some of the secondary links in the main navbar
* aliases/implications must now be approved * anyone can now submit an alias
This commit is contained in:
@@ -16,6 +16,18 @@ $(document).ready(function() {
|
|||||||
$(this).hide();
|
$(this).hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// More link
|
||||||
|
$("#site-map-link").click(function(e) {
|
||||||
|
$("#more-links").toggle();
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
$("#more-links").hide().offset({top: $("#site-map-link").offset().top + $("#site-map-link").height() + 10, left: $("#site-map-link").offset().left});
|
||||||
|
|
||||||
|
$(document).click(function(e) {
|
||||||
|
$("#more-links").hide();
|
||||||
|
});
|
||||||
|
|
||||||
// Ajax links
|
// Ajax links
|
||||||
$("a[data-remote=true]").click(function(e) {
|
$("a[data-remote=true]").click(function(e) {
|
||||||
Danbooru.ajax_start(e.target);
|
Danbooru.ajax_start(e.target);
|
||||||
|
|||||||
@@ -48,3 +48,16 @@ footer#page-footer {
|
|||||||
div.clearfix {
|
div.clearfix {
|
||||||
clear: both;
|
clear: both;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div#more-links {
|
||||||
|
z-index: 5000;
|
||||||
|
position: absolute;
|
||||||
|
background: white;
|
||||||
|
border: 1px solid #999;
|
||||||
|
width: 8em;
|
||||||
|
line-height: 1.3em;
|
||||||
|
padding: 0.2em 0.6em;
|
||||||
|
-moz-box-shadow: 2px 2px 2px #ccc;
|
||||||
|
-webkit-box-shadow: 2px 2px 2px #ccc;
|
||||||
|
box-shadow: 2px 2px 2px #ccc;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
class TagImplicationsController < ApplicationController
|
class TagImplicationsController < ApplicationController
|
||||||
before_filter :admin_only, :only => [:approve, :destroy]
|
before_filter :admin_only, :only => [:new, :create, :approve, :destroy]
|
||||||
before_filter :member_only, :only => [:create]
|
|
||||||
respond_to :html, :xml, :json, :js
|
respond_to :html, :xml, :json, :js
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
|||||||
@@ -82,29 +82,23 @@ protected
|
|||||||
when "forum_posts"
|
when "forum_posts"
|
||||||
/^\/forum_topics/
|
/^\/forum_topics/
|
||||||
|
|
||||||
when "uploads"
|
when "comments"
|
||||||
/^\/post/
|
/^\/comments/
|
||||||
|
|
||||||
when "post_versions", "explore/posts"
|
|
||||||
/^\/post/
|
|
||||||
|
|
||||||
when "pool_versions"
|
|
||||||
/^\/pool/
|
|
||||||
|
|
||||||
when "note_versions"
|
when "notes", "note_versions"
|
||||||
/^\/note/
|
/^\/notes/
|
||||||
|
|
||||||
when "artist_versions"
|
when "posts", "uploads", "post_versions", "explore/posts", "moderator/post/dashboards", "favorites", "tag_subscriptions"
|
||||||
/^\/artist/
|
|
||||||
|
|
||||||
when "moderator/post/dashboards"
|
|
||||||
/^\/post/
|
/^\/post/
|
||||||
|
|
||||||
when "moderator/dashboards"
|
when "wiki_pages", "wiki_page_versions"
|
||||||
/^\/moderator/
|
/^\/wiki_pages/
|
||||||
|
|
||||||
|
when "forum_topics", "forum_posts"
|
||||||
|
/^\/forum_topics/
|
||||||
|
|
||||||
else
|
else
|
||||||
/^\/#{controller}/
|
/^\/static/
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ class TagImplication < ActiveRecord::Base
|
|||||||
|
|
||||||
until children.empty?
|
until children.empty?
|
||||||
all.concat(children)
|
all.concat(children)
|
||||||
children = self.class.where(["antecedent_name IN (?) and status = ?", children, "active"]).all.map(&:consequent_name)
|
children = self.class.where(["antecedent_name IN (?)", children]).all.map(&:consequent_name)
|
||||||
end
|
end
|
||||||
end
|
end.sort
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ class TagImplication < ActiveRecord::Base
|
|||||||
|
|
||||||
def update_descendant_names!
|
def update_descendant_names!
|
||||||
update_descendant_names
|
update_descendant_names
|
||||||
save!
|
update_column(:descendant_names, descendant_names)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_descendant_names_for_parent
|
def update_descendant_names_for_parent
|
||||||
@@ -77,6 +77,7 @@ class TagImplication < ActiveRecord::Base
|
|||||||
|
|
||||||
def process!
|
def process!
|
||||||
update_column(:status, "processing")
|
update_column(:status, "processing")
|
||||||
|
update_descendant_names_for_parent
|
||||||
update_posts
|
update_posts
|
||||||
update_column(:status, "active")
|
update_column(:status, "active")
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
|
|||||||
@@ -7,17 +7,7 @@
|
|||||||
<%= nav_link_to("Posts", posts_path) %>
|
<%= nav_link_to("Posts", posts_path) %>
|
||||||
<%= nav_link_to("Comments", comments_path(:group_by => "post")) %>
|
<%= nav_link_to("Comments", comments_path(:group_by => "post")) %>
|
||||||
<%= nav_link_to("Notes", notes_path(:group_by => "post")) %>
|
<%= nav_link_to("Notes", notes_path(:group_by => "post")) %>
|
||||||
<%= nav_link_to("Artists", artists_path(:order => "date")) %>
|
|
||||||
<%= nav_link_to("Tags", tags_path(:order => "date")) %>
|
|
||||||
<% if CurrentUser.is_moderator? %>
|
|
||||||
<%= nav_link_to("Aliases", tag_aliases_path) %>
|
|
||||||
<%= nav_link_to("Implications", tag_implications_path) %>
|
|
||||||
<% end %>
|
|
||||||
<%= nav_link_to("Pools", pools_path) %>
|
|
||||||
<%= nav_link_to("Wiki", wiki_pages_path(:title => "help:home")) %>
|
<%= nav_link_to("Wiki", wiki_pages_path(:title => "help:home")) %>
|
||||||
<%= nav_link_to("Forum", forum_topics_path, :class => (CurrentUser.user.has_forum_been_updated? ? "forum-updated" : nil)) %>
|
<%= nav_link_to("Forum", forum_topics_path, :class => (CurrentUser.user.has_forum_been_updated? ? "forum-updated" : nil)) %>
|
||||||
<% if CurrentUser.is_janitor? %>
|
<%= nav_link_to("»".html_safe, site_map_path, :id => "site-map-link") %>
|
||||||
<%= nav_link_to("Dashboard", moderator_dashboard_path) %>
|
|
||||||
<% end %>
|
|
||||||
<%= nav_link_to("»".html_safe, site_map_path) %>
|
|
||||||
</menu>
|
</menu>
|
||||||
14
app/views/layouts/_more_links.html.erb
Normal file
14
app/views/layouts/_more_links.html.erb
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<div id="more-links">
|
||||||
|
<ul>
|
||||||
|
<%= nav_link_to("Artists", artists_path(:order => "date")) %>
|
||||||
|
<%= nav_link_to("Tags", tags_path(:order => "date")) %>
|
||||||
|
<% if CurrentUser.is_moderator? %>
|
||||||
|
<%= nav_link_to("Aliases", tag_aliases_path) %>
|
||||||
|
<%= nav_link_to("Implications", tag_implications_path) %>
|
||||||
|
<% end %>
|
||||||
|
<%= nav_link_to("Pools", pools_path) %>
|
||||||
|
<% if CurrentUser.is_janitor? %>
|
||||||
|
<%= nav_link_to("Dashboard", moderator_dashboard_path) %>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
@@ -30,6 +30,8 @@
|
|||||||
<%= render "layouts/main_links" %>
|
<%= render "layouts/main_links" %>
|
||||||
<%= yield :secondary_links %>
|
<%= yield :secondary_links %>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
<%= render "layouts/more_links" %>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div id="page">
|
<div id="page">
|
||||||
|
|||||||
@@ -29,17 +29,6 @@ class NotesControllerTest < ActionController::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "show action" do
|
|
||||||
setup do
|
|
||||||
@note = Factory.create(:note)
|
|
||||||
end
|
|
||||||
|
|
||||||
should "render" do
|
|
||||||
get :show, {:id => @note.id}
|
|
||||||
assert_response :success
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "create action" do
|
context "create action" do
|
||||||
should "create a note" do
|
should "create a note" do
|
||||||
assert_difference("Note.count", 1) do
|
assert_difference("Note.count", 1) do
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class PostVersionTest < ActiveSupport::TestCase
|
|||||||
assert_equal(2, @post.versions.size)
|
assert_equal(2, @post.versions.size)
|
||||||
@version = @post.versions.last
|
@version = @post.versions.last
|
||||||
assert_equal("bbb ccc xxx", @version.tags)
|
assert_equal("bbb ccc xxx", @version.tags)
|
||||||
assert_nil(@version.rating)
|
assert_equal("q", @version.rating)
|
||||||
assert_equal("", @version.source)
|
assert_equal("", @version.source)
|
||||||
assert_nil(@version.parent_id)
|
assert_nil(@version.parent_id)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -60,19 +60,37 @@ class TagImplicationTest < ActiveSupport::TestCase
|
|||||||
assert_equal("ddd", ti2.descendant_names)
|
assert_equal("ddd", ti2.descendant_names)
|
||||||
end
|
end
|
||||||
|
|
||||||
should "update the decendants for its parent on save" do
|
should "update the decendants for its parent on create" do
|
||||||
ti1 = FactoryGirl.create(:tag_implication, :antecedent_name => "aaa", :consequent_name => "bbb")
|
ti1 = FactoryGirl.create(:tag_implication, :antecedent_name => "aaa", :consequent_name => "bbb")
|
||||||
|
ti1.reload
|
||||||
|
assert_equal("active", ti1.status)
|
||||||
|
assert_equal("bbb", ti1.descendant_names)
|
||||||
|
|
||||||
ti2 = FactoryGirl.create(:tag_implication, :antecedent_name => "bbb", :consequent_name => "ccc")
|
ti2 = FactoryGirl.create(:tag_implication, :antecedent_name => "bbb", :consequent_name => "ccc")
|
||||||
|
ti1.reload
|
||||||
|
ti2.reload
|
||||||
|
assert_equal("active", ti1.status)
|
||||||
|
assert_equal("active", ti2.status)
|
||||||
|
assert_equal("bbb ccc", ti1.descendant_names)
|
||||||
|
assert_equal("ccc", ti2.descendant_names)
|
||||||
|
|
||||||
ti3 = FactoryGirl.create(:tag_implication, :antecedent_name => "ccc", :consequent_name => "ddd")
|
ti3 = FactoryGirl.create(:tag_implication, :antecedent_name => "ccc", :consequent_name => "ddd")
|
||||||
|
ti1.reload
|
||||||
|
ti2.reload
|
||||||
|
ti3.reload
|
||||||
|
assert_equal("bbb ccc ddd", ti1.descendant_names)
|
||||||
|
assert_equal("ccc ddd", ti2.descendant_names)
|
||||||
|
|
||||||
ti4 = FactoryGirl.create(:tag_implication, :antecedent_name => "ccc", :consequent_name => "eee")
|
ti4 = FactoryGirl.create(:tag_implication, :antecedent_name => "ccc", :consequent_name => "eee")
|
||||||
ti1.reload
|
ti1.reload
|
||||||
ti2.reload
|
ti2.reload
|
||||||
ti3.reload
|
ti3.reload
|
||||||
ti4.reload
|
ti4.reload
|
||||||
assert_equal("bbb ccc eee ddd", ti1.descendant_names)
|
assert_equal("bbb ccc ddd eee", ti1.descendant_names)
|
||||||
assert_equal("ccc eee ddd", ti2.descendant_names)
|
assert_equal("ccc ddd eee", ti2.descendant_names)
|
||||||
assert_equal("ddd", ti3.descendant_names)
|
assert_equal("ddd", ti3.descendant_names)
|
||||||
assert_equal("eee", ti4.descendant_names)
|
assert_equal("eee", ti4.descendant_names)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
should "update any affected post upon save" do
|
should "update any affected post upon save" do
|
||||||
|
|||||||
Reference in New Issue
Block a user