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

Use select2 for internal page link in link overlay #1685

Merged
merged 12 commits into from
Nov 28, 2019

Conversation

tvdeyen
Copy link
Member

@tvdeyen tvdeyen commented Nov 27, 2019

What is this pull request for?

Instead of rendering the complete Page sitemap every time we open the link overlay we load pages by demand with select2 ajax search feature. This way we can even handle the largest page trees and add more convenience for the authors as they can now search a page.

The same has been done for the page element anchor select.

Notable changes

Re moves the list_admin_elements action and path that has only be used internally.

Screenshots

Screen Shot 2019-11-27 at 10 59 23
Screen Shot 2019-11-27 at 10 59 41
Screen Shot 2019-11-27 at 11 00 12

@tvdeyen tvdeyen added this to the 4.4 milestone Nov 27, 2019
@tvdeyen tvdeyen changed the title Select2 page link overlay Use select2 for internal page link in link overlay Nov 27, 2019
Copy link
Contributor

@mamhoff mamhoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Pending green specs (it looks like the failure is related). Given the progress of modern JS, would it make sense to adopt a policy of not writing new code in CoffeeScript?

@tvdeyen
Copy link
Member Author

tvdeyen commented Nov 27, 2019

would it make sense to adopt a policy of not writing new code in CoffeeScript?

Yes! The problem is, Coffeescript helps with ES5. If we want to adopt ES6 (what I love to do) we need to do more things:

  1. Update the assets pipeline to Sprockets 4 (or even use webpacker instead?)
  2. Convert existing files from Coffeescript -> ES5
  3. Adopt modern ES6 by rewriting lot of code

I would like to do this for the next mayor release.

@tvdeyen tvdeyen force-pushed the select2-page-link-overlay branch from 952d538 to 064bb93 Compare November 28, 2019 11:32
within(:xpath, '//body', &block)
end

def find_label_by_text(text)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/IndentationConsistency: Inconsistent indentation detected.

Often elements are out of the current browser window during testing.
Let's raise window size to something more realistic.
Make sure we have a clear state of assets before compiling them
the first time. Makes sure we do not have old assets lurking around.
@tvdeyen tvdeyen force-pushed the select2-page-link-overlay branch from 064bb93 to 4ba36f8 Compare November 28, 2019 16:09
Thanks to the great folks of Spree/Solidus
This is a much faster and more realistic server to run system specs in
This is best practice anyway and helps to find the essence form field with
Capybara element finders.
Instead of rendering the complete Page sitemap everytime we open
the link overlay we load pages by demand with select2 ajax search
feature. This way we can even handle the largest page trees and
add more conveniecne for the authors as they can now search a page.

