Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 2 #328

Open
wants to merge 155 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
992ca78
Refactor
bogdan Nov 2, 2024
a3daafc
Add debugger
bogdan Nov 3, 2024
f3337ca
Migrate to rails-dom-testing
bogdan Nov 3, 2024
c278f0c
Refactor
bogdan Nov 3, 2024
494b183
Make CSS classes generation consistent
bogdan Nov 3, 2024
bf68e7d
Never override built-in generated html classes
bogdan Nov 3, 2024
1f0b5a6
Remove filter class from wrapping block
bogdan Nov 3, 2024
e1ad783
Rubocop install
bogdan Nov 3, 2024
fb7002f
Rubocop fixes
bogdan Nov 3, 2024
f9fe54f
Rubocop fixes
bogdan Nov 3, 2024
dd944db
Rubocop
bogdan Nov 3, 2024
d0786ae
Rubocop
bogdan Nov 3, 2024
b426776
Rubocop
bogdan Nov 3, 2024
7d6b8f1
Cleanup
bogdan Nov 3, 2024
9b76d77
Rubocop
bogdan Nov 3, 2024
e2fc7fb
Move formatting classes from input/label to wrapping div
bogdan Nov 4, 2024
948efc5
Add datagrid-range- prefix for from/to css classes
bogdan Nov 4, 2024
36bf694
Add datagrid-dynamic- prefix for field/operation/value css classes
bogdan Nov 4, 2024
a8d4cf6
Update CSS
bogdan Nov 4, 2024
dc926b6
Rename separator to datagrid-range-separator
bogdan Nov 4, 2024
350b6da
Rename datagrid_table autogenerated CSS classes to match modern CSS m…
bogdan Nov 4, 2024
589daaa
Rename .noresults .datagrid-noresults
bogdan Nov 4, 2024
544c734
Cleanup css
bogdan Nov 4, 2024
6aa9489
Use html5 input types by default
bogdan Nov 4, 2024
e486c6b
Rename several css classes
bogdan Nov 4, 2024
5ebe3e0
Migration document prototype
bogdan Nov 4, 2024
76e3aa3
Remove automatically generated css classes from grid class
bogdan Nov 4, 2024
527f8d6
Make datagrid-table datagrid-form classes explicitly set in views
bogdan Nov 4, 2024
874122c
Remove unnecessary html_safe calls
bogdan Nov 4, 2024
c9ec124
Fully removed column url option
bogdan Nov 4, 2024
0c6b9ca
Remove composite filters completely
bogdan Nov 4, 2024
a1a47a5
Cleanup
bogdan Nov 5, 2024
7b6e2b0
update upgrade guide
bogdan Nov 5, 2024
b3d4778
Ability to assign range as {from: , to:} hash
bogdan Nov 5, 2024
01e50e9
Use data attributes instead of CSS classes for column names
bogdan Nov 6, 2024
f68ba6b
Cleanup
bogdan Nov 6, 2024
bcfdd94
V2 guide
bogdan Nov 6, 2024
47f491d
Introduce Datagrid::Base
bogdan Nov 6, 2024
debfd76
Rename BaseGrid to ApplicationGrid
bogdan Nov 6, 2024
9279b7e
Use data-* attributes distinguish filters
bogdan Nov 6, 2024
9f0ce55
Use Range for RangedFilter value
bogdan Nov 6, 2024
68c2340
Change range inputs from array to [from] [to] hash
bogdan Nov 6, 2024
252e069
Dynamic filter rework to use Hash instead of Array
bogdan Nov 6, 2024
67baa57
Remove multiple attribute from range filters
bogdan Nov 7, 2024
6856b53
Ability to serialize/deserialize ranged filters
bogdan Nov 7, 2024
329f32d
Use hash instead of array when generating dynamic filter inputs
bogdan Nov 7, 2024
113536f
Update migration guide
bogdan Nov 7, 2024
ab79ed9
Remove SASS
bogdan Nov 8, 2024
ded516d
Make range input classes editable in partials
bogdan Nov 8, 2024
54a9a77
Expose datagrid-range-from/to classes in partials
bogdan Nov 8, 2024
4f5fd52
Prettify CSS
bogdan Nov 8, 2024
f19c191
Prettify CSS
bogdan Nov 8, 2024
47369af
Fully support pagy in scaffold generator
bogdan Nov 8, 2024
83d875f
Improve scaffold
bogdan Nov 8, 2024
755c21c
Fix dynamic filter when assigned a hash with string keys
bogdan Nov 8, 2024
ed1ad9a
Extract views diff to separated file
bogdan Nov 8, 2024
1a0fcbd
Form versions
bogdan Nov 9, 2024
c441425
Check order with direction
bogdan Nov 9, 2024
f1ee161
Lint
bogdan Nov 9, 2024
4c91827
Rework class attribute as method
bogdan Nov 9, 2024
efd092e
Simplify enum checkboxes partial
bogdan Nov 9, 2024
d6695cf
Rework a test
bogdan Nov 9, 2024
b273387
Migrate from form_for to form_with
bogdan Nov 9, 2024
77017a7
Update views diff
bogdan Nov 9, 2024
53c9fd0
Merge branch 'main' into version-2
bogdan Nov 9, 2024
e8b662a
Merge branch 'main' into version-2
bogdan Nov 9, 2024
cbcb851
Support rails from 7.0 and ruby from 3.1
bogdan Nov 10, 2024
296cc48
Fix build
bogdan Nov 10, 2024
9673a83
Support TimeWithZone as an argument of datetime filter
bogdan Nov 10, 2024
30b89a8
Support ruby 3.0
bogdan Nov 10, 2024
9c1ad90
Fix ruby 3.0
bogdan Nov 10, 2024
ade8780
Rails 8 gemfile
bogdan Nov 10, 2024
b667238
Fix build ruby 3.0 rails 7.2 8.0
bogdan Nov 10, 2024
bcde315
Cleanup
bogdan Nov 10, 2024
0a2077b
Expose datagrid-order-active-asc/desc classes
bogdan Nov 10, 2024
c2a8e83
Deprecate datagrid_order_for and related partial
bogdan Nov 10, 2024
1195f03
Update views diff
bogdan Nov 10, 2024
6ac1194
Update v2 guide
bogdan Nov 10, 2024
831001d
Merge branch 'main' into version-2
bogdan Nov 10, 2024
74aa904
Generate local form when using datagrid_form_for
bogdan Nov 10, 2024
ace61b3
Rollback changes in datagrid_order_for
bogdan Nov 10, 2024
5ead012
Update migration guide
bogdan Nov 10, 2024
a0c451d
Update doc
bogdan Nov 10, 2024
fb96d98
v2.0.0
bogdan Nov 11, 2024
80d56f5
BaseFilter#default_scope? method
bogdan Nov 11, 2024
cb8d752
Finding deprecation scripts
bogdan Nov 11, 2024
dbe6600
Fix script bug
bogdan Nov 11, 2024
3059c07
Replace rake datagrid:copy_partials with rails g datagrid::views
bogdan Nov 11, 2024
6020fd6
Set new rails default ActionView::Helpers::FormTagHelper.default_enfo…
bogdan Nov 11, 2024
18b97b3
Set form_with_generates_remote_forms to false as it is default value
bogdan Nov 11, 2024
c33c38e
Merge branch 'main' into version-2
bogdan Nov 11, 2024
5fa36cb
Update form-v2.html
bogdan Nov 11, 2024
5315eee
Update form-v1.html
bogdan Nov 11, 2024
0f9b365
Additional doc
bogdan Nov 11, 2024
7597515
Merge remote-tracking branch 'origin/version-2' into version-2
bogdan Nov 11, 2024
d6ce92c
Update datagrid_spec.rb
bogdan Nov 12, 2024
0cd6543
Update Readme.markdown
bogdan Nov 12, 2024
a26b59f
Update Readme.markdown
bogdan Nov 12, 2024
5ae09ee
Use Rails.deprecator
bogdan Nov 12, 2024
b1e34a2
Merge remote-tracking branch 'origin/version-2' into version-2
bogdan Nov 12, 2024
26dabcb
Fix rails 7.0 build
bogdan Nov 12, 2024
ff5193f
Cleanup old monkey patch
bogdan Nov 12, 2024
3ab520c
Forbid Range argument for non-range filter
bogdan Nov 12, 2024
7aa2832
Add date range deserialization test
bogdan Nov 12, 2024
7d22501
Merge branch 'main' into version-2
bogdan Nov 13, 2024
12de0d4
Fix regression for boolean filter default value
bogdan Nov 13, 2024
5bf9208
Add separator localization to upgrade guide
bogdan Nov 13, 2024
ee983ff
linting
bogdan Nov 13, 2024
a171ba7
Merge branch 'main' into version-2
bogdan Nov 13, 2024
61b0b50
Fix w3 validator warning for label[for] not corresponding to any inpu…
bogdan Nov 13, 2024
05cf3de
Change error type
bogdan Nov 13, 2024
ff1924d
cleanup
bogdan Nov 13, 2024
b4ec7a2
Merge branch 'main' into version-2
bogdan Nov 14, 2024
b4878f1
Cleanup
bogdan Nov 14, 2024
c133d7e
Cleanup
bogdan Nov 14, 2024
f5e082a
Linting
bogdan Nov 14, 2024
e12826b
Mention the removal of grid class from table[class]
bogdan Nov 14, 2024
b775675
column[url] option removal guide
bogdan Nov 14, 2024
c153d67
column[url] removal guide
bogdan Nov 14, 2024
5a0d966
Cleanup
bogdan Nov 14, 2024
d7f75ba
Cleanup
bogdan Nov 14, 2024
d488792
Merge branch 'main' into version-2
bogdan Nov 14, 2024
a80b0bc
Fix regression bug
bogdan Nov 14, 2024
481e3f5
Disable default label[for] for enum checkboxes
bogdan Nov 14, 2024
bad5914
Fix assignment hash value with string keys to range filter
bogdan Nov 15, 2024
e872fec
Update upgrade guide
bogdan Nov 15, 2024
95c289a
Cleanup
bogdan Nov 15, 2024
5ee5555
Update version-2/views.diff
bogdan Nov 15, 2024
41832ef
Update version-2/views.diff
bogdan Nov 15, 2024
a9190ad
Update version-2/views.diff
bogdan Nov 15, 2024
6981dc5
Update version-2/views.diff
bogdan Nov 15, 2024
c2b5543
Update app/views/datagrid/_head.html.erb
bogdan Nov 15, 2024
47a2d09
Update app/views/datagrid/_head.html.erb
bogdan Nov 15, 2024
cbece13
Update app/views/datagrid/_table.html.erb
bogdan Nov 15, 2024
dbd3d46
Migrate from content_tag to tag
bogdan Nov 15, 2024
0f761ca
Update view diff
bogdan Nov 15, 2024
ad56fe6
Update lib/datagrid/core.rb
bogdan Nov 15, 2024
6fab0e8
Update app/views/datagrid/_row.html.erb
bogdan Nov 15, 2024
f30a9bb
Update version-2/views.diff
bogdan Nov 15, 2024
14452df
Fix specifying inline class in #datagrid_filter for enum checkboxes
bogdan Nov 16, 2024
757fd56
Remove datagrid-enum-checkbox-label css class as styling by tag name …
bogdan Nov 16, 2024
3fb0aa1
Merge branch 'version-2' of github.com:bogdan/datagrid into version-2
bogdan Nov 16, 2024
c7b66ce
Update view diff
bogdan Nov 16, 2024
2a3fb80
Improve stylesheet to support enum filter
bogdan Nov 16, 2024
f072cde
Fix dynamic filter layout
bogdan Nov 16, 2024
a33986c
Cleanup stylesheet
bogdan Nov 16, 2024
5b6cd38
Improve Scaffold.view_code
bogdan Nov 17, 2024
0769160
Pagy tests for scaffold
bogdan Nov 17, 2024
76b9792
Reprecate elements in favor of choices inside enum_checkboxes
bogdan Nov 17, 2024
e82f48b
Linting
bogdan Nov 17, 2024
7d6eca1
Update diff
bogdan Nov 17, 2024
5cc3cc2
Merge branch 'main' into version-2
bogdan Nov 17, 2024
0365750
Add column[tag_options] option instead of column[class]
bogdan Nov 17, 2024
5acee62
Improve tag_options: merge custom class with order classes
bogdan Nov 17, 2024
7241336
Merge branch 'main' into version-2
bogdan Nov 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ jobs:
fail-fast: false
matrix:
# To keep matrix size down, only test highest and lowest rubies.
ruby: ["2.7", "3.3"]
rails: ["6.1", "7.0", "7.1", "7.2"]
ruby: ["3.0", "3.3"]
rails: ["7.0", "7.1", "7.2", "8.0"]
exclude:
- ruby: "2.7"
- ruby: "3.0"
rails: "7.2"
- ruby: "3.0"
rails: "8.0"
name: Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }}
runs-on: ubuntu-latest
env:
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 2.0.0

