-
-
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.
Desembolsos pasa de query+cocoon a turbo. Closes https://gitlab.com/p…
- Loading branch information
Showing
9 changed files
with
141 additions
and
47 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
app/controllers/cor1440_gen/desembolsos_proyectofinanciero_controller.rb
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,12 @@ | ||
# frozen_string_literal: true | ||
|
||
require "cor1440_gen/concerns/controllers/desembolsos_proyectofinanciero_controller" | ||
|
||
module Cor1440Gen | ||
class DesembolsosProyectofinancieroController < ApplicationController | ||
load_and_authorize_resource class: Desembolso | ||
before_action :prepara_desembolso_proyectofinanciero | ||
|
||
include Cor1440Gen::Concerns::Controllers::DesembolsosProyectofinancieroController | ||
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
22 changes: 22 additions & 0 deletions
22
app/views/cor1440_gen/desembolsos_proyectofinanciero/create.turbo_stream.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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<%= simple_form_for @proyectofinanciero do |f| %> | ||
<%= f.simple_fields_for :desembolso, | ||
child_index: params[:index] do |subf| %> | ||
<%= turbo_stream.replace "agregar-desembolso-proyectofinanciero" do %> | ||
<%= f.submit "Agregar Desembolso", | ||
class: "btn btn-sm btn-primary", | ||
data: { | ||
disable_with: false | ||
}, | ||
formaction: cor1440_gen.crear_desembolso_proyectofinanciero_path( | ||
subf.index.to_i + 1 | ||
), | ||
formmethod: :post, | ||
formnovalidate: true, | ||
id: "agregar-desembolso-proyectofinanciero", | ||
name: "agregar-desembolso-proyectofinanciero" %> | ||
<% end %> | ||
<%= turbo_stream.append "desembolsos_proyectofinanciero_marco" do %> | ||
<%= render "/cor1440_gen/proyectosfinancieros/desembolso_campos", f: subf %> | ||
<% end %> | ||
<% end %> | ||
<% end %> |
9 changes: 9 additions & 0 deletions
9
app/views/cor1440_gen/desembolsos_proyectofinanciero/destroy.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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<%= fields model: @proyectofinanciero do |f| %> | ||
<%= f.simple_fields_for :desembolso, | ||
child_index: params[:index] do |subf| %> | ||
<%= turbo_frame_tag "desembolso_proyectofinanciero_#{subf.index}" do %> | ||
<%= subf.hidden_field :id, value: params[:id] %> | ||
<%= subf.hidden_field :_destroy, value: true %> | ||
<% end %> | ||
<% end %> | ||
<% end %> |
42 changes: 24 additions & 18 deletions
42
app/views/cor1440_gen/proyectosfinancieros/_desembolso_campos.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,21 +1,27 @@ | ||
<tr class='nested-fields'> | ||
<td> | ||
<%= f.input :detalle, label: false, as: :text, input_html: { rows: 2 } %> | ||
</td> | ||
<td> | ||
<%= turbo_frame_tag "desembolso_proyectofinanciero_#{f.index}", class: 'div-tabla-fila nested-fields' do %> | ||
<div class="div-tabla-celda"> | ||
<%= f.input :detalle, label: false, as: :text, input_html: { rows: 2 } %> | ||
</div> | ||
<div class="div-tabla-celda"> | ||
<%= f.input :fecha, label: false, | ||
input_html: { type: "date" }, | ||
as: :string | ||
%> | ||
</td> | ||
<td> | ||
as: :string %> | ||
</div> | ||
<div class="div-tabla-celda"> | ||
<%= f.input :valorpesos_localizado, label: false %> | ||
</td> | ||
<td> | ||
<%= f.input :id, as: :hidden %> | ||
<%= link_to_remove_association "Eliminar", f, | ||
class: 'btn btn-sm btn-danger' | ||
%> | ||
<div><%= f.error_notification %></div> | ||
</td> | ||
</tr> | ||
</div> | ||
<div class="div-tabla-celda"> | ||
<%= f.input :id, as: :hidden %> | ||
<%= f.submit "Eliminar", | ||
class: 'btn btn-sm btn-danger', | ||
data: { | ||
turbo_frame: "desembolso_proyectofinanciero_#{f.index}", | ||
disable_with: false | ||
}, | ||
formaction: eliminar_desembolso_proyectofinanciero_path( | ||
id: f.object.id, index: f.index | ||
), | ||
formmethod: :delete, | ||
formnovalidate: true %> | ||
</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
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
30 changes: 30 additions & 0 deletions
30
lib/cor1440_gen/concerns/controllers/desembolsos_proyectofinanciero_controller.rb
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,30 @@ | ||
module Cor1440Gen | ||
module Concerns | ||
module Controllers | ||
module DesembolsosProyectofinancieroController | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
def destroy | ||
end | ||
|
||
def create | ||
end | ||
|
||
private | ||
|
||
def prepara_desembolso_proyectofinanciero | ||
@proyectofinanciero = Cor1440Gen::Proyectofinanciero.new( | ||
desembolso: [ | ||
Cor1440Gen::Desembolso.new | ||
] | ||
) | ||
end | ||
|
||
end # included | ||
|
||
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