mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Incluida arquitectura 'Js_loader' con un ejemplo de uso
This commit is contained in:
@ -29,4 +29,4 @@ defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
|
|||||||
| the system. This will control whether Kint is loaded, and a few other
|
| the system. This will control whether Kint is loaded, and a few other
|
||||||
| items. It can always be used within your own application too.
|
| items. It can always be used within your own application too.
|
||||||
*/
|
*/
|
||||||
defined('CI_DEBUG') || define('CI_DEBUG', false);
|
defined('CI_DEBUG') || define('CI_DEBUG', true);
|
||||||
|
|||||||
31
ci4/app/Controllers/Js_loader.php
Normal file
31
ci4/app/Controllers/Js_loader.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
use App\Controllers\BaseController;
|
||||||
|
|
||||||
|
|
||||||
|
class Js_loader extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function index()
|
||||||
|
{
|
||||||
|
echo "ok";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function comparador_js()
|
||||||
|
{
|
||||||
|
$this->response->setHeader('Content-Type', 'text/javascript');
|
||||||
|
return view('themes/backend/vuexy/form/presupuestos/cosidotapablanda/comparador.js');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@ -172,6 +172,9 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
|||||||
|
|
||||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Presupuestos.moduleTitleCosidoTB') . ' ' . lang('Basic.global.addNewSuffix');
|
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Presupuestos.moduleTitleCosidoTB') . ' ' . lang('Basic.global.addNewSuffix');
|
||||||
|
|
||||||
|
/* TEST JS LOADER */
|
||||||
|
$this->viewData['global_js_variables'] = array('jsVarTest' => "'Hola Jaime'");
|
||||||
|
|
||||||
|
|
||||||
return $this->displayForm(__METHOD__);
|
return $this->displayForm(__METHOD__);
|
||||||
} // end function add()
|
} // end function add()
|
||||||
|
|||||||
26
ci4/app/Controllers/Presupuestos/Js_loader.php
Normal file
26
ci4/app/Controllers/Presupuestos/Js_loader.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers\Presupuestos;
|
||||||
|
use App\Controllers\BaseController;
|
||||||
|
|
||||||
|
|
||||||
|
class Js_loader extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function comparador_js()
|
||||||
|
{
|
||||||
|
$data['test_var'] = 5;
|
||||||
|
|
||||||
|
$this->load->view('themes/backend/vuexy/form/presupuestos/cosidotapablanda/comparador.js', $data);
|
||||||
|
$this->output->set_content_type('text/javascript');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ class LoginAuthFilter implements FilterInterface
|
|||||||
*/
|
*/
|
||||||
public function whiteListController(){
|
public function whiteListController(){
|
||||||
return [
|
return [
|
||||||
'',
|
'Js_loader',
|
||||||
'BaseController',
|
'BaseController',
|
||||||
'Home',
|
'Home',
|
||||||
'Login',
|
'Login',
|
||||||
|
|||||||
@ -0,0 +1,17 @@
|
|||||||
|
$(function () {
|
||||||
|
|
||||||
|
console.log("Llamada desde JS Loader");
|
||||||
|
|
||||||
|
console.log("jsVarTest: " + jsVarTest);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function test(){
|
||||||
|
|
||||||
|
console.log("Test from function");
|
||||||
|
console.log("jsVarTest desde funcion: " + jsVarTest);
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,6 +1,7 @@
|
|||||||
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
|
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
|
||||||
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
|
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
|
||||||
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
|
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
|
||||||
|
|
||||||
<?= $this->section("content") ?>
|
<?= $this->section("content") ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
@ -106,11 +107,16 @@
|
|||||||
"<?=lang('Presupuestos.papelFormatoId') ?>*";
|
"<?=lang('Presupuestos.papelFormatoId') ?>*";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
<?= $this->endSection() ?>
|
|
||||||
|
|
||||||
|
|
||||||
|
// Function from comparador.js
|
||||||
|
test();
|
||||||
|
|
||||||
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
|
||||||
<?= $this->section('additionalExternalJs') ?>
|
<?= $this->section('additionalExternalJs') ?>
|
||||||
<script src="<?= site_url('themes/vuexy/vendor/libs/autosize/autosize.js') ?>"></script>
|
<script src="<?= site_url('themes/vuexy/vendor/libs/autosize/autosize.js') ?>"></script>
|
||||||
|
<script src="<?= site_url('js_loader/comparador_js') ?>"></script>
|
||||||
<?=$this->endSection() ?>
|
<?=$this->endSection() ?>
|
||||||
|
|
||||||
|
|||||||
@ -335,6 +335,16 @@ if (!empty($token) && $tfa == false) {
|
|||||||
<!-- Page JS -->
|
<!-- Page JS -->
|
||||||
<?= sweetAlert() ?>
|
<?= sweetAlert() ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if (isset($global_js_variables)) {
|
||||||
|
echo "<script>\n";
|
||||||
|
foreach ($global_js_variables as $name => $value):
|
||||||
|
echo "\t" . "var $name = $value;" . "\n";
|
||||||
|
endforeach;
|
||||||
|
echo "</script>\n";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user