trestle-search 0.3.0 → 0.4.0
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 +4 -4
- data/.browserlistrc +1 -0
- data/.gitignore +1 -0
- data/app/assets/bundle/trestle/search.css +1 -0
- data/app/views/trestle/search/_search.html.erb +3 -1
- data/config/{locale → locales}/en.yml +0 -0
- data/config/locales/es.yml +5 -0
- data/config/locales/fr.yml +5 -0
- data/config/{locale → locales}/pl.yml +0 -0
- data/config/{locale → locales}/pt-BR.yml +0 -0
- data/config/locales/ru.yml +5 -0
- data/{app/assets/stylesheets/trestle/search.scss → frontend/index.scss} +9 -8
- data/lib/trestle/search/resource.rb +6 -2
- data/lib/trestle/search/version.rb +1 -1
- data/package.json +30 -0
- data/trestle-search.gemspec +1 -1
- data/webpack.config.js +48 -0
- data/yarn.lock +4957 -0
- metadata +17 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9d2248468b6836412e7e254a97b044de88877f15071c77fcdb3d982fd6f3effb
|
|
4
|
+
data.tar.gz: d67cdb6dd4dbcaac0d1a5f58c6660d08e0047a5b88a927db4da0454055586397
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c573ba644e674b9bcb23fbc9189aa38ff52a87cefe8561aa3aa735c4db93b95de2d950ee75ed5e3ffe32722cfed1010c6a0544f54cc73ca65173ecbe08e21a54
|
|
7
|
+
data.tar.gz: f489967f05d2ce2af032532731cc810683219852fb2c56317d4bca1092ab24d70b8443e546b53c54b0a504a23e00020f1692b967c2f9af73fdc4802757d14fc3
|
data/.browserlistrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
> 0.25%
|
data/.gitignore
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.searchbox{width:100%;max-width:30em;margin-right:auto}.searchbox .input-group{background:#fff;border:1px solid #ccc;border-radius:50rem}.searchbox .form-control,.searchbox .input-group-text{background:transparent;border:0}.searchbox .form-control{padding-left:0;box-shadow:none}.searchbox .form-control::-webkit-search-cancel-button{display:none}.searchbox .clear-search{position:absolute;right:.75rem;z-index:5;color:#555;font-size:1.2rem;padding:.35rem}.searchbox .clear-search:focus,.searchbox .clear-search:hover{color:#333}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<div class="searchbox">
|
|
2
2
|
<%= form_tag admin.path, method: :get do %>
|
|
3
3
|
<div class="input-group">
|
|
4
|
-
<
|
|
4
|
+
<div class="input-group-prepend">
|
|
5
|
+
<span class="input-group-text"><icon class="fa fa-search"></icon></span>
|
|
6
|
+
</div>
|
|
5
7
|
<%= link_to icon("fa fa-times"), admin.path, class: "clear-search" if params[:q].present? %>
|
|
6
8
|
<%= search_field_tag :q, params[:q], class: "form-control", autocomplete: "off", placeholder: admin.t("search.placeholder", default: "Search") %>
|
|
7
9
|
</div>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
@import "trestle/support";
|
|
2
|
-
|
|
3
1
|
.searchbox {
|
|
4
2
|
width: 100%;
|
|
5
3
|
max-width: 30em;
|
|
@@ -8,11 +6,10 @@
|
|
|
8
6
|
.input-group {
|
|
9
7
|
background: white;
|
|
10
8
|
border: 1px solid #ccc;
|
|
11
|
-
border-radius:
|
|
12
|
-
box-shadow: inset 0 1px 1px rgba(black, 0.075);
|
|
9
|
+
border-radius: 50rem;
|
|
13
10
|
}
|
|
14
11
|
|
|
15
|
-
.input-group-
|
|
12
|
+
.input-group-text {
|
|
16
13
|
background: transparent;
|
|
17
14
|
border: 0;
|
|
18
15
|
}
|
|
@@ -24,15 +21,19 @@
|
|
|
24
21
|
box-shadow: none;
|
|
25
22
|
|
|
26
23
|
border: 0;
|
|
24
|
+
|
|
25
|
+
&::-webkit-search-cancel-button {
|
|
26
|
+
display: none;
|
|
27
|
+
}
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
.clear-search {
|
|
30
31
|
position: absolute;
|
|
31
|
-
right:
|
|
32
|
+
right: 0.75rem;
|
|
32
33
|
z-index: 5;
|
|
33
34
|
color: #555;
|
|
34
|
-
font-size:
|
|
35
|
-
padding:
|
|
35
|
+
font-size: 1.2rem;
|
|
36
|
+
padding: 0.35rem;
|
|
36
37
|
|
|
37
38
|
&:hover, &:focus {
|
|
38
39
|
color: #333;
|
|
@@ -12,13 +12,17 @@ module Trestle
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
module Collection
|
|
15
|
-
def collection(params)
|
|
15
|
+
def collection(params={})
|
|
16
16
|
if searchable?
|
|
17
|
-
|
|
17
|
+
search(params[:q].presence, params)
|
|
18
18
|
else
|
|
19
19
|
super
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
|
+
|
|
23
|
+
def search(query, params={})
|
|
24
|
+
adapter.search(query, params)
|
|
25
|
+
end
|
|
22
26
|
end
|
|
23
27
|
|
|
24
28
|
module ClassMethods
|
data/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "trestle-search",
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Search plugin for the Trestle admin framework",
|
|
5
|
+
"main": "index.scss",
|
|
6
|
+
"repository": "https://github.com/TrestleAdmin/trestle-search.git",
|
|
7
|
+
"author": "Sam Pohlenz <sam@sampohlenz.com>",
|
|
8
|
+
"license": "LGPL-3.0",
|
|
9
|
+
"private": true,
|
|
10
|
+
"scripts": {
|
|
11
|
+
"dev": "webpack --mode development",
|
|
12
|
+
"build": "webpack --mode production",
|
|
13
|
+
"watch": "webpack --mode development --watch"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"autoprefixer": "^9.6.1",
|
|
17
|
+
"css-loader": "^3.2.0",
|
|
18
|
+
"mini-css-extract-plugin": "^0.8.0",
|
|
19
|
+
"node-sass": "^4.12.0",
|
|
20
|
+
"optimize-css-assets-webpack-plugin": "^5.0.3",
|
|
21
|
+
"postcss-loader": "^3.0.0",
|
|
22
|
+
"sass-loader": "^8.0.0",
|
|
23
|
+
"webpack": "^4.40.2",
|
|
24
|
+
"webpack-cli": "^3.3.9",
|
|
25
|
+
"webpack-fix-style-only-entries": "^0.4.0"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"trestle": "https://github.com/TrestleAdmin/trestle.git"
|
|
29
|
+
}
|
|
30
|
+
}
|
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.
|
|
21
|
+
spec.add_dependency "trestle", "~> 0.9.0"
|
|
22
22
|
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.12"
|
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
data/webpack.config.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
|
|
3
|
+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
4
|
+
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
|
5
|
+
const FixStyleOnlyEntriesPlugin = require('webpack-fix-style-only-entries');
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
entry: {
|
|
9
|
+
search: path.resolve(__dirname, 'frontend/index.scss')
|
|
10
|
+
},
|
|
11
|
+
output: {
|
|
12
|
+
path: path.resolve(__dirname, 'app/assets/bundle/trestle')
|
|
13
|
+
},
|
|
14
|
+
optimization: {
|
|
15
|
+
splitChunks: {
|
|
16
|
+
cacheGroups: {
|
|
17
|
+
styles: {
|
|
18
|
+
name: 'bundle',
|
|
19
|
+
test: /\.css$/,
|
|
20
|
+
chunks: 'all',
|
|
21
|
+
enforce: true
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
minimizer: [
|
|
26
|
+
new OptimizeCSSAssetsPlugin({})
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
module: {
|
|
30
|
+
rules: [
|
|
31
|
+
{
|
|
32
|
+
test: /\.s?[ac]ss$/,
|
|
33
|
+
use: [
|
|
34
|
+
{ loader: MiniCssExtractPlugin.loader },
|
|
35
|
+
{ loader: 'css-loader' },
|
|
36
|
+
{ loader: 'postcss-loader', options: { plugins: [ require('autoprefixer') ] } },
|
|
37
|
+
{ loader: 'sass-loader' }
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
plugins: [
|
|
43
|
+
new FixStyleOnlyEntriesPlugin(),
|
|
44
|
+
new MiniCssExtractPlugin({
|
|
45
|
+
filename: '[name].css'
|
|
46
|
+
})
|
|
47
|
+
]
|
|
48
|
+
}
|