trestle-search 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/trestle/search.scss +23 -37
- data/app/views/trestle/search/_search.html.erb +9 -10
- data/config/initializers/trestle.rb +2 -2
- data/lib/trestle/search/builder.rb +1 -1
- data/lib/trestle/search/engine.rb +1 -1
- data/lib/trestle/search/resource.rb +19 -11
- data/lib/trestle/search/version.rb +1 -1
- data/trestle-search.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bc1fa4641982dcb21cc9ae627fb195a7478d309772a8783a058eb9520fc7753
|
4
|
+
data.tar.gz: 2dddb7bf7cd81cfa160a00a117197e9069d079c1e9071190866cbaebf2802726
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e868a81ac6c4e7cfb1147746053234e995c638ee67c0b8f9b15494a2bc3aa12255c975abaef830c8d446c3c40ae3360a6f30905a48ae1a0be1bf672c088f0e40
|
7
|
+
data.tar.gz: 042b653baf975277db24c9d1f39aaf01af1878e3d189bfea640dccd1ae975a8daa468afa4a8f275f7473a64215d942740165fdfd77485cd84e051b7f95fb51a4
|
@@ -1,55 +1,41 @@
|
|
1
1
|
@import "trestle/support";
|
2
2
|
|
3
3
|
.searchbox {
|
4
|
-
|
5
|
-
max-width:
|
6
|
-
|
4
|
+
width: 100%;
|
5
|
+
max-width: 30em;
|
6
|
+
margin-right: auto;
|
7
|
+
|
8
|
+
.input-group {
|
9
|
+
background: white;
|
10
|
+
border: 1px solid #ccc;
|
11
|
+
border-radius: 50px;
|
12
|
+
box-shadow: inset 0 1px 1px rgba(black, 0.075);
|
13
|
+
}
|
7
14
|
|
8
15
|
.input-group-addon {
|
9
|
-
background:
|
10
|
-
border:
|
11
|
-
padding-left: 0;
|
16
|
+
background: transparent;
|
17
|
+
border: 0;
|
12
18
|
}
|
13
19
|
|
14
20
|
.form-control {
|
15
21
|
padding-left: 0;
|
16
22
|
|
17
|
-
background:
|
23
|
+
background: transparent;
|
18
24
|
box-shadow: none;
|
19
25
|
|
20
|
-
border:
|
21
|
-
border-radius: 0;
|
22
|
-
|
23
|
-
border-bottom: 1px solid #ddd;
|
24
|
-
|
25
|
-
transition: border-color 500ms;
|
26
|
-
|
27
|
-
&:focus {
|
28
|
-
border-color: #555;
|
29
|
-
}
|
26
|
+
border: 0;
|
30
27
|
}
|
31
28
|
|
32
|
-
|
29
|
+
.clear-search {
|
33
30
|
position: absolute;
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
border-radius: 50px;
|
43
|
-
|
44
|
-
.form-control {
|
45
|
-
border-bottom: none;
|
46
|
-
font-size: 16px;
|
31
|
+
right: 10px;
|
32
|
+
z-index: 5;
|
33
|
+
color: #555;
|
34
|
+
font-size: 16px;
|
35
|
+
padding: 4px;
|
36
|
+
|
37
|
+
&:hover, &:focus {
|
38
|
+
color: #333;
|
47
39
|
}
|
48
40
|
}
|
49
41
|
}
|
50
|
-
|
51
|
-
@media (max-width: $screen-xs-max) {
|
52
|
-
.app-sidebar {
|
53
|
-
padding-top: 40px;
|
54
|
-
}
|
55
|
-
}
|
@@ -1,10 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
<
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
<% end -%>
|
1
|
+
<div class="searchbox">
|
2
|
+
<%= form_tag admin.path, method: :get do %>
|
3
|
+
<div class="input-group">
|
4
|
+
<span class="input-group-addon"><icon class="fa fa-search"></icon></span>
|
5
|
+
<%= link_to icon("fa fa-times"), admin.path, class: "clear-search" if params[:q].present? %>
|
6
|
+
<%= search_field_tag :q, params[:q], class: "form-control", autocomplete: "off", placeholder: admin.t("search.placeholder", default: "Search") %>
|
7
|
+
</div>
|
8
|
+
<% end %>
|
9
|
+
</div>
|
@@ -1,11 +1,11 @@
|
|
1
1
|
Trestle.configure do |config|
|
2
2
|
config.persistent_params << :q
|
3
|
-
|
3
|
+
|
4
4
|
config.hook("stylesheets") do
|
5
5
|
stylesheet_link_tag "trestle/search"
|
6
6
|
end
|
7
7
|
|
8
|
-
config.hook("
|
8
|
+
config.hook("resource.index.header", if: -> { admin.searchable? }) do
|
9
9
|
render "trestle/search/search"
|
10
10
|
end
|
11
11
|
end
|
@@ -4,7 +4,7 @@ module Trestle
|
|
4
4
|
config.assets.precompile << "trestle/search.css"
|
5
5
|
|
6
6
|
initializer :extensions do
|
7
|
-
Trestle::Resource.
|
7
|
+
Trestle::Resource.send(:include, Trestle::Search::Resource)
|
8
8
|
Trestle::Resource::Builder.send(:include, Trestle::Search::Builder)
|
9
9
|
Trestle::Resource::Controller.send(:prepend, Trestle::Search::Controller)
|
10
10
|
end
|
@@ -1,22 +1,30 @@
|
|
1
1
|
module Trestle
|
2
2
|
module Search
|
3
3
|
module Resource
|
4
|
-
|
4
|
+
extend ActiveSupport::Concern
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
included do
|
7
|
+
# Include custom #collection method on Resource instance
|
8
|
+
prepend Collection
|
9
|
+
|
10
|
+
# Include custom #collection method on Resource class
|
11
|
+
singleton_class.send(:prepend, Collection)
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
module Collection
|
15
|
+
def collection(params)
|
16
|
+
if searchable?
|
17
|
+
adapter.search(params[:q].presence, params)
|
18
|
+
else
|
19
|
+
super
|
20
|
+
end
|
21
|
+
end
|
16
22
|
end
|
17
23
|
|
18
|
-
|
19
|
-
|
24
|
+
module ClassMethods
|
25
|
+
def searchable?
|
26
|
+
adapter.respond_to?(:search)
|
27
|
+
end
|
20
28
|
end
|
21
29
|
end
|
22
30
|
end
|
data/trestle-search.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "trestle", "~> 0.8", ">= 0.8.
|
21
|
+
spec.add_dependency "trestle", "~> 0.8", ">= 0.8.10"
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.12"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trestle-search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Pohlenz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trestle
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '0.8'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.8.
|
22
|
+
version: 0.8.10
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '0.8'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.8.
|
32
|
+
version: 0.8.10
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: bundler
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
version: '0'
|
122
122
|
requirements: []
|
123
123
|
rubyforge_project:
|
124
|
-
rubygems_version: 2.7.
|
124
|
+
rubygems_version: 2.7.6
|
125
125
|
signing_key:
|
126
126
|
specification_version: 4
|
127
127
|
summary: Search plugin for the Trestle admin framework
|