dtext links: add basic index page.
This commit is contained in:
@@ -19,6 +19,18 @@ class DtextLink < ApplicationRecord
|
||||
links
|
||||
end
|
||||
|
||||
def self.model_matches(params)
|
||||
return all if params.blank?
|
||||
where(model_id: WikiPage.search(params).reorder(nil))
|
||||
end
|
||||
|
||||
def self.search(params)
|
||||
q = super
|
||||
q = q.search_attributes(params, :model_type, :model_id, :link_type, :link_target)
|
||||
q = q.model_matches(params[:model])
|
||||
q.apply_default_order(params)
|
||||
end
|
||||
|
||||
def normalize_link_target
|
||||
if wiki_link?
|
||||
self.link_target = WikiPage.normalize_title(link_target)
|
||||
|
||||
Reference in New Issue
Block a user