templates/modules/search-widget/schedule/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 %}
  11. {% set disruptions = currentDisruptions %}
  12. {% endif %}
  13. {% if showDisruptionBadge is not defined %}
  14. {% set showDisruptionBadge = false %}
  15. {% endif %}
  16. {% set style = '' %}
  17. {% if disruptionStatus is defined and disruptionStatus == 'current' %}
  18. {% set style = "style=opacity:0.5" %}
  19. {% if line.disruptions.currents is defined and line.disruptions.currents is not empty %}
  20. {% set notifnumber = line.disruptions.currents|length %}
  21. {% elseif line.disruptions.currentDisruptions is defined and line.disruptions.currentDisruptions is not empty %}
  22. {% set notifnumber = (line.disruptions.currentDisruptions|length) - 1 %}
  23. {% endif %}
  24. {% if notifnumber is defined and notifnumber > 0 %}
  25. {% set style = '' %}
  26. {% endif %}
  27. {% endif %}
  28. {% if disruptionStatus is defined and disruptionStatus == 'future' %}
  29. {% set style = "style=opacity:0.5" %}
  30. {% if line.disruptions.futures is defined and line.disruptions.futures is not empty %}
  31. {% set notifnumber = line.disruptions.futures|length %}
  32. {% elseif line.disruptions.futureDisruptions is defined and line.disruptions.futureDisruptions is not empty %}
  33. {% set notifnumber = (line.disruptions.futureDisruptions|length) - 1 %}
  34. {% endif %}
  35. {% if notifnumber is defined and notifnumber > 0 %}
  36. {% set style = '' %}
  37. {% endif %}
  38. {% endif %}
  39. {% if line is defined and line is not empty %}
  40. {% set mode = 'BUS' %}
  41. {% if line.mode is defined and line.mode is not empty %}
  42. {% set mode = line.mode %}
  43. {% endif %}
  44. <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 %}" {{ style }}>
  45. <span class="is-Badge-Icon"><span class="is-hidden-text is-dib">{{ ('mode.' ~ line.mode|lower)|trans }}</span>
  46. <i class="is-Icon is-Icon-sim-{{ line.mode }}"></i>
  47. {% if line.scholar is defined and line.scholar %}
  48. <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>
  49. {% endif %}
  50. </span>
  51. {% if line.imageUrl is defined and line.imageUrl is not empty %}
  52. <img src="{{ line.imageUrl }}" alt="{{ line.sName }}" class="is-Badge-Image">
  53. {% else %}
  54. {% if line.sName %}
  55. <span class="is-Badge-Text" style="background-color: #{{ lineColor }}; color: #{{ lineTextColor }};">
  56. <span class="is-hidden-text is-dib"> {{ 'schedule.line'|trans }} </span>{{ line.sName }}
  57. </span>
  58. {% endif %}
  59. {% endif %}
  60. {% if showDisruptionBadge and disruptions is defined and line.id in disruptions.lines|keys %}
  61. {% set disruption = disruptions.lines[line.id].disruptions.currents[0] %}
  62. {% set disruptionsIconClass = 'is-Badge-NotifIcon is-Icon-com-notice is-Disruption-State-' ~ disruption.effect|lower %}
  63. <i class="{{ disruptionsIconClass }}" aria-hidden="true"></i>
  64. <span class="is-sr-only">{{ 'disruptions.status_ongoing' | trans }}</span>
  65. {% endif %}
  66. </span>
  67. {% endif %}