Version 2 is a major update implementing a lot of major improvements
at the cost of backward compatibility.

[Changes and migration guide](./version-2)

## 1.8.3

* Fix rails hooking for version 7.1. [#327](https://github.com/bogdan/datagrid/issues/327)
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ group :development do
gem "debug"
gem "nokogiri" # used to test html output
gem "pry-byebug"
gem "rails-dom-testing", "~> 2.2"
gem "rspec"
gem "rubocop", "~> 1.68"
gem "sequel"
gem "sqlite3", "~> 1.7.0"

Expand All @@ -21,5 +23,3 @@ group :development do
gem "mongoid", "~> 9.0"
end
end

gem "rubocop", "~> 1.68"
20 changes: 10 additions & 10 deletions Readme.markdown
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Datagrid

[![Build Status](https://github.com/bogdan/datagrid/workflows/CI/badge.svg?branch=master)](https://github.com/bogdan/datagrid/actions)
Datagrid Version 2.0.0 is here.

[Migration Guide](./version-2).

[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fbogdan%2Fdatagrid.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fbogdan%2Fdatagrid?ref=badge_shield)
[![Build Status](https://github.com/bogdan/datagrid/workflows/CI/badge.svg?branch=master)](https://github.com/bogdan/datagrid/actions)

A really mighty and flexible ruby library that generates reports
including admin panels, analytics and data representation:
including admin panels, analytics and data browsers:

* Filtering
* Columns
Expand All @@ -31,7 +33,7 @@ including admin panels, analytics and data representation:

## Documentation

* [Readme](/Readme.markdown) - this read-me for basic information.
* Readme - this read-me for basic information.
* [Wiki](https://github.com/bogdan/datagrid/wiki) - general reference on how to use the gem.
* [Rdoc](https://rubydoc.info/gems/datagrid) - API reference.

Expand All @@ -47,9 +49,7 @@ including admin panels, analytics and data representation:
In order to create a grid:

``` ruby
class UsersGrid

include Datagrid
class UsersGrid < Datagrid::Base

scope do
User.includes(:group)
Expand Down Expand Up @@ -183,12 +183,12 @@ route resources :skills
insert app/assets/stylesheet/application.css
```

#### Customize Built-in partials
#### Customize Built-in views

In order to get a control on datagrid built-in partials run:
In order to get a control on datagrid built-in views run:

``` sh
rake datagrid:copy_partials
rails g datagrid::views
```

#### Advanced frontend
Expand Down
145 changes: 145 additions & 0 deletions app/assets/stylesheets/datagrid.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
/* Table */

table.datagrid-table {
background-color: transparent;
border-collapse: collapse;
max-width: 100%;
}

table.datagrid-table th {
background-color: #eee;
text-align: left;
vertical-align: top;
}

table.datagrid-table td,
table.datagrid-table th {
border: 1px solid #d6d6d6;
padding: 5px 10px;
}

.datagrid-order-control-asc,
.datagrid-order-control-desc {
text-decoration: none;
font-weight: normal;
}

.datagrid-order-active-asc,
.datagrid-order-active-desc {
background-color: #fff7d5;
}

.datagrid-order-active-asc a.datagrid-order-control-asc,
.datagrid-order-active-desc a.datagrid-order-control-desc {
font-weight: bold;
color: #d00;
}

.datagrid-no-results {
text-align: center;
}

/* Form */

.datagrid-form {
background-color: #f0f0f0;
border-radius: 5px;
padding: 20px;
}

.datagrid-filter {
margin: 10px;
}

.datagrid-filter label {
width: 150px;
display: inline-block;
}

.datagrid-filter input, .datagrid-filter select {
border: 2px solid #ccc;
border-radius: 4px;
display: inline-block;
padding: 5px 12px;
width: 300px;
}

input.datagrid-range-from, input.datagrid-range-to {
width: 138px;
}

.datagrid-filter select[multiple] {
border: 2px solid #ccc;
border-radius: 5px;
height: 100px;
}

select.datagrid-dynamic-field {
width: 228px
}

select.datagrid-dynamic-operation {
margin-left: 7px;
width: 60px;
}

.datagrid-dynamic-value {
margin: 10px 0 0 154px;
}

.datagrid-range-separator {
display: inline-block;
margin: 6px 4px 0;
}

.datagrid-enum-checkboxes {
display: inline-block;
}

.datagrid-enum-checkboxes input {
margin: 7px;
width: auto;
}

.datagrid-enum-checkboxes label {
display: block;
width: 100%;
}

.datagrid-actions {
padding-left: calc(150px + 10px);
}

.datagrid-submit {
background-color: #555;
border: none;
border-radius: 5px;
color: white;
cursor: pointer;
font-size: 14px;
font-weight: bold;
line-height: normal;
padding: 7px 15px;
vertical-align: middle;
display: inline-block;
zoom: 1;
*display: inline;
}

.datagrid-submit:hover,
.datagrid-submit:focus {
background-color: #333;
}

.datagrid-submit:active {
background-color: #000;
}

.datagrid-reset {
font-size: 14px;
padding: 7px 15px;
vertical-align: middle;
display: inline-block;
zoom: 1;
*display: inline;
}
135 changes: 0 additions & 135 deletions app/assets/stylesheets/datagrid.sass

This file was deleted.

8 changes: 5 additions & 3 deletions app/views/datagrid/_enum_checkboxes.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
Indent in this file may cause extra space to appear.
You can add indent if whitespace doesn't matter for you
%>
<%- elements.each do |value, text, checked| -%>
<div class="datagrid-enum-checkboxes">
<%- choices.each do |value, text| -%>
<%- id = [form.object_name, filter.name, value].join('_').underscore -%>
<%= form.label filter.name, options.merge(for: id) do -%>
<%= form.check_box(filter.name, {multiple: true, id: id, checked: checked, include_hidden: false}, value.to_s, nil) -%>
<%= form.datagrid_label(filter.name, for: id, **options) do -%>
<%= form.datagrid_filter_input(filter.name, id: id, value: value) -%>
<%= text -%>
<%- end -%>
<%- end -%>
</div>
Loading