flash.moe/tpl/index.php

85 lines
3.9 KiB
PHP

<?php
$self->extends('master');
$self->header_title = 'flash.moe';
$self->header_is_index = true;
$self->footer_onload = [['fm.initIndex']];
$self->block('container', function($self) {
?>
<div class="index-menu">
<?php for($i = 1; $i < count($self->header_nav); ++$i): $link = $self->header_nav[$i]; ?>
<a href="<?=$link['link'];?>"><?=$link['title'];?></a>
<?php endfor; ?>
</div>
<div class="index-featured">
<div class="index-feature">
<div class="index-feature-header">
<a href="/projects" class="index-feature-header-link"></a>
<div class="index-feature-header-title">Projects</div>
<div class="index-feature-header-more">More</div>
</div>
<?php
foreach($self->projects as $project):
$links = [];
if($project->hasHomePageUrl())
$links[] = ['class' => 'homepage', 'text' => 'Homepage', 'url' => $project->getHomePageUrl()];
if($project->hasSourceUrl())
$links[] = ['class' => 'repository', 'text' => 'Source', 'url' => $project->getSourceUrl()];
if($project->hasDiscussionUrl())
$links[] = ['class' => 'forum', 'text' => 'Discussion', 'url' => $project->getDiscussionUrl()];
$colour = $project->hasColour() ? $project->getColour() : $self->languages->getProjectColour($project);
$colour = str_pad(dechex($colour), 6, '0', STR_PAD_LEFT);
?>
<div class="index-project" style="background-color: #<?=$colour;?>;">
<a href="/projects#<?=$project->getCleanName();?>" class="index-project-anchor"></a>
<div class="index-project-content">
<div class="index-project-name"><?=$project->getName();?></div>
<?php if($project->hasSummary()): ?>
<div class="index-project-summary"><?=$project->getSummary();?></div>
<?php endif; ?>
</div>
<?php if(!empty($links)): ?>
<div class="index-project-links">
<?php foreach($links as $link): ?>
<a class="index-project-link index-project-link-<?=$link['class'];?>" href="<?=$link['url'];?>" rel="noopener" target="_blank"><?=$link['text'];?></a>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<div class="index-feature">
<div class="index-feature-header">
<a href="/contact" class="index-feature-header-link"></a>
<div class="index-feature-header-title">Contact</div>
<div class="index-feature-header-more">More</div>
</div>
<div class="index-contact">
<?php foreach($self->contacts as $contact): ?>
<div class="social social-<?=$contact->getName();?>" style="--social-colour: <?=$contact->getColourHex();?>">
<?php if($contact->hasLink()): ?>
<a href="<?=$contact->getLink();?>" class="social-background" target="_blank" rel="noopener"></a>
<?php else: ?>
<div class="social-background" onclick="fm.selectTextInElement(this.parentNode.querySelector('.social-handle')); fm.copySelectedText();"></div>
<?php endif; ?>
<div class="social-icon <?=$contact->getIcon();?>"></div>
<div class="social-content">
<div class="social-name"><?=$contact->getTitle();?></div>
<div class="social-handle"><?=$contact->getDisplay();?></div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
<?php
});