diff --git a/app/controllers/artists_controller.rb b/app/controllers/artists_controller.rb
index 5a465dbee..c12590cb4 100644
--- a/app/controllers/artists_controller.rb
+++ b/app/controllers/artists_controller.rb
@@ -14,7 +14,7 @@ class ArtistsController < ApplicationController
def index
@search = Artist.search(params[:search])
- @artists = @search.paginate(:page => params[:page])
+ @artists = @search.paginate(params[:page])
respond_with(@artists)
end
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb
index 0e1bfb2f4..ccc79f869 100644
--- a/app/controllers/comments_controller.rb
+++ b/app/controllers/comments_controller.rb
@@ -39,7 +39,7 @@ class CommentsController < ApplicationController
private
def index_by_post
- @posts = Post.tag_match(params[:tags]).commented_before(params[:before_date] || Time.now).limit(8)
+ @posts = Post.commented_before(Time.now).tag_match(params[:tags]).paginate(params[:page])
respond_with(@posts) do |format|
format.html {render :action => "index_by_post"}
end
@@ -47,7 +47,7 @@ private
def index_by_comment
@search = Comment.search(params[:search])
- @comments = @search.paginate(:page => params[:page])
+ @comments = @search.paginate(params[:page])
respond_with(@comments) do |format|
format.html {render :action => "index_by_comment"}
end
diff --git a/app/controllers/notes_controller.rb b/app/controllers/notes_controller.rb
index 561b97377..ded7f8c31 100644
--- a/app/controllers/notes_controller.rb
+++ b/app/controllers/notes_controller.rb
@@ -52,7 +52,7 @@ private
end
def index_by_post
- @posts = Post.tag_match(params[:tags]).noted_before(params[:before_date] || Time.now).limit(8)
+ @posts = Post.tag_match(params[:tags]).noted_before(params[:before_date] || Time.now).paginate(params[:page])
respond_with(@posts) do |format|
format.html {render :action => "index_by_post"}
end
@@ -60,7 +60,7 @@ private
def index_by_note
@search = Note.search(params[:search])
- @notes = @search.paginate(:page => params[:page])
+ @notes = @search.paginate(params[:page])
respond_with(@notes) do |format|
format.html {render :action => "index_by_note"}
end
diff --git a/app/controllers/tag_aliases_controller.rb b/app/controllers/tag_aliases_controller.rb
index d1823c5f6..61f4a03d5 100644
--- a/app/controllers/tag_aliases_controller.rb
+++ b/app/controllers/tag_aliases_controller.rb
@@ -9,7 +9,7 @@ class TagAliasesController < ApplicationController
def index
@search = TagAlias.search(params[:search])
- @tag_aliases = @search.paginate(:page => params[:page])
+ @tag_aliases = @search.paginate(params[:page])
respond_with(@tag_aliases)
end
diff --git a/app/controllers/tag_implications_controller.rb b/app/controllers/tag_implications_controller.rb
index 67e5cdbe4..91ace2f76 100644
--- a/app/controllers/tag_implications_controller.rb
+++ b/app/controllers/tag_implications_controller.rb
@@ -9,7 +9,7 @@ class TagImplicationsController < ApplicationController
def index
@search = TagImplication.search(params[:search])
- @tag_implications = @search.paginate(:page => params[:page])
+ @tag_implications = @search.paginate(params[:page])
respond_with(@tag_implicationes)
end
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb
index 2a14c5079..215baba8f 100644
--- a/app/controllers/tags_controller.rb
+++ b/app/controllers/tags_controller.rb
@@ -9,7 +9,7 @@ class TagsController < ApplicationController
def index
@search = Tag.search(params[:search])
- @tags = @search.paginate(:page => params[:page])
+ @tags = @search.paginate(params[:page])
respond_with(@tags)
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 11650f23d..c7a319709 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -16,7 +16,7 @@ class UsersController < ApplicationController
def index
@search = User.search(params[:search])
- @users = @search.paginate(:page => params[:page])
+ @users = @search.paginate(params[:page])
respond_with(@users)
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 538516ea3..c2a5e2c7c 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -35,12 +35,11 @@ module ApplicationHelper
protected
def nav_link_match(controller, url)
+ puts "controller=#{controller} url=#{url}"
+
url =~ case controller
- when "tag_aliases", "tag_implications"
- /^\/tags/
-
- when "sessions", "user_maintenance"
- /^\/users/
+ when "sessions", "users"
+ /^\/(session|users)/
when "forum_posts"
/^\/forum_topics/
diff --git a/app/models/post.rb b/app/models/post.rb
index 32bf8ec8e..97a929a63 100644
--- a/app/models/post.rb
+++ b/app/models/post.rb
@@ -40,6 +40,8 @@ class Post < ActiveRecord::Base
scope :available_for_moderation, lambda {where(["id NOT IN (SELECT pd.post_id FROM post_disapprovals pd WHERE pd.user_id = ?)", CurrentUser.id])}
scope :hidden_from_moderation, lambda {where(["id IN (SELECT pd.post_id FROM post_disapprovals pd WHERE pd.user_id = ?)", CurrentUser.id])}
scope :tag_match, lambda {|query| Post.tag_match_helper(query)}
+ scope :positive, where("score > 1")
+ scope :negative, where("score < -1")
search_methods :tag_match
scope :after_id, Proc.new {|num|
if num.present?
diff --git a/app/models/user.rb b/app/models/user.rb
index 948edc408..f5bd18e4e 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -7,7 +7,7 @@ class User < ActiveRecord::Base
attr_accessor :password, :old_password
attr_accessible :password, :old_password, :password_confirmation, :password_hash, :email, :last_logged_in_at, :last_forum_read_at, :has_mail, :receive_email_notifications, :comment_threshold, :always_resize_images, :favorite_tags, :blacklisted_tags, :name, :ip_addr
validates_length_of :name, :within => 2..20, :on => :create
- validates_format_of :name, :with => /\A[^\s;,]+\Z/, :on => :create, :message => "cannot have whitespace, commas, or semicolons"
+ validates_format_of :name, :with => /\A[^\s:]+\Z/, :on => :create, :message => "cannot have whitespace or colons"
validates_uniqueness_of :name, :case_sensitive => false, :on => :create
validates_uniqueness_of :email, :case_sensitive => false, :on => :create, :if => lambda {|rec| !rec.email.blank?}
validates_length_of :password, :minimum => 5, :if => lambda {|rec| rec.new_record? || !rec.password.blank?}
@@ -22,6 +22,7 @@ class User < ActiveRecord::Base
has_many :feedback, :class_name => "UserFeedback", :dependent => :destroy
has_one :ban
has_many :subscriptions, :class_name => "TagSubscription"
+ has_many :note_versions, :foreign_key => "updater_id"
belongs_to :inviter, :class_name => "User"
scope :named, lambda {|name| where(["lower(name) = ?", name])}
scope :admins, where("is_admin = TRUE")
@@ -143,6 +144,13 @@ class User < ActiveRecord::Base
end
end
+ def level_string
+ if is_admin?
+ "Admin"
+ elsif is_moderator?
+ "Moderator"
+ end
+
def normalize_level
if is_admin?
self.is_moderator = true
@@ -254,6 +262,12 @@ class User < ActiveRecord::Base
end
end
+ module PostMethods
+ def posts
+ Post.where("uploader_string = ?", "uploader:#{id}")
+ end
+ end
+
include BanMethods
include NameMethods
include PasswordMethods
@@ -264,6 +278,7 @@ class User < ActiveRecord::Base
include BlacklistMethods
include ForumMethods
include LimitMethods
+ include PostMethods
def initialize_default_image_size
self.default_image_size = "Medium"
diff --git a/app/views/comments/index_by_comment.html.erb b/app/views/comments/index_by_comment.html.erb
index fce4fb6dc..8033b96c9 100644
--- a/app/views/comments/index_by_comment.html.erb
+++ b/app/views/comments/index_by_comment.html.erb
@@ -8,7 +8,7 @@
-
+
<%= sequential_paginator(@comments) %>
diff --git a/app/views/comments/index_by_post.html.erb b/app/views/comments/index_by_post.html.erb
index b067a8d83..93c28bcfb 100644
--- a/app/views/comments/index_by_post.html.erb
+++ b/app/views/comments/index_by_post.html.erb
@@ -1,5 +1,9 @@