diff options
| -rwxr-xr-x | lib/Travelynx.pm | 26 | ||||
| -rw-r--r-- | templates/_departures_efa.html.ep | 3 | ||||
| -rw-r--r-- | templates/_show_load_icons.html.ep | 4 | 
3 files changed, 33 insertions, 0 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm index 3d892ec..7c8dc19 100755 --- a/lib/Travelynx.pm +++ b/lib/Travelynx.pm @@ -447,6 +447,32 @@ sub startup {  	);  	$self->helper( +		'efa_load_icon' => sub { +			my ( $self, $occupancy ) = @_; + +			my @symbols +			  = ( +				qw(help_outline person_outline people priority_high not_interested) +			  ); + +			if ( $occupancy eq 'MANY_SEATS' ) { +				$occupancy = 1; +			} +			elsif ( $occupancy eq 'FEW_SEATS' ) { +				$occupancy = 2; +			} +			elsif ( $occupancy eq 'STANDING_ONLY' ) { +				$occupancy = 3; +			} +			elsif ( $occupancy eq 'FULL' ) { +				$occupancy = 4; +			} + +			return $symbols[$occupancy] // 'help_outline'; +		} +	); + +	$self->helper(  		'load_icon' => sub {  			my ( $self, $load ) = @_;  			my $first  = $load->{FIRST}  // 0; diff --git a/templates/_departures_efa.html.ep b/templates/_departures_efa.html.ep index 6aec1c8..0abd887 100644 --- a/templates/_departures_efa.html.ep +++ b/templates/_departures_efa.html.ep @@ -47,6 +47,9 @@  						<%= $checkin->{followee_name} %> → <%= $checkin->{arr_name} // '???' %>  					</span>  				% } +				% if ($result->occupancy) { +					<i class="material-icons tiny" aria-hidden="true"><%= efa_load_icon($result->occupancy) %></i> +				% }  			% }  		</span>  	</li> diff --git a/templates/_show_load_icons.html.ep b/templates/_show_load_icons.html.ep index e69dab5..21093b9 100644 --- a/templates/_show_load_icons.html.ep +++ b/templates/_show_load_icons.html.ep @@ -5,3 +5,7 @@  	% }  	<i class="material-icons tiny" aria-hidden="true"><%= $second %></i>  % } +% elsif ($station->[2]{efa_load}) { +	% my ($icon) = efa_load_icon($station->[2]{efa_load}); +	<i class="material-icons tiny" aria-hidden="true"><%= $icon %></i> +% }  | 
