Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
2
2018_web_app
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
inutralia
2018_web_app
Commits
846b36c6
Commit
846b36c6
authored
Dec 11, 2018
by
David Villalba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Metodo para notificar desde el controllador mediante el modal de notificaiones.
parent
e141011e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
84 additions
and
2 deletions
+84
-2
app.php
fuel/app/classes/controller/app.php
+7
-0
index.php
fuel/app/classes/controller/listacompra/index.php
+2
-1
extension.php
fuel/app/classes/twig/seti/extension.php
+11
-0
template.twig
fuel/app/views/layout/template.twig
+16
-0
index.twig
fuel/app/views/menupersonalizado/index.twig
+1
-0
modal_notification.twig
fuel/app/views/modals/modal_notification.twig
+22
-0
main.js
public/assets/js/main.js
+25
-1
No files found.
fuel/app/classes/controller/app.php
View file @
846b36c6
...
@@ -64,4 +64,10 @@ class Controller_App extends Controller{
...
@@ -64,4 +64,10 @@ class Controller_App extends Controller{
return
new
\Response
(
json_encode
(
array
(
'localidades'
=>
$array_localidades
)));
return
new
\Response
(
json_encode
(
array
(
'localidades'
=>
$array_localidades
)));
}
}
public
function
notify
(
$type
,
$message
){
Session
::
set
(
'notification'
,
array
(
'type'
=>
$type
,
'text'
=>
$message
));
}
}
}
\ No newline at end of file
fuel/app/classes/controller/listacompra/index.php
View file @
846b36c6
...
@@ -81,7 +81,8 @@ class Controller_Listacompra_Index extends \Controller_App{
...
@@ -81,7 +81,8 @@ class Controller_Listacompra_Index extends \Controller_App{
}
}
}
}
Session
::
set_flash
(
'success'
,
"Se han borrado los ingredientes correctamente"
);
$this
->
notify
(
"success"
,
"Se han borrado los ingredientes correctamente"
);
return
Response
::
redirect_back
();
return
Response
::
redirect_back
();
}
}
...
...
fuel/app/classes/twig/seti/extension.php
View file @
846b36c6
...
@@ -125,6 +125,7 @@ class Twig_Seti_Extension extends Twig_Extension
...
@@ -125,6 +125,7 @@ class Twig_Seti_Extension extends Twig_Extension
'sha1'
=>
new
Twig_Function_Function
(
'sha1'
),
'sha1'
=>
new
Twig_Function_Function
(
'sha1'
),
'var_dump'
=>
new
Twig_Function_Function
(
'var_dump'
),
'var_dump'
=>
new
Twig_Function_Function
(
'var_dump'
),
'is_divisible'
=>
new
Twig_Function_Method
(
$this
,
'is_divisible'
),
'is_divisible'
=>
new
Twig_Function_Method
(
$this
,
'is_divisible'
),
'session_delete'
=>
new
Twig_Function_Method
(
$this
,
'session_delete'
),
);
);
}
}
...
@@ -199,4 +200,14 @@ class Twig_Seti_Extension extends Twig_Extension
...
@@ -199,4 +200,14 @@ class Twig_Seti_Extension extends Twig_Extension
return
(
$num
%
$div
==
0
)
?
true
:
false
;
return
(
$num
%
$div
==
0
)
?
true
:
false
;
}
}
/**
*
* Borra de session por key
*
* @param $key
*/
public
function
session_delete
(
$key
){
Session
::
delete
(
$key
);
}
}
}
fuel/app/views/layout/template.twig
View file @
846b36c6
...
@@ -53,6 +53,22 @@
...
@@ -53,6 +53,22 @@
{%
endblock
%}
{%
endblock
%}
</div>
</div>
{#PREPARAMOS NOTIFICAION PARA MOSTRAR EL MODAL#}
{%
if
session_get
(
'notification'
)
%}
<input
class=
"notification type"
value=
"
{{
session_get
(
'notification.type'
)
}}
"
>
<input
class=
"notification text"
value=
"
{{
session_get
(
'notification.text'
)
}}
"
>
{{
session_delete
(
'notification'
)
}}
{%
endif
%}
{#FIN NOTIFICAION#}
{%
include
'modals/modal_notification.twig '
%}
<!--modal instrucciones pantalla-->
<!--modal instrucciones pantalla-->
{%
include
'modals/modal_info.twig'
%}
{%
include
'modals/modal_info.twig'
%}
...
...
fuel/app/views/menupersonalizado/index.twig
View file @
846b36c6
...
@@ -265,6 +265,7 @@
...
@@ -265,6 +265,7 @@
<!--modal recomendaciones resto del día-->
<!--modal recomendaciones resto del día-->
{%
include
'modal_resto_dia.twig'
%}
{%
include
'modal_resto_dia.twig'
%}
{%
include
'modals/modal_saved.twig'
%}
{%
endblock
%}
{%
endblock
%}
...
...
fuel/app/views/modals/modal_notification.twig
0 → 100644
View file @
846b36c6
<!-- Modal info template -->
<div
class=
"modal fade"
id=
"modalNotification"
tabindex=
"-1"
role=
"dialog"
aria-labelledby=
"modalSuccess"
>
<div
class=
"modal-dialog"
role=
"document"
>
<div
class=
"modal-content"
>
<div
class=
"modal-body"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
><span
aria-hidden=
"true"
>
×
</span></button>
<div
class=
"text-center"
>
<img
src=
""
class=
"img-responsive-custom img-type"
/>
</div>
<div
class=
"content text-center pb40"
>
<h2
class=
"text-message"
></h2>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
public/assets/js/main.js
View file @
846b36c6
...
@@ -13,6 +13,12 @@ $(window).load(function() {
...
@@ -13,6 +13,12 @@ $(window).load(function() {
// Control Checked inputs
// Control Checked inputs
control_inputs_checked
();
control_inputs_checked
();
// Open modal notification
show_modal_notification
();
});
});
...
@@ -94,7 +100,13 @@ function control_inputs_checked() {
...
@@ -94,7 +100,13 @@ function control_inputs_checked() {
*/
*/
function
diff_input_checked
(
el
)
{
function
diff_input_checked
(
el
)
{
var
class_separate
=
$
(
el
).
closest
(
"form"
).
attr
(
'class'
).
split
(
' '
);
var
class_form_input
=
$
(
el
).
closest
(
"form.ac-custom"
).
attr
(
'class'
);
if
(
typeof
class_form_input
===
"undefined"
){
return
false
}
var
class_separate
=
class_form_input
.
split
(
' '
);
var
class_type
=
class_separate
[
class_separate
.
length
-
1
];
var
class_type
=
class_separate
[
class_separate
.
length
-
1
];
...
@@ -154,4 +166,16 @@ function print_radio_checked(el,type) {
...
@@ -154,4 +166,16 @@ function print_radio_checked(el,type) {
draw
(
el
,
type
);
draw
(
el
,
type
);
}
}
function
show_modal_notification
()
{
if
(
$
(
'.notification'
).
length
!==
0
){
$
(
'.img-type'
).
attr
(
'src'
,
$
(
'.notification.type'
).
val
()
===
"success"
?
"assets/img/save.png"
:
"url-img-error"
);
$
(
'.text-message'
).
text
(
$
(
'.notification.text'
).
val
());
$
(
'#modalNotification'
).
modal
(
'show'
);
}
}
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