diff --git a/app/controllers/notes_controller.rb b/app/controllers/notes_controller.rb
index 84bd73f58..f968e9e2d 100644
--- a/app/controllers/notes_controller.rb
+++ b/app/controllers/notes_controller.rb
@@ -3,9 +3,11 @@ class NotesController < ApplicationController
before_filter :member_only, :except => [:index, :show]
def index
- @search = Note.search(params[:search])
- @notes = @search.paginate(:page => params[:page])
- respond_with(@notes)
+ if params[:group_by] == "post"
+ index_by_post
+ else
+ index_by_note
+ end
end
def show
@@ -36,4 +38,21 @@ class NotesController < ApplicationController
@note.revert_to!(@version)
respond_with(@note)
end
+
+private
+ def index_by_post
+ @posts = Post.tag_match(params[:tags]).noted_before(params[:before_date] || Time.now).limit(8)
+ respond_with(@posts) do |format|
+ format.html {render :action => "index_by_post"}
+ end
+ end
+
+ def index_by_note
+ @search = Note.search(params[:search])
+ @notes = @search.paginate(:page => params[:page])
+ respond_with(@notes) do |format|
+ format.html {render :action => "index_by_note"}
+ end
+ end
+
end
diff --git a/app/controllers/pools_controller.rb b/app/controllers/pools_controller.rb
index 91a760331..fd5ebbf3c 100644
--- a/app/controllers/pools_controller.rb
+++ b/app/controllers/pools_controller.rb
@@ -19,6 +19,10 @@ class PoolsController < ApplicationController
respond_with(@pools)
end
+ def search
+ @search = Pool.search(params[:search])
+ end
+
def show
@pool = Pool.find(params[:id])
@post_set = PostSets::Pool.new(@pool, :page => params[:page])
diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb
index c6df11e2b..97ca84bbb 100644
--- a/app/controllers/static_controller.rb
+++ b/app/controllers/static_controller.rb
@@ -1,2 +1,4 @@
class StaticController < ApplicationController
+ def jquery_test
+ end
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index bf958e357..11650f23d 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -27,6 +27,8 @@ class UsersController < ApplicationController
def create
@user = User.create(params[:user])
+ session[:user_id] = @user.id
+ set_current_user
respond_with(@user)
end
diff --git a/app/models/post.rb b/app/models/post.rb
index 69427c5ed..465bb63e2 100644
--- a/app/models/post.rb
+++ b/app/models/post.rb
@@ -34,6 +34,7 @@ class Post < ActiveRecord::Base
scope :deleted, where(["is_deleted = ?", true])
scope :visible, lambda {|user| Danbooru.config.can_user_see_post_conditions(user)}
scope :commented_before, lambda {|date| where("last_commented_at < ?", date).order("last_commented_at DESC")}
+ scope :noted_before, lambda {|date| where("last_noted_at < ?", date).order("last_noted_at DESC")}
scope :for_user, lambda {|user_id| where(["uploader_string = ?", "uploader:#{user_id}"])}
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])}
diff --git a/app/views/notes/_secondary_links.html.erb b/app/views/notes/_secondary_links.html.erb
index bee0b6b39..2062406d5 100644
--- a/app/views/notes/_secondary_links.html.erb
+++ b/app/views/notes/_secondary_links.html.erb
@@ -1,7 +1,9 @@
-<% content_for("subnavbar") do %>
-
<%= link_to "List", :action => "index" %>
- <%= link_to "Search", :action => "search" %>
- <%= link_to "History", :action => "history" %>
- <%= link_to "Requests", :controller => "post", :action => "index", :tags => "translation_request" %>
- <%= link_to "Help", :controller => "help", :action => "notes" %>
+<% content_for(:secondary_links) do %>
+
<% end %>
diff --git a/app/views/notes/index.html.erb b/app/views/notes/index.html.erb
deleted file mode 100644
index d4e1e134d..000000000
--- a/app/views/notes/index.html.erb
+++ /dev/null
@@ -1,5 +0,0 @@
-
diff --git a/app/views/pools/_search.html.erb b/app/views/pools/_search.html.erb
deleted file mode 100644
index 905c8faec..000000000
--- a/app/views/pools/_search.html.erb
+++ /dev/null
@@ -1,7 +0,0 @@
-
- <%= simple_form_for @search, :method => :get do |f| %>
- <%= f.input :name_contains, :label => "Name", :required => false %>
- <%= f.input :description_contains, :label => "Description", :required => false %>
- <%= f.button :submit, "Search" %>
- <% end %>
-
diff --git a/app/views/pools/_secondary_links.html.erb b/app/views/pools/_secondary_links.html.erb
index 36f2d77b9..d3f491c96 100644
--- a/app/views/pools/_secondary_links.html.erb
+++ b/app/views/pools/_secondary_links.html.erb
@@ -1,6 +1,7 @@
<% content_for(:secondary_links) do %>