This commit is contained in:
@@ -2,8 +2,12 @@ class WikiPagesController < ApplicationController
|
||||
rescue_from Wiki::Commit::Conflict, with: :render_wiki_conflict
|
||||
|
||||
def index
|
||||
pages = WikiPage.all
|
||||
render json: pages.as_json(methods: [:title])
|
||||
title = params[:title].to_s.strip
|
||||
return render json: WikiPage.all.as_json(methods: [:title]) if title.blank?
|
||||
|
||||
q = WikiPage.joins(:tag_name).includes(:tag_name)
|
||||
.where('tag_names.name LIKE ?', "%#{ WikiPage.sanitize_sql_like(title) }%")
|
||||
render json: q.limit(20).as_json(methods: [:title])
|
||||
end
|
||||
|
||||
def show
|
||||
@@ -122,14 +126,7 @@ class WikiPagesController < ApplicationController
|
||||
end
|
||||
|
||||
def search
|
||||
title = params[:title].to_s.strip
|
||||
|
||||
q = WikiPage.joins(:tag_name).includes(:tag_name)
|
||||
if title.present?
|
||||
q = q.where('tag_names.name LIKE ?', "%#{ WikiPage.sanitize_sql_like(title) }%")
|
||||
end
|
||||
|
||||
render json: q.limit(20).as_json(methods: [:title])
|
||||
index
|
||||
end
|
||||
|
||||
def changes
|
||||
|
||||
Reference in New Issue
Block a user