searchjoy 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +2 -0
- data/app/assets/javascripts/searchjoy.js +2 -0
- data/app/models/searchjoy/search.rb +2 -3
- data/app/views/layouts/searchjoy/application.html.erb +1 -1
- data/app/views/searchjoy/searches/stream.html.erb +14 -4
- data/lib/generators/searchjoy/install_generator.rb +1 -3
- data/lib/searchjoy/engine.rb +4 -1
- data/lib/searchjoy/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47b5f1bbd61d9b7816b5bfe5333de4555e139b26f6a7e1149f20018563eadf9b
|
4
|
+
data.tar.gz: bf3f3e7f166ff1645cac7561562a4405728935601cb67eea54db06061c02d170
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a8815fd2d3832a5bf76bab88c724ef2f721c128fa9c8172b91e569682c91fc005da4d769d9ef1d8388dfd0d8551420f83b16e1613f725826c6c17119d355ae2
|
7
|
+
data.tar.gz: c9d2b458ffa97a76f773d48b3dc6238ee85c0693494d7f89e2c8d980788c1197ab1602f901f873c54be5634d5eb1b63a73f1d453abbfb0d42542584fc4d734bb
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -12,6 +12,8 @@ Works with any search platform, including Elasticsearch, Sphinx, and Solr
|
|
12
12
|
|
13
13
|
:cupid: An amazing companion to [Searchkick](https://github.com/ankane/searchkick)
|
14
14
|
|
15
|
+
[![Build Status](https://travis-ci.org/ankane/searchjoy.svg?branch=master)](https://travis-ci.org/ankane/searchjoy)
|
16
|
+
|
15
17
|
## Installation
|
16
18
|
|
17
19
|
Add this line to your application’s Gemfile:
|
@@ -2,9 +2,8 @@ module Searchjoy
|
|
2
2
|
class Search < ActiveRecord::Base
|
3
3
|
self.table_name = "searchjoy_searches"
|
4
4
|
|
5
|
-
|
6
|
-
belongs_to :
|
7
|
-
belongs_to :user, **options
|
5
|
+
belongs_to :convertable, polymorphic: true, optional: true
|
6
|
+
belongs_to :user, optional: true
|
8
7
|
|
9
8
|
before_save :set_normalized_query
|
10
9
|
|
@@ -280,7 +280,7 @@
|
|
280
280
|
}
|
281
281
|
</style>
|
282
282
|
|
283
|
-
<%= javascript_include_tag "
|
283
|
+
<%= javascript_include_tag "searchjoy" %>
|
284
284
|
</head>
|
285
285
|
<body>
|
286
286
|
<div class="container">
|
@@ -3,11 +3,21 @@
|
|
3
3
|
<table id="stream"></table>
|
4
4
|
|
5
5
|
<script>
|
6
|
+
function load(element, path) {
|
7
|
+
var request = new XMLHttpRequest();
|
8
|
+
request.open("GET", path, true);
|
9
|
+
request.onload = function() {
|
10
|
+
if (request.status >= 200 && request.status < 400) {
|
11
|
+
var resp = request.responseText;
|
12
|
+
element.innerHTML = resp;
|
13
|
+
}
|
14
|
+
};
|
15
|
+
request.send();
|
16
|
+
}
|
17
|
+
|
6
18
|
function fetchRecentSearches() {
|
7
|
-
|
19
|
+
load(document.getElementById("stream"), "<%= searches_recent_path %>")
|
8
20
|
setTimeout(fetchRecentSearches, 5 * 1000);
|
9
21
|
}
|
10
|
-
|
11
|
-
fetchRecentSearches();
|
12
|
-
});
|
22
|
+
fetchRecentSearches();
|
13
23
|
</script>
|
@@ -26,9 +26,7 @@ module Searchjoy
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def migration_version
|
29
|
-
|
30
|
-
"[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]"
|
31
|
-
end
|
29
|
+
"[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]"
|
32
30
|
end
|
33
31
|
end
|
34
32
|
end
|
data/lib/searchjoy/engine.rb
CHANGED
@@ -2,7 +2,10 @@ module Searchjoy
|
|
2
2
|
class Engine < ::Rails::Engine
|
3
3
|
isolate_namespace Searchjoy
|
4
4
|
|
5
|
-
initializer "searchjoy" do
|
5
|
+
initializer "searchjoy" do |app|
|
6
|
+
# use a proc instead of a string
|
7
|
+
app.config.assets.precompile << proc { |path| path == "searchjoy.js" }
|
8
|
+
|
6
9
|
Searchjoy.attach_to_searchkick! if defined?(Searchkick)
|
7
10
|
end
|
8
11
|
end
|
data/lib/searchjoy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: searchjoy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chartkick
|
@@ -131,6 +131,7 @@ files:
|
|
131
131
|
- CHANGELOG.md
|
132
132
|
- LICENSE.txt
|
133
133
|
- README.md
|
134
|
+
- app/assets/javascripts/searchjoy.js
|
134
135
|
- app/controllers/searchjoy/searches_controller.rb
|
135
136
|
- app/models/searchjoy/search.rb
|
136
137
|
- app/views/layouts/searchjoy/application.html.erb
|