diff options
| author | Guillaume | 2017-09-21 11:46:25 +0200 |
|---|---|---|
| committer | Guillaume | 2017-09-21 11:46:25 +0200 |
| commit | d59ec1b714ab55b0a66f3cfec5297c4baf9d47aa (patch) | |
| tree | 01c63ad14e4482f7b770875e9f9d5544e528e54b | |
| parent | 8007f0140f3fc5183e9a3d27b19fe90e4da839d2 (diff) | |
| download | chouette-core-d59ec1b714ab55b0a66f3cfec5297c4baf9d47aa.tar.bz2 | |
add organisation filter for compliance_control_set
4 files changed, 19 insertions, 2 deletions
diff --git a/app/controllers/compliance_control_sets_controller.rb b/app/controllers/compliance_control_sets_controller.rb index 6edfa3fcc..0c6e52f86 100644 --- a/app/controllers/compliance_control_sets_controller.rb +++ b/app/controllers/compliance_control_sets_controller.rb @@ -24,6 +24,12 @@ class ComplianceControlSetsController < BreadcrumbController ) end + protected + + def begin_of_association_chain + current_organisation + end + private def compliance_control_set_params diff --git a/app/helpers/compliance_control_sets_helper.rb b/app/helpers/compliance_control_sets_helper.rb index 3e02e0ef7..6ba4bed4f 100644 --- a/app/helpers/compliance_control_sets_helper.rb +++ b/app/helpers/compliance_control_sets_helper.rb @@ -1,2 +1,7 @@ module ComplianceControlSetsHelper + + def organisations_filters_values + [current_organisation, Organisation.find_by_name("STIF")].uniq + end + end diff --git a/app/views/compliance_control_sets/_filters.html.slim b/app/views/compliance_control_sets/_filters.html.slim index 7ee050636..587f74ce4 100644 --- a/app/views/compliance_control_sets/_filters.html.slim +++ b/app/views/compliance_control_sets/_filters.html.slim @@ -5,6 +5,11 @@ span.input-group-btn button.btn.btn-default type='submit' span.fa.fa-search + .ffg-row + .form-group.togglable + = f.label t('activerecord.models.organisation.one'), required: false, class: 'control-label' + = f.input :organisation_name_eq_any, collection: organisations_filters_values, as: :check_boxes, label: false, label_method: lambda {|w| ("<span>#{w.name}</span>").html_safe}, required: false, wrapper_html: {class: 'checkbox_list'} + .actions = link_to t('actions.erase'), @compliance_control_set, class: 'btn btn-link' - = f.submit t('actions.filter'), class: 'btn btn-default', id: 'referential_filter_btn' + = f.submit t('actions.filter'), class: 'btn btn-default', id: 'referential_filter_btn'
\ No newline at end of file diff --git a/app/views/compliance_control_sets/index.html.slim b/app/views/compliance_control_sets/index.html.slim index 95833a01c..aee1595ef 100644 --- a/app/views/compliance_control_sets/index.html.slim +++ b/app/views/compliance_control_sets/index.html.slim @@ -24,7 +24,7 @@ key: :name, \ attribute: 'name', \ link_to: lambda do |compliance_control_set| \ - compliance_control_set_path(@compliance_control_sets, compliance_control_set) \ + compliance_control_set_path(compliance_control_set) \ end \ ), \ TableBuilderHelper::Column.new( \ @@ -45,6 +45,7 @@ ) \ ], sortable: true, + links: [:show], cls: 'table has-filter has-search' - unless @compliance_control_sets.any? .row.mt-xs |
