diff options
| author | Zog | 2018-02-23 08:53:32 +0100 | 
|---|---|---|
| committer | Zog | 2018-02-23 08:53:32 +0100 | 
| commit | 6e38d3b54bce243c6ea6c4d31be9c4587c6c0b4f (patch) | |
| tree | 03bb21480542a805cdd2b900ce8e473a887b504e /app | |
| parent | 7e3065d47441f3e4fc41678a80737eef12c50c84 (diff) | |
| download | chouette-core-5990-clear-button-on-referentials.tar.bz2 | |
Refs #5990; Add a button to clear lines selection in Referential#new5990-clear-button-on-referentials
Diffstat (limited to 'app')
| -rw-r--r-- | app/views/referentials/_form.html.slim | 14 | 
1 files changed, 13 insertions, 1 deletions
| diff --git a/app/views/referentials/_form.html.slim b/app/views/referentials/_form.html.slim index 1e59ab566..96d847ec1 100644 --- a/app/views/referentials/_form.html.slim +++ b/app/views/referentials/_form.html.slim @@ -47,8 +47,13 @@              = link_to_add_association t('simple_form.labels.referential.actions.add_period'), subform, :periods, class: 'btn btn-outline-primary'      .separator +    .row +      .col-lg-11 +        = subform.input :lines, as: :select, collection: Chouette::Line.includes(:company).order(:name).where(objectid: current_functional_scope), selected: subform.object.line_ids, label_method: :display_name, input_html: { 'data-select2ed': 'true', 'data-select2ed-placeholder': t('simple_form.labels.referential.placeholders.select_lines'), 'multiple': 'multiple', style: 'width: 100%' } +      .col-lg-1 +        a.clear-lines.btn.btn-default href='#' +          .fa.fa-trash -    = subform.input :lines, as: :select, collection: Chouette::Line.includes(:company).order(:name).where(objectid: current_functional_scope), selected: subform.object.line_ids, label_method: :display_name, input_html: { 'data-select2ed': 'true', 'data-select2ed-placeholder': t('simple_form.labels.referential.placeholders.select_lines'), 'multiple': 'multiple', style: 'width: 100%' }    .hidden = form.input :workbench_id, as: :hidden @@ -58,3 +63,10 @@        class: 'btn btn-default formSubmitr',        data: { disable_with: t('actions.processing') },        form: 'referential_form' + +  - content_for :javascript do +    coffee: +      $(".clear-lines").click (e)-> +        e.preventDefault() +        $(e.currentTarget).parents('.row').first().find('[name*=line]').val('').trigger('change') +        false | 
