Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
iberculturaviva
iberculturaviva-mapas
Commits
a4fb64a0
Commit
a4fb64a0
authored
Dec 10, 2021
by
Alex Felippe Chiozo
Browse files
adiciona impressão do formulário de inscrição
parent
6cdec223
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
0 deletions
+60
-0
themes/IberCulturaViva/Theme.php
themes/IberCulturaViva/Theme.php
+27
-0
themes/IberCulturaViva/assets/js/print-registration.js
themes/IberCulturaViva/assets/js/print-registration.js
+23
-0
themes/IberCulturaViva/layouts/parts/button-print-registration.php
...erCulturaViva/layouts/parts/button-print-registration.php
+10
-0
No files found.
themes/IberCulturaViva/Theme.php
View file @
a4fb64a0
...
...
@@ -66,6 +66,33 @@ class Theme extends BaseV1\Theme{
}
return
;
});
// insere botão de imprimir na visualização do formulário de inscrição
$app
->
hook
(
"template(registration.view.form):begin"
,
function
()
use
(
$app
)
{
/** @var \MapasCulturais\Theme $this */
if
(
!
$this
->
controller
->
requestedEntity
->
canUser
(
"admin"
))
{
return
;
}
$this
->
part
(
"button-print-registration"
,
[
"registration"
=>
$this
->
controller
->
requestedEntity
]);
return
;
});
// implementa o endpoint para o botão de imprimir
$app
->
hook
(
"GET(registration.print)"
,
function
()
use
(
$app
)
{
/** @var \MapasCulturais\Controller $this */
$this
->
requireAuthentication
();
if
(
!
$this
->
requestedEntity
->
canUser
(
"admin"
))
{
$this
->
errorJson
(
"Unauthorised."
,
401
);
return
;
}
$app
->
view
->
enqueueScript
(
"app"
,
"print-registration"
,
"js/print-registration.js"
);
$app
->
view
->
enqueueStyle
(
"app"
,
"print-registration"
,
"css/print-registration.css"
,
[
"main"
]);
$this
->
render
(
"single"
,
[
"entity"
=>
$this
->
requestedEntity
]);
return
;
});
return
;
}
function
includeVendorAssets
()
...
...
themes/IberCulturaViva/assets/js/print-registration.js
0 → 100644
View file @
a4fb64a0
$
(
function
()
{
// initialisation
const
$footer
=
$
(
"
footer
"
);
console
.
log
(
$footer
.
height
());
$footer
.
before
(
"
<div id=
\"
empty-footer
\"
>.</div>
"
);
$
(
"
#main-header
"
).
removeClass
(
"
sombra
"
);
// trigger the print window
setTimeout
(
function
()
{
$
(
window
).
resize
();
window
.
print
();
return
;
},
500
);
// adjust height of empty-footer
$
(
window
).
resize
(
function
()
{
$
(
"
#empty-footer
"
).
height
(
$footer
.
height
());
return
;
});
// adjust header on scroll
$
(
window
).
scroll
(
function
()
{
$
(
"
#main-header
"
)[
0
].
style
.
top
=
0
;
return
;
});
});
\ No newline at end of file
themes/IberCulturaViva/layouts/parts/button-print-registration.php
0 → 100644
View file @
a4fb64a0
<?php
use
MapasCulturais\i
;
$url
=
$app
->
createUrl
(
"registration"
,
"print"
,
[
"id"
=>
$registration
->
id
]);
?>
<div
class=
"clearfix clear"
style=
"margin-bottom: 1rem;"
>
<a
href=
"
<?=
$url
?>
"
class=
"alignright btn btn-default hltip print-registration"
title=
""
hltitle=
"Acessar versão para impressão"
target=
"_blank"
>
<?php
i
::
_e
(
"Imprimir"
);
?>
</a>
</div>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment