-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://gitlab.com/pasosdeJesus/sivel2_gen/-/issues/733 formularios arreglados opcioncs con turbo See merge request pasosdeJesus/mr519_gen!29
- Loading branch information
Showing
12 changed files
with
149 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 31 additions & 21 deletions
52
app/views/mr519_gen/formularios/_fila_opcionescs.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,33 @@ | ||
<div class="nested-fields opcioncs" style="display: flex"> | ||
<% #byebug %> | ||
<% f.object = Mr519Gen::Opcioncs.new() if !f.object %> | ||
<div> | ||
<%= f.input :nombre, | ||
label: false, | ||
placeholder: 'Nombre' | ||
%> | ||
</div> | ||
<div> | ||
<%= f.input :valor, | ||
label: false, | ||
placeholder: 'Valor' | ||
%> | ||
</div> | ||
<div> | ||
<%= turbo_frame_tag "opcioncs_#{subf.index}_#{f.index}", class: 'div-tabla-fila nested-fields' do %> | ||
<div class="nested-fields opcioncs"> | ||
<%= f.input :id, as: :hidden %> | ||
<%= link_to_remove_association t("Eliminar"), f, | ||
:class => 'btn btn-sm btn-danger', "data-existing" => true | ||
%> | ||
<div><%= f.error_notification %></div> | ||
<div class="div-tabla-celda"> | ||
<%= f.input :nombre, | ||
label: false, | ||
placeholder: 'Nombre' | ||
%> | ||
</div> | ||
<div class="div-tabla-celda"> | ||
<%= f.input :valor, | ||
label: false, | ||
placeholder: 'Valor' | ||
%> | ||
</div> | ||
<div class="div-tabla-celda"> | ||
<%= f.submit "Eliminar", | ||
formaction: mr519_gen.eliminar_opcioncs_path( | ||
id: f.object.id, | ||
index: f.index, | ||
index_campo: subf.index | ||
), | ||
formmethod: :delete, | ||
formnovalidate: true, | ||
class: 'btn btn-sm btn-danger', | ||
data: { | ||
turbo_frame: "opcioncs_#{subf.index}_#{f.index}", | ||
disable_with: false | ||
} %> | ||
<div><%= f.error_notification %></div> | ||
</div> | ||
</div> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<%= simple_form_for @formulario do |form| %> | ||
<%= form.simple_fields_for :campo, | ||
child_index: params[:index_campo] do |subf| %> | ||
<%= subf.simple_fields_for :opcioncs, | ||
child_index: params[:index] do |opf| %> | ||
<%= turbo_stream.replace "agregar-opcion-#{params[:index_campo]}" do %> | ||
<%= opf.submit "Agregar opción", | ||
formaction: mr519_gen.crear_opcioncs_path( | ||
index: params[:index].to_i + 1, | ||
index_campo: params[:index_campo].to_i | ||
), | ||
formmethod: :post, | ||
formnovalidate: true, | ||
class: 'btn btn-sm btn-primary', | ||
name: "agregar-opcion-#{params[:index_campo]}", | ||
id: "agregar-opcion-#{params[:index_campo]}", | ||
data: { | ||
disable_with: false | ||
} %> | ||
<% end %> | ||
<%= turbo_stream.append "campo_#{params[:index_campo]}_opcioncs_marco" do %> | ||
<%= render "mr519_gen/formularios/fila_opcionescs", f: opf, subf: subf %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<%= simple_form_for @formulario do |form| %> | ||
<%= form.simple_fields_for :campo, child_index: params[:index_campo] do |subf| %> | ||
<%= subf.simple_fields_for :opcioncs do |opf| %> | ||
<%= turbo_frame_tag "opcioncs_#{params[:index_campo]}_#{params[:index]}" do %> | ||
<% opf.object = Mr519Gen::Opcioncs.find(params[:id]) %> | ||
<%= opf.hidden_field :id, value: params[:id] %> | ||
<%= opf.hidden_field :_destroy, value: 1 %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters