aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/lines
diff options
context:
space:
mode:
authorvlatka pavisic2016-11-15 15:55:39 +0100
committervlatka pavisic2016-11-15 15:55:44 +0100
commit9b52eb60503dca1294b677fa65cb6bbdbb81cd82 (patch)
treef5e2dc019e110d0b0598d185e63983fa626bdc15 /app/views/lines
parente652bbfa3f1665a405b361488a9e48a09b8ebb64 (diff)
downloadchouette-core-9b52eb60503dca1294b677fa65cb6bbdbb81cd82.tar.bz2
Refs #1935: Do not show select if there are no options
Diffstat (limited to 'app/views/lines')
-rw-r--r--app/views/lines/index.html.slim10
1 files changed, 4 insertions, 6 deletions
diff --git a/app/views/lines/index.html.slim b/app/views/lines/index.html.slim
index 92c04a193..11aa1810a 100644
--- a/app/views/lines/index.html.slim
+++ b/app/views/lines/index.html.slim
@@ -14,12 +14,10 @@
.row
.col-md-10.col-sm-9
.row
- .col-md-4.col-sm-4
- = f.select(:network_id_eq, @line_referential.networks.collect {|n| [ n.name, n.id ] }.unshift([t('.no_networks'), -1]), {include_blank: t('.all_networks')}, {class: 'form-control'})
- .col-md-4.col-sm-4
- = f.select(:company_id_eq, @line_referential.companies.collect {|c| [ c.name, c.id ] }.unshift([t('.no_companies'), -1]), {include_blank: t('.all_companies')}, {class: 'form-control'})
- .col-md-4.col-sm-4
- = f.select(:group_of_lines_id_eq, @line_referential.group_of_lines.collect {|c| [ c.name, c.id ] }.unshift([t('.no_group_of_lines'), -1]), {include_blank: t('.all_group_of_lines')}, {class: 'form-control'})
+ - %w(networks companies group_of_lines).each do |filter|
+ .col-md-4.col-sm-4
+ - if @referential && @referential.send(filter).any?
+ = f.select(:"#{filter.singularize unless filter == 'group_of_lines'}_id_eq", @referential.send(filter).collect { |f| [f.name, f.id] }.unshift([t(".no_#{filter}"), -1]), { include_blank: t(".all_#{filter}") }, { class: 'form-control' })
.col-md-2.col-sm-3
button.btn.btn-primary.btn-block type="submit" Filtrer