searchjoy 0.4.0 → 0.4.1

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
  SHA256:
3
- metadata.gz: 64e99ae7ad3156c550ad14bd0c6b8bea1771749a10136329dae8bf6493612125
4
- data.tar.gz: c8270664778714b46af93a4914c43539f69b73704d32e74f37bbbcc93352fca3
3
+ metadata.gz: 47b5f1bbd61d9b7816b5bfe5333de4555e139b26f6a7e1149f20018563eadf9b
4
+ data.tar.gz: bf3f3e7f166ff1645cac7561562a4405728935601cb67eea54db06061c02d170
5
5
  SHA512:
6
- metadata.gz: '0528355d4e0ae8259a06ef1f669c250dda444202f10de264594f1c338742a7400b95c0e60dd0d8458df114a560cc10139c405543840cf093cee155606706e437'
7
- data.tar.gz: deed698f626106cba1e4dff53983b978c01176b5e42c9a80a7cdc49a399282983b94e52ab826b9533603799c6af75d0866b16ed5c039ac27098904b8e2f04915
6
+ metadata.gz: 7a8815fd2d3832a5bf76bab88c724ef2f721c128fa9c8172b91e569682c91fc005da4d769d9ef1d8388dfd0d8551420f83b16e1613f725826c6c17119d355ae2
7
+ data.tar.gz: c9d2b458ffa97a76f773d48b3dc6238ee85c0693494d7f89e2c8d980788c1197ab1602f901f873c54be5634d5eb1b63a73f1d453abbfb0d42542584fc4d734bb
@@ -1,3 +1,7 @@
1
+ ## 0.4.1
2
+
3
+ - Added support for Rails 6
4
+
1
5
  ## 0.4.0
2
6
 
3
7
  - Added support for `models` option
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:
@@ -0,0 +1,2 @@
1
+ //= require chartkick
2
+ //= require Chart.bundle
@@ -2,9 +2,8 @@ module Searchjoy
2
2
  class Search < ActiveRecord::Base
3
3
  self.table_name = "searchjoy_searches"
4
4
 
5
- options = ActiveRecord::VERSION::MAJOR == 5 ? {optional: true} : {}
6
- belongs_to :convertable, polymorphic: true, **options
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 "https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js", "https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.bundle.min.js", "chartkick" %>
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
- $("#stream").load("<%= searches_recent_path %>");
19
+ load(document.getElementById("stream"), "<%= searches_recent_path %>")
8
20
  setTimeout(fetchRecentSearches, 5 * 1000);
9
21
  }
10
- $( function() {
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
- if ActiveRecord::VERSION::MAJOR >= 5
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Searchjoy
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
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.0
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-04-15 00:00:00.000000000 Z
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