49 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
1
answer
138
views
Rails controller-helper and view components
I have a bleeding edge Rails project (8.1) using the splendid View Components. I've made an image-modal component, triggered from a plain HTML anchor and that toggles visibility on a HTML dialog (...
1
vote
1
answer
52
views
How can I make Tailwind work on my component
Good morning everyone. I'm trying to render a FlashMessage component
<% flash.each do |type, message| %>
<%= render FlashMessageComponent.new(type: type, message: message) %&...
0
votes
0
answers
168
views
Rails: problem with handle redirect with turbo_stream in apps
In the application, when creating a feature, it was necessary to add hotwired/turbo-rails.
// app/javascript/application.js
import "@hotwired/turbo-rails"
import "controllers"
...
0
votes
1
answer
39
views
razor library loading views from different location
My app implements plugin system (razor libraries). App is using razor runtime compilation. Razor library contains few ViewComponents with custom structure described below.
Razor library structure:
...
2
votes
1
answer
939
views
Rails Hotwire and ViewComponents: turbo frames not replacing content
We are currently in the process of moving over our app from Vue.js to hotwire. We are just experiencing a very weird bug when using turbo_frames and ViewComponents.
We have a turbo_frame_tag for a ...
1
vote
2
answers
425
views
Flash message view component rendering :type as a :message?
I have followed this post https://reinteractive.com/articles/how-to-create-flash-messages-in-Rails-7 to add nice flash messages with tailwind, which got me into View Components. Everything works apart ...
1
vote
1
answer
309
views
Errors are being swallowed inside ViewComponent, Ruby on Rails
Hoping you're having a good day. So, i have this weird bug that's been kicking my ass and i'm not sure where it is located for the love of God.
I have a ViewComponent that is rendered normally inside ...
0
votes
0
answers
86
views
How can a local variable passed to a rendered partial be passed to a ViewComponent in the partial as an argument, without being explicitly passed?
If a partial is rendered, and receives 2 local variables "name" and "environment":
# arbitrary show view
<%= render partial: "sports_team/details_and_performance", ...
1
vote
2
answers
237
views
Specifying Paths for View Components in a Gem Utilizing Tailwind CSS in `tailwind.config.js`
I'm developing a gem that acts as a library of view components integrated with Tailwind CSS. In this project, there's a crucial tailwind.config.js file where I specify the paths for building the tags ...
0
votes
0
answers
288
views
What does the `#with_items` method do for a ViewComponent?
I'm editing a feature that renders a ViewComponent.
After the ViewComponent is rendered, it's passed a block, which is the component itself
render SomeComponent.new(arg: foo) do |component|
...
0
votes
1
answer
44
views
Problem with rendering in view_componets in rails
This is the situation in view components:
app/components/appointments/new_appointment_component.haml
= form_with(model: @appointment, url: appointments_path, method: :post) do |f|
= f.hidden_field :...
0
votes
1
answer
249
views
How to test View Component routes
I have a card component that when clicked, takes you to a different route in the application. The component is built using Rails ViewComponents. What is the best way to write tests that ensure when a ...
user avatar
user16806248
1
vote
1
answer
1k
views
Rendering template dynamically in Rails ViewComponent
I have a SectionComponent Class as follow :
class SectionComponent < ViewComponent::Base
def initialize(..)
...
end
end
And a matching section_component.html.erb file.
It works perfectly ...
0
votes
1
answer
447
views
In ruby View Components, is possible to access parent translation from child?
I am using view component in rails project. I want use translation from my parent inside a child.
For now, I have this:
components
└─ a
├─ component.rb
├─ component.html.erb
├─ component.yml
...
1
vote
1
answer
353
views
Rails URL Generation in ViewComponent Previews
I have a component that uses slots, which I managed to figure out how to render in a preview. I know that in a test environment, it's possible to use with_request_url to specify a particular request ...