このコミットが含まれているのは:
@@ -3,11 +3,11 @@ class WikiPagesController < ApplicationController
|
|||||||
|
|
||||||
def index
|
def index
|
||||||
# 互換性のための化石リソース
|
# 互換性のための化石リソース
|
||||||
# TODO: ヘルプおよびタグ・グループ追加後に,
|
# TODO: ヘルプ追加後にヘルプからも取得する作りに変更する.
|
||||||
# TODO: タグ説明とヘルプ、タグ・グループから取得する作りに変更する.
|
|
||||||
#
|
|
||||||
title = params[:title].to_s.strip
|
title = params[:title].to_s.strip
|
||||||
descriptions = TagDescription.where(language_code: 'ja')
|
descriptions =
|
||||||
|
TagDescription.where(language_code: 'ja')
|
||||||
.includes(tag: :tag_names)
|
.includes(tag: :tag_names)
|
||||||
pages = unmigrated_wiki_pages.includes(tag_name: :tag)
|
pages = unmigrated_wiki_pages.includes(tag_name: :tag)
|
||||||
|
|
||||||
@@ -16,10 +16,12 @@ class WikiPagesController < ApplicationController
|
|||||||
descriptions = descriptions.joins(tag: :tag_names)
|
descriptions = descriptions.joins(tag: :tag_names)
|
||||||
.where(tag_names: { language_code: 'ja', primary_flg: true })
|
.where(tag_names: { language_code: 'ja', primary_flg: true })
|
||||||
.where('tag_names.name LIKE ?', pattern).limit(20)
|
.where('tag_names.name LIKE ?', pattern).limit(20)
|
||||||
|
tag_groups = TagGroup.where("CONCAT('タググループ:', name) LIKE ?", pattern).limit(20)
|
||||||
pages = pages.where('tag_names.name LIKE ?', pattern).limit(20)
|
pages = pages.where('tag_names.name LIKE ?', pattern).limit(20)
|
||||||
end
|
end
|
||||||
|
|
||||||
json = descriptions.map { |description| WikiPageRepr.tag_description(description) }
|
json = descriptions.map { |description| WikiPageRepr.tag_description(description) }
|
||||||
|
json.concat(tag_groups.map { |tag_gorup| WikiPageRepr.tag_group(tag_group) })
|
||||||
json.concat(WikiPageRepr.base(pages))
|
json.concat(WikiPageRepr.base(pages))
|
||||||
json = json.first(20) if title.present?
|
json = json.first(20) if title.present?
|
||||||
render json:
|
render json:
|
||||||
@@ -271,7 +273,12 @@ class WikiPagesController < ApplicationController
|
|||||||
|
|
||||||
def unmigrated_wiki_pages
|
def unmigrated_wiki_pages
|
||||||
descriptions = TagDescription.where(language_code: 'ja')
|
descriptions = TagDescription.where(language_code: 'ja')
|
||||||
WikiPage.joins(:tag_name).where.not(id: descriptions.select(:id))
|
tag_groups = TagGroup.all
|
||||||
|
|
||||||
|
WikiPage
|
||||||
|
.joins(:tag_name)
|
||||||
|
.where.not(id: descriptions.select(:id))
|
||||||
|
.where.not(id: tag_groups.select(:id))
|
||||||
.where('tag_names.tag_id IS NULL OR tag_names.tag_id NOT IN (?)',
|
.where('tag_names.tag_id IS NULL OR tag_names.tag_id NOT IN (?)',
|
||||||
descriptions.select(:tag_id))
|
descriptions.select(:tag_id))
|
||||||
end
|
end
|
||||||
|
|||||||
新しいイシューから参照
ユーザーをブロックする