blob: 65e82e6f0f031ee81ba088ace72de0ed836b8355 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
 | 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'
    t("stop_areas.genealogical.genealogical")
  end
  def show_map?
    manage_itl || @stop_area.long_lat_type != nil
  end
  def manage_access_points
    @stop_area.stop_area_type == 'stop_place' || @stop_area.stop_area_type == 'commercial_stop_point'
  end
  def manage_itl
    @stop_area.stop_area_type == 'itl'
  end
  def manage_parent
    @stop_area.stop_area_type != 'itl'
  end
  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
    access_links.each do |link|
      key = pair_key(link)
      pair = nil
      if (hpairs.has_key? key)
        pair = hpairs[key]
      else
        pair = AccessLinkPair.new
        pairs << pair
        hpairs[key] = pair
      end
      if (link.link_orientation_type == "access_point_to_stop_area")
        pair.from_access_point = link
      else
        pair.to_access_point = link
      end
    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, I18n.t('stop_areas.show.no_geographic_data')
    else
      if !sa.projection.nil?
        p = content_tag :span, "#{sa.human_attribute_name(:projection)} : #{sar.projection_type_label}"
        px = content_tag :span, "#{sa.human_attribute_name(:projection_x)} : #{sa.projection_x}"
        py = content_tag :span, "#{sa.human_attribute_name(:projection_y)} : #{sa.projection_y}"
      elsif !sa.long_lat_type.nil?
        lonlat = content_tag :span, "#{sa.human_attribute_name(:long_lat_type)} : #{sa.long_lat_type}"
        lon = content_tag :span, "#{sa.human_attribute_name(:longitude)} : #{sa.longitude}"
        lat = content_tag :span, "#{sa.human_attribute_name(:latitude)} : #{sa.latitude}"
      end
    end
  end
end
 |