gestart-admino 1.0.0 → 2.0.0

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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +54 -35
  3. data/README.md +43 -128
  4. data/gestart-admino.gemspec +4 -4
  5. data/lib/gestart-admino.rb +1 -1
  6. data/lib/{admino → gestart_admino}/action_view_extension.rb +5 -5
  7. data/lib/{admino → gestart_admino}/query/base.rb +3 -3
  8. data/lib/{admino → gestart_admino}/query/base_presenter.rb +1 -1
  9. data/lib/{admino → gestart_admino}/query/builder.rb +1 -1
  10. data/lib/{admino → gestart_admino}/query/configuration.rb +1 -1
  11. data/lib/{admino → gestart_admino}/query/dsl.rb +2 -2
  12. data/lib/{admino → gestart_admino}/query/filter_group.rb +1 -1
  13. data/lib/{admino → gestart_admino}/query/filter_group_presenter.rb +1 -1
  14. data/lib/{admino → gestart_admino}/query/scope_presenter.rb +1 -1
  15. data/lib/{admino → gestart_admino}/query/search_field.rb +1 -1
  16. data/lib/{admino → gestart_admino}/query/sorting.rb +1 -1
  17. data/lib/{admino → gestart_admino}/query/sorting_presenter.rb +1 -1
  18. data/lib/gestart_admino/query.rb +15 -0
  19. data/lib/{admino → gestart_admino}/table/head_row.rb +2 -2
  20. data/lib/{admino → gestart_admino}/table/presenter.rb +3 -3
  21. data/lib/{admino → gestart_admino}/table/resource_row.rb +2 -2
  22. data/lib/{admino → gestart_admino}/table/row.rb +1 -1
  23. data/lib/gestart_admino/table.rb +7 -0
  24. data/lib/gestart_admino/version.rb +3 -0
  25. data/lib/gestart_admino.rb +14 -0
  26. data/spec/{admino → gestart_admino}/query/base_presenter_spec.rb +1 -1
  27. data/spec/{admino → gestart_admino}/query/base_spec.rb +1 -1
  28. data/spec/{admino → gestart_admino}/query/dsl_spec.rb +1 -1
  29. data/spec/{admino → gestart_admino}/query/filter_group_presenter_spec.rb +1 -1
  30. data/spec/{admino → gestart_admino}/query/filter_group_spec.rb +1 -1
  31. data/spec/{admino → gestart_admino}/query/search_field_spec.rb +1 -1
  32. data/spec/{admino → gestart_admino}/query/sorting_presenter_spec.rb +1 -1
  33. data/spec/{admino → gestart_admino}/query/sorting_spec.rb +1 -1
  34. data/spec/{admino → gestart_admino}/table/head_row_spec.rb +1 -1
  35. data/spec/{admino → gestart_admino}/table/presenter_spec.rb +1 -1
  36. data/spec/{admino → gestart_admino}/table/resource_row_spec.rb +1 -1
  37. data/spec/{admino → gestart_admino}/table/row_spec.rb +1 -1
  38. data/spec/spec_helper.rb +3 -3
  39. metadata +49 -49
  40. data/lib/admino/query.rb +0 -15
  41. data/lib/admino/table.rb +0 -7
  42. data/lib/admino/version.rb +0 -3
  43. data/lib/admino.rb +0 -14
  44. /data/spec/{admino → gestart_admino}/integration_spec.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4baf5cffece0aac5bd0a5da19dde2581d71ecc8a96b2cf5ba484eac50fdd9639
4
- data.tar.gz: 7dce2f718533b05040cbc998f1c33cf3de6c5c3d4bebd0b9d0ab9dddc7a98a08
3
+ metadata.gz: 5889239a6de572e00ac5736a3c1f0b4d46b0a334f4b718318f7385f3e4eb3373
4
+ data.tar.gz: 6307b369bfe7d59df2979db087b199fca023e537fea082213f7f4977a8b5cf59
5
5
  SHA512:
