diff options
| author | Teddy Wing | 2018-01-12 17:37:41 +0100 | 
|---|---|---|
| committer | Teddy Wing | 2018-01-15 18:25:52 +0100 | 
| commit | d5543a0875a4c6f9bd06268dff49c0fe41751e91 (patch) | |
| tree | 099665efdec005436df697186f98ac241fbe48ee | |
| parent | 06b37dd16a136eee747103de2144a96cf1718adc (diff) | |
| download | chouette-core-d5543a0875a4c6f9bd06268dff49c0fe41751e91.tar.bz2 | |
workbenches/_filters: Only show organisations in workgroup
We had been listing all `Organisation`s in the check-box list that
enables filtering `Referential`s by organisation.
There can be many organisations in the database, and users of one org
shouldn't necessarily see other organisations.
Only allow users to filter by those organisations that belong to their
`Workgroup`. To do that, We get the workgroup of the current workbench,
and build a list containing the organisations the workgroup.
Refs #5140
| -rw-r--r-- | app/views/workbenches/_filters.html.slim | 8 | 
1 files changed, 7 insertions, 1 deletions
| diff --git a/app/views/workbenches/_filters.html.slim b/app/views/workbenches/_filters.html.slim index 4d9e0066c..491749515 100644 --- a/app/views/workbenches/_filters.html.slim +++ b/app/views/workbenches/_filters.html.slim @@ -19,7 +19,13 @@      .form-group.togglable        = f.label t('activerecord.models.organisation.one'), required: false, class: 'control-label' -      = f.input :organisation_name_eq_any, collection: Organisation.order('name').pluck(:name), as: :check_boxes, label: false, label_method: lambda{|w| ("<span>#{w}</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list' } +      = f.input :organisation_name_eq_any, +          collection: @workbench.workgroup.organisations.order('name').pluck(:name), +          as: :check_boxes, +          label: false, +          label_method: lambda { |w| ("<span>#{w}</span>").html_safe }, +          required: false, +          wrapper_html: { class: 'checkbox_list' }      .form-group.togglable        = f.label Referential.human_attribute_name(:validity_period), required: false, class: 'control-label' | 
