trestle-search 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7bc1fa4641982dcb21cc9ae627fb195a7478d309772a8783a058eb9520fc7753
4
- data.tar.gz: 2dddb7bf7cd81cfa160a00a117197e9069d079c1e9071190866cbaebf2802726
3
+ metadata.gz: 9d2248468b6836412e7e254a97b044de88877f15071c77fcdb3d982fd6f3effb
4
+ data.tar.gz: d67cdb6dd4dbcaac0d1a5f58c6660d08e0047a5b88a927db4da0454055586397
5
5
  SHA512:
6
- metadata.gz: e868a81ac6c4e7cfb1147746053234e995c638ee67c0b8f9b15494a2bc3aa12255c975abaef830c8d446c3c40ae3360a6f30905a48ae1a0be1bf672c088f0e40
7
- data.tar.gz: 042b653baf975277db24c9d1f39aaf01af1878e3d189bfea640dccd1ae975a8daa468afa4a8f275f7473a64215d942740165fdfd77485cd84e051b7f95fb51a4
6
+ metadata.gz: c573ba644e674b9bcb23fbc9189aa38ff52a87cefe8561aa3aa735c4db93b95de2d950ee75ed5e3ffe32722cfed1010c6a0544f54cc73ca65173ecbe08e21a54
7
+ data.tar.gz: f489967f05d2ce2af032532731cc810683219852fb2c56317d4bca1092ab24d70b8443e546b53c54b0a504a23e00020f1692b967c2f9af73fdc4802757d14fc3
data/.browserlistrc ADDED
@@ -0,0 +1 @@
1
+ > 0.25%
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ /node_modules/
@@ -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
- <span class="input-group-addon"><icon class="fa fa-search"></icon></span>
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
@@ -0,0 +1,5 @@
1
+ es:
2
+ admin:
3
+ search:
4
+ placeholder: "Buscar"
5
+ results: "Resultados de la búsqueda"
@@ -0,0 +1,5 @@
1
+ fr:
2
+ admin:
3
+ search:
4
+ placeholder: "Recherche"
5
+ results: "Résultats de la recherche"
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ ru:
2
+ admin:
3
+ search:
4
+ placeholder: "Поиск"
5
+ results: "Результаты поиска"
@@ -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: 50px;
12
- box-shadow: inset 0 1px 1px rgba(black, 0.075);
9
+ border-radius: 50rem;
13
10
  }
14
11
 
15
- .input-group-addon {
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: 10px;
32
+ right: 0.75rem;
32
33
  z-index: 5;
33
34
  color: #555;
34
- font-size: 16px;
35
- padding: 4px;
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
- adapter.search(params[:q].presence, params)
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
@@ -1,5 +1,5 @@
1
1
  module Trestle
2
2
  module Search
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
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
+ }
@@ -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.10"
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
+ }