aboutsummaryrefslogtreecommitdiffstats
path: root/app/views
diff options
context:
space:
mode:
authorZog2017-12-21 15:47:29 +0100
committerAlban Peignier2017-12-21 21:58:56 +0100
commitbe8afa7aa3fd1c8922a4e02e16cdfef698b3df26 (patch)
tree390a90c9b243050259dd9e6ffe2e28e3943176e9 /app/views
parent09f335237d39e9cce1d4051355d16f2781806cbd (diff)
downloadchouette-core-be8afa7aa3fd1c8922a4e02e16cdfef698b3df26.tar.bz2
Refs #5361 @1H; Make company optional in Lines form
And handle the case when it is nil in the views
Diffstat (limited to 'app/views')
-rw-r--r--app/views/lines/_form.html.slim3
-rw-r--r--app/views/lines/index.html.slim2
-rw-r--r--app/views/lines/show.html.slim2
-rw-r--r--app/views/referentials/show.html.slim2
4 files changed, 4 insertions, 5 deletions
diff --git a/app/views/lines/_form.html.slim b/app/views/lines/_form.html.slim
index de0308289..909d6512e 100644
--- a/app/views/lines/_form.html.slim
+++ b/app/views/lines/_form.html.slim
@@ -3,7 +3,7 @@
.col-lg-12
= f.input :name
= f.input :network_id, as: :select, :collection => @line_referential.networks, include_blank: false
- = f.input :company_id, as: :select, :collection => @line_referential.companies, include_blank: false
+ = f.input :company_id, as: :select, :collection => @line_referential.companies, include_blank: true
= f.input :secondary_company_ids, :collection => @line_referential.companies, include_blank: false, input_html: { multiple: true, 'data-select2ed': true }, label: t('activerecord.attributes.line.secondary_company')
= f.input :published_name
= f.input :registration_number
@@ -20,4 +20,3 @@
.separator
= f.button :submit, t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'lines_form'
-
diff --git a/app/views/lines/index.html.slim b/app/views/lines/index.html.slim
index 8b035b477..e94837ed5 100644
--- a/app/views/lines/index.html.slim
+++ b/app/views/lines/index.html.slim
@@ -41,7 +41,7 @@
), \
TableBuilderHelper::Column.new( \
key: 'companies.name', \
- attribute: Proc.new { |n| n.try(:company).try(:name) } \
+ attribute: Proc.new { |n| n&.company&.name || "-" } \
), \
TableBuilderHelper::Column.new( \
key: :transport_mode, \
diff --git a/app/views/lines/show.html.slim b/app/views/lines/show.html.slim
index d62fe30d6..83244f739 100644
--- a/app/views/lines/show.html.slim
+++ b/app/views/lines/show.html.slim
@@ -6,7 +6,7 @@
= link_to link.href,
method: link.method,
data: link.data,
- class: 'btn btn-primary' do
+ class: "btn btn-primary #{link.disabled ? "disabled" : ""}" do
= link.content
- page_header_content_for @line
diff --git a/app/views/referentials/show.html.slim b/app/views/referentials/show.html.slim
index 9852fb0a3..96755359c 100644
--- a/app/views/referentials/show.html.slim
+++ b/app/views/referentials/show.html.slim
@@ -68,7 +68,7 @@
), \
TableBuilderHelper::Column.new( \
key: 'companies.name', \
- attribute: Proc.new { |n| n.try(:company).try(:name) } \
+ attribute: Proc.new { |n| n&.company&.name || "-" } \
) \
],
links: [:show],