aboutsummaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb4
-rw-r--r--app/helpers/breadcrumb_helper.rb34
-rw-r--r--app/helpers/history_helper.rb4
-rw-r--r--app/helpers/newapplication_helper.rb274
-rw-r--r--app/helpers/newfront_helper.rb116
-rw-r--r--app/helpers/pagination_helper.rb18
-rw-r--r--app/helpers/routes_helper.rb2
-rw-r--r--app/helpers/stop_areas_helper.rb31
8 files changed, 338 insertions, 145 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 49bc67ce7..5edb8c3bf 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,6 +1,6 @@
module ApplicationHelper
- include NewfrontHelper
+ include NewapplicationHelper
def font_awesome_classic_tag(name)
name = "fa-file-text-o" if name == "fa-file-csv-o"
@@ -9,7 +9,7 @@ module ApplicationHelper
end
def stop_area_picture_url(stop_area)
- image_path("map/#{stop_area.area_type.underscore}.png")
+ image_path("map/#{(stop_area.area_type || 'zdep').underscore}.png")
end
def selected_referential?
diff --git a/app/helpers/breadcrumb_helper.rb b/app/helpers/breadcrumb_helper.rb
index 7ef418af1..3a742d0dc 100644
--- a/app/helpers/breadcrumb_helper.rb
+++ b/app/helpers/breadcrumb_helper.rb
@@ -38,6 +38,8 @@ module BreadcrumbHelper
timeband_breadcrumb action
when 'Chouette::RoutingConstraintZone'
routing_constraint_zone_breadcrumb action
+ when 'Calendar'
+ calendar_breadcrumb action
when "StopAreaCopy"
stop_area_copy_breadcrumb action
when "Import"
@@ -70,6 +72,12 @@ module BreadcrumbHelper
end
end
+ def calendar_breadcrumb(action)
+ add_breadcrumb I18n.t('breadcrumbs.referentials'), referentials_path
+ add_breadcrumb I18n.t('calendars.index.title'), calendars_path
+ add_breadcrumb @calendar.name if %i(show edit).include? action
+ end
+
def workbench_breadcrumb(action)
add_breadcrumb I18n.t("breadcrumbs.referentials"), referentials_path
add_breadcrumb breadcrumb_label(@workbench), workbench_path(@workbench), :title => breadcrumb_tooltip(@workbench)
@@ -78,11 +86,11 @@ module BreadcrumbHelper
def network_breadcrumb(action)
if @line_referential
line_referential_breadcrumb
- add_breadcrumb Chouette::Network.model_name.human(:count => 2), line_referential_networks_path(@line_referential) unless action == :index
+ add_breadcrumb Chouette::Network.model_name.human(:count => 2).capitalize, line_referential_networks_path(@line_referential) unless action == :index
add_breadcrumb breadcrumb_label(@network), line_referential_network_path(@line_referential, @network),:title => breadcrumb_tooltip(@network) if action == :edit
else
referential_breadcrumb
- add_breadcrumb Chouette::Network.model_name.human(:count => 2), referential_networks_path(@referential) unless action == :index
+ add_breadcrumb Chouette::Network.model_name.human(:count => 2).capitalize, referential_networks_path(@referential) unless action == :index
add_breadcrumb breadcrumb_label(@network), referential_network_path(@referential, @network),:title => breadcrumb_tooltip(@network) if action == :edit
end
end
@@ -90,18 +98,18 @@ module BreadcrumbHelper
def group_of_line_breadcrumb(action)
if @line_referential
line_referential_breadcrumb
- add_breadcrumb Chouette::GroupOfLine.model_name.human(:count => 2), line_referential_group_of_lines_path(@line_referential) unless action == :index
+ add_breadcrumb Chouette::GroupOfLine.model_name.human(:count => 2).capitalize, line_referential_group_of_lines_path(@line_referential) unless action == :index
add_breadcrumb breadcrumb_label(@group_of_line), line_referential_group_of_line_path(@line_referential, @group_of_line),:title => breadcrumb_tooltip(@group_of_line) if action == :edit
else
referential_breadcrumb
- add_breadcrumb Chouette::GroupOfLine.model_name.human(:count => 2), referential_group_of_lines_path(@referential) unless action == :index
+ add_breadcrumb Chouette::GroupOfLine.model_name.human(:count => 2).capitalize, referential_group_of_lines_path(@referential) unless action == :index
add_breadcrumb breadcrumb_label(@group_of_line), referential_group_of_line_path(@referential, @group_of_line),:title => breadcrumb_tooltip(@group_of_line) if action == :edit
end
end
def stop_area_breadcrumb(action)
referential_breadcrumb
- add_breadcrumb Chouette::StopArea.model_name.human(:count => 2), stop_area_referential_stop_areas_path(@stop_area.stop_area_referential) unless action == :index
+ add_breadcrumb Chouette::StopArea.model_name.human(:count => 2).capitalize, stop_area_referential_stop_areas_path(@stop_area.stop_area_referential) unless action == :index
add_breadcrumb breadcrumb_label(@stop_area), stop_area_referential_stop_area_path(@stop_area.stop_area_referential, @stop_area),:title => breadcrumb_tooltip(@stop_area) if action == :edit
end
@@ -116,19 +124,19 @@ module BreadcrumbHelper
def access_link_breadcrumb(action)
access_point_breadcrumb :edit
- add_breadcrumb Chouette::AccessLink.model_name.human(:count => 2), access_links_referential_stop_area_path(@referential, @stop_area)
+ add_breadcrumb Chouette::AccessLink.model_name.human(:count => 2).capitalize.capitalize, access_links_referential_stop_area_path(@referential, @stop_area)
add_breadcrumb breadcrumb_label(@access_link), referential_access_point_access_link_path(@referential, @access_point,@access_link),:title => breadcrumb_tooltip(@access_link) if action == :edit
end
def connection_link_breadcrumb(action)
referential_breadcrumb
- add_breadcrumb Chouette::ConnectionLink.model_name.human(:count => 2), referential_connection_links_path(@referential) unless action == :index
+ add_breadcrumb Chouette::ConnectionLink.model_name.human.pluralize.capitalize, referential_connection_links_path(@referential) unless action == :index
add_breadcrumb breadcrumb_label(@connection_link), referential_connection_link_path(@referential, @connection_link),:title => breadcrumb_tooltip(@connection_link) if action == :edit
end
def time_table_breadcrumb(action)
referential_breadcrumb
- add_breadcrumb Chouette::TimeTable.model_name.human(:count => 2), referential_time_tables_path(@referential) unless action == :index
+ add_breadcrumb Chouette::TimeTable.model_name.human(:count => 2).capitalize, referential_time_tables_path(@referential) unless action == :index
add_breadcrumb breadcrumb_label(@time_table), referential_time_table_path(@referential, @time_table),:title => breadcrumb_tooltip(@time_table) if action == :edit
end
@@ -140,18 +148,18 @@ module BreadcrumbHelper
def timeband_breadcrumb(action)
referential_breadcrumb
- add_breadcrumb Chouette::Timeband.model_name.human(:count => 2), referential_timebands_path(@referential) unless action == :index
+ add_breadcrumb Chouette::Timeband.model_name.human(:count => 2).capitalize, referential_timebands_path(@referential) unless action == :index
add_breadcrumb breadcrumb_label(@timeband), referential_timeband_path(@referential, @timeband),:title => breadcrumb_tooltip(@timeband) if action == :edit
end
def line_breadcrumb(action)
if @line_referential
line_referential_breadcrumb
- add_breadcrumb Chouette::Line.model_name.human(:count => 2), line_referential_lines_path(@line_referential) unless action == :index
+ add_breadcrumb Chouette::Line.model_name.human(:count => 2).capitalize, line_referential_lines_path(@line_referential) unless action == :index
add_breadcrumb breadcrumb_label(@line), line_referential_line_path(@line_referential, @line),:title => breadcrumb_tooltip(@line) if action == :edit
else
referential_breadcrumb
- add_breadcrumb Chouette::Line.model_name.human(:count => 2), referential_lines_path(@referential) unless action == :index
+ add_breadcrumb Chouette::Line.model_name.human(:count => 2).capitalize, referential_lines_path(@referential) unless action == :index
add_breadcrumb breadcrumb_label(@line), referential_line_path(@referential, @line),:title => breadcrumb_tooltip(@line) if action == :edit
end
end
@@ -198,11 +206,11 @@ module BreadcrumbHelper
def company_breadcrumb (action)
if @line_referential
line_referential_breadcrumb
- add_breadcrumb Chouette::Company.model_name.human(:count => 2), line_referential_companies_path(@line_referential) unless action == :index
+ add_breadcrumb Chouette::Company.model_name.human(:count => 2).capitalize, line_referential_companies_path(@line_referential) unless action == :index
add_breadcrumb breadcrumb_label(@company), line_referential_company_path(@line_referential, @company),:title => breadcrumb_tooltip(@company) if action == :edit
else
referential_breadcrumb
- add_breadcrumb Chouette::Company.model_name.human(:count => 2), referential_companies_path(@referential) unless action == :index
+ add_breadcrumb Chouette::Company.model_name.human(:count => 2).capitalize, referential_companies_path(@referential) unless action == :index
add_breadcrumb breadcrumb_label(@company), referential_company_path(@referential, @company),:title => breadcrumb_tooltip(@company) if action == :edit
end
end
diff --git a/app/helpers/history_helper.rb b/app/helpers/history_helper.rb
index 3ad38a11e..56c651c1d 100644
--- a/app/helpers/history_helper.rb
+++ b/app/helpers/history_helper.rb
@@ -4,9 +4,7 @@ module HistoryHelper
field_set_tag t("layouts.history_tag.title"), :class => "history_tag" do
content_tag :ul do
[(content_tag :li do
- if object.has_attribute?(:creation_time)
- object.human_attribute_name('creation_time') + ' : ' + l(object.creation_time, :format => :short)
- else
+ if object.has_attribute?(:created_at)
object.class.human_attribute_name('created_at') + ' : ' + l(object.created_at, :format => :short)
end
end),
diff --git a/app/helpers/newapplication_helper.rb b/app/helpers/newapplication_helper.rb
new file mode 100644
index 000000000..194672c73
--- /dev/null
+++ b/app/helpers/newapplication_helper.rb
@@ -0,0 +1,274 @@
+module NewapplicationHelper
+
+ # Table Builder
+ def table_builder collection, columns, actions, selectable = [], cls = nil
+ return unless collection.present?
+
+ head = content_tag :thead do
+ content_tag :tr do
+ hcont = []
+
+ unless selectable.empty?
+ cbx = content_tag :div, '', class: 'checkbox' do
+ check_box_tag('0', 'all').concat(content_tag(:label, '', for: '0'))
+ end
+ hcont << content_tag(:th, cbx)
+ end
+
+ columns.map do |k, v|
+ hcont << content_tag(:th, sortable_columns(collection, k))
+ end
+ hcont << content_tag(:th, '') if actions.any?
+
+ hcont.join.html_safe
+ end
+ end
+
+ body = content_tag :tbody do
+ collection.collect do |item|
+ content_tag :tr do
+ bcont = []
+
+ unless selectable.empty?
+ cbx = content_tag :div, '', class: 'checkbox' do
+ check_box_tag(item.try(:id), item.try(:id)).concat(content_tag(:label, '', for: item.try(:id)))
+ end
+ bcont << content_tag(:td, cbx)
+ end
+
+ columns.map do |k, attribute|
+ value =
+ if Proc === attribute
+ attribute.call(item)
+ else
+ item.try(attribute)
+ end
+ if attribute == 'name'
+ lnk = []
+
+ unless item.class.to_s == 'Calendar' or item.class.to_s == 'Referential'
+ if current_referential
+ lnk << current_referential
+ lnk << item.line if item.respond_to? :line
+ lnk << item if item.respond_to? :line_referential
+ lnk << item.stop_area if item.respond_to? :stop_area
+ lnk << item if item.respond_to? :stop_points
+ elsif item.respond_to? :referential
+ lnk << item.referential
+ end
+ else
+ lnk << item
+ end
+
+ bcont << content_tag(:td, link_to(value, lnk), title: 'Voir')
+ else
+ bcont << content_tag(:td, value)
+ end
+ end
+ bcont << content_tag(:td, links_builder(item, actions), class: 'actions') if actions.any?
+
+ bcont.join.html_safe
+ end
+ end.join.html_safe
+ end
+
+ if selectable.empty?
+ content_tag :table, head + body, class: cls
+ else
+ content_tag :div, '', class: 'select_table' do
+ table = content_tag :table, head + body, class: cls
+ toolbox = select_toolbox(selectable)
+ table + toolbox
+ end
+ end
+ end
+
+ def links_builder(item, actions)
+ trigger = content_tag :div, class: 'btn dropdown-toggle', data: { toggle: 'dropdown' } do
+ content_tag :span, '', class: 'fa fa-cog'
+ end
+
+ menu = content_tag :ul, class: 'dropdown-menu' do
+ actions.collect do |action|
+ polymorph_url = []
+
+ unless [:show, :delete].include? action
+ polymorph_url << action
+ end
+
+ unless item.class.to_s == 'Calendar' or item.class.to_s == 'Referential'
+ if current_referential
+ polymorph_url << current_referential
+ polymorph_url << item.line if item.respond_to? :line
+ polymorph_url << item if item.respond_to? :line_referential
+ polymorph_url << item.stop_area if item.respond_to? :stop_area
+ polymorph_url << item if item.respond_to? :stop_points
+ elsif item.respond_to? :referential
+ polymorph_url << item.referential
+ end
+ else
+ polymorph_url << item
+ end
+
+ if action == :delete
+ if policy(item).present?
+ if policy(item).destroy?
+ content_tag :li, '', class: 'delete-action' do
+ link_to(polymorph_url, method: :delete, data: { confirm: 'Etes-vous sûr(e) de vouloir effectuer cette action ?' }) do
+ txt = t("actions.#{action}")
+ pic = content_tag :span, '', class: 'fa fa-trash'
+ pic + txt
+ end
+ end
+ end
+ else
+ content_tag :li, '', class: 'delete-action' do
+ link_to(polymorph_url, method: :delete, data: { confirm: 'Etes-vous sûr(e) de vouloir effectuer cette action ?' }) do
+ txt = t("actions.#{action}")
+ pic = content_tag :span, '', class: 'fa fa-trash'
+ pic + txt
+ end
+ end
+ end
+
+ elsif action == :edit
+ if policy(item).present?
+ if policy(item).update?
+ content_tag :li, link_to(t("actions.#{action}"), polymorph_url)
+ end
+ else
+ content_tag :li, link_to(t("actions.#{action}"), polymorph_url)
+ end
+ elsif action == :archive
+ unless item.archived?
+ content_tag :li, link_to(t("actions.#{action}"), polymorph_url, method: :put)
+ end
+ elsif action == :unarchive
+ if item.archived?
+ content_tag :li, link_to(t("actions.#{action}"), polymorph_url, method: :put)
+ end
+ else
+ content_tag :li, link_to(t("actions.#{action}"), polymorph_url)
+ end
+ end.join.html_safe
+ end
+
+ content_tag :div, trigger + menu, class: 'btn-group'
+
+ end
+
+ def sortable_columns collection, key
+ direction = (key == params[:sort] && params[:direction] == 'desc') ? 'asc' : 'desc'
+
+ link_to({sort: key, direction: direction}) do
+ pic1 = content_tag :span, '', class: "fa fa-sort-asc #{(direction == 'desc') ? 'active' : ''}"
+ pic2 = content_tag :span, '', class: "fa fa-sort-desc #{(direction == 'asc') ? 'active' : ''}"
+
+ pics = content_tag :span, pic1 + pic2, class: 'orderers'
+ (key.to_s + pics).html_safe
+ end
+ end
+
+ # Actions on select toolbox (for selectables tables)
+ def select_toolbox(actions)
+ tools = content_tag :ul do
+ actions.collect do |action|
+
+ actitem = link_to '#', title: t("actions.#{action}") do
+ if action == :edit
+ content_tag :span, '', class: 'fa fa-pencil'
+ elsif action == :delete
+ content_tag :span, '', class: 'fa fa-trash'
+ end
+ end
+
+ content_tag :li, actitem, class: 'st_action'
+ end.join.html_safe
+
+ end
+ content_tag :div, '', class: 'select_toolbox noselect' do
+ tools.concat(content_tag(:span, ("<span>0</span> élément(s) sélectionné(s)").html_safe, class: 'info-msg'))
+ end
+ 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
+
+ # PageHeader builder
+ def pageheader pageicon, pagetitle, desc = nil, meta = nil, mainaction = nil, &block
+
+ firstRow = content_tag :div, '', class: 'row' do
+ # Left part with pageicon & pagetitle & desc
+ left = content_tag :div, '', class: 'col-lg-9 col-md-8 col-sm-7 col-xs-7' do
+ picon = content_tag :div, '', class: 'page-icon' do
+ content_tag :span, '', class: "fa fa-lg fa-#{pageicon}"
+ end
+ ptitle = content_tag :div, '', class: 'page-title' do
+ content_tag :h1, pagetitle, title: desc
+ end
+
+ picon + ptitle
+ end
+ # Right part with meta & mainaction
+ right = content_tag :div, '', class: 'col-lg-3 col-md-4 col-sm-5 col-xs-5 text-right' do
+ content_tag :div, '', class: 'page-action' do
+ a = content_tag :div, meta.try(:html_safe), class: 'small'
+ b = mainaction.try(:html_safe)
+
+ a + b
+ end
+ end
+
+ left + right
+ end
+
+ content_tag :div, '', class: 'page_header' do
+ content_tag :div, '', class: 'container-fluid' do
+ if block_given?
+ firstRow + capture(&block)
+ else
+ firstRow
+ end
+ end
+ end
+ end
+
+ # Definition list
+ def definition_list title, test
+ return unless test.present?
+
+ head = content_tag(:div, title, class: 'dl-head')
+
+ body = content_tag :div, class: 'dl-body' do
+ cont = []
+ test.map do |k, v|
+ cont << content_tag(:div, k, class: 'dl-term')
+ cont << content_tag(:div, v, class: 'dl-def')
+ end
+ cont.join.html_safe
+ end
+
+ content_tag :div, '', class: 'definition-list' do
+ head + body
+ end
+ end
+
+ # ModalBox Builder
+ def modalbox id, &block
+ content_tag(:div, '', class: 'modal fade', id: id, tabindex: 1, role: 'dialog') do
+ content_tag(:div, '', class: 'modal-container') do
+ content_tag(:div, '', class: 'modal-dialog') do
+ content_tag(:div, '', class: 'modal-content') do
+ yield
+ end
+ end
+ end
+ end
+ end
+
+end
diff --git a/app/helpers/newfront_helper.rb b/app/helpers/newfront_helper.rb
deleted file mode 100644
index 2abfd589d..000000000
--- a/app/helpers/newfront_helper.rb
+++ /dev/null
@@ -1,116 +0,0 @@
-module NewfrontHelper
-
- # Table Builder
- def table_builder collection, columns, actions, cls = nil
- return unless collection.present?
-
- head = content_tag :thead do
- content_tag :tr do
- hcont = []
- columns.map do |k, v|
- # hcont << content_tag(:th, k.to_s.titleize)
- hcont << content_tag(:th, sortable_columns(collection, k))
- end
- hcont << content_tag(:th, 'Actions', class: 'text-center') if actions.any?
-
- hcont.join.html_safe
- end
- end
-
- body = content_tag :tbody do
- collection.collect do |item|
- content_tag :tr do
- bcont = []
- columns.map do |k, attribute|
- value =
- if Proc === attribute
- attribute.call(item)
- else
- item.try(attribute)
- end
- bcont << content_tag(:td, value)
- end
- bcont << content_tag(:td, links_builder(item, actions), class: 'text-center') if actions.any?
-
- bcont.join.html_safe
- end
- end.join.html_safe
- end
-
- content_tag :table, head + body, class: cls
- end
-
- def links_builder(item, actions)
- trigger = content_tag :div, class: 'btn btn-primary dropdown-toggle', data: { toggle: 'dropdown' } do
- a = content_tag :span, '', class: 'fa fa-bars'
- b = content_tag :span, '', class: 'caret'
- a + b
- end
-
- menu = content_tag :ul, class: 'dropdown-menu' do
- actions.collect do |action|
- polymorph_url = []
-
- unless [:show, :delete].include? action
- polymorph_url << action
- end
-
- if current_referential
- polymorph_url << current_referential
- polymorph_url << item.line if item.respond_to? :line
- elsif item.respond_to? :referential
- polymorph_url << item.referential
- elsif item.respond_to? :line_referential
- polymorph_url << item.line_referential
- end
-
- polymorph_url << item
-
- if action == :delete
- if policy(item).present?
- if policy(item).destroy?
- content_tag :li, link_to(t("table.#{action}"), polymorph_url, method: :delete, data: { confirm: 'Etes-vous sûr(e) de vouloir effectuer cette action ?' })
- end
- else
- content_tag :li, link_to(t("table.#{action}"), polymorph_url, method: :delete, data: { confirm: 'Etes-vous sûr(e) de vouloir effectuer cette action ?' })
- end
-
- elsif action == :edit
- if policy(item).present?
- if policy(item).update?
- content_tag :li, link_to(t("table.#{action}"), polymorph_url)
- end
- else
- content_tag :li, link_to(t("table.#{action}"), polymorph_url)
- end
- else
- content_tag :li, link_to(t("table.#{action}"), polymorph_url)
- end
- end.join.html_safe
- end
-
- content_tag :div, trigger + menu, class: 'btn-group btn-group-xs'
-
- end
-
- def sortable_columns collection, key
- direction = (key == params[:sort] && params[:direction] == 'desc') ? 'asc' : 'desc'
-
- icon = 'sort-desc' if direction == 'asc'
- icon = 'sort-asc' if direction == 'desc'
-
- link_to({sort: key, direction: direction}) do
- pic = content_tag :span, '', class: "fa fa-#{icon}", style: 'margin-left:5px'
- (key.to_s.titleize + pic).html_safe
- end
- 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/helpers/pagination_helper.rb b/app/helpers/pagination_helper.rb
index e373629af..350d796ea 100644
--- a/app/helpers/pagination_helper.rb
+++ b/app/helpers/pagination_helper.rb
@@ -1,5 +1,5 @@
-# coding: utf-8
module PaginationHelper
+
def paginated_content(models, default_partial_name = nil, options = {})
default_options = {:delete => true, :edit => true}
options = default_options.merge(options)
@@ -18,4 +18,20 @@ module PaginationHelper
return html.html_safe unless models.blank?
end
+
+ def new_pagination collection, cls = nil
+ k = collection.first.class
+ pinfos = page_entries_info collection, model: k, html: false
+
+ if collection.total_pages > 1
+ links = content_tag :div, '', class: 'page_links' do
+ will_paginate collection, container: false, page_links: false, previous_label: '', next_label: ''
+ end
+
+ content_tag :div, pinfos.concat(links).html_safe, class: "pagination #{cls}"
+ else
+ content_tag :div, pinfos, class: "pagination #{cls}"
+ end
+ end
+
end
diff --git a/app/helpers/routes_helper.rb b/app/helpers/routes_helper.rb
index b55308eb8..40c1278f7 100644
--- a/app/helpers/routes_helper.rb
+++ b/app/helpers/routes_helper.rb
@@ -15,7 +15,7 @@ module RoutesHelper
def route_json_for_edit(route)
route.stop_points.includes(:stop_area).map do |stop_point|
- stop_area_attributes = stop_point.stop_area.attributes.slice("name","city_name", "zip_code")
+ stop_area_attributes = stop_point.stop_area.attributes.slice("name","city_name", "zip_code", "registration_number", "longitude", "latitude")
stop_point_attributes = stop_point.attributes.slice("for_boarding","for_alighting")
stop_area_attributes.merge(stop_point_attributes).merge(stoppoint_id: stop_point.id, stoparea_id: stop_point.stop_area.id).merge(user_objectid: stop_point.stop_area.user_objectid)
end.to_json
diff --git a/app/helpers/stop_areas_helper.rb b/app/helpers/stop_areas_helper.rb
index db8d40920..2188a272d 100644
--- a/app/helpers/stop_areas_helper.rb
+++ b/app/helpers/stop_areas_helper.rb
@@ -1,24 +1,24 @@
module StopAreasHelper
def explicit_name(stop_area)
name = localization = ""
-
+
name += truncate(stop_area.name, :length => 30) || ""
name += (" <small>["+ ( truncate(stop_area.registration_number, :length => 10) || "") + "]</small>") if stop_area.registration_number
-
+
localization += stop_area.zip_code || ""
localization += ( truncate(stop_area.city_name, :length => 15) ) if stop_area.city_name
-
+
( "<img src='#{stop_area_picture_url(stop_area)}'/>" + " <span style='height:25px; line-height:25px; margin-left: 5px; '>" + name + " <small style='height:25px; line-height:25px; margin-left: 10px; color: #555;'>" + localization + "</small></span>").html_safe
end
-
+
def genealogical_title
- return t("stop_areas.genealogical.genealogical_routing") if @stop_area.stop_area_type == 'itl'
+ return t("stop_areas.genealogical.genealogical_routing") if @stop_area.stop_area_type == 'itl'
t("stop_areas.genealogical.genealogical")
end
-
+
def show_map?
manage_itl || @stop_area.long_lat_type != nil
- end
+ end
def manage_access_points
@stop_area.stop_area_type == 'stop_place' || @stop_area.stop_area_type == 'commercial_stop_point'
@@ -32,7 +32,7 @@ module StopAreasHelper
def manage_children
@stop_area.stop_area_type == 'stop_place' || @stop_area.stop_area_type == 'commercial_stop_point'
end
-
+
def access_links_pairs(access_links)
hpairs = Hash.new
pairs = Array.new
@@ -54,10 +54,23 @@ module StopAreasHelper
end
pairs
end
-
+
def pair_key(access_link)
"#{access_link.access_point.id}-#{access_link.stop_area.id}"
end
+ def geo_data(sa, sar)
+ if sa.long_lat_type.nil?
+ content_tag :span, '-'
+ else
+ if !sa.projection.nil?
+ content_tag :span, "#{sa.projection_x}, #{sa.projection_y}"
+
+ elsif !sa.long_lat_type.nil?
+ content_tag :span, "#{sa.long_lat_type} : #{sa.longitude}, #{sa.latitude}"
+ end
+ end
+ end
+
end