/notes: default to listing notes, not posts. Remove group_by=post.

The posts listing is replaced by a link to order:note.
This commit is contained in:
evazion
2017-04-23 14:26:23 -05:00
parent 76eefd0ffe
commit e6d1842545
6 changed files with 8 additions and 61 deletions

View File

@@ -6,10 +6,11 @@ class NotesController < ApplicationController
end
def index
if params[:group_by] == "note"
index_by_note
else
index_by_post
@notes = Note.search(params[:search]).order("id desc").paginate(params[:page], :limit => params[:limit], :search_count => params[:search])
respond_with(@notes) do |format|
format.xml do
render :xml => @notes.to_xml(:root => "notes")
end
end
end
@@ -66,25 +67,4 @@ private
def create_params
params.require(:note).permit(:x, :y, :width, :height, :body, :post_id, :html_id)
end
def index_by_post
@post_set = PostSets::Note.new(params)
@posts = @post_set.posts
respond_with(@posts) do |format|
format.html {render :action => "index_by_post"}
format.xml do
render :xml => @posts.to_xml(:root => "posts")
end
end
end
def index_by_note
@notes = Note.search(params[:search]).order("id desc").paginate(params[:page], :limit => params[:limit], :search_count => params[:search])
respond_with(@notes) do |format|
format.html {render :action => "index_by_note"}
format.xml do
render :xml => @notes.to_xml(:root => "notes")
end
end
end
end

View File

@@ -1,17 +0,0 @@
module PostSets
class Note < PostSets::Post
attr_reader :params
def initialize(params)
# don't call super because we don't want to repeat these queries
@params = params
@tag_array = Tag.scan_query(params[:tags])
@page = params[:page] || 1
@posts = ::Post.tag_match(tag_string).has_notes.paginate(page, :limit => limit).reorder("last_noted_at desc")
end
def limit
[(params[:limit] || CurrentUser.user.per_page).to_i, 1_000].min
end
end
end

View File

@@ -6,7 +6,7 @@
<% end %>
<%= nav_link_to("Posts", posts_path) %>
<%= nav_link_to("Comments", comments_path(:group_by => "post")) %>
<%= nav_link_to("Notes", notes_path(:group_by => "post")) %>
<%= nav_link_to("Notes", notes_path) %>
<%= nav_link_to("Artists", artists_path) %>
<%= nav_link_to("Tags", tags_path) %>
<% if CurrentUser.is_builder? %>

View File

@@ -1,7 +1,8 @@
<% content_for(:secondary_links) do %>
<menu>
<li><%= render "notes/quick_search" %></li>
<li><%= link_to "Listing", notes_path(:group_by => "post") %></li>
<li><%= link_to "Listing", notes_path %></li>
<li><%= link_to "Posts", posts_path(:tags => "order:note") %></li>
<li><%= link_to "Search", search_notes_path %></li>
<li><%= link_to "History", note_versions_path %></li>
<li><%= link_to "Requests", posts_path(:tags => "translation_request") %></li>

View File

@@ -1,17 +0,0 @@
<div id="c-notes">
<div id="a-index">
<h1>Notes</h1>
<%= render "posts/partials/common/inline_blacklist" %>
<%= @post_set.presenter.post_previews_html(self) %>
<%= numbered_paginator(@posts, false) %>
</div>
</div>
<%= render "secondary_links" %>
<% content_for(:page_title) do %>
Notes - <%= Danbooru.config.app_name %>
<% end %>