-
-
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.
En marco lógico actividad con turbo en lugar de coccon
- Loading branch information
Showing
8 changed files
with
161 additions
and
50 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
app/controllers/cor1440_gen/actividadespf_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/actividadespf_proyectofinanciero_controller" | ||
|
||
module Cor1440Gen | ||
class ActividadespfProyectofinancieroController < ApplicationController | ||
before_action :preparar_actividadpf_proyectofinanciero | ||
load_and_authorize_resource class: Cor1440Gen::Actividadpf | ||
|
||
include Cor1440Gen::Concerns::Controllers::ActividadespfProyectofinancieroController | ||
end | ||
end |
27 changes: 27 additions & 0 deletions
27
app/views/cor1440_gen/actividadespf_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,27 @@ | ||
<%= simple_form_for @proyectofinanciero do |f| %> | ||
<%= f.simple_fields_for :actividadpf, | ||
child_index: params[:index] do |subf| %> | ||
<%= turbo_stream.replace "agregar-actividadpf" do %> | ||
<%= f.submit "Agregar #{Cor1440Gen::Proyectofinanciero.human_attribute_name(:actividadpf)}", | ||
formaction: cor1440_gen.crear_actividadpf_proyectofinanciero_path( | ||
subf.index.to_i + 1 | ||
), | ||
formmethod: :post, | ||
formnovalidate: true, | ||
class: "btn btn-sm btn-primary", | ||
id: "agregar-actividadpf", | ||
data: { | ||
disable_with: false | ||
} %> | ||
<% end %> | ||
|
||
<%= turbo_stream.append "actividadespf_marco" do %> | ||
<%= render( | ||
partial: "/cor1440_gen/proyectosfinancieros/actividadpf_campos", | ||
locals: { | ||
f: subf, | ||
ruta_eliminar: cor1440_gen.eliminar_actividadpf_proyectofinanciero_path | ||
}) %> | ||
<% end %> | ||
<% end %> | ||
<% end %> |
9 changes: 9 additions & 0 deletions
9
app/views/cor1440_gen/actividadespf_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 :actividadpf, | ||
child_index: params[:index] do |subf| %> | ||
<%= turbo_frame_tag "actividadpf_#{subf.index}" do %> | ||
<%= subf.hidden_field :id, value: params[:id] %> | ||
<%= subf.hidden_field :_destroy, value: true %> | ||
<% 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
65 changes: 35 additions & 30 deletions
65
app/views/cor1440_gen/proyectosfinancieros/_campo_actividadpf.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,36 +1,41 @@ | ||
<p></p> | ||
<%= f.input :id, as: :hidden %> | ||
<div class="panel panel-default"> | ||
<div class="panel-heading"><%= t('Actividades del marco lógico') %></div> | ||
<div class="panel-body table-responsive" style='overflow-x:scroll;'> | ||
<div class="div-actividadespf"> | ||
<table class='table table-bordered' border=1 width="100%"> | ||
<thead> | ||
<tr> | ||
<th style='min-width: 8rem'><%= t('refresultado') %></th> | ||
<th style='min-width: 4rem'><%= t('Código') %></th> | ||
<th style='min-width: 18rem'><%= t('Actividad del marco lógico') %></th> | ||
<th style='min-width: 18rem'><%= t('Detalle') %></th> | ||
<th style='min-width: 8rem'><%= t('Formulario') %></th> | ||
<th style='min-width: 14rem'><%= t('Hereda de') %></th> | ||
<th style='min-width: 4rem'><%= t('Acciones') %></th> | ||
</tr> | ||
</thead> | ||
<tbody id="actividadespf"> | ||
<%= f.simple_fields_for :actividadpf, | ||
<div class="panel-heading"><%= t('Actividades') %></div> | ||
<div class="panel-body"> | ||
|
||
<div class="div-actividadespf table-responsive"> | ||
<div class='div-tabla'> | ||
<div id="actividadespf_marco" class="div-tabla-cuerpo"> | ||
<div class="div-tabla-fila"> | ||
<div class="div-tabla-celda-encabezado"><%= t('refresultado') %></div> | ||
<div class="div-tabla-celda-encabezado"><%= t('Código') %></div> | ||
<div class="div-tabla-celda-encabezado"><%= t('Actividad del marco lógico') %></div> | ||
<div class="div-tabla-celda-encabezado"><%= t('Detalle') %></div> | ||
<div class="div-tabla-celda-encabezado"><%= t('Formulario') %></div> | ||
<div class="div-tabla-celda-encabezado"><%= t('Hereda de') %></div> | ||
<div class="div-tabla-celda-encabezado"><%= t('Acciones') %></div> | ||
</div> | ||
<%= f.simple_fields_for :actividadpf, | ||
f.object.actividadpf.order(:id) do |o| %> | ||
<%= render 'actividadpf_campos', f: o %> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
<div class="links"> | ||
<%= link_to_add_association t('Añadir actividad'), f, :actividadpf, { | ||
:"data-association-insertion-node" => "tbody#actividadespf", | ||
:"data-association-insertion-method" => "append", | ||
partial: 'actividadpf_campos', | ||
class: 'btn btn-sm btn-primary', | ||
"data-ajax" => cor1440_gen.new_actividadespf_path, | ||
"data-ajaxdata" => "proyectofinanciero_id" } %> | ||
</div> <!-- links --> | ||
</div> | ||
</div> | ||
<div class="enlace-agregar-actividadpf"> | ||
<%= f.submit "Agregar #{Cor1440Gen::Actividadpf.human_attribute_name(:actividadpf)}", | ||
formaction: cor1440_gen.crear_actividadpf_proyectofinanciero_path( | ||
index: @proyectofinanciero.actividadpf.size | ||
), | ||
formmethod: :post, | ||
formnovalidate: true, | ||
class: 'btn btn-sm btn-primary', | ||
name: "agregar-actividadpf", | ||
id: "agregar-actividadpf", | ||
data: { | ||
disable_with: false | ||
} %> | ||
</div> <!-- enlace-agregar-actividadpf --> | ||
</div> <!-- .div-actividadespf --> | ||
</div> <!-- panel-body --> | ||
</div> <!-- panel --> | ||
</div><!-- panel-body --> | ||
</div><!-- panel --> |
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
31 changes: 31 additions & 0 deletions
31
lib/cor1440_gen/concerns/controllers/actividadespf_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,31 @@ | ||
module Cor1440Gen | ||
module Concerns | ||
module Controllers | ||
module ActividadespfProyectofinancieroController | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
|
||
def create | ||
end | ||
|
||
def destroy | ||
end | ||
|
||
private | ||
|
||
def preparar_actividadpf_proyectofinanciero | ||
#o = Cor1440Gen::Objetivopf.new | ||
r = Cor1440Gen::Actividadpf.new | ||
@registro = @proyectofinanciero = | ||
Cor1440Gen::Proyectofinanciero.new( | ||
actividadpf: [r] | ||
) | ||
end | ||
|
||
end # included | ||
|
||
end | ||
end | ||
end | ||
end |