Commit 48265584 by gema

Merge branch 'master' of http://git.setisl.com/inutraliaapp/2018_web_app into gemis_dev

parents 8ecfb025 0d6e04c5
...@@ -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
...@@ -86,7 +86,8 @@ class Controller_Listacompra_Index extends \Controller_App{ ...@@ -86,7 +86,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();
} }
......
...@@ -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);
}
} }
...@@ -54,6 +54,22 @@ ...@@ -54,6 +54,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' %}
......
...@@ -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 %}
......
<!-- 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">&times;</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
...@@ -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');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment