aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjpl2016-11-30 11:52:38 +0100
committerjpl2016-11-30 11:52:48 +0100
commitfdd5f8faf5c5e22fc486df99d60a5d0184af1b98 (patch)
tree26b290e36b2e0452f61de461a822491b1fa8bf0c
parentc8be59728089ccbf34a72fee709f742de11f2acf (diff)
downloadchouette-core-fdd5f8faf5c5e22fc486df99d60a5d0184af1b98.tar.bz2
Refs #1763: adding no results messages
-rw-r--r--app/helpers/newfront_helper.rb11
-rw-r--r--app/views/companies/_companies.html.slim16
-rw-r--r--app/views/networks/_networks.html.slim15
-rw-r--r--app/views/referential_companies/_companies.html.slim16
-rw-r--r--app/views/referential_lines/_lines.html.slim18
-rw-r--r--app/views/referential_networks/_networks.html.slim16
-rw-r--r--app/views/referential_stop_areas/_stop_areas.html.slim16
-rw-r--r--app/views/stop_areas/_stop_areas.html.slim24
-rw-r--r--config/locales/companies.en.yml1
-rw-r--r--config/locales/companies.fr.yml1
-rw-r--r--config/locales/lines.en.yml1
-rw-r--r--config/locales/lines.fr.yml1
-rw-r--r--config/locales/networks.en.yml1
-rw-r--r--config/locales/networks.fr.yml1
-rw-r--r--config/locales/stop_areas.en.yml1
-rw-r--r--config/locales/stop_areas.fr.yml1
16 files changed, 88 insertions, 52 deletions
diff --git a/app/helpers/newfront_helper.rb b/app/helpers/newfront_helper.rb
index 3ec1a8242..27dce3af8 100644
--- a/app/helpers/newfront_helper.rb
+++ b/app/helpers/newfront_helper.rb
@@ -1,5 +1,6 @@
module NewfrontHelper
+ # Table Builder
def table_builder collection, columns, actions, cls = nil
return unless collection.present?
@@ -90,4 +91,14 @@ module NewfrontHelper
end
+
+ # Replacement message
+ def replacement_msg text
+ content_tag :div, '', class: 'alert alert-warning' do
+ icon = content_tag :span, '', class: 'fa fa-lg fa-info-circle', style: 'margin-right:7px;'
+
+ icon + text
+ end
+ end
+
end
diff --git a/app/views/companies/_companies.html.slim b/app/views/companies/_companies.html.slim
index 7184ebd65..52ea668e1 100644
--- a/app/views/companies/_companies.html.slim
+++ b/app/views/companies/_companies.html.slim
@@ -1,7 +1,11 @@
-= table_builder @companies,
- { 'Oid' => Proc.new { |n| n.objectid.local_id }, @companies.human_attribute_name(:name) => 'name', @companies.human_attribute_name(:code) => 'code' },
- [:show, :edit, :delete],
- 'table table-bordered'
+- if @companies.any?
+ = table_builder @companies,
+ { 'Oid' => Proc.new { |n| n.objectid.local_id }, @companies.human_attribute_name(:name) => 'name', @companies.human_attribute_name(:code) => 'code' },
+ [:show, :edit, :delete],
+ 'table table-bordered'
-.text-center
- = will_paginate @companies, container: false, renderer: RemoteBootstrapPaginationLinkRenderer
+ .text-center
+ = will_paginate @companies, container: false, renderer: RemoteBootstrapPaginationLinkRenderer
+
+- else
+ = replacement_msg t('companies.search_no_results')
diff --git a/app/views/networks/_networks.html.slim b/app/views/networks/_networks.html.slim
index 531454719..a53ca80d5 100644
--- a/app/views/networks/_networks.html.slim
+++ b/app/views/networks/_networks.html.slim
@@ -1,11 +1,14 @@
-= table_builder @networks,
- { 'Oid' => Proc.new { |n| n.objectid.local_id }, @networks.human_attribute_name(:name) => 'name' },
- [:show, :edit, :delete],
- 'table table-bordered'
+- if @networks.any?
+ = table_builder @networks,
+ { 'Oid' => Proc.new { |n| n.objectid.local_id }, @networks.human_attribute_name(:name) => 'name' },
+ [:show, :edit, :delete],
+ 'table table-bordered'
-.text-center
- = will_paginate @networks, container: false, renderer: RemoteBootstrapPaginationLinkRenderer
+ .text-center
+ = will_paginate @networks, container: false, renderer: RemoteBootstrapPaginationLinkRenderer
+- else
+ = replacement_msg t('networks.search_no_results')
/ .networks
/ table.table.table-bordered.table-hover
diff --git a/app/views/referential_companies/_companies.html.slim b/app/views/referential_companies/_companies.html.slim
index aadbc7b78..a9c59f84f 100644
--- a/app/views/referential_companies/_companies.html.slim
+++ b/app/views/referential_companies/_companies.html.slim
@@ -1,7 +1,11 @@
-= table_builder @companies,
- { 'Oid' => Proc.new { |n| n.objectid.local_id }, Chouette::Company.human_attribute_name(:name) => 'name', Chouette::Company.human_attribute_name(:code) => 'code' },
- [:show, :edit, :delete],
- 'table table-bordered'
+- if @companies.any?
+ = table_builder @companies,
+ { 'Oid' => Proc.new { |n| n.objectid.local_id }, Chouette::Company.human_attribute_name(:name) => 'name', Chouette::Company.human_attribute_name(:code) => 'code' },
+ [:show, :edit, :delete],
+ 'table table-bordered'
-.text-center
- = will_paginate @companies, container: false, renderer: RemoteBootstrapPaginationLinkRenderer
+ .text-center
+ = will_paginate @companies, container: false, renderer: RemoteBootstrapPaginationLinkRenderer
+
+- else
+ = replacement_msg t('companies.search_no_results')
diff --git a/app/views/referential_lines/_lines.html.slim b/app/views/referential_lines/_lines.html.slim
index f765f4a4d..662c42f8c 100644
--- a/app/views/referential_lines/_lines.html.slim
+++ b/app/views/referential_lines/_lines.html.slim
@@ -1,8 +1,12 @@
-= table_builder @lines,
- { 'Oid' => Proc.new { |n| n.objectid.local_id }, @lines.human_attribute_name(:id) => 'id',
- @lines.human_attribute_name(:number) => 'number', @lines.human_attribute_name(:name) => 'name', @lines.human_attribute_name(:network) => Proc.new { |n| n.network.name }, @lines.human_attribute_name(:company) => Proc.new { |n| n.company.name }, @lines.human_attribute_name(:group_of_lines) => Proc.new { |n| n.group_of_lines.count } },
- [:show, :edit, :delete],
- 'table table-bordered'
+- if @lines.any?
+ = table_builder @lines,
+ { 'Oid' => Proc.new { |n| n.objectid.local_id }, @lines.human_attribute_name(:id) => 'id',
+ @lines.human_attribute_name(:number) => 'number', @lines.human_attribute_name(:name) => 'name', @lines.human_attribute_name(:network) => Proc.new { |n| n.network.name }, @lines.human_attribute_name(:company) => Proc.new { |n| n.company.name }, @lines.human_attribute_name(:group_of_lines) => Proc.new { |n| n.group_of_lines.count } },
+ [:show, :edit, :delete],
+ 'table table-bordered'
-.text-center
- = will_paginate @lines, container: false, renderer: RemoteBootstrapPaginationLinkRenderer
+ .text-center
+ = will_paginate @lines, container: false, renderer: RemoteBootstrapPaginationLinkRenderer
+
+- else
+ = replacement_msg t('referential_lines.search_no_results')
diff --git a/app/views/referential_networks/_networks.html.slim b/app/views/referential_networks/_networks.html.slim
index fc462c171..6835dcbbe 100644
--- a/app/views/referential_networks/_networks.html.slim
+++ b/app/views/referential_networks/_networks.html.slim
@@ -1,7 +1,11 @@
-= table_builder @networks,
- { 'Oid' => Proc.new { |n| n.objectid.local_id }, Chouette::Network.human_attribute_name(:name) => 'name' },
- [:show, :edit, :delete],
- 'table table-bordered'
+- if @networks.any?
+ = table_builder @networks,
+ { 'Oid' => Proc.new { |n| n.objectid.local_id }, Chouette::Network.human_attribute_name(:name) => 'name' },
+ [:show, :edit, :delete],
+ 'table table-bordered'
-.text-center
- = will_paginate @networks, container: false, renderer: RemoteBootstrapPaginationLinkRenderer
+ .text-center
+ = will_paginate @networks, container: false, renderer: RemoteBootstrapPaginationLinkRenderer
+
+- else
+ = replacement_msg t('networks.search_no_results')
diff --git a/app/views/referential_stop_areas/_stop_areas.html.slim b/app/views/referential_stop_areas/_stop_areas.html.slim
index a79c86a96..bb646d914 100644
--- a/app/views/referential_stop_areas/_stop_areas.html.slim
+++ b/app/views/referential_stop_areas/_stop_areas.html.slim
@@ -1,7 +1,11 @@
-= table_builder @stop_areas,
- { 'Object_id' => 'objectid', @stop_areas.human_attribute_name(:name) => 'name', @stop_areas.human_attribute_name(:registration_number) => 'registration_number', @stop_areas.human_attribute_name(:city_name) => 'city_name', @stop_areas.human_attribute_name(:zip_code) => 'zip_code', @stop_areas.human_attribute_name(:lines) => Proc.new { |n| n.lines.count } },
- [:show, :edit, :delete],
- 'table table-bordered'
+- if @stop_areas.any?
+ = table_builder @stop_areas,
+ { 'Object_id' => 'objectid', @stop_areas.human_attribute_name(:name) => 'name', @stop_areas.human_attribute_name(:registration_number) => 'registration_number', @stop_areas.human_attribute_name(:city_name) => 'city_name', @stop_areas.human_attribute_name(:zip_code) => 'zip_code', @stop_areas.human_attribute_name(:lines) => Proc.new { |n| n.lines.count } },
+ [:show, :edit, :delete],
+ 'table table-bordered'
-.text-center
- = will_paginate @stop_areas, container: false, renderer: RemoteBootstrapPaginationLinkRenderer
+ .text-center
+ = will_paginate @stop_areas, container: false, renderer: RemoteBootstrapPaginationLinkRenderer
+
+- else
+ = replacement_msg t('stop_areas.search_no_results')
diff --git a/app/views/stop_areas/_stop_areas.html.slim b/app/views/stop_areas/_stop_areas.html.slim
index 8bbc65776..bb646d914 100644
--- a/app/views/stop_areas/_stop_areas.html.slim
+++ b/app/views/stop_areas/_stop_areas.html.slim
@@ -1,17 +1,11 @@
-= table_builder @stop_areas,
- { 'Object_id' => 'objectid', @stop_areas.human_attribute_name(:name) => 'name', @stop_areas.human_attribute_name(:registration_number) => 'registration_number', @stop_areas.human_attribute_name(:city_name) => 'city_name', @stop_areas.human_attribute_name(:zip_code) => 'zip_code', @stop_areas.human_attribute_name(:lines) => Proc.new { |n| n.lines.count } },
- [:show, :edit, :delete],
- 'table table-bordered'
+- if @stop_areas.any?
+ = table_builder @stop_areas,
+ { 'Object_id' => 'objectid', @stop_areas.human_attribute_name(:name) => 'name', @stop_areas.human_attribute_name(:registration_number) => 'registration_number', @stop_areas.human_attribute_name(:city_name) => 'city_name', @stop_areas.human_attribute_name(:zip_code) => 'zip_code', @stop_areas.human_attribute_name(:lines) => Proc.new { |n| n.lines.count } },
+ [:show, :edit, :delete],
+ 'table table-bordered'
-.text-center
- = will_paginate @stop_areas, container: false, renderer: RemoteBootstrapPaginationLinkRenderer
+ .text-center
+ = will_paginate @stop_areas, container: false, renderer: RemoteBootstrapPaginationLinkRenderer
-/ .page_info
-/ span.search = t("will_paginate.page_entries_info.search")
-/ = page_entries_info @stop_areas
-/
-/ .stop_areas.paginated_content
-/ = paginated_content(@stop_areas)
-/
-/ .pagination
-/ = will_paginate @stop_areas, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer
+- else
+ = replacement_msg t('stop_areas.search_no_results')
diff --git a/config/locales/companies.en.yml b/config/locales/companies.en.yml
index 706b8e62f..55ad321d8 100644
--- a/config/locales/companies.en.yml
+++ b/config/locales/companies.en.yml
@@ -1,5 +1,6 @@
en:
companies: &en_companies
+ search_no_results: "No company matching your query"
actions:
new: "Add a new company"
edit: "Edit this company"
diff --git a/config/locales/companies.fr.yml b/config/locales/companies.fr.yml
index 61967fc2b..4d268a407 100644
--- a/config/locales/companies.fr.yml
+++ b/config/locales/companies.fr.yml
@@ -1,5 +1,6 @@
fr:
companies: &fr_companies
+ search_no_results: "Aucun transporteur ne correspond à votre recherche"
actions:
new: "Ajouter un transporteur"
edit: "Modifier ce transporteur"
diff --git a/config/locales/lines.en.yml b/config/locales/lines.en.yml
index e7c8f9d97..4f8392196 100644
--- a/config/locales/lines.en.yml
+++ b/config/locales/lines.en.yml
@@ -1,5 +1,6 @@
en:
lines: &en_lines
+ search_no_results: "No line matching your query"
actions:
new: "Add a new line"
edit: "Edit this line"
diff --git a/config/locales/lines.fr.yml b/config/locales/lines.fr.yml
index e4cfdb513..46508d083 100644
--- a/config/locales/lines.fr.yml
+++ b/config/locales/lines.fr.yml
@@ -1,5 +1,6 @@
fr:
lines: &fr_lines
+ search_no_results: "Aucune ligne ne correspond à votre recherche"
actions:
new: "Ajouter une ligne"
edit: "Modifier cette ligne"
diff --git a/config/locales/networks.en.yml b/config/locales/networks.en.yml
index 225d28005..fdec3d45a 100644
--- a/config/locales/networks.en.yml
+++ b/config/locales/networks.en.yml
@@ -1,5 +1,6 @@
en:
networks: &en_networks
+ search_no_results: "No network matching your query"
actions:
new: "Add a new network"
edit: "Edit this network"
diff --git a/config/locales/networks.fr.yml b/config/locales/networks.fr.yml
index 00ad84668..0621a6689 100644
--- a/config/locales/networks.fr.yml
+++ b/config/locales/networks.fr.yml
@@ -1,5 +1,6 @@
fr:
networks: &fr_networks
+ search_no_results: "Aucun réseau ne correspond à votre recherche"
actions:
new: "Ajouter un réseau"
edit: "Modifier ce réseau"
diff --git a/config/locales/stop_areas.en.yml b/config/locales/stop_areas.en.yml
index d06da3e76..1bfdad7e3 100644
--- a/config/locales/stop_areas.en.yml
+++ b/config/locales/stop_areas.en.yml
@@ -1,5 +1,6 @@
en:
stop_areas: &en_stop_areas
+ search_no_results: "No stop area matching your query"
default_geometry_success: "%{count} modified stop areas"
stop_area:
no_position: "No Position"
diff --git a/config/locales/stop_areas.fr.yml b/config/locales/stop_areas.fr.yml
index 0015b571d..eaa904f00 100644
--- a/config/locales/stop_areas.fr.yml
+++ b/config/locales/stop_areas.fr.yml
@@ -1,5 +1,6 @@
fr:
stop_areas: &fr_stop_areas
+ search_no_results: "Aucun arrêt ne correspond à votre recherche"
default_geometry_success: "%{count} arrêts modifiés"
stop_area:
no_position: "Pas de position"