inline_forms 8.1.86 → 8.1.88
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 +35 -0
- data/README.rdoc +6 -2
- data/app/assets/javascripts/inline_forms/inline_forms.js +17 -1
- data/app/assets/stylesheets/inline_forms/inline_forms.scss +6 -0
- data/app/controllers/concerns/suggestions_concern.rb +3 -1
- data/app/helpers/inline_forms_helper.rb +17 -7
- data/archived/README.md +18 -5
- data/lib/inline_forms/form_elements/rich_text_helper.rb +14 -6
- data/lib/inline_forms/suggestions.rb +11 -3
- 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 +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f557f3a3da96a06b4c9e0bc5a2ac3608aab2a131466baddf804a59888db906e5
|
|
4
|
+
data.tar.gz: 1a15811f4cac5dca91e00ebeb04bbe301c3e8a9d6b8c189fe0e3eba93d73b271
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 24e0258caf2408e17b54d09bccd0dec27969728061275abd6bc5e949e12b22a323198d20af2ce91dd2f1799bb2eabbaacb0d0cac3634449fc3afe526561fe26b
|
|
7
|
+
data.tar.gz: cf33ec74101cc24ae8a37b42579cd433b01561013eb9d448ca087d297fd84a5ab8e3eb351f929b97fbaef8b222f9cd7e824beffb6f66dae25fefe4e76fe43944
|
data/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,41 @@ 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.88] - 2026-11-25
|
|
12
|
+
|
|
13
|
+
From the fourth ladder note from RACVS and yavetracker (`ladder/inline_forms-PROMPT-4-2026-11-25.md`).
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- **A file dropped or pasted into a `:rich_text` editor on a plain column now gives a message.** Since 8.1.86 the file was refused without a word. The editor now carries the translated `inline_forms.files.not_in_this_field` ("Files cannot be added to this field.") in `data-no-files-message`, and `inline_forms.js` shows it under the editor when it refuses a file, once however many files were dropped. The message goes away when the text changes. Styled by `.inline_forms-trix-refused`. New locale key in en and nl.
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- **`order: :relation` reads its pages in one fixed order.** Rows equal on the relation's order and on `LOWER(value)` had no fixed order between the page queries (MySQL and PostgreSQL may order ties differently each time), so a row could be read twice or skipped at a page boundary. The primary key is now the last `ORDER BY` term. The visible effect was at most which spelling of an equal value ("José", "Jose") was kept.
|
|
22
|
+
|
|
23
|
+
### Documentation
|
|
24
|
+
|
|
25
|
+
- **The plus on a plain-column `:rich_text` is decided by text, not by what the allowlist removes.** A value with no text in what is shown gets the plus, which includes markup that shows something but holds no text (a lone `<hr>`, a table of empty cells), not only what the allowlist empties. The code is unchanged since 8.1.86; the comment in `rich_text_show`, the README and this entry now say so. The plus opens the editor with that markup in it.
|
|
26
|
+
|
|
27
|
+
## [8.1.87] - 2026-11-25
|
|
28
|
+
|
|
29
|
+
From a review of 8.1.85 and 8.1.86 (local note `stuff/reviews/2026-11-25-review-8.1.85-8.1.86.md`).
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
|
|
33
|
+
- **A values list that mixes numbers and strings sorts the same way every time.** 8.1.85 compared two numbers as numbers and anything else as text, and the two rules contradicted each other: `[10, 9, "1a"]` gave 10, "1a", 9, and a `0..12` list with "12+" added put "12+" between 1 and 2. Now `nil` comes first (a blank option, as before), then the numbers in numeric order, then everything else as text; equal values keep their order. This corrects 8.1.85's "Numbers now sort as numbers", which held only for lists of numbers alone.
|
|
34
|
+
|
|
35
|
+
### Documentation
|
|
36
|
+
|
|
37
|
+
- **`order: :relation` reads a limited window** (README, `InlineForms::Suggestions`): at most 10 pages of 4 × `limit` matching rows per column (480 at the default 12), one query each, and stops there. A value that fills those rows hides the values after it (480 × "Ada" hide "Adam", which A-Z finds). 8.1.86 did not say so.
|
|
38
|
+
- **A suggestion action outside `InlineFormsController` is not authorized by the engine.** `load_and_authorize_resource` checks the action's ability only in `InlineFormsController`; elsewhere the app authorizes the action itself. Records and columns are still limited to what the user may read (README, `SuggestionsConcern`).
|
|
39
|
+
- **Vendoring an archived element (`archived/README.md`): make the module's methods private.** Included into `InlineFormsController`, a public module made `<name>_show`, `_edit` and `_update` controller actions again, which 8.1.83 stopped for the engine's own. The example now shows the module. The page no longer calls the archived-element check a boot check: since 8.1.85 it runs on each code reload in development.
|
|
40
|
+
- README: the tabs section's code (`link_options: …`, `<a>`, `<turbo-frame …>`) and the suggestions section's `order: :relation` render as code. 8.1.85 said the first did; RDoc's `+…+` does not mark text with spaces or markup, so it showed the plus signs.
|
|
41
|
+
|
|
42
|
+
### Tests
|
|
43
|
+
|
|
44
|
+
- The Trix file refusal's listener, dropping `<template>` and `<noscript>`, `order: :relation` with a CanCan rule that hides records, and the `order: :relation` window.
|
|
45
|
+
|
|
11
46
|
## [8.1.86] - 2026-11-25
|
|
12
47
|
|
|
13
48
|
From the third RACVS / yavetracker ladder prompt (`ladder/inline_forms-PROMPT-3-2026-11-25.md`).
|
data/README.rdoc
CHANGED
|
@@ -262,7 +262,7 @@ Two rules hold for every pattern:
|
|
|
262
262
|
- *The model keeps an instance +inline_forms_attribute_list+ with the rows of every tab.* Each field request (edit, update, a field's show) is checked against the record's list since 8.1.76, not against the tab's +@inline_forms_attribute_list+ of the page that linked to it. A model whose rows live only in a class-level structure raises +InlineForms::MissingAttributeListError+, naming the model; give it e.g. <tt>def inline_forms_attribute_list = @inline_forms_attribute_list ||= self.class.tab_fields.values.flatten(1)</tt>.
|
|
263
263
|
- *A +show+ override hands field requests to the engine with <tt>return super if params[:form_element] || …</tt>*, as above. Since 8.1.84 +show+ returns true after it has answered, a refusal included, so the older <tt>super and return if …</tt> works too; before, a refused request (400) fell through to the override's own render (DoubleRenderError).
|
|
264
264
|
|
|
265
|
-
In every case the Turbo wiring is the same:
|
|
265
|
+
In every case the Turbo wiring is the same: <tt>link_options: { data: { turbo_frame: @update_span } }</tt> on the <tt><a></tt>, surrounding <tt><turbo-frame id="<%= @update_span %>"></tt> in the show view, and a controller that picks the active tab via +set_tab+ + +params[:tab]+. The +InlineForms::TurboTabsBuilder+ choice is independent of which partial layout you adopt.
|
|
266
266
|
|
|
267
267
|
== Generated application +rails-i18n+
|
|
268
268
|
|
|
@@ -333,6 +333,8 @@ Trade-off: files accumulate on disk; periodic sweeping is out of scope of the ge
|
|
|
333
333
|
|
|
334
334
|
For long text fields, use +:plain_text+ for a plain textarea backed by a DB +text+ column, or +:rich_text+ for ActionText/Trix content. +:plain_text+ requires an actual column on the model table; if the column is missing, inline_forms now raises +InlineForms::PlainTextColumnMissingError+ during controller boot/runtime checks.
|
|
335
335
|
|
|
336
|
+
+:rich_text+ also works on a plain text column, without +has_rich_text+. The stored HTML is shown through the display allowlist (<tt>InlineForms.rich_text_display_html</tt>). A value with no text in what is shown gets the plus, so the field can still be opened: that covers what the allowlist empties (only an +<img>+ or a +<script>+) and also markup that shows something but holds no text, such as a lone +<hr>+ or a table of empty cells. Such a column cannot store a file: the editor has no attach button, and a file dropped or pasted into it is refused with the notice <tt>inline_forms.files.not_in_this_field</tt> under the editor (8.1.88).
|
|
337
|
+
|
|
336
338
|
Note: generated apps also depend on ActiveStorage transitively because the +:rich_text+ form element uses ActionText (+active_storage:install+ runs during +inline_forms create+). Image uploads still go through CarrierWave; ActiveStorage is only there to back ActionText embeds.
|
|
337
339
|
|
|
338
340
|
== Native inputs (no jQuery UI)
|
|
@@ -361,7 +363,9 @@ Each defines <tt>autocomplete_<model>_<column></tt>, answering <tt>GET …?term=
|
|
|
361
363
|
end
|
|
362
364
|
can :autocomplete_client_last_name, Client
|
|
363
365
|
|
|
364
|
-
Only values of records the user may read (+accessible_by+) and of a column the user may read (<tt>can?(:read, Model, :column)</tt>).
|
|
366
|
+
Only values of records the user may read (+accessible_by+) and of a column the user may read (<tt>can?(:read, Model, :column)</tt>). <tt>order: :relation</tt> (8.1.86) keeps the relation's own order (a +default_scope+, or a scope that orders documents newest first) instead of A-Z. It reads the matching rows in that order, at most 10 pages of 4 × +limit+ rows (480 at the default 12) per column, and stops there: a column where one value fills those rows (500 documents with the same subject) answers fewer values than A-Z would. Each page is a query. Rows equal on the relation's order and the value are read in primary-key order, so none is read twice or skipped between pages (8.1.88).
|
|
367
|
+
|
|
368
|
+
Outside +InlineFormsController+ nothing checks the action's ability: +InlineFormsController+'s +load_and_authorize_resource+ does that. Records and columns are still limited to what the user may read, but the app authorizes the action itself (+authorize!+ in a +before_action+, or its own +load_and_authorize_resource+).
|
|
365
369
|
|
|
366
370
|
An action of your own uses the same private helpers, which are supported API:
|
|
367
371
|
|
|
@@ -48,13 +48,29 @@ if (!window.inlineFormsBooted) {
|
|
|
48
48
|
|
|
49
49
|
// A :rich_text editor on a plain column (no has_rich_text) cannot store a
|
|
50
50
|
// file: the attach button is hidden (CSS), and a dropped or pasted file is
|
|
51
|
-
// refused here, so nothing is inserted.
|
|
51
|
+
// refused here, so nothing is inserted. The editor's data-no-files-message
|
|
52
|
+
// (translated by rich_text_edit) is shown under it, once however many files
|
|
53
|
+
// were dropped, and goes away when the text changes.
|
|
52
54
|
document.addEventListener("trix-file-accept", function(event) {
|
|
53
55
|
var editor = event.target;
|
|
54
56
|
if (editor && editor.classList && editor.classList.contains("inline_forms-trix-no-files")) {
|
|
55
57
|
event.preventDefault();
|
|
58
|
+
var message = editor.getAttribute("data-no-files-message");
|
|
59
|
+
if (!message) { return; }
|
|
60
|
+
var notice = editor.nextElementSibling;
|
|
61
|
+
if (!notice || !notice.classList.contains("inline_forms-trix-refused")) {
|
|
62
|
+
notice = document.createElement("p");
|
|
63
|
+
notice.className = "inline_forms-trix-refused";
|
|
64
|
+
notice.setAttribute("role", "status");
|
|
65
|
+
editor.insertAdjacentElement("afterend", notice);
|
|
66
|
+
}
|
|
67
|
+
notice.textContent = message;
|
|
56
68
|
}
|
|
57
69
|
});
|
|
70
|
+
document.addEventListener("trix-change", function(event) {
|
|
71
|
+
var notice = event.target && event.target.nextElementSibling;
|
|
72
|
+
if (notice && notice.classList.contains("inline_forms-trix-refused")) { notice.remove(); }
|
|
73
|
+
});
|
|
58
74
|
|
|
59
75
|
// get rid of translation_missing tooltips
|
|
60
76
|
document.addEventListener("mouseover", function(event) {
|
|
@@ -588,3 +588,9 @@ trix-toolbar .trix-button-row.trix-button-row {
|
|
|
588
588
|
trix-toolbar:has(+ trix-editor.inline_forms-trix-no-files) .trix-button-group--file-tools {
|
|
589
589
|
display: none;
|
|
590
590
|
}
|
|
591
|
+
// The notice inline_forms.js shows under it when a file is dropped or pasted.
|
|
592
|
+
.inline_forms-trix-refused {
|
|
593
|
+
margin: 0.25rem 0 0;
|
|
594
|
+
font-size: 0.875rem;
|
|
595
|
+
font-style: italic;
|
|
596
|
+
}
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
# rails-jquery-autocomplete's `autocomplete` macro used), which answers
|
|
17
17
|
# GET …?term=… with a JSON array of at most `limit` (12) names: see
|
|
18
18
|
# InlineForms::Suggestions for `match:` (:contains, :start, :word) and the
|
|
19
|
-
# order. The app adds the route and the ability, as for any other action
|
|
19
|
+
# order. The app adds the route and the ability, as for any other action
|
|
20
|
+
# (outside InlineFormsController, whose load_and_authorize_resource checks
|
|
21
|
+
# it, the app authorizes the action itself):
|
|
20
22
|
#
|
|
21
23
|
# resources :clients do
|
|
22
24
|
# get :autocomplete_client_last_name, on: :collection
|
|
@@ -404,22 +404,32 @@ module InlineFormsHelper
|
|
|
404
404
|
values.to_a.each do |k, v|
|
|
405
405
|
temp << [ k, inline_forms_value_label(v) ]
|
|
406
406
|
end
|
|
407
|
-
values = temp
|
|
407
|
+
values = inline_forms_sort_values(temp) { |pair| pair[0] }
|
|
408
408
|
else
|
|
409
409
|
temp = Array.new
|
|
410
410
|
values.to_a.each_index do |i|
|
|
411
411
|
temp << [ i, inline_forms_value_label(values.to_a[i]) ]
|
|
412
412
|
end
|
|
413
|
-
values = temp
|
|
413
|
+
values = inline_forms_sort_values(temp) { |pair| pair[1] }
|
|
414
414
|
end
|
|
415
415
|
values
|
|
416
416
|
end
|
|
417
417
|
|
|
418
|
-
#
|
|
419
|
-
#
|
|
420
|
-
#
|
|
421
|
-
|
|
422
|
-
|
|
418
|
+
# nil first (a blank option), then numbers in numeric order, then anything
|
|
419
|
+
# else as text, equal ones in their given order. One key for every value: a pairwise fallback
|
|
420
|
+
# ((a <=> b) || (a.to_s <=> b.to_s), 8.1.85) contradicted itself on a mixed
|
|
421
|
+
# list ([10, 9, "1a"] put 10 before 9). A list that mixes numbers and
|
|
422
|
+
# strings ([1, 2, "many"]) raised ArgumentError in 8.1.83, once labels
|
|
423
|
+
# stopped being the strings t() returned.
|
|
424
|
+
def inline_forms_sort_values(pairs)
|
|
425
|
+
pairs.each_with_index.sort_by { |pair, index| [ inline_forms_value_sort_key(yield(pair)), index ] }.map(&:first)
|
|
426
|
+
end
|
|
427
|
+
|
|
428
|
+
def inline_forms_value_sort_key(value)
|
|
429
|
+
if value.nil? then [ 0, 0, "" ]
|
|
430
|
+
elsif value.is_a?(Numeric) && value.real? then [ 1, value, "" ]
|
|
431
|
+
else [ 2, 0, value.to_s ]
|
|
432
|
+
end
|
|
423
433
|
end
|
|
424
434
|
|
|
425
435
|
# A value as text for the screen: a Date as dd-mm-yyyy (since Rails 7.1 a
|
data/archived/README.md
CHANGED
|
@@ -15,7 +15,7 @@ This directory is the **versioned archive** for inline_forms capabilities that a
|
|
|
15
15
|
| `:question_list` | **Archived** | **8.1.30** | [`form_elements/question_list/`](form_elements/question_list/) — hardcoded host `Question` model |
|
|
16
16
|
| `:dnsrecords` | **Archived** | **8.1.30** | [`form_elements/dns_records/`](form_elements/dns_records/) — host `a_records`/`djbdns_line` APIs |
|
|
17
17
|
|
|
18
|
-
Programmatic registry: `InlineForms::ARCHIVED_FORM_ELEMENTS` in `lib/inline_forms.rb` (
|
|
18
|
+
Programmatic registry: `InlineForms::ARCHIVED_FORM_ELEMENTS` in `lib/inline_forms.rb` (checked on every code reload in development, after the app's own `to_prepare` blocks, if a model still declares an archived symbol; since 8.1.85 not at boot).
|
|
19
19
|
|
|
20
20
|
## Layout
|
|
21
21
|
|
|
@@ -47,9 +47,20 @@ has one) in a module, plus the models, controllers, views, routes and assets
|
|
|
47
47
|
its README lists. The views call `_show` and `_edit`, but the save calls
|
|
48
48
|
`_update` on the controller, which does not get the app's helpers. So include
|
|
49
49
|
the module into both, in a `to_prepare` (both are reloadable engine
|
|
50
|
-
constants)
|
|
50
|
+
constants). Make its methods **private**: a public method of a module
|
|
51
|
+
included into a controller is an action, and since 8.1.83 the engine's own
|
|
52
|
+
form element helpers are not.
|
|
51
53
|
|
|
52
54
|
```ruby
|
|
55
|
+
# lib/form_elements/geo_code_curacao.rb
|
|
56
|
+
module GeoCodeCuracaoHelper
|
|
57
|
+
private
|
|
58
|
+
|
|
59
|
+
def geo_code_curacao_show(object, attribute) = …
|
|
60
|
+
def geo_code_curacao_edit(object, attribute) = …
|
|
61
|
+
def geo_code_curacao_update(object, attribute) = …
|
|
62
|
+
end
|
|
63
|
+
|
|
53
64
|
# config/initializers/inline_forms_vendored_form_elements.rb
|
|
54
65
|
require Rails.root.join("lib/form_elements/geo_code_curacao").to_s
|
|
55
66
|
|
|
@@ -59,11 +70,13 @@ end
|
|
|
59
70
|
```
|
|
60
71
|
|
|
61
72
|
A module only under `app/helpers/` shows and edits, but every save is refused
|
|
62
|
-
(400). Since 8.1.81 the
|
|
73
|
+
(400). Since 8.1.81 the archived-element check
|
|
63
74
|
(`InlineForms.validate_no_archived_form_elements_for!`) skips an archived
|
|
64
75
|
symbol when the app's helpers (`ApplicationController.helpers`) answer
|
|
65
|
-
`<name>_show`, so the element is then the app's.
|
|
66
|
-
|
|
76
|
+
`<name>_show`, private or not (8.1.84), so the element is then the app's.
|
|
77
|
+
Since 8.1.85 that check runs on each code reload in development, after the
|
|
78
|
+
app's own `to_prepare` blocks, so the include above is seen; it no longer
|
|
79
|
+
runs at boot. The archived files are
|
|
67
80
|
written in the old top-level `def` style; wrap them in a helper module
|
|
68
81
|
(`module GeoCodeCuracaoHelper … end`) and replace any jQuery/UJS they use.
|
|
69
82
|
|
|
@@ -9,9 +9,12 @@ module InlineForms
|
|
|
9
9
|
rich = object.respond_to?(attribute) ? object.public_send(attribute) : nil
|
|
10
10
|
# A plain column's HTML goes through the display allowlist; Action Text
|
|
11
11
|
# sanitizes its own (InlineForms.rich_text_display_html). Blank is
|
|
12
|
-
# decided on what is shown: a value
|
|
13
|
-
#
|
|
14
|
-
#
|
|
12
|
+
# decided on the TEXT of what is shown: a value without any text gets
|
|
13
|
+
# the plus, or the link could be empty and the field could not be
|
|
14
|
+
# opened. That is wider than what the allowlist empties (only an <img>,
|
|
15
|
+
# a <script>, an empty <p>): markup that shows something but holds no
|
|
16
|
+
# text, such as a lone <hr> or a table of empty cells, gets the plus
|
|
17
|
+
# too, and the plus opens the editor with that markup in it.
|
|
15
18
|
shown = rich.is_a?(String) ? InlineForms.rich_text_display_html(rich) : rich
|
|
16
19
|
is_blank =
|
|
17
20
|
shown.nil? ||
|
|
@@ -41,11 +44,16 @@ module InlineForms
|
|
|
41
44
|
end
|
|
42
45
|
input_id = "trix_input_#{object.class.name.underscore}_#{object.id || 'new'}_#{attribute}"
|
|
43
46
|
# A plain column (no has_rich_text) cannot hold attachments: the class
|
|
44
|
-
# hides Trix's attach button there.
|
|
47
|
+
# hides Trix's attach button there, and inline_forms.js refuses a
|
|
48
|
+
# dropped or pasted file and shows the message in the data attribute.
|
|
45
49
|
classes = 'trix-content attribute_rich_text_area'
|
|
46
|
-
|
|
50
|
+
data = {}
|
|
51
|
+
unless rich.respond_to?(:body)
|
|
52
|
+
classes += ' inline_forms-trix-no-files'
|
|
53
|
+
data[:no_files_message] = t('inline_forms.files.not_in_this_field')
|
|
54
|
+
end
|
|
47
55
|
hidden_field_tag(attribute, body, id: input_id) +
|
|
48
|
-
content_tag(:'trix-editor', ''.html_safe, input: input_id, class: classes)
|
|
56
|
+
content_tag(:'trix-editor', ''.html_safe, input: input_id, class: classes, data: data)
|
|
49
57
|
end
|
|
50
58
|
|
|
51
59
|
def rich_text_update(object, attribute)
|
|
@@ -23,7 +23,10 @@ module InlineForms
|
|
|
23
23
|
# (the default)
|
|
24
24
|
# :relation the relation's own order (a default_scope's, a scope's:
|
|
25
25
|
# documents newest first), LOWER(value) A-Z after it; the
|
|
26
|
-
# first record's spelling kept (8.1.86)
|
|
26
|
+
# first record's spelling kept (8.1.86). It reads at most
|
|
27
|
+
# PAGES pages of 4 × limit matching rows per column (480 at
|
|
28
|
+
# the default limit), one query each, and stops there: a
|
|
29
|
+
# value that fills them hides the values after it.
|
|
27
30
|
module Suggestions
|
|
28
31
|
MATCHES = %i[contains start word].freeze
|
|
29
32
|
ORDERS = %i[alphabetical relation].freeze
|
|
@@ -80,7 +83,7 @@ module InlineForms
|
|
|
80
83
|
|
|
81
84
|
# The relation's own order kept, so no GROUP BY (its ORDER BY columns
|
|
82
85
|
# would have to be grouped or aggregated): rows in that order, LOWER(value)
|
|
83
|
-
# A-Z after it, a page at a time, each value once (stripped, any case),
|
|
86
|
+
# A-Z and the primary key after it, a page at a time, each value once (stripped, any case),
|
|
84
87
|
# until `limit` values or PAGES pages.
|
|
85
88
|
PAGES = 10
|
|
86
89
|
|
|
@@ -91,7 +94,12 @@ module InlineForms
|
|
|
91
94
|
condition = patterns(model, term, match).map { |pattern|
|
|
92
95
|
lowered.matches(Arel::Nodes::NamedFunction.new("LOWER", [ Arel::Nodes.build_quoted(pattern) ]), "\\", true)
|
|
93
96
|
}.reduce(:or)
|
|
94
|
-
rows
|
|
97
|
+
# The primary key last, so rows equal on everything before it keep one
|
|
98
|
+
# order from page to page (none would be read twice or skipped at a
|
|
99
|
+
# page boundary: MySQL and PostgreSQL may order ties differently in
|
|
100
|
+
# each query).
|
|
101
|
+
tiebreak = Array(model.primary_key).map { |key| model.arel_table[key].asc }
|
|
102
|
+
rows = relation.where(condition).unscope(:select).order(lowered.asc, *tiebreak)
|
|
95
103
|
page_size = limit * 4
|
|
96
104
|
found = {}
|
|
97
105
|
PAGES.times do |page|
|
data/lib/inline_forms/version.rb
CHANGED
|
@@ -68,6 +68,7 @@ en:
|
|
|
68
68
|
undo: undo
|
|
69
69
|
restore_previous: "restore removed file %{filename}"
|
|
70
70
|
replace_hint: "The current file %{filename} goes to the trash."
|
|
71
|
+
not_in_this_field: "Files cannot be added to this field."
|
|
71
72
|
confirm_remove:
|
|
72
73
|
one: "Remove %{filename}? It goes to the trash and can be restored for 1 day."
|
|
73
74
|
other: "Remove %{filename}? It goes to the trash and can be restored for %{count} days."
|
|
@@ -68,6 +68,7 @@ nl:
|
|
|
68
68
|
undo: ongedaan maken
|
|
69
69
|
restore_previous: "verwijderd bestand %{filename} terugzetten"
|
|
70
70
|
replace_hint: "Het huidige bestand %{filename} gaat naar de prullenbak."
|
|
71
|
+
not_in_this_field: "In dit veld kunnen geen bestanden worden opgenomen."
|
|
71
72
|
confirm_remove:
|
|
72
73
|
one: "%{filename} verwijderen? Het gaat naar de prullenbak en kan 1 dag worden teruggezet."
|
|
73
74
|
other: "%{filename} verwijderen? Het gaat naar de prullenbak en kan %{count} dagen worden teruggezet."
|