* Revert "conditionally render create post button for admins #16490 (#16606)"
This reverts commit 1cb45995cb.
* Adding conditional create post rendering
This pull request does two things:
- Reverts the forem/forem#16606
- Replaces the conditional rendering with the approach from forem/forem#17076
What to consider:
- How does this impact Cumulative Layout Shift (CLS). Prior to this
commit, we didn't "flicker" the "Create Post" button into view if the
site didn't have the conditional.
- In reverting forem/forem#16606 we remove a dependency on Turbo.
- We reduce one network call, relying instead on the async_info to carry
the visible/hidden logic.
If the "flicker" is a problem we could add a conditional in the page for
if the site has enabled that feature. However, that's a place holder as
we're looking at possible other reasons for allowing/disabling the
create a post.
This is a non-blocking PR, as in we can merge or not merge this and
proceed with what we have. Instead the main goal is to "unify" our approach.
* Update cypress/integration/seededFlows/policyFlows/limitPostCreationToAdmins.spec.js
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
* Leveraging change from forem/forem#17143
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
* Trigger Build
* WIP - use turbo to render html for create post button
todos and discussion topics
[] add tests (probably gonna be a lot of cypress 😅😭)
[] nominclature & file structure for authorization controller/routes
[] is this "authorizations" namespace approach the best?
[] authorization strategy relies on current user and caching doesn't
like `current_user`
* Use URL helper and not change the policy just yet
* put the turbo frame behind a feature flag
* Trigger Build
* Use URL helper and not change the policy just yet
* :)
* Add some test coverage and use same feature flag for consistency
* rubocop
* more rubocop
* trigger build
* adding a small sleep to see if specs pass 😩
* remove sleep
* disable Turbo session drive
* WIP
* Revert "WIP"
This reverts commit ce838672069fd703122156a0d82e5e6ad5398e0a.
* Moving spec from dashboard to root
With forem/forem#16913 the underlying test broke because we were
redirecting on the dashboard.
Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>
* Admin-configurable display locale
* Add i18n-js and namespacing
* Basic tests and clean up
* A few test adjustments
* Update vendor cache
* Fix a few tests
* Fix a few tests
* Update app/views/articles/_actions.html.erb
Co-authored-by: Michael Kohl <citizen428@dev.to>
* Update app/views/articles/_comments_actions.html.erb
Co-authored-by: Michael Kohl <citizen428@dev.to>
* Update app/views/articles/_single_story.html.erb
Co-authored-by: Michael Kohl <citizen428@dev.to>
* Update app/views/articles/_single_story.html.erb
Co-authored-by: Michael Kohl <citizen428@dev.to>
* Update app/views/comments/_comment_header.html.erb
Co-authored-by: Michael Kohl <citizen428@dev.to>
* Update app/views/layouts/_sidebar_tags.html.erb
Co-authored-by: Michael Kohl <citizen428@dev.to>
* Update app/views/listings/index.html.erb
Co-authored-by: Michael Kohl <citizen428@dev.to>
* Update spec/system/homepage/user_visits_homepage_articles_spec.rb
Co-authored-by: Michael Kohl <citizen428@dev.to>
* Update spec/system/user/view_user_index_spec.rb
Co-authored-by: Michael Kohl <citizen428@dev.to>
* Alphabetical locale page
* Add activerecord custom validation error translations
* Add i18n to webpacker
* Fix a few tests
* Adjust error messages
* Add i18n-tasks
* Adjust JS to get working with jest
* Adjust the way translations are pulled in
* Adjust jest tests
* Remove time localization
* Remove superfluous public js
* Add basic tests for i18n application controller
* Remove unnecessary content
Co-authored-by: Michael Kohl <citizen428@dev.to>
* reinstate skip link on search page
* actually commit the tests this time
* use optional chaining
* Revert "use optional chaining"
This reverts commit 921677f425c2e90f272a6e21dc8a8d37f916e0da.
* autofocus Skip Link on keyboard navigation
* focus Skip Link on route change if Skip Link exists
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
* Improve keyboard a11y of header menu dropdown
This commit also includes some cleanup of unnecessary functions that seemed to degrade performance.
Closes https://github.com/forem/forem/issues/1154
* Add temporary focus style on navigation-button
* Put menu items in a list
* Adjust menu button based on VoiceOver testing
* Refactor menu logic to be reusable/work on touch
* Preserve admin link visibility
* Focus on first item on menu open
* Clean up some HTML and CSS
* Apply suggestions from code review
Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
* Ensure menu hides on click outside
* Rename toggle function and adjust formatting
* Update nav button focus style
* Clean up padding on header avatar focus style
* Make button show focus state for keyboard only
Using .focus-visible:focus targets keyboard focus and eliminates a flash of the blue border on click before focus is moved to the child item (which also has no focus style on mouse click)
* Update app/views/layouts/_top_bar.html.erb
Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
* Add some defensive programming
* Removed initializeTouchDevice from base.js.erb
* navigation-butt ID is now member-menu-button
* Moved all the logic from initializeTouchDevice.js into a pack file/utilities.
* committing re-ordered schema after setup
* add tests for initializeTouchDevice
* remove some unneeded html setup
* make sure menu doesn't close if user tabs back from sign out
* Revert "committing re-ordered schema after setup"
This reverts commit a41a1c861cca3b97d8a7b8a99268b8afaae9f028.
* optimized code
* small tweaks, only show outline when focused
Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
Co-authored-by: rhymes <rhymes@hey.com>
Co-authored-by: Nick Taylor <nick@dev.to>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
* Set up ahoy gem, add ahoy-js
* Import ahoy.js into base.js.erb
* Add trackNotification function to notifications/index.html.erb
* Add sanitized_broadcast_id helper
* Use sanitized_broadcast_id in broadcast partial
* Add specs around tracking welcome notifications
* Remove optional fields from Ahoy::Visit migration + table
* Fiddle with trait to see if it helps with CI failures
* Disable geocode tracking in ahoy
* Stub out SiteConfig in notifications page spec
rails-assets.org is often down, and apparently has been down intermittently since yesterday.
In addition to this the only thing the gem does is literally to add `honeybadger.js` to the assets path:
```ruby
gem_path.join('app/assets').each_child.to_a
```
Hence we can ditch the gem and use the library directly.