templates/modules/search-widget/traffic-infos/includes/line.html.twig line 1

Open in your IDE?
  1. {% set lineColor = 'eee' %}
  2. {% if line.color is defined and line.color is not empty %}
  3. {% set lineColor = line.color %}
  4. {% endif %}
  5. {% set lineTextColor = '000' %}
  6. {% if line.textColor is defined and line.textColor is not empty %}
  7. {% set lineTextColor = line.textColor %}
  8. {% endif %}
  9. {% set disruptions = [] %}
  10. {% if currentDisruptions is defined and currentDisruptions is not empty and disruptionStatus == 'currents' %}
  11. {% set disruptions = currentDisruptions %}
  12. {% endif %}
  13. {% if futureDisruptions is defined and futureDisruptions is not empty and disruptionStatus == 'futures' %}
  14. {% set disruptions = futureDisruptions %}
  15. {% endif %}
  16. {% if showDisruptionBadge is not defined %}
  17. {% set showDisruptionBadge = false %}
  18. {% endif %}
  19. {% set style = '' %}
  20. {% if disruptionStatus is defined %}
  21. {% set style = "style=opacity:0.5" %}
  22. {% if line.disruptions[disruptionStatus ~ 's'] is defined and line.disruptions[disruptionStatus ~ 's'] is not empty %}
  23. {% set notifnumber = line.disruptions[disruptionStatus ~ 's']|length %}
  24. {% elseif line.disruptions[disruptionStatus~'Disruptions'] is defined and line.disruptions[disruptionStatus~'Disruptions'] is not empty %}
  25. {% set notifnumber = (line.disruptions[disruptionStatus~'Disruptions']|length) - 1 %}
  26. {% endif %}
  27. {% if notifnumber is defined and notifnumber > 0 %}
  28. {% set style = '' %}
  29. {% endif %}
  30. {% endif %}
  31. {% if line is defined and line is not empty %}
  32. {% set mode = 'BUS' %}
  33. {% if line.mode is defined and line.mode is not empty %}
  34. {% set mode = line.mode %}
  35. {% endif %}
  36. <span class="is-Badge {% if line.sName %} is-Badge_WithIconText{% endif %}{% if line.imageUrl is not defined or line.imageUrl is empty %} is-Badge_WithIcon{% else %} is-Badge_WithImage{% endif %}">
  37. <span class="is-Badge-Icon"><span class="is-hidden-text is-dib">{{ ('mode.' ~ line.mode|lower)|trans }}</span>
  38. <i class="is-Icon is-Icon-sim-{{ line.mode }}"></i>
  39. {% if line.scholar is defined and line.scholar %}
  40. <i class="is-Icon is-Icon-sim-scholastic" data-toggle="is-tooltip" title="{{ 'line.scholastic' | trans }}"><i class="is-path1"></i><i class="is-path2"></i></i>
  41. {% endif %}
  42. </span>
  43. {% if line.imageUrl is defined and line.imageUrl is not empty %}
  44. <img src="{{ line.imageUrl }}" alt="{{ line.sName }}" class="is-Badge-Image">
  45. {% else %}
  46. {% if line.sName %}
  47. <span class="is-Badge-Text" style="background-color: #{{ lineColor }}; color: #{{ lineTextColor }};">
  48. <span class="is-hidden-text is-dib"> {{ 'schedule.line'|trans }} </span>{{ line.sName }}
  49. </span>
  50. {% endif %}
  51. {% endif %}
  52. {% if showDisruptionBadge and disruptions is defined and line.id in disruptions.lines|keys %}
  53. {% if currentLine.disruptions is defined %}
  54. {% set disruptionsIconClass = 'is-Badge-NotifIcon is-Icon-com-notice is-Disruption-State_' ~ currentLine.disruptions.effect %}
  55. {% else %}
  56. {% set disruption = disruptions.lines[line.id].disruptions.currents[0] %}
  57. {% set disruptionsIconClass = 'is-Badge-NotifIcon is-Icon-com-notice is-Disruption-State-' ~ disruption.effect|lower %}
  58. {% endif %}
  59. <i class="{{ disruptionsIconClass }}" aria-hidden="true"></i>
  60. <span class="is-hidden-text is-dib">{{ disruptionStatus == 'currents' ? 'disruptions.status_ongoing' | trans : 'disruptions.status_tocome' | trans }}</span>
  61. {% endif %}
  62. </span>
  63. {% endif %}