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

BulkActions - Migration to AlpineJS v2 #1196

Merged
merged 2 commits into from
May 12, 2023

Conversation

lrljoe
Copy link
Collaborator

@lrljoe lrljoe commented May 12, 2023

How this works

Changes to a number of blades, and a couple of traits have occurred to allow for this to work smoothly.

The design is so that the "Selected" is only updated on a typical Livewire refresh, rather than forcing it on each checkbox select.

Setup

  • In wrapper.blade.php, a number of AlpineJS variables are set.
    • selectedCount (integer - used while on the same page to avoid a Livewire refresh)
    • visibleItems (array - stores a list of Visible Items)
    • selectedItems (entangled - stores a list of Selected Items, is a deferred entanglement)
    • allItemsSelected (boolean - returns if all items are selected or not)
    • selectAllOnPage() (function - selects all items on a page)

When Checking a Box

  • The value of the checkbox is set to the Primary Key of the row, to ensure persistence
  • selectedItems (AlpineJS) variable is updated, so it will be updated during the next Livewire lifecycle

When loading a new page

  • The value of the checkbox is set to the Primary Key of the row, to ensure persistence
  • The checkbox for each row is bound to selectedItems, so it will display the correct state when browsing between pages.

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests and did you add any new tests needed for your feature?
  2. Did you update all templates (if applicable)?
  3. Did you add the relevant documentation (if applicable)?
  4. Did you test locally to make sure your feature works as intended?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

lrljoe and others added 2 commits May 12, 2023 20:06
* Test AlpineBA

* Fix styling

* Fixes

* Remove typo

* HTML Fixes due to AlpineJS

* Test Fix Tests

* Fix Missing ;

* Test

* Fix styling

* Pagination Fixes

* Update tests to remove HtmlInOrder

* Fixes

* Remove BulkActions Visual Tests

* Add Default Test to BulkActions Visuals Test

* Add Bootstrap Options for Bulk Actions

* Update Blade - Remove Formatting Issue

* Remove Formatting from Code

* Strip back code formatting

* Remove Extra Spacing

* Remove Extra Spacing

* Clean up code format

* Code format cleanup

* Fix Code Formatting

---------

Co-authored-by: lrljoe <lrljoe@users.noreply.github.com>
@lrljoe
Copy link
Collaborator Author

lrljoe commented May 12, 2023

@siebsie23 - This replaces the other PR, and I'd welcome any testing you do before it hits the next release, as you're clearly keen for this! :)

Keep in mind that this does use new functions from the develop branch, so you're best off using the develop branch to test.

@lrljoe lrljoe merged commit d86227d into rappasoft:develop May 12, 2023
@lrljoe lrljoe added enhancement New feature or request Version 2 Version 2 of Package labels May 12, 2023
@rappasoft rappasoft mentioned this pull request May 18, 2023
@lrljoe lrljoe deleted the alpinejs-bulkactions-v2 branch July 15, 2023 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Version 2 Version 2 of Package
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

1 participant