-
Notifications
You must be signed in to change notification settings - Fork 446
RFC: Hotwire Turbo Frames Pattern
Approved by:
As developers, in OBS we need to insert partials into views while they are already loaded. Sometimes this is used for the purpose of delaying rendering and sometimes it's used as a reaction to a users' action. For this purpose, we frequently use AJAX with supporting JS. This affects views, controllers and javascript.
For example:
- https://github.com/openSUSE/open-build-service/blob/master/src/api/app/assets/javascripts/webui/comment.js
- https://github.com/openSUSE/open-build-service/blob/master/src/api/app/views/webui/package/update.js.haml
It gets cumbersome, both in terms of maintaining a big library of code that essentially does the same thing, and in terms of writing new code. There is no one way to do it, and so the implementations that are there are generally messy and filled with various patches on top of the old code for the new things to work.
There needs to be one way to go about writing this kind of code. The simpler the better. If possible, we would be using a minimal amount of javascript that reacts to a button with an appropriate tag being pressed or a page element with appropriate page being made visible.
Replace all of this functionality with Turbo Frames. Turbo Frames allow us to render partials for pages using turbo-frame
tag. It mimics functionality of the old html frame tags, by allowing you to navigate within the frame, including submitting forms and displaying the modified contents of the data after submission. It also allows you to break out of the frame to perform a full page navigation if required.
Turbo documentation has a more in depth breakdown of the features of Frames, you should follow the guidance of the Turbo Frames Reference for documentation on how to use them, as well as check out Turbo Frames Handbook for more guidance about the individual features.
- Development Environment Overview
- Development Environment Tips & Tricks
- Spec-Tips
- Code Style
- Rubocop
- Testing with VCR
- Authentication
- Authorization
- Autocomplete
- BS Requests
- Events
- ProjectLog
- Notifications
- Feature Toggles
- Build Results
- Attrib classes
- Flags
- The BackendPackage Cache
- Maintenance classes
- Cloud uploader
- Delayed Jobs
- Staging Workflow
- StatusHistory
- OBS API
- Owner Search
- Search
- Links
- Distributions
- Repository
- Data Migrations
- next_rails
- Ruby Update
- Rails Profiling
- Installing a local LDAP-server
- Remote Pairing Setup Guide
- Factory Dashboard
- osc
- Setup an OBS Development Environment on macOS
- Run OpenQA smoketest locally
- Responsive Guidelines
- Importing database dumps
- Problem Statement & Solution
- Kickoff New Stuff
- New Swagger API doc
- Documentation and Communication
- GitHub Actions
- How to Introduce Software Design Patterns
- Query Objects
- Services
- View Components
- RFC: Core Components
- RFC: Decorator Pattern
- RFC: Backend models
- RFC: Hotwire Turbo Frames Pattern