- <%= numbered_paginator(@artists) do |page| %>
- <%= link_to(page, artists_path(:page => page, :search => params[:search])) %>
- <% end %>
+
<%= render "secondary_links" %>
diff --git a/app/views/pools/index.html.erb b/app/views/pools/index.html.erb
index 279f61acf..f1dac6cd9 100644
--- a/app/views/pools/index.html.erb
+++ b/app/views/pools/index.html.erb
@@ -25,7 +25,7 @@
-
+
<%= sequential_paginator(@pools) %>
diff --git a/app/views/pools/show.html.erb b/app/views/pools/show.html.erb
index b4ab4be75..b1ede6d9e 100644
--- a/app/views/pools/show.html.erb
+++ b/app/views/pools/show.html.erb
@@ -12,9 +12,7 @@
- <%= numbered_paginator(@post_set) do |page| %>
- <%= link_to(page, pool_path(@pool, :page => page)) %>
- <% end %>
+ <%= numbered_paginator(@post_set) %>
diff --git a/app/views/tag_aliases/index.html.erb b/app/views/tag_aliases/index.html.erb
index b7c554541..27d955a65 100644
--- a/app/views/tag_aliases/index.html.erb
+++ b/app/views/tag_aliases/index.html.erb
@@ -22,7 +22,11 @@
| <%= link_to tag_alias.antecedent_name, posts_path(:tags => tag_alias.antecedent_name) %> (<%= tag_alias.antecedent_tag.post_count rescue 0 %>) |
<%= link_to tag_alias.consequent_name, posts_path(:tags => tag_alias.consequent_name) %> (<%= tag_alias.consequent_tag.post_count rescue 0 %>) |
- <%= link_to tag_alias.forum_topic_id, forum_topic_path(tag_alias.forum_topic_id) %> |
+
+ <% if tag_alias.forum_topic_id %>
+ <%= link_to tag_alias.forum_topic_id, forum_topic_path(tag_alias.forum_topic_id) %>
+ <% end %>
+ |
<% if CurrentUser.is_admin? %>
<%= link_to "Delete", tag_alias_path(tag_alias), :remote => true, :method => :delete, :confirm => "Are you sure you want to delete this alias?" %>
@@ -35,10 +39,8 @@
-
- <%= numbered_paginator(@tag_aliases) do |page| %>
- <%= link_to(page, tag_aliases_path(:page => page)) %>
- <% end %>
+
+ <%= numbered_paginator(@tag_aliases) %>
<%= render "secondary_links" %>
diff --git a/app/views/tag_implications/index.html.erb b/app/views/tag_implications/index.html.erb
index 466ef2f89..92aaefbb4 100644
--- a/app/views/tag_implications/index.html.erb
+++ b/app/views/tag_implications/index.html.erb
@@ -22,7 +22,11 @@
| <%= link_to tag_implication.antecedent_name, posts_path(:tags => tag_implication.antecedent_name) %> (<%= tag_implication.antecedent_tag.post_count rescue 0 %>) |
<%= link_to tag_implication.consequent_name, posts_path(:tags => tag_implication.consequent_name) %> (<%= tag_implication.consequent_tag.post_count rescue 0 %>) |
- <%= link_to tag_implication.forum_topic_id, forum_topic_path(tag_implication.forum_topic_id) %> |
+
+ <% if tag_implication.forum_topic_id %>
+ <%= link_to tag_implication.forum_topic_id, forum_topic_path(tag_implication.forum_topic_id) %>
+ <% end %>
+ |
<% if CurrentUser.is_admin? %>
<%= link_to "Delete", tag_implication_path(tag_implication), :remote => true, :method => :delete, :confirm => "Are you sure you want to delete this implication?" %>
@@ -35,10 +39,8 @@
-
- <%= numbered_paginator(@tag_implications) do |page| %>
- <%= link_to(page, tag_impliactions_path(:page => page)) %>
- <% end %>
+
+ <%= numbered_paginator(@tag_implications) %>
<%= render "secondary_links" %>
diff --git a/app/views/tags/index.html.erb b/app/views/tags/index.html.erb
index 314faf9f0..aacb7aefa 100644
--- a/app/views/tags/index.html.erb
+++ b/app/views/tags/index.html.erb
@@ -19,9 +19,7 @@
- <%= numbered_paginator(@tags) do |page| %>
- <%= link_to(page, tags_path(:page => page)) %>
- <% end %>
+ <%= numbered_paginator(@tags) %>
<%= render "secondary_links" %>
diff --git a/config/danbooru_default_config.rb b/config/danbooru_default_config.rb
index 858e89679..dac00824a 100644
--- a/config/danbooru_default_config.rb
+++ b/config/danbooru_default_config.rb
@@ -109,7 +109,7 @@ module Danbooru
# After this many pages, the paginator will switch to sequential mode.
def max_numbered_pages
- 2
+ 10
end
# Max number of tag subscriptions per user
diff --git a/config/danbooru_local_config.rb b/config/danbooru_local_config.rb
index e380ab2f2..283e02225 100644
--- a/config/danbooru_local_config.rb
+++ b/config/danbooru_local_config.rb
@@ -6,7 +6,7 @@ module Danbooru
end
def posts_per_page
- 1
+ 3
end
def is_user_restricted?(user)
diff --git a/db/seeds.rb b/db/seeds.rb
index 664d8c74c..132843e4a 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -1,7 +1,84 @@
-# This file should contain all the record creation needed to seed the database with its default values.
-# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
-#
-# Examples:
-#
-# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
-# Mayor.create(:name => 'Daley', :city => cities.first)
+if User.count == 0
+ puts "Creating users"
+ user = User.create(
+ :name => "albert",
+ :password => "password1",
+ :password_confirmation => "password1"
+ )
+else
+ puts "Skipping users"
+ user = User.first
+end
+
+CurrentUser.user = user
+CurrentUser.ip_addr = "127.0.0.1"
+
+if Upload.count == 0
+ puts "Creating uploads"
+ 1.upto(100) do |i|
+ url = "http://dummyimage.com/#{i * 10}x400/000/fff"
+ tags = (i * i * i).to_s.scan(/./).uniq.join(" ")
+
+ Upload.create(:source => url, :content_type => "image/gif", :rating => "q", :tag_string => tags)
+ end
+else
+ puts "Skipping uploads"
+end
+
+if Post.count == 0
+ puts "Creating posts"
+ Upload.all.each do |upload|
+ upload.process!
+ end
+else
+ puts "Skipping posts"
+end
+
+if Comment.count == 0
+ puts "Creating comments"
+ Post.all.each do |post|
+ Comment.create(:post_id => post.id, :body => rand(1_000_000).to_s)
+ end
+else
+ puts "Skipping comments"
+end
+
+if Note.count == 0
+ puts "Creating notes"
+ Post.all.each do |post|
+ 3.times do
+ Note.create(:post_id => post.id, :x => 0, :y => 0, :width => 100, :height => 100, :body => rand(1_000_000).to_s)
+ end
+ end
+else
+ puts "Skipping notes"
+end
+
+if Artist.count == 0
+ puts "Creating artists"
+ 0.upto(100) do |i|
+ Artist.create(:name => i.to_s)
+ end
+else
+ puts "Skipping artists"
+end
+
+if TagAlias.count == 0
+ puts "Creating tag aliases"
+
+ 11.upto(99) do |i|
+ TagAlias.create(:antecedent_name => i.to_s, :consequent_name => (i * 100).to_s)
+ end
+else
+ puts "Skipping tag aliases"
+end
+
+if TagImplication.count == 0
+ puts "Creating tag implictions"
+
+ 10_000.upto(10_100) do |i|
+ TagImplication.create(:antecedent_name => i.to_s, :consequent_name => (i * 100).to_s)
+ end
+else
+ puts "Skipping tag implications"
+end
\ No newline at end of file
diff --git a/lib/danbooru/paginator/active_record_extension.rb b/lib/danbooru/paginator/active_record_extension.rb
index 1abaf8937..37f9ab6ab 100644
--- a/lib/danbooru/paginator/active_record_extension.rb
+++ b/lib/danbooru/paginator/active_record_extension.rb
@@ -52,7 +52,7 @@ module Danbooru
page = [page.to_i, 1].max
if page > Danbooru.config.max_numbered_pages
- raise Error.new("You cannot go beyond page #{Danbooru.config.max_numbered_pages}. Please narrow your search terms.")
+ raise "You cannot go beyond page #{Danbooru.config.max_numbered_pages}. Please narrow your search terms."
end
limit(records_per_page).offset((page - 1) * records_per_page).tap do |obj|
diff --git a/lib/danbooru/paginator/error.rb b/lib/danbooru/paginator/error.rb
deleted file mode 100644
index 4acfa49fc..000000000
--- a/lib/danbooru/paginator/error.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-module Danbooru
- module Paginator
- class Error < Exception
- end
- end
-end
| |