-
-
Notifications
You must be signed in to change notification settings - Fork 317
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
Introduces an Elements finder class #1544
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
houndci-bot
reviewed
Feb 20, 2019
a73d069
to
9b9a315
Compare
7bcd9bf
to
1fce2f9
Compare
1fce2f9
to
5f28ec4
Compare
houndci-bot
reviewed
Feb 21, 2019
5f28ec4
to
7e51d3c
Compare
houndci-bot
reviewed
Feb 21, 2019
ActiveRecord supports this now, we do not need to use Arel here.
This controller actions spec leaks global state into subsequent specs that lead to very hard to debug spec errors.
Please implement your own sorting
7e51d3c
to
a70487b
Compare
houndci-bot
reviewed
Feb 21, 2019
a70487b
to
efc1ef1
Compare
This class abstracts elements finding logic that we currently have in `render_elements` helper and `Page#find_elements` method. But with pure active record finders and a clean testable interface. It now returns an `ActiveRecord::Relation` that later materializes in the view. The sort_by option and show hidden elements options have been removed. As this uses a very opinionated way of loading and sorting elements that only few people use - if at all. Please implement your own elements finder in your project instead and pass this as options[:finder] to those methods.
The element find logic is now abstracted into the elements finder. If you have custom element finding logic, you can pass your own elements finder instance to the method as options[:finder]. This custom class needs to implement the interface of Alchemy::ElementsFinder.
If you have custom element finding logic, you can pass your own elements finder instance to the helper as options[:finder]. This custom class needs to implement the interface of Alchemy::ElementsFinder.
efc1ef1
to
b2683c6
Compare
mamhoff
approved these changes
Feb 21, 2019
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.
Sweet. This will clean up views around the world :)
tvdeyen
added a commit
to tvdeyen/alchemy_cms
that referenced
this pull request
Mar 29, 2019
- Use element name local in generators [AlchemyCMS#1556](AlchemyCMS#1556) ([tvdeyen](https://github.com/tvdeyen)) - Remove invalid bytecode handler [AlchemyCMS#1555](AlchemyCMS#1555) ([tvdeyen](https://github.com/tvdeyen)) - Separate render element calls [AlchemyCMS#1554](AlchemyCMS#1554) ([tvdeyen](https://github.com/tvdeyen)) - Expose the element into partials as local object [AlchemyCMS#1553](AlchemyCMS#1553) ([tvdeyen](https://github.com/tvdeyen)) - Allow admins to switch all languages [AlchemyCMS#1552](AlchemyCMS#1552) ([tvdeyen](https://github.com/tvdeyen)) - Raise targeted Ruby version to 2.3 [AlchemyCMS#1545](AlchemyCMS#1545) ([tvdeyen](https://github.com/tvdeyen)) - Introduces an Elements finder class [AlchemyCMS#1544](AlchemyCMS#1544) ([tvdeyen](https://github.com/tvdeyen)) - Fixate sqlite dep for bug fix [AlchemyCMS#1543](AlchemyCMS#1543) ([tvdeyen](https://github.com/tvdeyen)) - Upgrade shoulda-matchers to version 4.0.0 [AlchemyCMS#1542](AlchemyCMS#1542) ([depfu](https://github.com/apps/depfu)) - Upgrade factory_bot_rails to version 5.0.1 [AlchemyCMS#1540](AlchemyCMS#1540) ([depfu](https://github.com/apps/depfu)) - Use Flatpickr as Datepicker [AlchemyCMS#1533](AlchemyCMS#1533) ([mamhoff](https://github.com/mamhoff)) - Use system tests over feature specs [AlchemyCMS#1528](AlchemyCMS#1528) ([tvdeyen](https://github.com/tvdeyen)) - Flexible width for admin navigation entry labels [AlchemyCMS#1527](AlchemyCMS#1527) ([tvdeyen](https://github.com/tvdeyen)) - Responsive elements window and sidebar [AlchemyCMS#1519](AlchemyCMS#1519) ([tvdeyen](https://github.com/tvdeyen)) - Change element eye icon on public state [AlchemyCMS#1517](AlchemyCMS#1517) ([oniram88](https://github.com/oniram88)) - Maximize element window if Tinymce is fullscreen [AlchemyCMS#1515](AlchemyCMS#1515) ([tvdeyen](https://github.com/tvdeyen)) - Remove cells in favour of fixed elements [AlchemyCMS#1514](AlchemyCMS#1514) ([tvdeyen](https://github.com/tvdeyen)) - Feature: Autogenerate nestable elements [AlchemyCMS#1513](AlchemyCMS#1513) ([tvdeyen](https://github.com/tvdeyen)) - Allow "data" key for module navigations [AlchemyCMS#1512](AlchemyCMS#1512) ([mamhoff](https://github.com/mamhoff)) - Allow to define layout for page previews [AlchemyCMS#1500](AlchemyCMS#1500) ([westonganger](https://github.com/westonganger)) - Fix capitalization for login/logout/leave [AlchemyCMS#1497](AlchemyCMS#1497) ([westonganger](https://github.com/westonganger)) - Verify controller keys within `register_module` [AlchemyCMS#1495](AlchemyCMS#1495) ([westonganger](https://github.com/westonganger)) - Update bundled Tinymce to 4.8.3 [AlchemyCMS#1491](AlchemyCMS#1491) ([tvdeyen](https://github.com/tvdeyen)) - Use dynamic attributes in factories [AlchemyCMS#1484](AlchemyCMS#1484) ([tvdeyen](https://github.com/tvdeyen)) - Migrating to active_model_serializers ~> 0.10.0 [AlchemyCMS#1478](AlchemyCMS#1478) ([pmashchak](https://github.com/pmashchak)) - Replace picture galleries with nestable elements [AlchemyCMS#1358](AlchemyCMS#1358) ([tvdeyen](https://github.com/tvdeyen)) - Add a compact nested element style [AlchemyCMS#1357](AlchemyCMS#1357) by [tvdeyen](https://github.com/tvdeyen)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is this pull request for?
Introduce an elements finder class.
This class abstracts elements finding logic that we currently have in
render_elements
helper andPage#find_elements
method. But with pure active record finders and a clean testable interface. It now returns anActiveRecord::Relation
that later materializes in the view.Notable changes
The
sort_by
option and "show hidden elements" options have been removed. As this uses a very opinionated way of loading and sorting elements that only few people use - if at all.Please implement your own elements finder in your project instead and pass this as
options[:finder]
to those methods.