-
-
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.
Cambia a turbo y mejora validaciones. Closes https://gitlab.com/pasos…
…deJesus/si_jrscol/-/issues/1105. Closes https://gitlab.com/pasosdeJesus/si_jrscol/-/issues/1107. Closes https://gitlab.com/pasosdeJesus/si_jrscol/-/issues/1108
- Loading branch information
Showing
13 changed files
with
347 additions
and
223 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
12 changes: 12 additions & 0 deletions
12
app/controllers/cor1440_gen/proyectofinanciero_usuarios_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/proyectofinanciero_usuarios_controller" | ||
|
||
module Cor1440Gen | ||
class ProyectofinancieroUsuariosController < ApplicationController | ||
load_and_authorize_resource class: ProyectofinancieroUsuario | ||
before_action :prepara_proyectofinanciero_usuario | ||
|
||
include Cor1440Gen::Concerns::Controllers::ProyectofinancieroUsuariosController | ||
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
24 changes: 24 additions & 0 deletions
24
app/views/cor1440_gen/proyectofinanciero_usuarios/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,24 @@ | ||
<%= simple_form_for @proyectofinanciero do |f| %> | ||
<%= f.simple_fields_for :proyectofinanciero_usuario, | ||
child_index: params[:index] do |subf| %> | ||
<%= turbo_stream.replace "agregar-proyectofinanciero-usuario" do %> | ||
<%= f.submit "Agregar funcionario", | ||
class: 'btn btn-sm btn-primary', | ||
data: { | ||
disable_with: false | ||
}, | ||
formaction: cor1440_gen.crear_proyectofinanciero_usuario_path( | ||
index: subf.index.to_i + 1 | ||
), | ||
formmethod: :post, | ||
formnovalidate: true, | ||
id: "agregar-proyectofinanciero-usuario", | ||
name: "agregar-proyectofinanciero-usuario" | ||
%> | ||
<% end %> | ||
|
||
<%= turbo_stream.append "proyectofinanciero_usuarios_marco" do %> | ||
<%= render "/cor1440_gen/proyectosfinancieros/proyectofinanciero_usuario_campos", f: subf %> | ||
<% end %> | ||
<% end %> | ||
<% end %> |
9 changes: 9 additions & 0 deletions
9
app/views/cor1440_gen/proyectofinanciero_usuarios/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 :proyectofinanciero_usuario, | ||
child_index: params[:index] do |subf| %> | ||
<%= turbo_frame_tag "proyectofinanciero_usuario_#{subf.index}" do %> | ||
<%= subf.hidden_field :id, value: params[:id] %> | ||
<%= subf.hidden_field :_destroy, value: true %> | ||
<% end %> | ||
<% end %> | ||
<% end %> |
41 changes: 22 additions & 19 deletions
41
app/views/cor1440_gen/proyectosfinancieros/_campo_proyectofinanciero_usuario.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,24 +1,27 @@ | ||
<p> | ||
<%= t('Equipo de trabajo') %>: | ||
<table class='table table-bordered' border=1 width="100%"> | ||
<thead> | ||
<tr> | ||
<th><%= t('Persona') %></th> | ||
<th><%= t('Acciones') %></th> | ||
</tr> | ||
</thead> | ||
<tbody id="proyectofinanciero_usuario"> | ||
<div class="div-tabla"> | ||
<div id="proyectofinanciero_usuarios_marco" class="div-tabla-cuerpo"> | ||
<div class="div-tabla-fila"> | ||
<div class="div-tabla-celda-encabezado"><%= t('Persona') %></div> | ||
<div class="div-tabla-celda-encabezado"><%= t('Acciones') %></div> | ||
</div> | ||
<%= f.simple_fields_for :proyectofinanciero_usuario do |pu| %> | ||
<%= render 'proyectofinanciero_usuario_campos', :f => pu%> | ||
<%= render 'proyectofinanciero_usuario_campos', :f => pu %> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
<div class="links"> | ||
<%= link_to_add_association t('Añadir funcionario'), f, | ||
:proyectofinanciero_usuario, | ||
:"data-association-insertion-node" => "tbody#proyectofinanciero_usuario", | ||
:"data-association-insertion-method" => "append", | ||
partial: 'proyectofinanciero_usuario_campos', | ||
:class => 'btn btn-sm btn-primary' | ||
%> | ||
</div> | ||
</div> | ||
<div class="enlace-agregar-usuarios"> | ||
<%= f.submit "Agregar funcionario", | ||
class: 'btn btn-sm btn-primary', | ||
data: { | ||
disable_with: false | ||
}, | ||
formaction: cor1440_gen.crear_proyectofinanciero_usuario_path( | ||
index: @registro.proyectofinanciero_usuario.size | ||
), | ||
formmethod: :post, | ||
formnovalidate: true, | ||
id: "agregar-proyectofinanciero-usuario", | ||
name: "agregar-proyectofinanciero-usuario" %> | ||
</div> |
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/proyectofinanciero_usuarios_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 ProyectofinancieroUsuariosController | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
def destroy | ||
end | ||
|
||
def create | ||
end | ||
|
||
private | ||
|
||
def prepara_proyectofinanciero_usuario | ||
@proyectofinanciero = Cor1440Gen::Proyectofinanciero.new( | ||
proyectofinanciero_usuario: [ | ||
Cor1440Gen::ProyectofinancieroUsuario.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
Oops, something went wrong.