tkh_search 0.3.0.2 → 0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9748ff601f15d8ab012357f8728cef710eb84488
|
4
|
+
data.tar.gz: c0351037148f0801b3df02527bf15a698303156d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5edec205a9a08c8b0d0deab1d5de54dc5d70e5d7cdfe535281873ed0ab4b300933a0b08cf3ac3bba7813850de099e18632cbcdd15eee8d4c6343d1cf5c5dd1d7
|
7
|
+
data.tar.gz: cb1367241a31e67ce6656ca1c14c58f1e24f61b07182928dc997ccd43c87f1ca25464c93fd3ed78ef3600600323480b03bc198e2bfcc7316b841c524a0eca2cc
|
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,6 @@ class SearchController < ApplicationController
|
|
4
4
|
@query = params[:query].downcase.strip
|
5
5
|
@models_to_search = params[:models_to_search].split
|
6
6
|
@results_css_class = params[:results_css_class] || 'js-search-results'
|
7
|
-
current_locale = @cl
|
8
7
|
@the_current_locale = I18n.locale
|
9
8
|
token = SecureRandom.base64
|
10
9
|
search_terms = []
|
@@ -12,8 +11,8 @@ class SearchController < ApplicationController
|
|
12
11
|
search_terms << TkhSearchTerm.find_or_create_by( word: query_word )
|
13
12
|
end
|
14
13
|
search_terms.each do |search_term|
|
15
|
-
if search_term.tkh_search_instances.for_locale(
|
16
|
-
search_term.tkh_search_instances.for_locale(
|
14
|
+
if search_term.tkh_search_instances.for_locale(@the_current_locale).any?
|
15
|
+
search_term.tkh_search_instances.for_locale(@the_current_locale).each do |search_instance|
|
17
16
|
if @models_to_search.include? search_instance.host_model_name
|
18
17
|
search_result = TkhSearchResult.find_or_create_by(
|
19
18
|
token: token,
|
@@ -1,7 +1,11 @@
|
|
1
1
|
<ul class="search-results">
|
2
2
|
<% if search_results.any? %>
|
3
3
|
<% search_results.each do |result| %>
|
4
|
-
<%
|
4
|
+
<% begin %>
|
5
|
+
<% record = (Kernel.const_get result.host_model_name).find(result.model_record_id) %>
|
6
|
+
<% rescue %>
|
7
|
+
next
|
8
|
+
<% end %>
|
5
9
|
<% if defined? record.name %>
|
6
10
|
<% link_label = record.name %>
|
7
11
|
<% elsif defined? record.title %>
|
@@ -9,11 +13,11 @@
|
|
9
13
|
<% else %>
|
10
14
|
<% link_label = 'no title or name' %>
|
11
15
|
<% end %>
|
12
|
-
<%= content_tag :li,
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
16
|
+
<%= content_tag( :li,
|
17
|
+
"<span class='sr-model-name'>#{result.host_model_name}</span> -
|
18
|
+
<span class='sr-record-link'>#{link_to link_label, record}</span> -
|
19
|
+
<span class='sr-rating'>#{result.rating}</span>
|
20
|
+
".html_safe) unless link_label == 'no title or name'
|
17
21
|
%>
|
18
22
|
<% end %>
|
19
23
|
<% else %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
<h3>The index ...</h3>
|
4
4
|
|
5
|
-
<p>... has <strong><%= TkhSearchTerm.count %></strong> different search terms pointing to <strong><%= TkhSearchInstance.count %></strong> instances.</p>
|
5
|
+
<p>... has <strong><%= number_with_delimiter TkhSearchTerm.count, delimiter: ',' %></strong> different search terms pointing to <strong><%= number_with_delimiter TkhSearchInstance.count, delimiter: ',' %></strong> instances.</p>
|
6
6
|
|
7
7
|
<h3>Total User Searches</h3>
|
8
8
|
|
data/lib/tkh_search/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tkh_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Swami Atma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|