Move browse#note to notes#show
This allows a more resourceful routing approach.
This commit is contained in:
parent
b5046fdcd0
commit
9748ce301c
22 changed files with 175 additions and 138 deletions
|
@ -76,19 +76,5 @@ class BrowseController < ApplicationController
|
|||
render :action => "not_found", :status => :not_found
|
||||
end
|
||||
|
||||
def note
|
||||
@type = "note"
|
||||
|
||||
if current_user&.moderator?
|
||||
@note = Note.find(params[:id])
|
||||
@note_comments = @note.comments.unscope(:where => :visible)
|
||||
else
|
||||
@note = Note.visible.find(params[:id])
|
||||
@note_comments = @note.comments
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render :action => "not_found", :status => :not_found
|
||||
end
|
||||
|
||||
def query; end
|
||||
end
|
||||
|
|
|
@ -33,5 +33,19 @@ class NotesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@type = "note"
|
||||
|
||||
if current_user&.moderator?
|
||||
@note = Note.find(params[:id])
|
||||
@note_comments = @note.comments.unscope(:where => :visible)
|
||||
else
|
||||
@note = Note.visible.find(params[:id])
|
||||
@note_comments = @note.comments
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render :template => "browse/not_found", :status => :not_found
|
||||
end
|
||||
|
||||
def new; end
|
||||
end
|
||||
|
|
|
@ -140,7 +140,7 @@ class SiteController < ApplicationController
|
|||
elsif params[:relation]
|
||||
redirect_to relation_path(params[:relation])
|
||||
elsif params[:note]
|
||||
redirect_to browse_note_path(params[:note])
|
||||
redirect_to note_path(params[:note])
|
||||
elsif params[:query]
|
||||
redirect_to search_path(:query => params[:query])
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue