Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ nav_order: 6

## main

* Fix outdated settings related to default layout preview.

*Lucas Geron*

## 4.0.2

* Share the view context in tests to prevent out-of-order rendering issues for certain advanced use-cases, eg. testing instances of Rails' `FormBuilder`.
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/previews.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ To set a custom layout for individual previews and the previews index page, set:
```ruby
# config/application.rb
# Set the default layout to app/views/layouts/component_preview.html.erb
config.view_component.default_preview_layout = "component_preview"
config.view_component.previews.default_layout = "component_preview"
```

## Preview paths
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ComponentGenerator < Rails::Generators::NamedBase
class_option :skip_suffix, type: :boolean, default: false

def create_component_file
template "component.rb", File.join(component_path, class_path, "#{file_name}#{options[:skip_suffix] ? "" : "_component"}.rb")
template "component.rb", File.join(component_path, class_path, "#{file_name}#{"_component" unless options[:skip_suffix]}.rb")
end

hook_for :test_framework
Expand Down
1 change: 1 addition & 0 deletions lib/view_component/collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
module ViewComponent
class Collection
include Enumerable

attr_reader :component

delegate :size, to: :@collection
Expand Down
1 change: 1 addition & 0 deletions lib/view_component/inline_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
module ViewComponent # :nodoc:
module InlineTemplate
extend ActiveSupport::Concern

Template = Struct.new(:source, :language, :path, :lineno)

class_methods do
Expand Down
Loading