diff options
author | Minteck <contact@minteck.org> | 2022-04-22 11:48:10 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-04-22 11:48:50 +0200 |
commit | 42d9e605fc3f7e0e139a68e9916b3ccdaa721322 (patch) | |
tree | df86ce2164fe499d2290941aaf51f876ecc57181 /projects | |
parent | 958a68292191d8a4c9024ca2f1f658135ab6f704 (diff) | |
download | ember-42d9e605fc3f7e0e139a68e9916b3ccdaa721322.tar.gz ember-42d9e605fc3f7e0e139a68e9916b3ccdaa721322.tar.bz2 ember-42d9e605fc3f7e0e139a68e9916b3ccdaa721322.zip |
Update
Diffstat (limited to 'projects')
-rw-r--r-- | projects/home.php | 39 | ||||
-rw-r--r-- | projects/index.php | 31 | ||||
-rw-r--r-- | projects/view.php | 52 |
3 files changed, 97 insertions, 25 deletions
diff --git a/projects/home.php b/projects/home.php new file mode 100644 index 0000000..6ef808d --- /dev/null +++ b/projects/home.php @@ -0,0 +1,39 @@ +<?php $title = "Projects"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/header.php"; global $Parsedown; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/navigation.php"; ?> + + <br> + <div class="container"> + <h1>Projects</h1> + <br> + + <div class="row"> + <?php foreach (json_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/fetcher/projects.json"), true) as $project): if (!$project['archive']): ?> + <div class="col-lg-4"> + <div class="card stylized-card"> + <div class="card-body"> + <img class="stylized-card-icon" <?php if (!isset($project["icon"])): ?>style="background: hsla(<?= hexdec(substr($project['id'], 0, 2)) ?>, 100%, 50%, 0.1) !important;"<?php endif; ?> src="<?= isset($project["icon"]) ? $project["icon"] . "?width=96" : "/assets/img/letters/" . getLetters($project['name']) . ".png" ?>" alt=""> + <h4 class="card-title"><?= $project["name"] ?></h4> + <p class="card-text"><?= preg_replace('/[|.?!;](.*)/m', '', strip_tags($Parsedown->line(trim($project["description"])))) ?></p> + <a href="?<?= $project["id"] ?>" class="btn btn-outline-light">View Project</a> + <div class="small text-muted" style="margin-top:10px;">Updated <?= timeAgo($project['date']) ?></div> + </div> + </div> + </div> + <?php endif; endforeach; ?> + </div> + + <details> + <summary>View deprecated projects</summary> + <br> + <div class="list-group"> + <?php foreach (json_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/fetcher/projects.json"), true) as $project): if ($project['archive']): ?> + <a href="?<?= $project["id"] ?>" class="list-stylized list-group-item list-group-item-action"> + <img <?php if (!isset($project["icon"])): ?>style="background: hsla(<?= hexdec(substr($project['id'], 0, 2)) ?>, 100%, 50%, 0.1) !important;"<?php endif; ?> src="<?= isset($project["icon"]) ? $project["icon"] . "?width=96" : "/assets/img/letters/" . getLetters($project['name']) . ".png" ?>" class="memberview-icon archive-icon"> + <?= $project["name"] ?><span style="opacity:.5;"> ยท Updated <?= timeAgo($project['date']) ?></span> + </a> + <?php endif; endforeach; ?> + </div> + </details> + </div> + +<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/footer.php"; ?>
\ No newline at end of file diff --git a/projects/index.php b/projects/index.php index e693deb..0b56fe8 100644 --- a/projects/index.php +++ b/projects/index.php @@ -1,26 +1,7 @@ -<?php $title = "Projects"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/header.php"; global $Parsedown; ?> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/navigation.php"; ?> +<?php -<br> -<div class="container"> - <h1>Projects</h1> - <br> - - <div class="row"> - <?php foreach (json_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/fetcher/projects.json"), true) as $project): ?> - <div class="col-lg-4"> - <div class="card stylized-card"> - <div class="card-body"> - <img class="stylized-card-icon" <?php if (!isset($project["icon"])): ?>style="background: hsla(<?= hexdec(substr($project['id'], 0, 2)) ?>, 100%, 50%, 0.1) !important;"<?php endif; ?> src="<?= isset($project["icon"]) ? $project["icon"] . "?width=96" : "/assets/img/letters/" . getLetters($project['name']) . ".png" ?>" alt=""> - <h4 class="card-title"><?= $project["name"] ?></h4> - <p class="card-text"><?= preg_replace('/[|.?!;](.*)/m', '', strip_tags($Parsedown->line(trim($project["description"])))) ?></p> - <a href="<?= $project["web"] ?>" target="_blank" class="btn btn-outline-light">View Project</a> - <div class="small text-muted" style="margin-top:10px;">Updated <?= timeAgo($project['date']) ?></div> - </div> - </div> - </div> - <?php endforeach; ?> - </div> -</div> - -<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/footer.php"; ?>
\ No newline at end of file +if (isset(array_keys($_GET)[0])) { + require_once "view.php"; +} else { + require_once "home.php"; +}
\ No newline at end of file diff --git a/projects/view.php b/projects/view.php new file mode 100644 index 0000000..05cce0b --- /dev/null +++ b/projects/view.php @@ -0,0 +1,52 @@ +<?php + +$sel = array_keys($_GET)[0]; +$projects = json_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/fetcher/projects.json"), true); +$prj = null; + +foreach ($projects as $project) { + if ($project["id"] === $sel) { + $prj = $project; + } +} + +if ($prj === null) { + header("Location: /projects"); + die(); +} + +$title = $prj["name"] . " | Projects"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/header.php"; global $Parsedown; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/navigation.php"; ?> + + <br> + <div class="container"> + <a class="ln small-ln" href="/projects">← Go back to projects list</a> + <h1><img class="stylized-card-icon" <?php if (!isset($project["icon"])): ?>style="background: hsla(<?= hexdec(substr($prj['id'], 0, 2)) ?>, 100%, 50%, 0.1) !important;"<?php endif; ?> src="<?= isset($prj["icon"]) ? $prj["icon"] . "?width=128" : "/assets/img/letters/" . getLetters($prj['name']) . ".png" ?>" alt=""> <?= $prj["name"] ?><?php if ($prj['archive']): ?> <span style="font-size: initial;vertical-align: middle;"><span class="badge bg-warning">Deprecated</span></span><?php endif; ?></h1> + + <p><?= preg_replace('/[|.?!;](.*)/m', '', strip_tags($Parsedown->line(trim($prj["description"])))) ?><?php foreach ($prj['tags'] as $tag): ?> <span class="badge bg-secondary rounded-pill"><a class="ln ln-hidden" href="https://gitlab.minteck.org/explore/projects/topics/<?= str_replace("%2520", "%20", urlencode(str_replace(" ", "%20", $tag))) ?>" target="_blank"><?= $tag ?></a></span><?php endforeach; ?></p> + + <div class="list-group"> + <span class="list-stylized list-group-item list-stylized-static"> + <?= "<a class='ln' href='https://gitlab.minteck.org/' target='_blank'>".$prj['event']['author']['name']." (@".$prj['event']['author']['username'].")</a> ".$prj['event']['action_name']." ".(isset($prj['event']['push_data']) ? $prj['event']['push_data']['ref_type']." <code>".$prj['event']['push_data']['ref']."</code> " : (isset($prj['event']['wiki_page']) ? "wiki page <a href='" . $prj['web'] . "/-/wikis/" . $prj['event']['wiki_page']['slug'] . "' target='_blank' class='ln'><code>" . $prj['event']['wiki_page']['slug'] . "</code></a> " : "project ")) . timeAgo($prj['event']['created_at']) ?> + <?php if (isset($prj['event']['push_data']['commit_title'])): ?> + <blockquote class="stylized-quote"> + <?= strip_tags($prj['event']['push_data']['commit_title']); ?> + </blockquote> + <?php endif; ?> + </span> + </div> + + <div style="width:max-content;margin: 10px auto;"> + <div class="btn-group"> + <a type="button" class="btn btn-outline-light" href="<?= $prj['web'] ?>" target="_blank">Source Code</a> + <a type="button" class="btn btn-outline-light" href="<?= $prj['web'] ?>/activity" target="_blank">Project Activity</a> + <a type="button" class="btn btn-outline-light<?php if (!isset($prj['issues'])): ?> disabled<?php endif; ?>" href="<?php if (isset($prj['issues'])): ?>https://youtrack.minteck.org/issues/<?= $prj['issues'] ?><?php endif; ?>" target="_blank">Bug Reports</a> + <a type="button" class="btn btn-outline-light disabled" href="" target="_blank">Continuous Integration</a> + </div> + </div> + + <?= $Parsedown->text(base64_decode($prj['readme'])) ?> + + </div> + +<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/footer.php"; ?>
\ No newline at end of file |