Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 66
[Bug Fix] Fix DataTable pagination with array params and adapter naming#359
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
b9860535959464a626a9d4940ef2File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # frozen_string_literal: true | ||
| module RubyUI | ||
| class DataTableKaminariAdapter | ||
| def initialize(collection) | ||
| @collection = collection | ||
| end | ||
| def current_page = @collection.current_page | ||
| def total_pages = @collection.total_pages | ||
| def total_count = @collection.total_count | ||
| def per_page = @collection.limit_value | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # frozen_string_literal: true | ||
| module RubyUI | ||
| class DataTableManualAdapter | ||
| attr_reader :current_page, :per_page, :total_count | ||
| def initialize(page:, per_page:, total_count:) | ||
| @current_page = page.to_i | ||
| @per_page = [per_page.to_i, 1].max | ||
| @total_count = total_count.to_i | ||
| end | ||
| def total_pages | ||
| [(@total_count.to_f / @per_page).ceil, 1].max | ||
| end | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # frozen_string_literal: true | ||
| module RubyUI | ||
| class DataTablePagyAdapter | ||
| def initialize(pagy) | ||
| @pagy = pagy | ||
| end | ||
| def current_page = @pagy.page | ||
| def total_pages = @pagy.pages | ||
| def total_count = @pagy.count | ||
| def per_page = @pagy.items | ||
| end | ||
| end |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@djalmaaraujo I believe it's not necessary anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The gem doesn't use Zeitwerk, so require_relative is needed here. When the generator copies the files into a Rails app, the app's autoloader handles it — but in the gem context these are required.