notes: include search form on search results page.
Also eliminate /notes/search endpoint.
This commit is contained in:
@@ -1,9 +1,6 @@
|
|||||||
class NotesController < ApplicationController
|
class NotesController < ApplicationController
|
||||||
respond_to :html, :xml, :json, :js
|
respond_to :html, :xml, :json, :js
|
||||||
|
|
||||||
def search
|
|
||||||
end
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@notes = authorize Note.paginated_search(params)
|
@notes = authorize Note.paginated_search(params)
|
||||||
@notes = @notes.includes(:post) if request.format.html?
|
@notes = @notes.includes(:post) if request.format.html?
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
<%= quick_search_form_for(:body_matches, notes_path, "notes") %>
|
<%= quick_search_form_for(:body_matches, notes_path, "notes") %>
|
||||||
<%= subnav_link_to "Listing", notes_path %>
|
<%= subnav_link_to "Listing", notes_path %>
|
||||||
<%= subnav_link_to "Posts", posts_path(:tags => "order:note") %>
|
<%= subnav_link_to "Posts", posts_path(:tags => "order:note") %>
|
||||||
<%= subnav_link_to "Search", search_notes_path %>
|
|
||||||
<%= subnav_link_to "History", note_versions_path %>
|
<%= subnav_link_to "History", note_versions_path %>
|
||||||
<%= subnav_link_to "Requests", posts_path(:tags => "translation_request") %>
|
<%= subnav_link_to "Requests", posts_path(:tags => "translation_request") %>
|
||||||
<%= subnav_link_to "Help", wiki_page_path("help:notes") %>
|
<%= subnav_link_to "Help", wiki_page_path("help:notes") %>
|
||||||
|
|||||||
@@ -4,6 +4,14 @@
|
|||||||
<div id="a-index">
|
<div id="a-index">
|
||||||
<h1>Notes</h1>
|
<h1>Notes</h1>
|
||||||
|
|
||||||
|
<%= search_form_for(notes_path) do |f| %>
|
||||||
|
<%= f.hidden_field :group_by, value: "note" %>
|
||||||
|
|
||||||
|
<%= f.input :body_matches, label: "Note", hint: "Use * for wildcard", input_html: { value: params[:search][:body_matches] } %>
|
||||||
|
<%= f.input :post_tags_match, label: "Tags", input_html: { value: params[:search][:post_tags_match], "data-autocomplete": "tag-query" } %>
|
||||||
|
<%= f.submit "Search" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= table_for @notes, class: "striped autofit" do |t| %>
|
<%= table_for @notes, class: "striped autofit" do |t| %>
|
||||||
<% t.column "Post" do |note| %>
|
<% t.column "Post" do |note| %>
|
||||||
<%= link_to note.post_id, note.post %>
|
<%= link_to note.post_id, note.post %>
|
||||||
@@ -12,7 +20,7 @@
|
|||||||
<%= link_to "#{note.id}.#{note.version}", post_path(note.post_id, anchor: "note-#{note.id}") %>
|
<%= link_to "#{note.id}.#{note.version}", post_path(note.post_id, anchor: "note-#{note.id}") %>
|
||||||
<%= link_to "»", note_versions_path(search: { note_id: note.id }) %>
|
<%= link_to "»", note_versions_path(search: { note_id: note.id }) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% t.column "Body", td: { class: "col-expand" } do |note| %>
|
<% t.column "Text", td: { class: "col-expand" } do |note| %>
|
||||||
<%= note.body %>
|
<%= note.body %>
|
||||||
<% unless note.is_active? %>
|
<% unless note.is_active? %>
|
||||||
<span class="inactive">(deleted)</span>
|
<span class="inactive">(deleted)</span>
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
<div id="c-notes">
|
|
||||||
<div id="a-search">
|
|
||||||
<h1>Search Notes</h1>
|
|
||||||
|
|
||||||
<%= search_form_for(notes_path) do |f| %>
|
|
||||||
<%= f.hidden_field :group_by, value: "note" %>
|
|
||||||
|
|
||||||
<%= f.input :body_matches, label: "Body" %>
|
|
||||||
<%= f.input :post_tags_match, label: "Tags", input_html: { data: { autocomplete: "tag-query" } } %>
|
|
||||||
<%= f.submit "Search" %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<%= render "secondary_links" %>
|
|
||||||
@@ -57,7 +57,6 @@
|
|||||||
<li><h2>Notes</h2></li>
|
<li><h2>Notes</h2></li>
|
||||||
<li><%= link_to_wiki "Help", "help:notes" %></li>
|
<li><%= link_to_wiki "Help", "help:notes" %></li>
|
||||||
<li><%= link_to("Listing", notes_path) %></li>
|
<li><%= link_to("Listing", notes_path) %></li>
|
||||||
<li><%= link_to("Search", search_notes_path) %></li>
|
|
||||||
<li><%= link_to("Changes", note_versions_path) %></li>
|
<li><%= link_to("Changes", note_versions_path) %></li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul>
|
<ul>
|
||||||
|
|||||||
@@ -142,9 +142,6 @@ Rails.application.routes.draw do
|
|||||||
resources :modqueue, only: [:index]
|
resources :modqueue, only: [:index]
|
||||||
resources :news_updates
|
resources :news_updates
|
||||||
resources :notes do
|
resources :notes do
|
||||||
collection do
|
|
||||||
get :search
|
|
||||||
end
|
|
||||||
member do
|
member do
|
||||||
put :revert
|
put :revert
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user