diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/helpers/referentials_helper.rb | 10 | ||||
| -rw-r--r-- | app/views/lines/index.html.slim | 2 | ||||
| -rw-r--r-- | app/views/referentials/show.html.slim | 2 | ||||
| -rw-r--r-- | app/views/routes/show.html.slim | 2 | ||||
| -rw-r--r-- | app/views/stop_areas/index.html.slim | 2 |
5 files changed, 14 insertions, 4 deletions
diff --git a/app/helpers/referentials_helper.rb b/app/helpers/referentials_helper.rb index 73384bef6..f3c18d9f8 100644 --- a/app/helpers/referentials_helper.rb +++ b/app/helpers/referentials_helper.rb @@ -1,2 +1,12 @@ module ReferentialsHelper + # Line statuses helper + def line_status(status) + if status + cls = 'danger' + content_tag :span, status ? " #{t('false')} " : " #{t('true')}", class: "fa fa-exclamation-circle fa-lg text-#{cls}" + else + cls = 'success' + content_tag :span, status ? " #{t('false')} " : " #{t('true')}", class: "fa fa-check-circle fa-lg text-#{cls}" + end + end end diff --git a/app/views/lines/index.html.slim b/app/views/lines/index.html.slim index dda5afd44..fb07c45a2 100644 --- a/app/views/lines/index.html.slim +++ b/app/views/lines/index.html.slim @@ -36,7 +36,7 @@ ), \ TableBuilderHelper::Column.new( \ key: :deactivated, \ - attribute: Proc.new{|n| n.deactivated? ? t('false') : t('true')} \ + attribute: Proc.new { |n| line_status(n.deactivated?) } \ ), \ TableBuilderHelper::Column.new( \ key: 'networks.name', \ diff --git a/app/views/referentials/show.html.slim b/app/views/referentials/show.html.slim index e1d89cba4..0fdd79e14 100644 --- a/app/views/referentials/show.html.slim +++ b/app/views/referentials/show.html.slim @@ -58,7 +58,7 @@ ), \ TableBuilderHelper::Column.new( \ key: :deactivated, \ - attribute: Proc.new { |n| n.deactivated? ? t('false') : t('true') } \ + attribute: Proc.new { |n| line_status(n.deactivated?) } \ ), \ TableBuilderHelper::Column.new( \ key: :transport_mode, \ diff --git a/app/views/routes/show.html.slim b/app/views/routes/show.html.slim index e2681d215..edc2d254b 100644 --- a/app/views/routes/show.html.slim +++ b/app/views/routes/show.html.slim @@ -48,7 +48,7 @@ ), \ TableBuilderHelper::Column.new( \ key: :deleted_at, \ - attribute: Proc.new { |s| s.try(:stop_area).deleted_at ? t('false') : t('true') }, \ + attribute: Proc.new { |s| line_status(s.try(:stop_area).deleted_at) } \ ), \ TableBuilderHelper::Column.new( \ key: :zip_code, \ diff --git a/app/views/stop_areas/index.html.slim b/app/views/stop_areas/index.html.slim index 4c95761d2..95b9b1b0e 100644 --- a/app/views/stop_areas/index.html.slim +++ b/app/views/stop_areas/index.html.slim @@ -39,7 +39,7 @@ ), \ TableBuilderHelper::Column.new( \ key: :deleted_at, \ - attribute: Proc.new { |s| s.deleted_at ? t('false') : t('true') } \ + attribute: Proc.new { |s| line_status(s.deleted_at) } \ ), \ TableBuilderHelper::Column.new( \ key: :zip_code, \ |
