zeus.ugent.be/lib/helpers/search.rb

24 lines
391 B
Ruby
Raw Permalink Normal View History

2016-10-08 18:52:46 +02:00
module SearchHelper
def blog_search_json
jsonify articles
end
def event_search_json
jsonify all_events
end
private
def jsonify(collection)
elems = collection.map do |e|
{
title: e[:title],
url: url_for(e),
2018-07-05 11:36:11 +02:00
text: "#{e[:title]} #{e.reps[:text].compiled_content}",
2016-10-08 18:52:46 +02:00
tags: ''
}
end
{ pages: elems }.to_json
end
end