6
- metadata.gz: 75cac2ae7f0f54f500ac679c66e33d14bec52d0cbc5e06956a70ae1a304df8da49757ab93e1534a112e9d2f18a1cf147746e4f48e04796763d2d9ae18c61b5e2
7
- data.tar.gz: 3c4de0954b01ff07eb96066981e961411e6ab530cb1af6c10cbdf89ec39d7a905f40c179a18fc724998cd20c47aeaa64092602e8fdb8ed1384a8fd7b6461800a
6
+ metadata.gz: 0cb4e9fe74ae759707c78c41abe998db72a6548ba55cd4b982f8e168d7429283aac11bb8968ead7368f3c258e2235cc858220e090bc8019cc7868ddc5d1ad038
7
+ data.tar.gz: 9c0cbe21e2db1bfe301ba8f50d4c0af5c3a5a90ca64d32588115ddd881d72d865c648cc8ad2aa0c7c6e6dc0e81288e436da45d491bb18bd520771c4ca8351255
data/CHANGELOG.md CHANGED
@@ -1,38 +1,57 @@
1
- # v1.0.0 — il fork
2
-
3
- Fork Gestart di [`admino`](https://github.com/cantierecreativo/admino) 0.0.22,
4
- ultima release upstream del 23/06/2017.
5
-
6
- **Perché.** Ogni pagina indice di Gestart poggia su questa gemma: 26 query object,
7
- 32 partial `_index_row`, 29 `_query` e 28 presenter ne parlano il DSL. Upstream è
8
- fermo dal 2017 e non riceverà più fix. Sotto letterali frozen il regime di Ruby
9
- 4.0 la gemma rompeva la suite dell'app in 121 punti, tutti radicati in
10
- `Admino::Table::HeadRow#column`. Riscrivere la superficie avrebbe significato
11
- riscrivere quel vocabolario in ~115 file; forkare e potare costa un giorno e non
12
- tocca nessuno di quei file.
13
-
14
- La decisione completa, con le alternative scartate, sta nel repo dell'app:
15
- `docs/decisioni/admino.md`.
16
-
17
- **Cosa cambia rispetto a 0.0.22.**
18
-
19
- * Corretti i due letterali stringa mutati in place (`@columns = ""` → `+""`) in
20
- `Table::HeadRow` e `Table::ResourceRow`: è la rottura che impediva Ruby 4.
21
- * Rimossa la dipendenza da `coercible` (ferma al 10/12/2013) e con essa l'opzione
22
- `coerce:` di `search_field`. Il valore raggiunge lo scope così come arriva dai
23
- params; a interpretarlo sono gli scope dell'applicazione.
24
- * Potata l'API che Gestart non usa: gli helper `filters_for`, `sortings_for` e
25
- `search_form_for`, e `Query::BasePresenter#form` che dipendeva dall'ultimo.
26
- Restano `table_for` e `simple_search_form_for`.
27
- * Aggiunto il `require` di `active_support/core_ext/class/attribute`, che upstream
28
- si aspettava caricato da altri: senza, la gemma non si carica isolata.
29
- * Suite eseguibile su Ruby 3.4 e Rails 8.1: rimossi `appraisal`, `coveralls`,
30
- `simplecov` e i gemfile per Rails 4.0/4.2; rilassato il vincolo
31
- `bundler ~> 1.3`.
32
-
33
- **Manutenzione.** Questo fork si ripara, non si arricchisce: si aggiusta quando
34
- Rails lo rompe, e basta. Le funzionalità nuove non entrano qui — il giorno in cui
35
- servono, il segnale è che serve il sistema tabellare nuovo, non un fork più largo.
1
+ # v2.0.0 — the namespace
2
+
3
+ **Breaking.** The namespace goes from `Admino::` to `GestartAdmino::`, and the
4
+ files from `lib/admino/` to `lib/gestart_admino/`. No behaviour changes: names
5
+ only.
6
+
7
+ Why: `Admino::Query::Base` inside a file that is ours is a lie somebody
8
+ eventually pays for. Upstream has been dead since 2017, so no fix will ever come
9
+ back from it and the usual "keep the diff against upstream clean" argument does
10
+ not apply.
11
+
12
+ To upgrade, in the application: `Admino::` → `GestartAdmino::`. In Gestart that
13
+ is 6 lines, across `base_query.rb`, `table_presenter.rb` and
14
+ `bemo_table_presenter.rb`.
15
+
16
+ ---
17
+
18
+ # v1.0.0 — the fork
19
+
20
+ Gestart fork of [`admino`](https://github.com/cantierecreativo/admino) 0.0.22,
21
+ the last upstream release, dated 23/06/2017.
22
+
23
+ **Why.** Every index page in Gestart rests on this gem: 26 query objects, 32
24
+ `_index_row` partials, 29 `_query` partials and 28 presenters speak its DSL.
25
+ Upstream has been frozen since 2017 and will get no further fixes. Under frozen
26
+ string literals the Ruby 4.0 regime — the gem broke the application suite in
27
+ 121 places, all rooted in `Admino::Table::HeadRow#column`. Rewriting the surface
28
+ would have meant rewriting that vocabulary across ~115 files; forking and pruning
29
+ costs a day and touches none of them.
30
+
31
+ The full decision, with the alternatives that were dropped, lives in the
32
+ application repo: `docs/decisioni/admino.md`.
33
+
34
+ **What changed from 0.0.22.**
35
+
36
+ * Fixed the two string literals mutated in place (`@columns = ""` → `+""`) in
37
+ `Table::HeadRow` and `Table::ResourceRow`: this was the breakage that stood in
38
+ the way of Ruby 4.
39
+ * Dropped the `coercible` dependency (upstream frozen since 10/12/2013) and with
40
+ it the `coerce:` option of `search_field`. The value reaches the scope exactly
41
+ as it arrived from the params; interpreting it is the application's job.
42
+ * Pruned the API Gestart does not use: the `filters_for`, `sortings_for` and
43
+ `search_form_for` helpers, and `Query::BasePresenter#form`, which depended on
44
+ the last one. `table_for` and `simple_search_form_for` stay.
45
+ * Added the `require` of `active_support/core_ext/class/attribute`, which
46
+ upstream assumed loaded elsewhere: without it the gem does not load in
47
+ isolation.
48
+ * Suite runnable on Ruby 3.4 and Rails 8.1: dropped `appraisal`, `coveralls`,
49
+ `simplecov` and the Rails 4.0/4.2 gemfiles; relaxed the `bundler ~> 1.3`
50
+ constraint.
51
+
52
+ **Maintenance.** This fork gets repaired, not extended: it is fixed when Rails
53
+ breaks it, and nothing more. New features do not go in here — the day they are
54
+ wanted, that is the signal that a new table system is due, not a wider fork.
36
55
 
37
56
  ---
38
57
 
data/README.md CHANGED
@@ -1,12 +1,21 @@
1
- ![Admino Logo](https://raw.github.com/cantierecreativo/admino/master/logo.jpg)
2
-
3
- [![Gem Version](https://badge.fury.io/rb/admino.png)](http://badge.fury.io/rb/admino)
4
- [![Build Status](https://travis-ci.org/cantierecreativo/admino.png?branch=v0.0.1)](https://travis-ci.org/cantierecreativo/admino)
5
- [![Coverage Status](https://coveralls.io/repos/cantierecreativo/admino/badge.png?branch=master)](https://coveralls.io/r/cantierecreativo/admino?branch=master)
6
- [![Code Climate](https://codeclimate.com/github/cantierecreativo/admino.png)](https://codeclimate.com/github/cantierecreativo/admino)
1
+ # gestart-admino
7
2
 
8
3
  A minimal, object-oriented solution to generate Rails administrative index views. Through query objects and presenters, it features a customizable table generator and search forms with filtering/sorting.
9
4
 
5
+ > **This is a maintenance fork.** `gestart-admino` is Gestart's fork of
6
+ > [`admino`](https://github.com/cantierecreativo/admino) 0.0.22, whose last
7
+ > upstream release is dated 23/06/2017. It exists because every Gestart index
8
+ > page rests on this DSL, and upstream will get no further fixes.
9
+ >
10
+ > **It gets repaired, not extended.** It is fixed when Rails breaks it, and
11
+ > nothing more. If you find yourself wanting to add a feature here, that is the
12
+ > signal a new table system is due — not a wider fork.
13
+ >
14
+ > Compared to upstream: the namespace is `GestartAdmino::`, the `coercible`
15
+ > dependency and the `coerce:` option are gone, and the unused helpers
16
+ > (`filters_for`, `sortings_for`, `search_form_for`) have been pruned. See
17
+ > [`CHANGELOG.md`](CHANGELOG.md).
18
+
10
19
  ## The philosophy behind it
11
20
 
12
21
  The Rails ecosystem has many [full-fledged solutions to generate administrative interfaces](https://www.ruby-toolbox.com/categories/rails_admin_interfaces).
@@ -26,28 +35,24 @@ If a particular controller or view needs something different from the standard C
26
35
 
27
36
  So what about Admino? Well, it complements the above-mentioned gems, giving you the the missing ~10%: a fast way to generate administrative index views.
28
37
 
29
- ## Demo
30
-
31
- To better illustrate how to create a 100%-custom, super-DRY administrative interface using Admino and the aforementioned gems, we prepared a [repo with a sample Rails project](https://github.com/cantierecreativo/admino-example) you can take a look. The app is browsable at [http://admino-example.herokuapp.com](http://admino-example.herokuapp.com), and features a Bootstrap 3 theme.
32
-
33
38
  ## Installation
34
39
 
35
40
  Add this line to your application's Gemfile:
36
41
 
37
- gem 'admino'
42
+ gem 'gestart-admino'
38
43
 
39
44
  And then execute:
40
45
 
41
46
  $ bundle
42
47
 
43
- ## Admino::Query::Base
48
+ ## GestartAdmino::Query::Base
44
49
 
45
- `Admino::Query::Base` implements the [Query object](http://martinfowler.com/eaaCatalog/queryObject.html) pattern, that is, an object responsible for returning a result set (ie. an `ActiveRecord::Relation`) based on business rules.
50
+ `GestartAdmino::Query::Base` implements the [Query object](http://martinfowler.com/eaaCatalog/queryObject.html) pattern, that is, an object responsible for returning a result set (ie. an `ActiveRecord::Relation`) based on business rules.
46
51
 
47
- Given a `Task` model, we can generate a `TasksQuery` query object subclassing `Admino::Query::Base`:
52
+ Given a `Task` model, we can generate a `TasksQuery` query object subclassing `GestartAdmino::Query::Base`:
48
53
 
49
54
  ```ruby
50
- class TasksQuery < Admino::Query::Base
55
+ class TasksQuery < GestartAdmino::Query::Base
51
56
  end
52
57
  ```
53
58
 
@@ -71,7 +76,7 @@ You can specify how a `TaskQuery` must build a result set through a simple DSL.
71
76
  The `starting_scope` method is in charge of defining the scope that will start the filtering/ordering chain:
72
77
 
73
78
  ```ruby
74
- class TasksQuery < Admino::Query::Base
79
+ class TasksQuery < GestartAdmino::Query::Base
75
80
  starting_scope { Task.all }
76
81
  end
77
82
 
@@ -85,7 +90,7 @@ TaskQuery.new.scope.count # => 1
85
90
  Once you define the following field:
86
91
 
87
92
  ```ruby
88
- class TasksQuery < Admino::Query::Base
93
+ class TasksQuery < GestartAdmino::Query::Base
89
94
  # ...
90
95
  search_field :title_matches
91
96
  end
@@ -110,7 +115,7 @@ TaskQuery.new(query: { title_matches: 'ASAP' }).scope.count # => 1
110
115
  You can provide a default value with the `default` option:
111
116
 
112
117
  ```ruby
113
- class TasksQuery < Admino::Query::Base
118
+ class TasksQuery < GestartAdmino::Query::Base
114
119
  # ...
115
120
  search_field :title_matches, default: 'TODO'
116
121
  end
@@ -126,7 +131,7 @@ class Task < ActiveRecord::Base
126
131
  }
127
132
  end
128
133
 
129
- class TasksQuery < Admino::Query::Base
134
+ class TasksQuery < GestartAdmino::Query::Base
130
135
  # ...
131
136
  filter_by :status, [:completed, :pending]
132
137
  filter_by :deleted, [:with_deleted]
@@ -155,7 +160,7 @@ TaskQuery.new(query: { status: 'foobar' }).scope.count # => 3
155
160
  You can include a "reset" scope with the `include_empty_scope` option, and provide a default scope with the `default` option:
156
161
 
157
162
  ```ruby
158
- class TasksQuery < Admino::Query::Base
163
+ class TasksQuery < GestartAdmino::Query::Base
159
164
  # ...
160
165
  filter_by :time, [:last_month, :last_week],
161
166
  include_empty_scope: true,
@@ -166,7 +171,7 @@ end
166
171
  #### `sorting`
167
172
 
168
173
  ```ruby
169
- class TasksQuery < Admino::Query::Base
174
+ class TasksQuery < GestartAdmino::Query::Base
170
175
  # ...
171
176
  sorting :by_due_date, :by_title
172
177
  end
@@ -195,7 +200,7 @@ TaskQuery.new(sorting: 'by_due_date').scope # => [ expired_t
195
200
  It's very common ie. to paginate a result set. The block declared in the `ending_scope` block will be always appended to the end of the chain:
196
201
 
197
202
  ```ruby
198
- class TasksQuery < Admino::Query::Base
203
+ class TasksQuery < GestartAdmino::Query::Base
199
204
  ending_scope { |q| page(q.params[:page]) }
200
205
  end
201
206
  ```
@@ -208,7 +213,7 @@ If you do not want to pollute your ActiveRecord model with all these scopes, you
208
213
  class Task < ActiveRecord::Base
209
214
  end
210
215
 
211
- class TasksQuery < Admino::Query::Base
216
+ class TasksQuery < GestartAdmino::Query::Base
212
217
  search_field :title_matches
213
218
 
214
219
  def title_matches_scope(scope, text)
@@ -223,8 +228,8 @@ A query object supports various methods to inspect the available search fields,
223
228
 
224
229
  ```ruby
225
230
  query = TaskQuery.new
226
- query.search_fields # => [ #<Admino::Query::SearchField>, ... ]
227
- query.filter_groups # => [ #<Admino::Query::FilterGroup>, ... ]
231
+ query.search_fields # => [ #<GestartAdmino::Query::SearchField>, ... ]
232
+ query.filter_groups # => [ #<GestartAdmino::Query::FilterGroup>, ... ]
228
233
 
229
234
  search_field = query.search_field_by_name(:title_matches)
230
235
 
@@ -239,68 +244,13 @@ filter_group.scopes # => [ :completed, :pending ]
239
244
  filter_group.active_scope # => :completed
240
245
  filter_group.is_scope_active?(:pending) # => false
241
246
 
242
- sorting = query.sorting # => #<Admino::Query::Sorting>
247
+ sorting = query.sorting # => #<GestartAdmino::Query::Sorting>
243
248
  sorting.scopes # => [ :by_title, :by_due_date ]
244
249
  sorting.active_scope # => :by_due_date
245
250
  sorting.is_scope_active?(:by_title) # => false
246
251
  sorting.ascending? # => true
247
252
  ```
248
253
 
249
- ### Presenting search form and filters to the user
250
-
251
- Admino offers some helpers that make it really easy to generate search forms and filtering links:
252
-
253
- ```erb
254
- <%# generate the search form %>
255
- <%= search_form_for(query) do |q| %>
256
- <%# generate inputs from search_fields %>
257
- <p>
258
- <%= q.label :title_matches %>
259
- <%= q.text_field :title_matches %>
260
- </p>
261
- <p>
262
- <%= q.submit %>
263
- </p>
264
-
265
- <%# generate inputs from filter_by %>
266
- <p>
267
- <%= q.label :status %>
268
- <%= q.select :status, Task.statuses.keys %>
269
- </p>
270
-
271
- <%# if filter_by has only one scope you can use a checkbox %>
272
- <p>
273
- <%= q.check_box :deleted, {}, checked_value: "with_deleted" %>
274
- <%= q.label :deleted %>
275
- </p>
276
- <% end %>
277
-
278
- <%# generate the filtering links %>
279
- <% filters_for(query) do |filter_group| %>
280
- <h6><%= filter_group.name %></h6>
281
- <ul>
282
- <% filter_group.each_scope do |scope| %>
283
- <li><%= scope.link %><li>
284
- <% end %>
285
- </ul>
286
- <% end %>
287
-
288
- <%# generate the sorting links %>
289
- <h6>Sort by</h6>
290
- <ul>
291
- <% sortings_for(query) do |scope| %>
292
- <li><%= scope.link %></li>
293
- <% end %>
294
- </ul>
295
- ```
296
- The great thing is that:
297
-
298
- * the search form gets automatically filled in with the last input the user submitted
299
- * a `is-active` CSS class gets added to the currently active filter scopes
300
- * if a particular filter link has been clicked and is now active, it is possible to deactivate it by clicking on the link again
301
- * a `is-asc`/`is-desc` CSS class gets added to the currently active sorting scope
302
- * if a particular sorting scope link has been clicked and is now in ascending order, it is possible to make it descending by clicking on the link again
303
-
304
254
  ### Simple Form support
305
255
 
306
256
  If you prefer using [Simple Form](https://github.com/plataformatec/simple_form), please use the `simple_search_form_for` helper instead.
@@ -331,47 +281,12 @@ def index
331
281
  end
332
282
  ```
333
283
 
334
- ### Coertions
335
-
336
- Suppose the presence of a model scope that requires a non-textual argument (ie. a date):
337
-
338
- ```ruby
339
- class Task < ActiveRecord::Base
340
- scope :due_date_from, ->(date) { where('due_date >= ?', date) }
341
- end
342
- ```
343
-
344
- Admino can perform some automatic coertions to the textual parameter it gets, and pass the coerced value to the scope:
345
-
346
- ```ruby
347
- class TasksQuery < Admino::Query::Base
348
- search_field :due_date_from, coerce: :to_date
349
- end
350
-
351
- query = TaskQuery.new(query: { due_date_from: '2014-03-01' })
352
- query.search_field_by_name(:due_date_from).value # => #<Date Sat, 01 Mar 2014>
353
- ```
354
-
355
- If a specific coercion cannot be performed with the provided input, the scope won't be chained. The following coertions are available:
356
-
357
- * `:to_boolean`
358
- * `:to_constant`
359
- * `:to_date`
360
- * `:to_datetime`
361
- * `:to_decimal`
362
- * `:to_float`
363
- * `:to_integer`
364
- * `:to_symbol`
365
- * `:to_time`
366
-
367
- Please see the [`Coercible::Coercer::String`](https://github.com/solnic/coercible/blob/master/lib/coercible/coercer/string.rb) class for details.
368
-
369
284
  ### Default sorting
370
285
 
371
286
  If you need to setup a default sorting, you can pass some optional arguments to the `sorting` declaration:
372
287
 
373
288
  ```ruby
374
- class TasksQuery < Admino::Query::Base
289
+ class TasksQuery < GestartAdmino::Query::Base
375
290
  # ...
376
291
  sorting :by_due_date, :by_title,
377
292
  default_scope: :by_due_date,
@@ -402,7 +317,7 @@ en:
402
317
  by_title: 'By title'
403
318
  ```
404
319
 
405
- ## Admino::Table::Presenter
320
+ ## GestartAdmino::Table::Presenter
406
321
 
407
322
  Admino offers a `table_for` helper that makes it really easy to generate HTML tables from a set of records:
408
323
 
@@ -481,7 +396,7 @@ Often tables need to offer some kind of action associated with the records. The
481
396
  If you want to make the table headers sortable, then please create an Admino query object class to define the available sorting scopes.
482
397
 
483
398
  ```ruby
484
- class TaskQuery < Admino::Query::Base
399
+ class TaskQuery < GestartAdmino::Query::Base
485
400
  sorting :by_title, :by_due_date
486
401
  end
487
402
  ```
@@ -531,11 +446,11 @@ The `#column` and `#action` methods are very flexible, allowing you to change al
531
446
  <% end %>
532
447
  ```
533
448
 
534
- If you need more power, you can also subclass `Admino::Table::Presenter`. For each HTML element, there's a set of methods you can override to customize it's appeareance.
535
- Table cells are generated through two collaborator classes: `Admino::Table::HeadRow` and `Admino::Table::ResourceRow`. You can easily replace them with a subclass if you want. To grasp the idea here's an example:
449
+ If you need more power, you can also subclass `GestartAdmino::Table::Presenter`. For each HTML element, there's a set of methods you can override to customize it's appeareance.
450
+ Table cells are generated through two collaborator classes: `GestartAdmino::Table::HeadRow` and `GestartAdmino::Table::ResourceRow`. You can easily replace them with a subclass if you want. To grasp the idea here's an example:
536
451
 
537
452
  ```ruby
538
- class CustomTablePresenter < Admino::Table::Presenter
453
+ class CustomTablePresenter < GestartAdmino::Table::Presenter
539
454
  private
540
455
 
541
456
  def table_html_options
@@ -558,7 +473,7 @@ class CustomTablePresenter < Admino::Table::Presenter
558
473
  HeadRow.new(collection_klass, query, view_context)
559
474
  end
560
475
 
561
- class ResourceRow < Admino::Table::ResourceRow
476
+ class ResourceRow < GestartAdmino::Table::ResourceRow
562
477
  private
563
478
 
564
479
  def action_html_options(action_name)
@@ -574,7 +489,7 @@ class CustomTablePresenter < Admino::Table::Presenter
574
489
  end
575
490
  end
576
491
 
577
- class HeadRow < Admino::Table::ResourceRow
492
+ class HeadRow < GestartAdmino::Table::ResourceRow
578
493
  def column_html_options(attribute_name)
579
494
  { class: 'column-class' }
580
495
  end
@@ -600,17 +515,17 @@ Please refer to the tests for all the details.
600
515
 
601
516
  If your controller actions are generated through [Inherited Resources](https://github.com/josevalim/inherited_resources), then you can always get the URL pointing to the show action with the `resource_path` helper method. Similar helpers [are available for the other REST actions too](https://github.com/josevalim/inherited_resources#url-helpers) (new, edit, destroy).
602
517
 
603
- More in general, if you are able to programmatically generate/obtain the URLs of your row actions, you can subclass `Admino::Table::Presenter` and declare them:
518
+ More in general, if you are able to programmatically generate/obtain the URLs of your row actions, you can subclass `GestartAdmino::Table::Presenter` and declare them:
604
519
 
605
520
  ```ruby
606
- class CustomTablePresenter < Admino::Table::Presenter
521
+ class CustomTablePresenter < GestartAdmino::Table::Presenter
607
522
  private
608
523
 
609
524
  def resource_row(resource, view_context)
610
525
  ResourceRow.new(resource, view_context)
611
526
  end
612
527
 
613
- class ResourceRow < Admino::Table::ResourceRow
528
+ class ResourceRow < GestartAdmino::Table::ResourceRow
614
529
  def show_action_url
615
530
  h.resource_url(resource)
616
531
  end
@@ -658,7 +573,7 @@ end
658
573
  ```erb
659
574
  <% tasks = present_collection(@tasks)
660
575
 
661
- <%= Admino::Table::Presenter.new(tasks, Task, self).to_html do |row, record| %>
576
+ <%= GestartAdmino::Table::Presenter.new(tasks, Task, self).to_html do |row, record| %>
662
577
  <%= row.column :truncated_title, 'Title' %>
663
578
  <% end %>
664
579
  ```
@@ -1,15 +1,15 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'admino/version'
4
+ require 'gestart_admino/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'gestart-admino'
8
- spec.version = Admino::VERSION
8
+ spec.version = GestartAdmino::VERSION
9
9
  spec.authors = ['Gestart Cloud S.r.l.', 'Stefano Verna']
10
10
  spec.email = ['dev@gestart.net']
11
- spec.description = %q{Fork Gestart di admino 0.0.22, potato di ciò che Gestart non usa}
12
- spec.summary = %q{Fork Gestart di admino: query object e tabelle delle pagine indice}
11
+ spec.description = %q{Gestart fork of admino 0.0.22, pruned of what Gestart does not use}
12
+ spec.summary = %q{Gestart fork of admino: query objects and tables for index pages}
13
13
  spec.homepage = 'https://github.com/gestartcloudsrl/gestart-admino'
14
14
  spec.license = 'MIT'
15
15
 
@@ -1 +1 @@
1
- require 'admino'
1
+ require 'gestart_admino'
@@ -1,12 +1,12 @@
1
1
  require 'active_support/core_ext/hash'
2
- require 'admino/table/presenter'
3
- require 'admino/query/base_presenter'
2
+ require 'gestart_admino/table/presenter'
3
+ require 'gestart_admino/query/base_presenter'
4
4
 
5
- module Admino
5
+ module GestartAdmino
6
6
  module ActionViewExtension
7
7
  module Internals
8
8
  def self.present_query(query, context, options, key = :presenter)
9
- presenter_klass = options.fetch(key, Admino::Query::BasePresenter)
9
+ presenter_klass = options.fetch(key, GestartAdmino::Query::BasePresenter)
10
10
  presenter_klass.new(query, context)
11
11
  end
12
12
  end
@@ -14,7 +14,7 @@ module Admino
14
14
  def table_for(collection, options = {}, &block)
15
15
  options.symbolize_keys!
16
16
  options.assert_valid_keys(:presenter, :class, :query, :html)
17
- presenter_klass = options.fetch(:presenter, Admino::Table::Presenter)
17
+ presenter_klass = options.fetch(:presenter, GestartAdmino::Table::Presenter)
18
18
  query = if options[:query]
19
19
  Internals.present_query(options[:query], self, options, :query_presenter)
20
20
  else
@@ -6,10 +6,10 @@ require 'active_support/hash_with_indifferent_access'
6
6
  require 'active_support/core_ext/hash'
7
7
  require 'active_support/core_ext/class/attribute'
8
8
 
9
- require 'admino/query/dsl'
10
- require 'admino/query/builder'
9
+ require 'gestart_admino/query/dsl'
10
+ require 'gestart_admino/query/builder'
11
11
 
12
- module Admino
12
+ module GestartAdmino
13
13
  module Query
14
14
  class Base
15
15
  extend ActiveModel::Naming
@@ -1,6 +1,6 @@
1
1
  require 'showcase'
2
2
 
3
- module Admino
3
+ module GestartAdmino
4
4
  module Query
5
5
  class BasePresenter < Showcase::Presenter
6
6
  presents_collection :filter_groups
@@ -1,4 +1,4 @@
1
- module Admino
1
+ module GestartAdmino
2
2
  module Query
3
3
  class Builder
4
4
  attr_accessor :scope
@@ -1,4 +1,4 @@
1
- module Admino
1
+ module GestartAdmino
2
2
  module Query
3
3
  class Configuration
4
4
  class SearchField
@@ -1,8 +1,8 @@
1
- module Admino
1
+ module GestartAdmino
2
2
  module Query
3
3
  module Dsl
4
4
  def config
5
- @config ||= Admino::Query::Configuration.new
5
+ @config ||= GestartAdmino::Query::Configuration.new
6
6
  end
7
7
 
8
8
  def search_field(name, options = {})
@@ -1,7 +1,7 @@
1
1
  require 'active_support/hash_with_indifferent_access'
2
2
  require 'active_support/core_ext/hash'
3
3
 
4
- module Admino
4
+ module GestartAdmino
5
5
  module Query
6
6
  class FilterGroup
7
7
  attr_reader :params
@@ -6,7 +6,7 @@ require 'active_support/core_ext/array/extract_options'
6
6
  require 'active_support/hash_with_indifferent_access'
7
7
  require 'active_support/core_ext/hash'
8
8
 
9
- module Admino
9
+ module GestartAdmino
10
10
  module Query
11
11
  class FilterGroupPresenter < Showcase::Presenter
12
12
  def scope_link(scope, *args)
@@ -1,6 +1,6 @@
1
1
  require 'showcase'
2
2
 
3
- module Admino
3
+ module GestartAdmino
4
4
  module Query
5
5
  class ScopePresenter < Showcase::Presenter
6
6
  def initialize(object, parent, view_context)
@@ -1,7 +1,7 @@
1
1
  require 'active_support/hash_with_indifferent_access'
2
2
  require 'active_support/core_ext/hash'
3
3
 
4
- module Admino
4
+ module GestartAdmino
5
5
  module Query
6
6
  class SearchField
7
7
  attr_reader :params
@@ -1,7 +1,7 @@
1
1
  require 'active_support/hash_with_indifferent_access'
2
2
  require 'active_support/core_ext/hash'
3
3
 
4
- module Admino
4
+ module GestartAdmino
5
5
  module Query
6
6
  class Sorting
7
7
  attr_reader :params
@@ -1,7 +1,7 @@
1
1
  require 'showcase'
2
2
  require 'active_support/core_ext/object/deep_dup'
3
3
 
4
- module Admino
4
+ module GestartAdmino
5
5
  module Query
6
6
  class SortingPresenter < Showcase::Presenter
7
7
  def scope_link(scope, *args)
@@ -0,0 +1,15 @@
1
+ require 'gestart_admino/query/base'
2
+ require 'gestart_admino/query/base_presenter'
3
+ require 'gestart_admino/query/configuration'
4
+ require 'gestart_admino/query/search_field'
5
+ require 'gestart_admino/query/filter_group'
6
+ require 'gestart_admino/query/filter_group_presenter'
7
+ require 'gestart_admino/query/sorting'
8
+ require 'gestart_admino/query/sorting_presenter'
9
+ require 'gestart_admino/query/scope_presenter'
10
+
11
+ module GestartAdmino
12
+ module Query
13
+ end
14
+ end
15
+
@@ -1,7 +1,7 @@
1
- require 'admino/table/row'
1
+ require 'gestart_admino/table/row'
2
2
  require 'showcase/helpers/html_options'
3
3
 
4
- module Admino
4
+ module GestartAdmino
5
5
  module Table
6
6
  class HeadRow < Row
7
7
  attr_reader :resource_klass
@@ -1,8 +1,8 @@
1
1
  require 'showcase'
2
- require 'admino/table/head_row'
3
- require 'admino/table/resource_row'
2
+ require 'gestart_admino/table/head_row'
3
+ require 'gestart_admino/table/resource_row'
4
4
 
5
- module Admino
5
+ module GestartAdmino
6
6
  module Table
7
7
  class Presenter < Showcase::Presenter
8
8
  attr_reader :collection_klass
@@ -1,7 +1,7 @@
1
- require 'admino/table/row'
1
+ require 'gestart_admino/table/row'
2
2
  require 'showcase/helpers/html_options'
3
3
 
4
- module Admino
4
+ module GestartAdmino
5
5
  module Table
6
6
  class ResourceRow < Row
7
7
  attr_reader :resource
@@ -1,4 +1,4 @@
1
- module Admino
1
+ module GestartAdmino
2
2
  module Table
3
3
  class Row
4
4
  attr_reader :view_context
@@ -0,0 +1,7 @@
1
+ require 'gestart_admino/table/presenter'
2
+
3
+ module GestartAdmino
4
+ module Table
5
+ end
6
+ end
7
+
@@ -0,0 +1,3 @@
1
+ module GestartAdmino
2
+ VERSION = "2.0.0"
3
+ end
@@ -0,0 +1,14 @@
1
+ require 'active_support/core_ext/module/delegation'
2
+
3
+ require "gestart_admino/version"
4
+ require "gestart_admino/query"
5
+ require "gestart_admino/table"
6
+ require "gestart_admino/action_view_extension"
7
+
8
+ module GestartAdmino
9
+ end
10
+
11
+ ActiveSupport.on_load(:action_view) do
12
+ include GestartAdmino::ActionViewExtension
13
+ end
14
+
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Admino
3
+ module GestartAdmino
4
4
  module Query
5
5
  describe BasePresenter do
6
6
  subject(:presenter) { BasePresenter.new(query, view) }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Admino
3
+ module GestartAdmino
4
4
  module Query
5
5
  describe Base do
6
6
  subject(:query) { Base.new(params, context, config) }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Admino
3
+ module GestartAdmino
4
4
  module Query
5
5
  describe Dsl do
6
6
  let(:config) { TestQuery.config }
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'active_support/hash_with_indifferent_access'
3
3
 
4
- module Admino
4
+ module GestartAdmino
5
5
  module Query
6
6
  describe FilterGroupPresenter do
7
7
  subject(:presenter) { FilterGroupPresenter.new(filter_group, view) }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Admino
3
+ module GestartAdmino
4
4
  module Query
5
5
  describe FilterGroup do
6
6
  subject(:filter_group) { FilterGroup.new(config, params) }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Admino
3
+ module GestartAdmino
4
4
  module Query
5
5
  describe SearchField do
6
6
  subject(:search_field) { SearchField.new(config, params) }
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'active_support/hash_with_indifferent_access'
3
3
 
4
- module Admino
4
+ module GestartAdmino
5
5
  module Query
6
6
  describe SortingPresenter do
7
7
  subject(:presenter) { SortingPresenter.new(sorting, view) }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Admino
3
+ module GestartAdmino
4
4
  module Query
5
5
  describe Sorting do
6
6
  subject(:sorting) { Sorting.new(config, params) }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Admino
3
+ module GestartAdmino
4
4
  module Table
5
5
  describe HeadRow do
6
6
  subject(:row) { HeadRow.new(klass, query, view) }
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'ostruct'
3
3
 
4
- module Admino
4
+ module GestartAdmino
5
5
  module Table
6
6
  describe Presenter do
7
7
  subject(:presenter) { presenter_klass.new(collection, Post, query, view) }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Admino
3
+ module GestartAdmino
4
4
  module Table
5
5
  describe ResourceRow do
6
6
  subject(:row) { ResourceRow.new(resource, view) }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Admino
3
+ module GestartAdmino
4
4
  module Table
5
5
  describe Row do
6
6
  subject(:row) { Row.new(view) }
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'admino'
1
+ require 'gestart_admino'
2
2
  require 'rspec-html-matchers'
3
3
  require 'ostruct'
4
4
 
@@ -19,7 +19,7 @@ class ScopeMock
19
19
  end
20
20
  end
21
21
 
22
- class TestQuery < Admino::Query::Base
22
+ class TestQuery < GestartAdmino::Query::Base
23
23
  search_field :foo, default: 'bar'
24
24
  search_field :starting_from
25
25
 
@@ -68,7 +68,7 @@ require 'simple_form'
68
68
  class RailsViewContext < ActionView::Base
69
69
  include ActionView::Helpers::TagHelper
70
70
  include SimpleForm::ActionViewExtensions::FormHelper
71
- include Admino::ActionViewExtension
71
+ include GestartAdmino::ActionViewExtension
72
72
 
73
73
  def initialize(*)
74
74
  super(ActionView::LookupContext.new([]), {}, nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gestart-admino
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gestart Cloud S.r.l.
@@ -178,7 +178,7 @@ dependencies:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
- description: Fork Gestart di admino 0.0.22, potato di ciò che Gestart non usa
181
+ description: Gestart fork of admino 0.0.22, pruned of what Gestart does not use
182
182
  email:
183
183
  - dev@gestart.net
184
184
  executables: []
@@ -194,40 +194,40 @@ files:
194
194
  - README.md
195
195
  - Rakefile
196
196
  - gestart-admino.gemspec
197
- - lib/admino.rb
198
- - lib/admino/action_view_extension.rb
199
- - lib/admino/query.rb
200
- - lib/admino/query/base.rb
201
- - lib/admino/query/base_presenter.rb
202
- - lib/admino/query/builder.rb
203
- - lib/admino/query/configuration.rb
204
- - lib/admino/query/dsl.rb
205
- - lib/admino/query/filter_group.rb
206
- - lib/admino/query/filter_group_presenter.rb
207
- - lib/admino/query/scope_presenter.rb
208
- - lib/admino/query/search_field.rb
209
- - lib/admino/query/sorting.rb
210
- - lib/admino/query/sorting_presenter.rb
211
- - lib/admino/table.rb
212
- - lib/admino/table/head_row.rb
213
- - lib/admino/table/presenter.rb
214
- - lib/admino/table/resource_row.rb
215
- - lib/admino/table/row.rb
216
- - lib/admino/version.rb
217
197
  - lib/gestart-admino.rb
218
- - spec/admino/integration_spec.rb
219
- - spec/admino/query/base_presenter_spec.rb
220
- - spec/admino/query/base_spec.rb
221
- - spec/admino/query/dsl_spec.rb
222
- - spec/admino/query/filter_group_presenter_spec.rb
223
- - spec/admino/query/filter_group_spec.rb
224
- - spec/admino/query/search_field_spec.rb
225
- - spec/admino/query/sorting_presenter_spec.rb
226
- - spec/admino/query/sorting_spec.rb
227
- - spec/admino/table/head_row_spec.rb
228
- - spec/admino/table/presenter_spec.rb
229
- - spec/admino/table/resource_row_spec.rb
230
- - spec/admino/table/row_spec.rb
198
+ - lib/gestart_admino.rb
199
+ - lib/gestart_admino/action_view_extension.rb
200
+ - lib/gestart_admino/query.rb
201
+ - lib/gestart_admino/query/base.rb
202
+ - lib/gestart_admino/query/base_presenter.rb
203
+ - lib/gestart_admino/query/builder.rb
204
+ - lib/gestart_admino/query/configuration.rb
205
+ - lib/gestart_admino/query/dsl.rb
206
+ - lib/gestart_admino/query/filter_group.rb
207
+ - lib/gestart_admino/query/filter_group_presenter.rb
208
+ - lib/gestart_admino/query/scope_presenter.rb
209
+ - lib/gestart_admino/query/search_field.rb
210
+ - lib/gestart_admino/query/sorting.rb
211
+ - lib/gestart_admino/query/sorting_presenter.rb
212
+ - lib/gestart_admino/table.rb
213
+ - lib/gestart_admino/table/head_row.rb
214
+ - lib/gestart_admino/table/presenter.rb
215
+ - lib/gestart_admino/table/resource_row.rb
216
+ - lib/gestart_admino/table/row.rb
217
+ - lib/gestart_admino/version.rb
218
+ - spec/gestart_admino/integration_spec.rb
219
+ - spec/gestart_admino/query/base_presenter_spec.rb
220
+ - spec/gestart_admino/query/base_spec.rb
221
+ - spec/gestart_admino/query/dsl_spec.rb
222
+ - spec/gestart_admino/query/filter_group_presenter_spec.rb
223
+ - spec/gestart_admino/query/filter_group_spec.rb
224
+ - spec/gestart_admino/query/search_field_spec.rb
225
+ - spec/gestart_admino/query/sorting_presenter_spec.rb
226
+ - spec/gestart_admino/query/sorting_spec.rb
227
+ - spec/gestart_admino/table/head_row_spec.rb
228
+ - spec/gestart_admino/table/presenter_spec.rb
229
+ - spec/gestart_admino/table/resource_row_spec.rb
230
+ - spec/gestart_admino/table/row_spec.rb
231
231
  - spec/spec_helper.rb
232
232
  homepage: https://github.com/gestartcloudsrl/gestart-admino
233
233
  licenses:
@@ -249,19 +249,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
249
249
  requirements: []
250
250
  rubygems_version: 3.6.9
251
251
  specification_version: 4
252
- summary: 'Fork Gestart di admino: query object e tabelle delle pagine indice'
252
+ summary: 'Gestart fork of admino: query objects and tables for index pages'
253
253
  test_files:
254
- - spec/admino/integration_spec.rb
255
- - spec/admino/query/base_presenter_spec.rb
256
- - spec/admino/query/base_spec.rb
257
- - spec/admino/query/dsl_spec.rb
258
- - spec/admino/query/filter_group_presenter_spec.rb
259
- - spec/admino/query/filter_group_spec.rb
260
- - spec/admino/query/search_field_spec.rb
261
- - spec/admino/query/sorting_presenter_spec.rb
262
- - spec/admino/query/sorting_spec.rb
263
- - spec/admino/table/head_row_spec.rb
264
- - spec/admino/table/presenter_spec.rb
265
- - spec/admino/table/resource_row_spec.rb
266
- - spec/admino/table/row_spec.rb
254
+ - spec/gestart_admino/integration_spec.rb
255
+ - spec/gestart_admino/query/base_presenter_spec.rb
256
+ - spec/gestart_admino/query/base_spec.rb
257
+ - spec/gestart_admino/query/dsl_spec.rb
258
+ - spec/gestart_admino/query/filter_group_presenter_spec.rb
259
+ - spec/gestart_admino/query/filter_group_spec.rb
260
+ - spec/gestart_admino/query/search_field_spec.rb
261
+ - spec/gestart_admino/query/sorting_presenter_spec.rb
262
+ - spec/gestart_admino/query/sorting_spec.rb
263
+ - spec/gestart_admino/table/head_row_spec.rb
264
+ - spec/gestart_admino/table/presenter_spec.rb
265
+ - spec/gestart_admino/table/resource_row_spec.rb
266
+ - spec/gestart_admino/table/row_spec.rb
267
267
  - spec/spec_helper.rb
data/lib/admino/query.rb DELETED
@@ -1,15 +0,0 @@
1
- require 'admino/query/base'
2
- require 'admino/query/base_presenter'
3
- require 'admino/query/configuration'
4
- require 'admino/query/search_field'
5
- require 'admino/query/filter_group'
6
- require 'admino/query/filter_group_presenter'
7
- require 'admino/query/sorting'
8
- require 'admino/query/sorting_presenter'
9
- require 'admino/query/scope_presenter'
10
-
11
- module Admino
12
- module Query
13
- end
14
- end
15
-
data/lib/admino/table.rb DELETED
@@ -1,7 +0,0 @@
1
- require 'admino/table/presenter'
2
-
3
- module Admino
4
- module Table
5
- end
6
- end
7
-
@@ -1,3 +0,0 @@
1
- module Admino
2
- VERSION = "1.0.0"
3
- end
data/lib/admino.rb DELETED
@@ -1,14 +0,0 @@
1
- require 'active_support/core_ext/module/delegation'
2
-
3
- require "admino/version"
4
- require "admino/query"
5
- require "admino/table"
6
- require "admino/action_view_extension"
7
-
8
- module Admino
9
- end
10
-
11
- ActiveSupport.on_load(:action_view) do
12
- include Admino::ActionViewExtension
13
- end
14
-