inline_forms 8.1.79 → 8.1.80
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/CHANGELOG.md +16 -0
- data/app/controllers/concerns/suggestion_request_concern.rb +26 -0
- data/app/controllers/inline_forms_application_controller.rb +1 -0
- data/app/controllers/inline_forms_controller.rb +1 -0
- data/app/views/inline_forms/_generic_search.html.erb +5 -4
- data/lib/inline_forms/suggestions.rb +6 -2
- data/lib/inline_forms/version.rb +1 -1
- data/lib/locales/inline_forms.en.yml +1 -0
- data/lib/locales/inline_forms.nl.yml +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 50bb6fa49e77c07b640995f0385e6c4194ac115a99c81b622983171ae8cb68e9
|
|
4
|
+
data.tar.gz: e4496274fbf81968e133425f365d0cd5b3cd93921f00f98dc034111184e4d3f1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 530bd5a53c304dbea6c620d331de5bdf5ca7bf37f46ec5c05e75b90ef46b294f2c9ae6128f2ecf001bf70676a597a4fabe684bcd8c8a3e278cd651b83a19e71e
|
|
7
|
+
data.tar.gz: 26b3c77195556e13c3de8ceada7322c9dd8bad3373903a17752e074f0d40319918e598a9a8784e1287d9a34d75f59dcd8a50305e1e1b7f80d29990f4838ed922
|
data/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,22 @@ All notable changes to this project are documented in this file.
|
|
|
8
8
|
|
|
9
9
|
- Known issues, parked (local note `stuff/2026-10-31-dropdown-rule-3-parked.md`) with dropdown order rule 3: `includes`, `group` or `select` in `inline_forms_list` make `dropdown` and `dropdown_with_other` raise while `/index` works, so 8.1.65's fix for a list order on a joined table holds only for `joins`, `left_joins` and `eager_load`; a has_many join gives duplicate options. Present since 8.1.60. No host's list scope has these today. Parked; not changed.
|
|
10
10
|
|
|
11
|
+
## [8.1.80] - 2026-11-24
|
|
12
|
+
|
|
13
|
+
From the notes of the apps' move to 8.1.79's suggestions.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- **`match: :word` also starts a word after a hyphen or an apostrophe** (`'` and `’`), not only after a space: "marc" finds Jean-Marc, "brien" O'Brien, "abreu" D’Abreu. Still not inside a word ("marc" does not find Lamarck). Apps that pin the old space-only behaviour in a spec (Scouting's `members_autocomplete_spec.rb`) see that spec fail on the upgrade, on purpose.
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- **`inline_forms_suggestion_request?`** (concern `SuggestionRequestConcern`), in `InlineFormsController` and in `InlineFormsApplicationController`, so a generated app's `ApplicationController` has it for every controller, and in views: true when the request is the search box's suggestions (`index` with `?suggest=1`), which answer JSON and are not a list view; false outside the inline_forms lists. For an app's own callbacks, e.g. statistics that count list views only: `skip_after_action :track_action, if: :inline_forms_suggestion_request?`.
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- **The generic search box has accessible names.** The form has `role="search"`, the field an `aria-label` (new key `inline_forms.search.label`: "search", "zoeken"; without it, the placeholder text), the reset link an `aria-label` as well as its `title`, and its `fi-x` icon `aria-hidden="true"`.
|
|
26
|
+
|
|
11
27
|
## [8.1.79] - 2026-11-23
|
|
12
28
|
|
|
13
29
|
### Added
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# `inline_forms_suggestion_request?`: true when this request is an
|
|
4
|
+
# inline_forms list's search-box suggestions (index with ?suggest=1&term=…,
|
|
5
|
+
# which answers a JSON array), not a list view. For an app's own callbacks,
|
|
6
|
+
# e.g. statistics that count list views only:
|
|
7
|
+
#
|
|
8
|
+
# skip_after_action :track_action, if: :inline_forms_suggestion_request?
|
|
9
|
+
#
|
|
10
|
+
# Included in InlineFormsController and in InlineFormsApplicationController,
|
|
11
|
+
# so an ApplicationController that inherits from the latter has it for every
|
|
12
|
+
# controller (false outside the inline_forms lists).
|
|
13
|
+
module SuggestionRequestConcern
|
|
14
|
+
extend ActiveSupport::Concern
|
|
15
|
+
|
|
16
|
+
included do
|
|
17
|
+
helper_method :inline_forms_suggestion_request?
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
protected
|
|
21
|
+
|
|
22
|
+
def inline_forms_suggestion_request?
|
|
23
|
+
is_a?(InlineFormsController) && action_name == "index" &&
|
|
24
|
+
params.key?(:suggest) && params[:parent_class].blank?
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
class InlineFormsApplicationController < ActionController::Base
|
|
4
4
|
protect_from_forgery
|
|
5
|
+
include SuggestionRequestConcern
|
|
5
6
|
# `layout 'devise' if :devise_controller?` was wrong: `:devise_controller?` is a
|
|
6
7
|
# Symbol (always truthy), so every controller used the Devise layout. Use a
|
|
7
8
|
# callable so only Devise controllers get `layouts/devise`; everything else
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
<% search_label = t("inline_forms.search.label", default: t("inline_forms.search.placeholder")) %>
|
|
2
|
+
<%= form_tag request.path, method: :get, role: "search" do %>
|
|
2
3
|
<div class="row collapse">
|
|
3
4
|
<div class="large-1 small-1 columns">
|
|
4
|
-
<%= link_to tag.i(class: "fi-x"), request.path, title: t("inline_forms.search.reset"), class: "button expanded inline_forms_model_top_bar_buttons" %>
|
|
5
|
+
<%= link_to tag.i(class: "fi-x", "aria-hidden": "true"), request.path, title: t("inline_forms.search.reset"), "aria-label": t("inline_forms.search.reset"), class: "button expanded inline_forms_model_top_bar_buttons" %>
|
|
5
6
|
</div>
|
|
6
7
|
<div class="large-6 small-6 columns">
|
|
7
8
|
<%# With `inline_forms_search_on …, suggest: …` the list itself answers %>
|
|
8
9
|
<%# the suggestions (index with ?suggest=1&term=…). %>
|
|
9
10
|
<% if @Klass.respond_to?(:inline_forms_suggestions) && @Klass.inline_forms_suggestions %>
|
|
10
|
-
<%= suggest_field_tag :search, params[:search], "#{request.path}?suggest=1", placeholder: t("inline_forms.search.placeholder"), id: "input_search", list: "input_search_suggestions" %>
|
|
11
|
+
<%= suggest_field_tag :search, params[:search], "#{request.path}?suggest=1", placeholder: t("inline_forms.search.placeholder"), "aria-label": search_label, id: "input_search", list: "input_search_suggestions" %>
|
|
11
12
|
<% else %>
|
|
12
|
-
<%= text_field_tag :search, params[:search], placeholder: t("inline_forms.search.placeholder"), id: "input_search" %>
|
|
13
|
+
<%= text_field_tag :search, params[:search], placeholder: t("inline_forms.search.placeholder"), "aria-label": search_label, id: "input_search" %>
|
|
13
14
|
<% end %>
|
|
14
15
|
</div>
|
|
15
16
|
<div class="large-3 small-3 columns">
|
|
@@ -12,13 +12,17 @@ module InlineForms
|
|
|
12
12
|
#
|
|
13
13
|
# :contains anywhere in the value ("ma" finds Martina, Tinamart, Tima)
|
|
14
14
|
# :start at the start of the value ("ma" finds Martina only)
|
|
15
|
-
# :word at the start of any word ("ma" finds Martina, Anna Maria)
|
|
15
|
+
# :word at the start of any word ("ma" finds Martina, Anna Maria);
|
|
16
|
+
# a word starts after a space, a hyphen or an apostrophe
|
|
17
|
+
# ("marc" finds Jean-Marc, "brien" O'Brien and O’Brien)
|
|
16
18
|
#
|
|
17
19
|
# The answer: at most `limit` values, each once (compared stripped and in any
|
|
18
20
|
# case, the first in A-Z order kept), in case-insensitive A-Z order. An empty
|
|
19
21
|
# term gives [].
|
|
20
22
|
module Suggestions
|
|
21
23
|
MATCHES = %i[contains start word].freeze
|
|
24
|
+
# What starts a word for match: :word, besides the start of the value.
|
|
25
|
+
WORD_STARTS = [ " ", "-", "'", "’" ].freeze
|
|
22
26
|
LIMIT = 12
|
|
23
27
|
|
|
24
28
|
module_function
|
|
@@ -77,7 +81,7 @@ module InlineForms
|
|
|
77
81
|
case match
|
|
78
82
|
when :contains then [ "%#{escaped}%" ]
|
|
79
83
|
when :start then [ "#{escaped}%" ]
|
|
80
|
-
when :word then [ "#{escaped}%", "
|
|
84
|
+
when :word then [ "#{escaped}%", *WORD_STARTS.map { |start| "%#{start}#{escaped}%" } ]
|
|
81
85
|
end
|
|
82
86
|
end
|
|
83
87
|
end
|
data/lib/inline_forms/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: inline_forms
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 8.1.
|
|
4
|
+
version: 8.1.80
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ace Suares
|
|
@@ -113,6 +113,7 @@ files:
|
|
|
113
113
|
- app/assets/stylesheets/inline_forms_fonts.css.erb
|
|
114
114
|
- app/controllers/concerns/cancan_concern.rb
|
|
115
115
|
- app/controllers/concerns/file_slots_concern.rb
|
|
116
|
+
- app/controllers/concerns/suggestion_request_concern.rb
|
|
116
117
|
- app/controllers/concerns/suggestions_concern.rb
|
|
117
118
|
- app/controllers/concerns/versions_concern.rb
|
|
118
119
|
- app/controllers/inline_forms/file_trash_controller.rb
|