forked from fixin.me/fixin.me
Change 'Add unit' link to turbo_stream
This commit is contained in:
parent
c96b646087
commit
6d9f4918f1
@ -1,8 +1,8 @@
|
||||
<div class="rightside">
|
||||
<% if current_user.at_least(:active) %>
|
||||
<%= turbo_frame_tag target: dom_id(Unit.new) do %>
|
||||
<%= turbo_frame_tag do %>
|
||||
<%= image_link_to t('.add_unit'), 'plus-outline', new_unit_path, id: :add_unit,
|
||||
onclick: 'this.style.visibility = "hidden";' %>
|
||||
onclick: 'this.style.visibility = "hidden";', data: {turbo_stream: true} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -1,12 +0,0 @@
|
||||
<!-- NOTE: as of turbo-rails 2.0.0.pre.beta.1/turbo 8.0.0-beta.1
|
||||
loading <form> through *.turbo_stream.erb does not autofocus -->
|
||||
<%= turbo_frame_tag @unit do %>
|
||||
<%= turbo_stream.update @unit do %>
|
||||
<%= render partial: 'form', locals: {unit: @unit} %>
|
||||
<% end %>
|
||||
|
||||
<%= turbo_stream.update :unit_form_frame do %>
|
||||
<%= form_with model: @unit, html: {id: :unit_form} do %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
8
app/views/units/new.turbo_stream.erb
Normal file
8
app/views/units/new.turbo_stream.erb
Normal file
@ -0,0 +1,8 @@
|
||||
<%= turbo_stream.update @unit do %>
|
||||
<%= render partial: 'form', locals: {unit: @unit} %>
|
||||
<% end %>
|
||||
|
||||
<%= turbo_stream.update :unit_form_frame do %>
|
||||
<%= form_with model: @unit, html: {id: :unit_form} do %>
|
||||
<% end %>
|
||||
<% end %>
|
@ -58,6 +58,7 @@ en:
|
||||
actions: Actions
|
||||
add: Add
|
||||
back: Back
|
||||
cancel: Cancel
|
||||
or: or
|
||||
register: Register
|
||||
sign_in: Sign in
|
||||
|
Loading…
x
Reference in New Issue
Block a user