modules/pageview-group/public/js/pageview-group.js
function(match){
			/*
				Depending on the match state, we shall render
				a different match view. Templates are:
					+ pageview-group.match.scheduled
					+ pageview-group.match.playing
					+ pageview-group.match.endend
			*/
			var templates = {
				'scheduled': JST['pageview-group.match.scheduled'],
				'playing': JST['pageview-group.match.playing'],
				'ended': JST['pageview-group.match.ended'],
			};

			if(match.state == 'scheduled'){

				return JST['pageview-group.match.scheduled']({match: match});

			}else if(match.state == 'playing'){

				return JST['pageview-group.match.playing']({match: match});

			}else if(match.state == 'ended'){

				// In this case, we need to set the class for A and B.
				// (teamAClass and teamBClass to null, team-win, team-loose)
				return JST['pageview-group.match.ended']({
					match: match,
					
					teamAClass: (match.teamAScore > match.teamBScore ? 'team-win'
								:match.teamAScore < match.teamBScore ? 'team-loose' : ''),

					teamBClass: (match.teamBScore > match.teamAScore ? 'team-win'
								:match.teamBScore < match.teamAScore ? 'team-loose' : ''),
				});
			}
		}
function(match){
			/*
				Depending on the match state, we shall render
				a different match view. Templates are:
					+ pageview-group.match.scheduled
					+ pageview-group.match.playing
					+ pageview-group.match.endend
			*/
			var templates = {
				'scheduled': JST['pageview-group.match.scheduled'],
				'playing': JST['pageview-group.match.playing'],
				'ended': JST['pageview-group.match.ended'],
			};

			if(match.state == 'scheduled'){

				return JST['pageview-group.match.scheduled']({match: match});

			}else if(match.state == 'playing'){

				return JST['pageview-group.match.playing']({match: match});

			}else if(match.state == 'ended'){

				// In this case, we need to set the class for A and B.
				// (teamAClass and teamBClass to null, team-win, team-loose)
				return JST['pageview-group.match.ended']({
					match: match,
					
					teamAClass: (match.teamAScore > match.teamBScore ? 'team-win'
								:match.teamAScore < match.teamBScore ? 'team-loose' : ''),

					teamBClass: (match.teamBScore > match.teamAScore ? 'team-win'
								:match.teamBScore < match.teamAScore ? 'team-loose' : ''),
				});
			}
		}
function ( match ) { /*
				Depending on the match state, we shall render
				a different match view. Templates are:
					+ pageview-group.match.scheduled
					+ pageview-group.match.playing
					+ pageview-group.match.endend
			*/ var templates = { 'scheduled' : JST [ 'pageview-group.match.scheduled' ] , 'playing' : JST [ 'pageview-group.match.playing' ] , 'ended' : JST [ 'pageview-group.match.ended' ] , } ; if ( match . state == 'scheduled' ) { return JST [ 'pageview-group.match.scheduled' ] ( { match : match } ) ; } else if ( match . state == 'playing' ) { return JST [ 'pageview-group.match.playing' ] ( { match : match } ) ; } else if ( match . state == 'ended' ) { // In this case, we need to set the class for A and B. // (teamAClass and teamBClass to null, team-win, team-loose) return JST [ 'pageview-group.match.ended' ] ( { match : match , teamAClass : ( match . teamAScore > match . teamBScore ? 'team-win' : match . teamAScore < match . teamBScore ? 'team-loose' : '' ) , teamBClass : ( match . teamBScore > match . teamAScore ? 'team-win' : match . teamBScore < match . teamAScore ? 'team-loose' : '' ) , } ) ; } }
Render a single match view with the correct view state
Render a single match view with the correct view state