Skip to content

Commit

Permalink
column[url] removal guide
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdan committed Nov 14, 2024
1 parent b775675 commit c153d67
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
16 changes: 14 additions & 2 deletions version-2/Readme.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ All deprecated columns can be found [with a script](./find_deprecated_url_option
Rails [deprecates form\_for in favor of form\_with](https://guides.rubyonrails.org/form_helpers.html#using-form-tag-and-form-for).

`datagrid_form_for` is now deprecated if favor of `datagrid_form_with`.
However, `datagrid_form_for` would also use Rails `form_with` because they share the same view partial.

TODO: update the wiki

Expand All @@ -71,14 +70,27 @@ datagrid_form_for(@users_grid, url: users_path)
datagrid_form_with(model: @users_grid, url: users_path)
```

Built-in partial uses `form_with` no matter
Version 2 built-in view `datagrid/form` uses `form_with` no matter of the with helper is used.
Beware of that.

[Grep all deprecations](./deprecations.sh).

## Deprecated datagrid\_order\_for

`datagrid_order_for` helper serves no purpose and should not be used directly.
The recommended way is to include your ordering code directly into `datagrid/head` partial.
You implement `datagrid_order_for` in `ApplicationHelper`
and copy [datagrid/order\_for](../app/views/datagrid/_order_for.html.erb) into your project
if you consider it useful:

``` ruby
module ApplicationHelper
def datagrid_order_for(grid, column)
render(partial: "datagrid/order_for", locals: { grid: grid, column: column })
end
end
```

See default [head partial](../app/views/datagrid/_head.html.erb) for example.
[Grep all deprecations](./deprecations.sh).

Expand Down
1 change: 1 addition & 0 deletions version-2/deprecations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ git grep 'datagrid_form_for'
git grep 'datagrid_order_for'

# Put necessary classes manually
# or copy the helper from datagrid source code to ApplicationHelper
git grep 'datagrid_column_classes'

# Inherit Datagrid::Base
Expand Down

0 comments on commit c153d67

Please sign in to comment.