The same has been done for the page element anchor select.
These specs are failing once out of ten and for unknown reasons.
We are preloading the assets before feature specs run. We clear
assets cache for feature specs run. I tried to run these specs with
insane wait times (up to one minute) and they still fail. Nothing
in the logs. Before we continue to waste more carbon dioxide on
useless CI retries I implemented a "Pend if failing" protection
for these feature specs.
@tvdeyen tvdeyen force-pushed the select2-page-link-overlay branch from 1105b1e to c37c7ec Compare November 28, 2019 16:52
@tvdeyen tvdeyen merged commit 356392d into AlchemyCMS:master Nov 28, 2019
@tvdeyen tvdeyen deleted the select2-page-link-overlay branch November 28, 2019 18:59
tvdeyen added a commit that referenced this pull request Jan 6, 2020
- Use contents settings for size in EssencePicture#picture_url [#1703](#1703) ([tvdeyen](https://github.com/tvdeyen))
- Remove title tag from preview elements [#1701](#1701) ([tvdeyen](https://github.com/tvdeyen))
- Remove custom JS logging [#1700](#1700) ([tvdeyen](https://github.com/tvdeyen))
- Remove demo locale files [#1699](#1699) ([tvdeyen](https://github.com/tvdeyen))
- Use alchemyPageSelect for Node page select [#1698](#1698) ([tvdeyen](https://github.com/tvdeyen))
- Cache menu partials [#1697](#1697) ([tvdeyen](https://github.com/tvdeyen))
- Update page tree to menu nodes Rake task [#1696](#1696) ([tvdeyen](https://github.com/tvdeyen))
- Validate nodes name if page is absent [#1695](#1695) ([tvdeyen](https://github.com/tvdeyen))
- Update the application layout installer template [#1691](#1691) ([tvdeyen](https://github.com/tvdeyen))
- Update note about missing user class [#1690](#1690) ([tvdeyen](https://github.com/tvdeyen))
- Use a Sprockets 3/4 manifest file [#1689](#1689) ([tvdeyen](https://github.com/tvdeyen))
- Use select2 for internal page link in link overlay [#1685](#1685) ([tvdeyen](https://github.com/tvdeyen))
- Do not consider nested elements "orphaned" [#1684](#1684) ([mamhoff](https://github.com/mamhoff))
- Destroy page-dependent elements [#1683](#1683) ([mamhoff](https://github.com/mamhoff))
- Add anchor link tab to link overlay [#1682](#1682) ([tvdeyen](https://github.com/tvdeyen))
- Ensure the apt/cache folder exists while installing [#1678](#1678) ([tvdeyen](https://github.com/tvdeyen))
- Cache apt packages between CI runs [#1677](#1677) ([tvdeyen](https://github.com/tvdeyen))
- Use select2 with AJAX search for essence page select [#1675](#1675) ([tvdeyen](https://github.com/tvdeyen))
- Eager load associated records [#1674](#1674) ([tvdeyen](https://github.com/tvdeyen))
- Add support for testing with multiple Rails versions [#1673](#1673) ([tvdeyen](https://github.com/tvdeyen))
- Page api pagination [#1672](#1672) ([tvdeyen](https://github.com/tvdeyen))
- Adjust select2 loading-more indicator [#1671](#1671) ([tvdeyen](https://github.com/tvdeyen))
- Test support fixes [#1669](#1669) ([tvdeyen](https://github.com/tvdeyen))
- Build fixes [#1668](#1668) ([tvdeyen](https://github.com/tvdeyen))
- Add Menus [#1667](#1667) ([tvdeyen](https://github.com/tvdeyen))
- Add a label component [#1666](#1666) ([tvdeyen](https://github.com/tvdeyen))
- Run bundle install on CI even if cache hits [#1665](#1665) ([tvdeyen](https://github.com/tvdeyen))
- Moves switch_language method into languages_controller. [#1664](#1664) ([tvdeyen](https://github.com/tvdeyen))
- Cache gems between CI runs [#1663](#1663) ([tvdeyen](https://github.com/tvdeyen))
- Remove production gems from local Gemfile [#1662](#1662) ([tvdeyen](https://github.com/tvdeyen))
- Touch contents updated_at column in pure SQL [#1661](#1661) ([tvdeyen](https://github.com/tvdeyen))
- Convert page editing user methods into AR relations [#1658](#1658) ([tvdeyen](https://github.com/tvdeyen))
- Ensure the admin locale is only set by available locales [#1655](#1655) ([tvdeyen](https://github.com/tvdeyen))
- Add a GitHub actions ci.yml [#1654](#1654) ([tvdeyen](https://github.com/tvdeyen))
- Adjust install generator to latest changes [#1649](#1649) ([tvdeyen](https://github.com/tvdeyen))
- Deprecate _view suffix of element views [#1648](#1648) ([tvdeyen](https://github.com/tvdeyen))
- Add a configurable logout method (default: delete) [#1647](#1647) ([delphaber](https://github.com/delphaber))
- Deprecate render_essence helpers [#1644](#1644) ([tvdeyen](https://github.com/tvdeyen))
- Deprecate element editors [#1643](#1643) ([tvdeyen](https://github.com/tvdeyen))
- Deprecate local options in essence editors [#1642](#1642) ([tvdeyen](https://github.com/tvdeyen))
- Ensure the EssencePage id regexp matches only numbers [#1641](#1641) ([tvdeyen](https://github.com/tvdeyen))
- Use EssencePage in contact forms [#1640](#1640) ([tvdeyen](https://github.com/tvdeyen))
- Add Alchemy::EssencePage [#1639](#1639) ([tvdeyen](https://github.com/tvdeyen))
- FEAT: Render message and warnings in element editor [#1637](#1637) ([tvdeyen](https://github.com/tvdeyen))
- Tackle Rails 6 deprecations [#1636](#1636) ([tvdeyen](https://github.com/tvdeyen))
- Preload assets in tests [#1635](#1635) ([tvdeyen](https://github.com/tvdeyen))
- Allow acts-as-list 1.0 [#1634](#1634) ([tvdeyen](https://github.com/tvdeyen))
- Add Sprockets manifest file to dummy app [#1632](#1632) ([tvdeyen](https://github.com/tvdeyen))
- Master now tracks 4.4.0.alpha [#1627](#1627) ([tvdeyen](https://github.com/tvdeyen))
- Fix Cell Migration to maintain positions [#1625](#1625) ([mamhoff](https://github.com/mamhoff))
- Cell Upgrader: Match quotation marks in cell name string [#1624](#1624) ([mamhoff](https://github.com/mamhoff))
- Cell Migrator: Maintain element order in fixed elements [#1623](#1623) ([mamhoff](https://github.com/mamhoff))
- Enhance cells upgrader to deal with render_elements from_page: x [#1622](#1622) ([mamhoff](https://github.com/mamhoff))
@tvdeyen tvdeyen mentioned this pull request Jan 6, 2020
tvdeyen added a commit that referenced this pull request Jan 6, 2020
- Use contents settings for size in EssencePicture#picture_url [#1703](#1703) ([tvdeyen](https://github.com/tvdeyen))
- Remove title tag from preview elements [#1701](#1701) ([tvdeyen](https://github.com/tvdeyen))
- Remove custom JS logging [#1700](#1700) ([tvdeyen](https://github.com/tvdeyen))
- Remove demo locale files [#1699](#1699) ([tvdeyen](https://github.com/tvdeyen))
- Use alchemyPageSelect for Node page select [#1698](#1698) ([tvdeyen](https://github.com/tvdeyen))
- Cache menu partials [#1697](#1697) ([tvdeyen](https://github.com/tvdeyen))
- Update page tree to menu nodes Rake task [#1696](#1696) ([tvdeyen](https://github.com/tvdeyen))
- Validate nodes name if page is absent [#1695](#1695) ([tvdeyen](https://github.com/tvdeyen))
- Update the application layout installer template [#1691](#1691) ([tvdeyen](https://github.com/tvdeyen))
- Update note about missing user class [#1690](#1690) ([tvdeyen](https://github.com/tvdeyen))
- Use a Sprockets 3/4 manifest file [#1689](#1689) ([tvdeyen](https://github.com/tvdeyen))
- Use select2 for internal page link in link overlay [#1685](#1685) ([tvdeyen](https://github.com/tvdeyen))
- Do not consider nested elements "orphaned" [#1684](#1684) ([mamhoff](https://github.com/mamhoff))
- Destroy page-dependent elements [#1683](#1683) ([mamhoff](https://github.com/mamhoff))
- Add anchor link tab to link overlay [#1682](#1682) ([tvdeyen](https://github.com/tvdeyen))
- Ensure the apt/cache folder exists while installing [#1678](#1678) ([tvdeyen](https://github.com/tvdeyen))
- Cache apt packages between CI runs [#1677](#1677) ([tvdeyen](https://github.com/tvdeyen))
- Use select2 with AJAX search for essence page select [#1675](#1675) ([tvdeyen](https://github.com/tvdeyen))
- Eager load associated records [#1674](#1674) ([tvdeyen](https://github.com/tvdeyen))
- Add support for testing with multiple Rails versions [#1673](#1673) ([tvdeyen](https://github.com/tvdeyen))
- Page api pagination [#1672](#1672) ([tvdeyen](https://github.com/tvdeyen))
- Adjust select2 loading-more indicator [#1671](#1671) ([tvdeyen](https://github.com/tvdeyen))
- Test support fixes [#1669](#1669) ([tvdeyen](https://github.com/tvdeyen))
- Build fixes [#1668](#1668) ([tvdeyen](https://github.com/tvdeyen))
- Add Menus [#1667](#1667) ([tvdeyen](https://github.com/tvdeyen))
- Add a label component [#1666](#1666) ([tvdeyen](https://github.com/tvdeyen))
- Run bundle install on CI even if cache hits [#1665](#1665) ([tvdeyen](https://github.com/tvdeyen))
- Moves switch_language method into languages_controller. [#1664](#1664) ([tvdeyen](https://github.com/tvdeyen))
- Cache gems between CI runs [#1663](#1663) ([tvdeyen](https://github.com/tvdeyen))
- Remove production gems from local Gemfile [#1662](#1662) ([tvdeyen](https://github.com/tvdeyen))
- Touch contents updated_at column in pure SQL [#1661](#1661) ([tvdeyen](https://github.com/tvdeyen))
- Convert page editing user methods into AR relations [#1658](#1658) ([tvdeyen](https://github.com/tvdeyen))
- Ensure the admin locale is only set by available locales [#1655](#1655) ([tvdeyen](https://github.com/tvdeyen))
- Add a GitHub actions ci.yml [#1654](#1654) ([tvdeyen](https://github.com/tvdeyen))
- Adjust install generator to latest changes [#1649](#1649) ([tvdeyen](https://github.com/tvdeyen))
- Deprecate _view suffix of element views [#1648](#1648) ([tvdeyen](https://github.com/tvdeyen))
- Add a configurable logout method (default: delete) [#1647](#1647) ([delphaber](https://github.com/delphaber))
- Deprecate render_essence helpers [#1644](#1644) ([tvdeyen](https://github.com/tvdeyen))
- Deprecate element editors [#1643](#1643) ([tvdeyen](https://github.com/tvdeyen))
- Deprecate local options in essence editors [#1642](#1642) ([tvdeyen](https://github.com/tvdeyen))
- Ensure the EssencePage id regexp matches only numbers [#1641](#1641) ([tvdeyen](https://github.com/tvdeyen))
- Use EssencePage in contact forms [#1640](#1640) ([tvdeyen](https://github.com/tvdeyen))
- Add Alchemy::EssencePage [#1639](#1639) ([tvdeyen](https://github.com/tvdeyen))
- FEAT: Render message and warnings in element editor [#1637](#1637) ([tvdeyen](https://github.com/tvdeyen))
- Tackle Rails 6 deprecations [#1636](#1636) ([tvdeyen](https://github.com/tvdeyen))
- Preload assets in tests [#1635](#1635) ([tvdeyen](https://github.com/tvdeyen))
- Allow acts-as-list 1.0 [#1634](#1634) ([tvdeyen](https://github.com/tvdeyen))
- Add Sprockets manifest file to dummy app [#1632](#1632) ([tvdeyen](https://github.com/tvdeyen))
- Master now tracks 4.4.0.alpha [#1627](#1627) ([tvdeyen](https://github.com/tvdeyen))
- Fix Cell Migration to maintain positions [#1625](#1625) ([mamhoff](https://github.com/mamhoff))
- Cell Upgrader: Match quotation marks in cell name string [#1624](#1624) ([mamhoff](https://github.com/mamhoff))
- Cell Migrator: Maintain element order in fixed elements [#1623](#1623) ([mamhoff](https://github.com/mamhoff))
- Enhance cells upgrader to deal with render_elements from_page: x [#1622](#1622) ([mamhoff](https://github.com/mamhoff))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants