look_for 1.0.1 → 1.0.3
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/app/assets/stylesheets/look_for/look_for-tableless.css +292 -17
- data/app/views/look_for/_toolbar.html.erb +21 -4
- data/app/views/look_for/look_for.js.erb +144 -119
- data/lib/look_for/version.rb +1 -1
- data/look_for-1.0.1.gem +0 -0
- data/look_for.gemspec +2 -2
- metadata +6 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3d5806612f95f7c6de2cb4cbd82ce31c993aea924332c2baa81cf10fe4c2c804
|
|
4
|
+
data.tar.gz: 0637532d3468abebfa41dd28a669a89aaf2e6be3f23ef8fa24c744d46f7f33d0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bb529e979793a2c67a78f9b7b52680263ee36fbc5cb400d65c809ca052b8fb92bb8ec2d535e380f1d1b49b1ec86110fb240bfa43788824a5139f0d602f261429
|
|
7
|
+
data.tar.gz: 4b85e2fee93de6180a65986907ba88102292b626f3b801f5cfe8aa24e5bd9f52fadd2cb7392c9cbe45a24e663f510f0defab866fd588c8b080641881ba611fa2
|
|
@@ -1,48 +1,323 @@
|
|
|
1
|
+
/* =============================================================================
|
|
2
|
+
GEMMA "LOOK_FOR" - GESTIONE APPARIZIONE E CENTRAMENTO SENZA SCATTI
|
|
3
|
+
============================================================================= */
|
|
4
|
+
|
|
5
|
+
/* 1. LA FINESTRA DIALOG (Sospesa ed elegante) */
|
|
6
|
+
.ui-dialog.look-for-dialog {
|
|
7
|
+
background: #ffffff !important; /* Bianco puro */
|
|
8
|
+
border: 1px solid var(--border-color) !important;
|
|
9
|
+
border-radius: 8px !important;
|
|
10
|
+
padding: 12px !important;
|
|
11
|
+
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
STATO DI DEFAULT (Nascosto):
|
|
16
|
+
La modale nasce invisibile e non interattiva.
|
|
17
|
+
La transizione CSS gestirà l'apparizione sfumata.
|
|
18
|
+
*/
|
|
19
|
+
opacity: 0 !important;
|
|
20
|
+
visibility: hidden !important;
|
|
21
|
+
pointer-events: none !important;
|
|
22
|
+
transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out !important;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
STATO TEMPORANEO DI MISURAZIONE (look-for-measuring):
|
|
27
|
+
Durante l'iniezione asincrona dei dati, la modale deve occupare il suo spazio fisico
|
|
28
|
+
nel DOM per consentire a jQuery UI di misurarne larghezza ed altezza reali,
|
|
29
|
+
ma deve rimanere totalmente invisibile all'utente.
|
|
30
|
+
Disabilitiamo la transizione per evitare che si intraveda lo spostamento fisico verso il centro.
|
|
31
|
+
*/
|
|
32
|
+
.ui-dialog.look-for-dialog.look-for-measuring {
|
|
33
|
+
opacity: 0 !important;
|
|
34
|
+
visibility: hidden !important;
|
|
35
|
+
pointer-events: none !important;
|
|
36
|
+
transition: none !important; /* Nessuna transizione durante il calcolo e il riposizionamento */
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* STATO PRONTO (look-for-ready):
|
|
40
|
+
La modale è stata centrata con le dimensioni corrette. Viene mostrata fluidamente.
|
|
41
|
+
*/
|
|
42
|
+
.ui-dialog.look-for-dialog.look-for-ready {
|
|
43
|
+
opacity: 1 !important;
|
|
44
|
+
visibility: visible !important;
|
|
45
|
+
pointer-events: auto !important;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Rimuove i bordi blu di focus all'apertura */
|
|
49
|
+
.ui-dialog:focus, .ui-dialog *:focus {
|
|
50
|
+
outline: none !important;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/*
|
|
54
|
+
FIX SCROLLBAR & ALTEZZA CONTENUTO:
|
|
55
|
+
Forza la scrollbar interna sulla finestra di dialogo principale,
|
|
56
|
+
limitando l'altezza della griglia a un massimo di 380px (circa 10 righe).
|
|
57
|
+
*/
|
|
58
|
+
.ui-dialog .ui-dialog-content {
|
|
59
|
+
overflow-y: auto !important;
|
|
60
|
+
overflow-x: auto !important; /* Mostra la barra orizzontale solo se la tabella è lunghissima */
|
|
61
|
+
box-sizing: border-box;
|
|
62
|
+
max-height: calc(100vh - 180px) !important; /* Limite verticale di sicurezza */
|
|
63
|
+
}
|
|
64
|
+
|
|
1
65
|
.look_for_window {
|
|
2
|
-
|
|
66
|
+
text-align: center;
|
|
67
|
+
font-family: inherit; /* Forza Inter */
|
|
68
|
+
overflow: visible !important;
|
|
3
69
|
}
|
|
4
70
|
|
|
71
|
+
/* 2. LA TABELLA DEI RISULTATI */
|
|
5
72
|
.look_for_table {
|
|
6
|
-
|
|
73
|
+
display: inline-block;
|
|
74
|
+
width: 100%;
|
|
75
|
+
border-collapse: collapse;
|
|
76
|
+
margin-top: 10px;
|
|
7
77
|
}
|
|
8
78
|
|
|
79
|
+
/* Intestazione Colonne */
|
|
9
80
|
.look_for_header {
|
|
10
|
-
|
|
81
|
+
display: table-row;
|
|
11
82
|
}
|
|
12
83
|
|
|
13
84
|
.look_for_header .look_for_cell {
|
|
14
|
-
|
|
85
|
+
display: table-cell;
|
|
86
|
+
background-color: #eff6ff !important; /* Azzurrino elegante */
|
|
87
|
+
color: #1e3a8a !important; /* Testo blu scuro per staccare col rosso */
|
|
88
|
+
font-weight: 700 !important;
|
|
89
|
+
text-transform: uppercase;
|
|
90
|
+
font-size: 10px;
|
|
91
|
+
letter-spacing: 0.05em;
|
|
92
|
+
padding: 10px 12px;
|
|
93
|
+
border-bottom: 2px solid #bfdbfe !important; /* Linea blu coordinata */
|
|
94
|
+
vertical-align: middle;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.look_for_header_cell_content {
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
justify-content: space-between;
|
|
15
101
|
}
|
|
16
102
|
|
|
103
|
+
/* Bottoni di ordinamento (Asc, Desc) nell'intestazione (Ripristinati in Vettoriale) */
|
|
104
|
+
.look_for_header_cell_content button.look_for_sort_buttons {
|
|
105
|
+
background: transparent !important;
|
|
106
|
+
border: none !important;
|
|
107
|
+
box-shadow: none !important;
|
|
108
|
+
cursor: pointer;
|
|
109
|
+
padding: 0 4px !important;
|
|
110
|
+
height: auto !important;
|
|
111
|
+
display: inline-flex;
|
|
112
|
+
align-items: center;
|
|
113
|
+
justify-content: center;
|
|
114
|
+
color: #94a3b8 !important;
|
|
115
|
+
transition: color 0.15s ease;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* Nasconde gli sprite vecchi e inietta i simboli triangolari Unicode */
|
|
119
|
+
.look_for_sort_buttons .ui-icon {
|
|
120
|
+
background-image: none !important;
|
|
121
|
+
text-indent: 0 !important;
|
|
122
|
+
display: inline-flex !important;
|
|
123
|
+
align-items: center;
|
|
124
|
+
justify-content: center;
|
|
125
|
+
position: static !important;
|
|
126
|
+
width: auto !important; height: auto !important;
|
|
127
|
+
}
|
|
128
|
+
.look_for_sort_buttons .ui-button-text { display: none !important; }
|
|
129
|
+
|
|
130
|
+
/* Spazio minimo tra le due freccette (▲ e ▼) */
|
|
131
|
+
.look_for_sort_buttons {
|
|
132
|
+
margin-left: 2px !important;
|
|
133
|
+
vertical-align: middle;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* Stacca la prima freccetta (Asc) dal testo della colonna di 10 pixel */
|
|
137
|
+
.look_for_header_cell_content button.look_for_sort_buttons:first-of-type {
|
|
138
|
+
margin-left: 10px !important;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* Iniezione Simboli Asc e Desc */
|
|
142
|
+
.look_for_sort_buttons .ui-icon-triangle-1-n::before { content: "▲" !important; font-size: 11px; }
|
|
143
|
+
.look_for_sort_buttons .ui-icon-triangle-1-s::before { content: "▼" !important; font-size: 11px; }
|
|
144
|
+
.look_for_sort_buttons .ui-icon-carat-1-n::before { content: "▲" !important; font-size: 12px; color: var(--primary-blue) !important; }
|
|
145
|
+
.look_for_sort_buttons .ui-icon-carat-1-s::before { content: "▼" !important; font-size: 12px; color: var(--primary-blue) !important; }
|
|
146
|
+
|
|
147
|
+
.look_for_header_cell_content button.look_for_sort_buttons:hover {
|
|
148
|
+
color: var(--primary-blue) !important;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* =========================================================
|
|
152
|
+
5. FILTRI E RIGHE RISULTATI
|
|
153
|
+
========================================================= */
|
|
17
154
|
.look_for_filters {
|
|
18
|
-
|
|
155
|
+
display: table-row;
|
|
156
|
+
background-color: #f8fafc;
|
|
19
157
|
}
|
|
20
158
|
|
|
21
159
|
.look_for_filters .look_for_cell {
|
|
22
|
-
|
|
160
|
+
display: table-cell;
|
|
161
|
+
padding: 6px 8px;
|
|
162
|
+
border-bottom: 1px solid var(--border-color);
|
|
163
|
+
vertical-align: middle;
|
|
23
164
|
}
|
|
24
165
|
|
|
25
166
|
input.look_for_filter {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
167
|
+
background: #ffffff !important;
|
|
168
|
+
border: 1px solid var(--border-color) !important;
|
|
169
|
+
border-radius: 4px !important;
|
|
170
|
+
padding: 4px 8px !important;
|
|
171
|
+
height: 26px !important;
|
|
172
|
+
font-family: inherit;
|
|
173
|
+
font-size: 11px !important;
|
|
174
|
+
color: var(--text-main);
|
|
175
|
+
width: 100%;
|
|
176
|
+
box-sizing: border-box;
|
|
177
|
+
transition: all 0.2s ease;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
input.look_for_filter:focus {
|
|
181
|
+
outline: none;
|
|
182
|
+
border-color: var(--primary-blue) !important;
|
|
183
|
+
box-shadow: var(--focus-ring) !important;
|
|
30
184
|
}
|
|
31
185
|
|
|
32
186
|
.look_for_body {
|
|
33
|
-
|
|
34
|
-
|
|
187
|
+
background: #ffffff !important;
|
|
188
|
+
display: table-row-group;
|
|
35
189
|
}
|
|
36
190
|
|
|
37
191
|
.look_for_row {
|
|
38
|
-
|
|
192
|
+
display: table-row;
|
|
193
|
+
transition: background-color 0.1s ease-in-out;
|
|
39
194
|
}
|
|
40
195
|
|
|
41
196
|
.look_for_row .look_for_cell {
|
|
42
|
-
|
|
43
|
-
|
|
197
|
+
display: table-cell;
|
|
198
|
+
text-align: left;
|
|
199
|
+
padding: 6px 12px;
|
|
200
|
+
font-size: 11px;
|
|
201
|
+
vertical-align: middle;
|
|
202
|
+
border-bottom: 1px solid #f1f5f9;
|
|
203
|
+
color: #4b5563;
|
|
204
|
+
white-space: nowrap !important; /* Soluzione A: select minimalista, testo dritto */
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/* STILE MINIMALISTA SELECT (Soluzione A) */
|
|
208
|
+
.tabulator-cell select, .look_for_cell select {
|
|
209
|
+
background-color: transparent !important;
|
|
210
|
+
border: none !important;
|
|
211
|
+
box-shadow: none !important;
|
|
212
|
+
padding: 0 15px 0 0 !important;
|
|
213
|
+
height: 100% !important;
|
|
214
|
+
width: 100% !important;
|
|
215
|
+
cursor: pointer;
|
|
216
|
+
font-family: inherit;
|
|
217
|
+
font-size: 11px;
|
|
218
|
+
color: #4b5563;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.tabulator-cell select:hover, .look_for_cell select:hover {
|
|
222
|
+
background-color: #f1f5f9 !important;
|
|
223
|
+
border-radius: 4px;
|
|
224
|
+
color: var(--primary-blue);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.look_for_row:hover {
|
|
228
|
+
background-color: #eff6ff !important;
|
|
229
|
+
cursor: pointer;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.look_for_row .look_for_cell a {
|
|
233
|
+
color: inherit;
|
|
234
|
+
text-decoration: none !important;
|
|
235
|
+
display: block;
|
|
236
|
+
width: 100%;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.look_for_row:hover .look_for_cell a {
|
|
240
|
+
color: #1e3a8a !important;
|
|
241
|
+
font-weight: 500;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/* =========================================================
|
|
245
|
+
6. LA TOOLBAR NELLA BARRA ROSSA (Semi-trasparente)
|
|
246
|
+
========================================================= */
|
|
247
|
+
.ui-dialog-titlebar {
|
|
248
|
+
position: relative !important;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.ui-dialog-titlebar .look_for_toolbar {
|
|
252
|
+
position: absolute !important;
|
|
253
|
+
left: 50% !important;
|
|
254
|
+
top: 50% !important;
|
|
255
|
+
transform: translate(-50%, -50%) !important;
|
|
256
|
+
margin: 0 !important;
|
|
257
|
+
display: flex !important;
|
|
258
|
+
gap: 8px;
|
|
259
|
+
z-index: 15;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/* BOTTONI TOOLBAR: Sfondo semi-trasparente bianco */
|
|
263
|
+
.look_for_toolbar button,
|
|
264
|
+
.look_for_toolbar .ui-button {
|
|
265
|
+
background: rgba(255, 255, 255, 0.15) !important;
|
|
266
|
+
border: 1px solid rgba(255, 255, 255, 0.25) !important;
|
|
267
|
+
color: #ffffff !important;
|
|
268
|
+
border-radius: 50% !important;
|
|
269
|
+
width: 28px !important;
|
|
270
|
+
height: 28px !important;
|
|
271
|
+
display: inline-flex !important;
|
|
272
|
+
align-items: center !important;
|
|
273
|
+
justify-content: center !important;
|
|
274
|
+
box-shadow: none !important;
|
|
275
|
+
cursor: pointer !important;
|
|
276
|
+
padding: 0 !important;
|
|
277
|
+
box-sizing: border-box;
|
|
278
|
+
text-indent: 0 !important;
|
|
279
|
+
transition: all 0.2s ease;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.look_for_toolbar .ui-button .ui-icon,
|
|
283
|
+
.look_for_toolbar .ui-button .ui-button-icon-space,
|
|
284
|
+
.look_for_toolbar .ui-button-text {
|
|
285
|
+
display: none !important;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/* Iniettiamo i simboli direttamente */
|
|
289
|
+
.look_for_toolbar .ui-icon-seek-prev::before { content: "‹" !important; font-size: 20px; font-weight: bold; }
|
|
290
|
+
.look_for_toolbar .ui-icon-seek-next::before { content: "›" !important; font-size: 20px; font-weight: bold; }
|
|
291
|
+
.look_for_toolbar .ui-icon-search::before { content: "⌕" !important; font-size: 20px; font-weight: normal; margin-top: -3px; }
|
|
292
|
+
|
|
293
|
+
/* HOVER: Il bottone si illumina dolcemente */
|
|
294
|
+
.look_for_toolbar button:hover:not(:disabled),
|
|
295
|
+
.look_for_toolbar .ui-button:hover:not(.ui-state-disabled) {
|
|
296
|
+
background: rgba(255, 255, 255, 0.35) !important;
|
|
297
|
+
border-color: #ffffff !important;
|
|
298
|
+
color: #ffffff !important;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/* DISABILITATO: Il bottone diventa quasi invisibile */
|
|
302
|
+
.look_for_toolbar button:disabled,
|
|
303
|
+
.look_for_toolbar .ui-button.ui-state-disabled {
|
|
304
|
+
background: rgba(0, 0, 0, 0.1) !important;
|
|
305
|
+
border-color: transparent !important;
|
|
306
|
+
color: rgba(255, 255, 255, 0.3) !important;
|
|
307
|
+
cursor: not-allowed !important;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/* 7. PAGINAZIONE (Testo a fondo tabella) */
|
|
311
|
+
.look_for_pagination .page_info {
|
|
312
|
+
font-family: inherit;
|
|
313
|
+
font-size: 11px;
|
|
314
|
+
color: var(--text-muted);
|
|
315
|
+
text-align: left;
|
|
316
|
+
margin-top: 8px;
|
|
317
|
+
padding: 0 4px;
|
|
44
318
|
}
|
|
45
319
|
|
|
46
|
-
.
|
|
47
|
-
|
|
320
|
+
.look_for_pagination .page_info b {
|
|
321
|
+
color: var(--text-main);
|
|
322
|
+
font-weight: 600;
|
|
48
323
|
}
|
|
@@ -1,5 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<!-- Tasto Previous (SVG Freccia Sinistra) -->
|
|
2
|
+
<button id="<%= params[:base_id] %>_prev" class="btn-icon" type="button" title="Previous" <%= "disabled" if !(@records.current_page > 1) %>>
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
4
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M15 19l-7-7 7-7" />
|
|
5
|
+
</svg>
|
|
6
|
+
</button>
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
<!-- Tasto Find / Cerca (SVG Lente) -->
|
|
9
|
+
<button id="<%= params[:base_id] %>_find" class="btn-icon" type="button" title="Search">
|
|
10
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
11
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
|
|
12
|
+
</svg>
|
|
13
|
+
</button>
|
|
14
|
+
|
|
15
|
+
<!-- Tasto Next (SVG Freccia Destra) -->
|
|
16
|
+
<button id="<%= params[:base_id] %>_next" class="btn-icon" type="button" title="Next" <%= "disabled" if !(@records.current_page < @records.total_pages) %>>
|
|
17
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
18
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M9 5l7 7-7 7" />
|
|
19
|
+
</svg>
|
|
20
|
+
</button>
|
|
21
|
+
|
|
22
|
+
<%= hidden_field_tag "#{params[:base_id]}_page", @records.current_page %>
|
|
@@ -1,119 +1,144 @@
|
|
|
1
|
-
<% params[:name] ||= "#{params[:base_id]}_window" %>
|
|
2
|
-
var window_id = "<%= params[:name] %>";
|
|
3
|
-
|
|
4
|
-
<% if params[:validate] == 'true' %>
|
|
5
|
-
<% if !params[:fill].nil? %>
|
|
6
|
-
<% params[:fill].each do |key, value| %>
|
|
7
|
-
$("#<%= value %>").val("");
|
|
8
|
-
<% end %>
|
|
9
|
-
<% end %>
|
|
10
|
-
<% end %>
|
|
11
|
-
|
|
12
|
-
<% unless params[:update] %>
|
|
13
|
-
if ($("#"+window_id).length == 0)
|
|
14
|
-
{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
$("#<%= params[:base_id]
|
|
82
|
-
$("#<%= params[:base_id]
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
$("#<%= params[:base_id] %>
|
|
87
|
-
$("#<%= params[:base_id] %>
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
$('#<%= params[:base_id] %>
|
|
114
|
-
(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
)
|
|
1
|
+
<% params[:name] ||= "#{params[:base_id]}_window" %>
|
|
2
|
+
var window_id = "<%= params[:name] %>";
|
|
3
|
+
|
|
4
|
+
<% if params[:validate] == 'true' %>
|
|
5
|
+
<% if !params[:fill].nil? %>
|
|
6
|
+
<% params[:fill].each do |key, value| %>
|
|
7
|
+
$("#<%= value %>").val("");
|
|
8
|
+
<% end %>
|
|
9
|
+
<% end %>
|
|
10
|
+
<% end %>
|
|
11
|
+
|
|
12
|
+
<% unless params[:update] %>
|
|
13
|
+
if ($("#"+window_id).length == 0)
|
|
14
|
+
{
|
|
15
|
+
var dialogDiv = $("<div id='"+window_id+"'></div>");
|
|
16
|
+
dialogDiv.dialog({
|
|
17
|
+
autoOpen: true,
|
|
18
|
+
title: '<%= params[:title] ? escape_javascript(params[:title].capitalize) : escape_javascript(t(params[:object_name].to_s.downcase).capitalize) %>',
|
|
19
|
+
height: "auto",
|
|
20
|
+
width: "auto",
|
|
21
|
+
modal: true,
|
|
22
|
+
show: false, // Disabilita le animazioni legacy jQuery UI
|
|
23
|
+
hide: false,
|
|
24
|
+
close: function(ev, ui) { $(this).remove(); }
|
|
25
|
+
});
|
|
26
|
+
$("#"+window_id).html("<%= escape_javascript(render('look_for')) %>");
|
|
27
|
+
<% if params[:effect] %>
|
|
28
|
+
$("#"+window_id).effect('<%= params[:effect] %>');
|
|
29
|
+
<% end %>
|
|
30
|
+
}
|
|
31
|
+
$("#"+window_id).dialog('open');
|
|
32
|
+
<% else %>
|
|
33
|
+
if ($("#<%= params[:update] %> div.look_for").length == 0)
|
|
34
|
+
{
|
|
35
|
+
$("#<%= params[:update] %>").html("<%= escape_javascript(render('look_for')) %>");
|
|
36
|
+
|
|
37
|
+
<% if params[:effect] %>
|
|
38
|
+
$("#<%= params[:update] %>").effect('<%= params[:effect] %>');
|
|
39
|
+
<% end %>
|
|
40
|
+
}
|
|
41
|
+
<% end %>
|
|
42
|
+
|
|
43
|
+
// --- GESTIONE COESIONE GRAFICA (Solo alla prima apertura!) ---
|
|
44
|
+
var dialogWrapper = $("#" + window_id).closest(".ui-dialog");
|
|
45
|
+
|
|
46
|
+
// Determiniamo se è la prima volta che apriamo la finestra di ricerca
|
|
47
|
+
var isFirstOpening = dialogWrapper.length && !dialogWrapper.hasClass("look-for-ready");
|
|
48
|
+
|
|
49
|
+
if (dialogWrapper.length) {
|
|
50
|
+
dialogWrapper.addClass("look-for-dialog");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (isFirstOpening) {
|
|
54
|
+
// 1. Blocchiamo temporaneamente lo scorrimento della pagina per neutralizzare sfarfallii delle barre di sistema
|
|
55
|
+
$("html, body").css("overflow", "hidden");
|
|
56
|
+
|
|
57
|
+
// 2. Nascondiamo la modale applicando lo stato di misurazione (invisibile ma calcolabile dal DOM)
|
|
58
|
+
dialogWrapper.addClass("look-for-measuring").removeClass("look-for-ready");
|
|
59
|
+
|
|
60
|
+
// 3. Spostiamo provvisoriamente la finestra a coordinate 0,0.
|
|
61
|
+
// Così, man mano che inseriamo le righe della tabella, crescerà verticalmente dall'estremo alto del viewport,
|
|
62
|
+
// garantendosi la massima tolleranza di spazio prima di poter toccare il fondo della pagina.
|
|
63
|
+
dialogWrapper.css({ top: "0px", left: "0px" });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Scrittura dei componenti nel DOM
|
|
67
|
+
$("#<%= params[:base_id] %>-toolbar").html("<%= escape_javascript(render('toolbar')) %>");
|
|
68
|
+
|
|
69
|
+
// Spostiamo la barra degli strumenti nella testata rossa
|
|
70
|
+
var titlebar = $("#" + window_id).closest(".ui-dialog").find(".ui-dialog-titlebar");
|
|
71
|
+
if (titlebar.length) {
|
|
72
|
+
$("#<%= params[:base_id] %>-toolbar").appendTo(titlebar);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
$("#<%= params[:base_id] %>-header").html("<%= escape_javascript(render('header')) %>");
|
|
76
|
+
$("#<%= params[:base_id] %>-results").html("<%= escape_javascript(render('results')) %>");
|
|
77
|
+
$("#<%= params[:base_id] %>-pagination").html("<%= escape_javascript(render('pagination')) %>");
|
|
78
|
+
|
|
79
|
+
// Inizializzazione icone pulsanti
|
|
80
|
+
$("#<%= params[:base_id] %>_prev").button({text: false, icons: { primary: "ui-icon-seek-prev"}}).css('padding-top','4px').css('padding-bottom','4px');
|
|
81
|
+
$("#<%= params[:base_id] %>_next").button({text: false, icons: { primary: "ui-icon-seek-next"}}).css('padding-top','4px').css('padding-bottom','4px');
|
|
82
|
+
$("#<%= params[:base_id] %>_find").button({text: false, icons: { primary: "ui-icon-search"}}).css('padding-top','4px').css('padding-bottom','4px');
|
|
83
|
+
|
|
84
|
+
<% if params[:labels] %>
|
|
85
|
+
<% params[:labels].each do |lab| %>
|
|
86
|
+
$("#<%= params[:base_id] %>_<%= lab.hash %>_asc").hasClass('selected') ? $("#<%= params[:base_id] %>_<%= lab.hash %>_asc").button({text: false, icons: { primary: "ui-icon-carat-1-n"}}).css('font-size','5px').css('padding-left','10px').css('padding-right','10px').css('padding-top','3px').css('padding-bottom','3px') : $("#<%= params[:base_id] %>_<%= lab.hash %>_asc").button({text: false, icons: { primary: "ui-icon-triangle-1-n"}}).css('font-size','5px').css('padding-left','10px').css('padding-right','10px').css('padding-top','3px').css('padding-bottom','3px');
|
|
87
|
+
$("#<%= params[:base_id] %>_<%= lab.hash %>_desc").hasClass('selected') ? $("#<%= params[:base_id] %>_<%= lab.hash %>_desc").button({text: false, icons: { primary: "ui-icon-carat-1-s"}}).css('font-size','5px').css('padding-left','10px').css('padding-right','10px').css('padding-top','3px').css('padding-bottom','3px') : $("#<%= params[:base_id] %>_<%= lab.hash %>_desc").button({text: false, icons: { primary: "ui-icon-triangle-1-s"}}).css('font-size','5px').css('padding-left','10px').css('padding-right','10px').css('padding-top','3px').css('padding-bottom','3px');
|
|
88
|
+
<% end %>
|
|
89
|
+
<% end %>
|
|
90
|
+
|
|
91
|
+
// Forza il submit tramite Rails UJS
|
|
92
|
+
function forceRemoteSubmit() {
|
|
93
|
+
var form = $('#<%= params[:base_id] %>_form');
|
|
94
|
+
var pageInput = $('#<%= params[:base_id] %>_page');
|
|
95
|
+
form.find('input[name="<%= params[:base_id] %>_page"]').remove();
|
|
96
|
+
if (pageInput.length) {
|
|
97
|
+
form.append('<input type="hidden" name="<%= params[:base_id] %>_page" value="' + pageInput.val() + '">');
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
var hiddenBtn = $('<input type="submit" style="display:none;">');
|
|
101
|
+
form.append(hiddenBtn);
|
|
102
|
+
hiddenBtn.click();
|
|
103
|
+
hiddenBtn.remove();
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Gestione dei click di navigazione con prevenzione dei listener duplicati
|
|
107
|
+
$('#<%= params[:base_id] %>_prev').off('click').on('click', function(e) {
|
|
108
|
+
var pageField = $('#<%= params[:base_id] %>_page');
|
|
109
|
+
pageField.val(parseInt(pageField.val()) - 1);
|
|
110
|
+
forceRemoteSubmit();
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
$('#<%= params[:base_id] %>_find').off('click').on('click', function(e) {
|
|
114
|
+
var pageField = $('#<%= params[:base_id] %>_page');
|
|
115
|
+
pageField.val(1);
|
|
116
|
+
forceRemoteSubmit();
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
$('#<%= params[:base_id] %>_next').off('click').on('click', function(e) {
|
|
120
|
+
var pageField = $('#<%= params[:base_id] %>_page');
|
|
121
|
+
pageField.val(parseInt(pageField.val()) + 1);
|
|
122
|
+
forceRemoteSubmit();
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// --- POSIZIONAMENTO FINALE ED APPARIZIONE FLUIDA (Solo alla prima apertura!) ---
|
|
126
|
+
if (isFirstOpening) {
|
|
127
|
+
// Un delay di 50ms assicura che il browser completi la compilazione del DOM e la computazione delle altezze
|
|
128
|
+
setTimeout(function() {
|
|
129
|
+
var targetOf = $("#form").length ? "#form" : window;
|
|
130
|
+
|
|
131
|
+
// Eseguiamo il posizionamento dinamico e il centramento reale calcolato sulle dimensioni finali
|
|
132
|
+
$("#" + window_id).dialog("option", "position", {
|
|
133
|
+
my: "center",
|
|
134
|
+
at: "center",
|
|
135
|
+
of: targetOf
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
// Rimuoviamo la classe temporanea per avviare il fade-in morbido gestito dal CSS
|
|
139
|
+
dialogWrapper.removeClass("look-for-measuring").addClass("look-for-ready");
|
|
140
|
+
|
|
141
|
+
// Ripristiniamo lo stato originario dello scorrimento naturale della pagina
|
|
142
|
+
$("html, body").css("overflow", "");
|
|
143
|
+
}, 50);
|
|
144
|
+
}
|
data/lib/look_for/version.rb
CHANGED
data/look_for-1.0.1.gem
ADDED
|
Binary file
|
data/look_for.gemspec
CHANGED
|
@@ -16,6 +16,6 @@ Gem::Specification.new do |gem|
|
|
|
16
16
|
gem.files = Dir.glob("**/*").select { |f| File.file?(f) }
|
|
17
17
|
gem.require_paths = ["lib"]
|
|
18
18
|
|
|
19
|
-
gem.add_dependency "rails", "
|
|
20
|
-
gem.add_dependency "will_paginate", "
|
|
19
|
+
gem.add_dependency "rails", ">= 7.0"
|
|
20
|
+
gem.add_dependency "will_paginate", ">= 3.0"
|
|
21
21
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: look_for
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Fabio Montarsolo
|
|
@@ -13,28 +13,28 @@ dependencies:
|
|
|
13
13
|
name: rails
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
|
15
15
|
requirements:
|
|
16
|
-
- - "
|
|
16
|
+
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
18
|
version: '7.0'
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
|
-
- - "
|
|
23
|
+
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
25
|
version: '7.0'
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: will_paginate
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
|
-
- - "
|
|
30
|
+
- - ">="
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
32
|
version: '3.0'
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
|
-
- - "
|
|
37
|
+
- - ">="
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
39
|
version: '3.0'
|
|
40
40
|
description: Simple ajax search form
|
|
@@ -67,6 +67,7 @@ files:
|
|
|
67
67
|
- lib/look_for/engine.rb
|
|
68
68
|
- lib/look_for/helpers/look_for_helper.rb
|
|
69
69
|
- lib/look_for/version.rb
|
|
70
|
+
- look_for-1.0.1.gem
|
|
70
71
|
- look_for.gemspec
|
|
71
72
|
homepage: https://github.com/TheSynthMaster/look_for
|
|
72
73
|
licenses:
|