Skip to content
Merged
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
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
rolemodel_rails (0.25.1)
rolemodel_rails (0.26.0)
rails (> 7.1)

GEM
Expand Down
2 changes: 1 addition & 1 deletion example_rails7/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
rolemodel_rails (0.25.1)
rolemodel_rails (0.26.0)
rails (> 7.1)

GEM
Expand Down
5 changes: 3 additions & 2 deletions example_rails8/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
rolemodel_rails (0.25.1)
rolemodel_rails (0.26.0)
rails (> 7.1)

GEM
Expand Down Expand Up @@ -382,6 +382,7 @@ PLATFORMS
aarch64-linux-musl
arm-linux-gnu
arm-linux-musl
arm64-darwin-23
arm64-darwin-25
x86_64-linux
x86_64-linux-gnu
Expand Down Expand Up @@ -521,7 +522,7 @@ CHECKSUMS
regexp_parser (2.11.3) sha256=ca13f381a173b7a93450e53459075c9b76a10433caadcb2f1180f2c741fc55a4
reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835
rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142
rolemodel_rails (0.25.1)
rolemodel_rails (0.26.0)
rubocop (1.84.1) sha256=14cc626f355141f5a2ef53c10a68d66b13bb30639b26370a76559096cc6bcc1a
rubocop-ast (1.49.0) sha256=49c3676d3123a0923d333e20c6c2dbaaae2d2287b475273fddee0c61da9f71fd
rubocop-performance (1.26.1) sha256=cd19b936ff196df85829d264b522fd4f98b6c89ad271fa52744a8c11b8f71834
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Controller } from "@hotwired/stimulus"

export default class extends Controller {
static values = {
attributeName: String
}

/**
* Use this method in conjunction with the turbo:before-morph-attribute event to prevent morphing of a specific
* attribute on an element. This is useful for attributes that may change due to user interaction, such as the "open"
* attribute on a details element, which can be toggled by the user and should not be overridden by Turbo's morphing process.
*
* Example:
* <details controller="morph" data-morph-attribute-name-value="open" data-action="turbo:before-morph-attribute->morph#skipMorphAttribute">
*
* @param {import("@hotwired/turbo").TurboBeforeMorphAttributeEvent} event
*/
skipMorphAttribute(event) {
if (event.detail.attributeName === this.attributeNameValue) {
event.preventDefault()
}
}
}
2 changes: 1 addition & 1 deletion lib/rolemodel_rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module RolemodelRails
VERSION = '0.25.1'
VERSION = '0.26.0'
end
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
let(:command_line_options) { [] }

it 'adds the correct javascript files' do
assert_file 'app/javascript/controllers/morph_controller.js'
assert_file 'app/javascript/controllers/toggle_controller.js'
assert_file 'app/javascript/initializers/turbo_confirm.js'
assert_file 'app/javascript/initializers/frame_missing_handler.js'
Expand Down