From 926d705806f595282463abdeaac6a0ccb2e73421 Mon Sep 17 00:00:00 2001 From: JC Date: Mon, 7 Nov 2016 10:30:45 +0100 Subject: [PATCH] Added js and button, only flushing input value from parent form --- app/assets/javascripts/dossiers_list_filter.js | 5 ++++- app/assets/javascripts/pref_list_dossier.js | 2 +- app/views/backoffice/dossiers/_filter_framed.html.haml | 6 ++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/dossiers_list_filter.js b/app/assets/javascripts/dossiers_list_filter.js index dee999526..f69d28d97 100644 --- a/app/assets/javascripts/dossiers_list_filter.js +++ b/app/assets/javascripts/dossiers_list_filter.js @@ -7,6 +7,9 @@ function filters_init() { filter_framed_show(event); filter_framed_close_all_excepted(framed_id(event)); }); + $(".erase-filter").on('click', function (event) { + $(this).parent().find(".filter_input").val(""); + }); } function filter_framed_close_all_excepted(id) { @@ -24,4 +27,4 @@ function filter_framed_show(event) { dom_object.css('top', (event.pageY + 7) + 'px'); dom_object.css('left', (event.pageX + 7) + 'px'); -} \ No newline at end of file +} diff --git a/app/assets/javascripts/pref_list_dossier.js b/app/assets/javascripts/pref_list_dossier.js index 70bf1a4dd..977778ff1 100644 --- a/app/assets/javascripts/pref_list_dossier.js +++ b/app/assets/javascripts/pref_list_dossier.js @@ -30,4 +30,4 @@ function pref_list_dossier_close_action() { } ) }); -} \ No newline at end of file +} diff --git a/app/views/backoffice/dossiers/_filter_framed.html.haml b/app/views/backoffice/dossiers/_filter_framed.html.haml index 0c69e2aed..35c60c7f8 100644 --- a/app/views/backoffice/dossiers/_filter_framed.html.haml +++ b/app/views/backoffice/dossiers/_filter_framed.html.haml @@ -3,6 +3,8 @@ = preference.libelle =form_tag @dossiers_list_facade.filter_url, {class: 'panel-body form-inline', method: :post} do - %input.form-control.filter_input{name: "filter_input[#{preference.table_attr}]", style:'width: 84%', value: "#{preference.filter}"} + %input.form-control.filter_input{name: "filter_input[#{preference.table_attr}]", style:'width: 69%', value: "#{preference.filter}"} %button.btn.btn-sm.btn-success - %i.fa.fa-check \ No newline at end of file + %i.fa.fa-check + %div.btn.btn-sm.btn-danger.erase-filter + %i.fa.fa-remove