hot-glue 0.6.26 → 0.6.26.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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +20 -13
- data/lib/generators/hot_glue/scaffold_generator.rb +1 -0
- data/lib/hotglue/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 077bb2e61017931d3db8f961922f3af0d4440bfd9900cc56f86bfa26aeb2e188
|
4
|
+
data.tar.gz: 3feecb2d560274cab61e7cb5f673175cf426fd6d7cef09112612e72f88e74038
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2add6dcc569806f8953976332a63f29ea4cfa309ced3b8fdeb97b5c9108d030711d01a39fde8029bbfcacdde8fd7b0229861647258a40e340d1deeacfed13f8
|
7
|
+
data.tar.gz: 0c36945b6007e22bd672822bd206f842a1cd7eea54e819652fce71d613c66d8791b3902c51cb7c177f1c743a6e7a7241679b19e274e34e12bafe1dd06acbc187
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1620,20 +1620,20 @@ bin/rails generate hot_glue:set_search_interface_install
|
|
1620
1620
|
```
|
1621
1621
|
|
1622
1622
|
_Additional search option for Set Search_
|
1623
|
-
|
1623
|
+
### `--search-fields=aaa,bbb,ccc,ddd,eee`
|
1624
1624
|
to specify which fields you want to be searchable.
|
1625
1625
|
|
1626
1626
|
|
1627
|
-
|
1627
|
+
### `--search-query-fields=aaa,ddd`
|
1628
1628
|
to specify a list of strings only which will be taken out of the search set and presented in a singular query box (allowing search across multiple string fields)
|
1629
1629
|
|
1630
|
-
|
1630
|
+
### `--search-position=vertical`
|
1631
1631
|
to specify vertical or horizontal (default: horizontal)
|
1632
1632
|
|
1633
|
-
|
1633
|
+
### `--search-clear-button` (no option)
|
1634
1634
|
to specify whether to show a clear button to clear the whole search form at once (default: false)
|
1635
1635
|
|
1636
|
-
|
1636
|
+
### `--search-autosearch` (no option)
|
1637
1637
|
to specify whether to automatically search when the user exit or changes any field (default: false)
|
1638
1638
|
|
1639
1639
|
examples:
|
@@ -1657,8 +1657,7 @@ Here's how you would add a search interface to Example #1 in the [Hot Glue Tutor
|
|
1657
1657
|
bin/rails generate Book --include=name,author_id --search=set --search-fields=name,author_id
|
1658
1658
|
```
|
1659
1659
|
|
1660
|
-
|
1661
|
-
`--phantom-search='{type}_{name}[All|choice A:scope_a|choice B:scope_b],radio_yyyy[choice C:scope_c|]`
|
1660
|
+
### `--phantom-search='{type}_{name}[All|choice A:scope_a|choice B:scope_b]`
|
1662
1661
|
|
1663
1662
|
A phantom search is a search we are doing on this result set that doesn't correspond to a single field. Currently, the only available implementation is for scopes with no arguments, as in the example below. It is called 'phantom' because it could be (probably is) querying fields within the scope, but the search doesn't match up with a single field on your model. (So it's like creating 'phantom' criteria.). Only RADIO type is implemented, dropdown & checkboxes an a way to input a search value passed into the scope as an argument is TBD.
|
1664
1663
|
|
@@ -1666,13 +1665,24 @@ A phantom search is a search we are doing on this result set that doesn't corres
|
|
1666
1665
|
|
1667
1666
|
{name} is a designation for this phantom search. Should NOT match any field name on your table. This should describe the kind of categorization we are performing.
|
1668
1667
|
|
1669
|
-
|
1670
1668
|
Your phantom search selector will be appended to the search fields and will be treated like a first-class search input, able to be combined with any of the other fields specified in a set search.
|
1671
1669
|
|
1672
|
-
|
1670
|
+
Note that multiple phantom searched can be specified by separating them by comma (`,`), like so:
|
1671
|
+
|
1672
|
+
`--phantom-search='radio_xxxx[All|choice A:scope_a|choice B:scope_b],radio_yyyy[All|choice W:scope_w|choice Z:scope_z|]`
|
1673
|
+
(this creates two phantom searches: `xxxx` and `yyyy` both radio selection lists)
|
1674
|
+
|
1675
|
+
After the type & name, comes a block marked by square braces [ ... ]
|
1676
|
+
|
1677
|
+
Within the square braces, each search option is separated by a pipe (|) character.
|
1673
1678
|
|
1679
|
+
Within each option is a label and ruby scope, separated by a colon (:).
|
1674
1680
|
|
1675
|
-
|
1681
|
+
The label comes before the colon the ruby scope. The ruby scope should be specified here without a dot. Each ruby scope must be defined on your model. If there is no scope specified, we assume "all", but we still need to specify a label for "All", which is why in the example above "All" has no colon after it.
|
1682
|
+
|
1683
|
+
example
|
1684
|
+
|
1685
|
+
`--phantom-search='radio_status[Pending:pending|Rejected:rejected|Accepted:accepted|All]'`
|
1676
1686
|
|
1677
1687
|
On my model, I have these scopes defined:
|
1678
1688
|
|
@@ -1682,7 +1692,6 @@ scope :rejected, -> { where.not(rejected_at: nil) }
|
|
1682
1692
|
scope :not_rejected, -> { where(rejected_at: nil) }
|
1683
1693
|
scope :not_approved, -> { where(approved_at: nil) }
|
1684
1694
|
|
1685
|
-
|
1686
1695
|
This produces a search interface with four options listed as radio buttons:
|
1687
1696
|
° Pending
|
1688
1697
|
° Approved
|
@@ -1693,13 +1702,11 @@ This produces a search interface with four options listed as radio buttons:
|
|
1693
1702
|
|
1694
1703
|
The pending, approved, and rejected options will return search results with the corresponding scopes applied. The 'All' option will behave as a no-op, leaving the root search intact (giving all of the other modifications that Hot glue provides in different functionality).
|
1695
1704
|
|
1696
|
-
|
1697
1705
|
#### Predicate Search
|
1698
1706
|
NOT IMPLEMENTED YET
|
1699
1707
|
TODO: implement me
|
1700
1708
|
|
1701
1709
|
|
1702
|
-
|
1703
1710
|
### `--stimmify` or `--stimmify=xyz`
|
1704
1711
|
|
1705
1712
|
Automatically build the new and edit form with `data-controller='xyz'` to attach stimulus
|
@@ -1835,6 +1835,7 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
|
|
1835
1835
|
res << "\n @#{plural} = @#{plural}#{choice[:scope]} if @q['0'][:#{phantom_key}_search] == \"#{choice[:label]}\""
|
1836
1836
|
end
|
1837
1837
|
end
|
1838
|
+
res << "\n"
|
1838
1839
|
end
|
1839
1840
|
|
1840
1841
|
res << " @#{plural} = @#{plural}.page(params[:page])#{ ".per(per)" if @paginate_per_page_selector }"
|
data/lib/hotglue/version.rb
CHANGED