Draper
view_component
Draper | view_component | |
---|---|---|
5 | 74 | |
5,202 | 3,148 | |
0.1% | 0.7% | |
0.0 | 9.0 | |
3 months ago | 7 days ago | |
Ruby | Ruby | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Draper
-
From partials to ViewComponents: writing reusable front-end code in Rails
So what about the world outside Rails defaults? There are quite a few independent projects trying to help build components in the Rails view layer, among the more famous being Draper (utilizing the decorators pattern) or Cells (full-featured components in views). In the end, we decided to take a deeper look into a relatively new one – the ViewComponent framework.
-
Ruby on Rails View Patterns and Anti-patterns
If you are not a big fan of writing Rails custom helpers, you can always opt-in for a View Model pattern with the Draper gem. Or you can roll your own View Model pattern here, it shouldn't be that complicated. If you are just starting out with your web app, I suggest starting slowly by writing custom helpers and if that brings pain, turn to other solutions.
-
2 noob questions about app structure
The Draper gem is the one I'm familiar with which does this well, I'm sure there are others.
-
My Ruby on Rails stack for side projects in 2021
Don't introduce decorators and view models. Use helpers instead. Don't extract domain models. Put the code in the ActiveRecord models and the controllers. Don't reach for interactors to model your domain logic. Don't try to avoid duplication too early.
-
RoR Gems: Pin To Plane For Developing RoR Application
7. DRAPER
view_component
- Things I wish I knew before moving 50K lines of code to React Server Components
-
Supercharged table component built with ViewComponent
When searching for examples of table components built with the ViewComponent gem, I was surprised to find none. After some inquiries, I came across examples that worked like this:
-
More expressive APIs for View Components
View components offer two primary ways to interact with the component: passing arguments to the initializer and using slots:
- Have you been using ViewComponent. What advantages do you see in it?
-
How can I integrate VueJS into a rails 7 application? What is the workflow?
For example, splitting out views into partials? Or the new ViewComponent feature that's becoming quite popular - https://viewcomponent.org/
- Helpers vs Components
-
Vanilla Rails view components with partials | Stanko K.R.
I used to do "pure ruby" approach to that -- but basically wound up realizing I was re-inventing github's view_component. Their design goals were similar enough to what I was trying to do, that it made more sense just to use that, rather than try to re-invent it myself.
-
Gnarly Learnings from March 2023
ViewComponent
- Os benefícios de componentizar as views do Rails
-
Does anyone kind of miss simpler webpages?
The linked one is my Rails implementation, written for ViewComponent. The official version uses Nunjucks.
What are some alternatives?
ActiveDecorator - ORM agnostic truly Object-Oriented view helper for Rails 4, 5, 6, and 7
Stimulus - A modest JavaScript framework for the HTML you already have
jsonapi-serializer - A fast JSON:API serializer for Ruby (fork of Netflix/fast_jsonapi)
turbo-rails - Use Turbo in your Ruby on Rails app
ShowFor - Wrap your objects with a helper to easily show them
Tailwind CSS - A utility-first CSS framework for rapid UI development.
Simple Form - Forms made easy for Rails! It's tied to a simple DSL, with no opinion on markup.
cypress-rails - Helps you write Cypress tests of your Rails app
Kaminari - ⚡ A Scope & Engine based, clean, powerful, customizable and sophisticated paginator for Ruby webapps
hotwire-rails - Use Hotwire in your Ruby on Rails app
AASM - AASM - State machines for Ruby classes (plain Ruby, ActiveRecord, Mongoid, NoBrainer, Dynamoid)
i18n-tasks - Manage translation and localization with static analysis, for Ruby i18n