mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Refactoring the code to avoid some conditionals
This commit is contained in:
parent
aeea158d95
commit
b178a92428
1 changed files with 4 additions and 4 deletions
|
@ -934,13 +934,13 @@ module ActionView
|
|||
end
|
||||
|
||||
def set_default_disable_with(value, tag_options)
|
||||
data = tag_options["data"]
|
||||
data = tag_options.fetch("data", {})
|
||||
|
||||
if tag_options["data-disable-with"] == false || (data && data["disable_with"] == false)
|
||||
data.delete("disable_with") if data
|
||||
if tag_options["data-disable-with"] == false || data["disable_with"] == false
|
||||
data.delete("disable_with")
|
||||
elsif ActionView::Base.automatically_disable_submit_tag
|
||||
disable_with_text = tag_options["data-disable-with"]
|
||||
disable_with_text ||= data["disable_with"] if data
|
||||
disable_with_text ||= data["disable_with"]
|
||||
disable_with_text ||= value.to_s.clone
|
||||
tag_options.deep_merge!("data" => { "disable_with" => disable_with_text })
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue