Skip to content

Commit

Permalink
Yo!
Browse files Browse the repository at this point in the history
  • Loading branch information
taufik-nurrohman committed May 6, 2023
1 parent 9a85258 commit 6be6524
Show file tree
Hide file tree
Showing 13 changed files with 123 additions and 37 deletions.
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
Expand Down Expand Up @@ -671,4 +671,4 @@ into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
<https://www.gnu.org/licenses/why-not-lgpl.html>.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Bootstrap Album Layout for [Mecha](https://github.com/mecha-cms/mecha)

![Code Size](https://img.shields.io/github/languages/code-size/mecha-cms/y.bootstrap.album?color=%23444&style=for-the-badge)

![Bootstrap Album](index.png?v=2022-11-14)
![Bootstrap Album: Light](index.png?v=2023-05-06)

![Bootstrap Album: Dark](index/1.png?v=2023-05-06)

A fully functional layout from the [Bootstrap’s album example](https://getbootstrap.com/docs/5.3/examples/album).
24 changes: 23 additions & 1 deletion about.page
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,31 @@ image: /lot/y/bootstrap.album/index.png
images:
- /lot/y/bootstrap.album/index.png
- /lot/y/bootstrap.album/index/1.png
- /lot/y/bootstrap.album/index/2.png
link: 'https://getbootstrap.com/docs/5.3/examples/album'
author: Taufik Nurrohman
version: 1.0.0
...

A fully functional layout from the Bootstrap’s album example.
A fully functional layout from the Bootstrap’s album example.

### Usage

Typical page data structure for this layout:

~~~ .yaml
---
title: Album Title
description: Album description.
author: Album Author
type: Markdown
image: /lot/image/album/2013/cover.jpg
images:
- /lot/image/album/2013/photo-1.jpg
- /lot/image/album/2013/photo-2.jpg
- /lot/image/album/2013/photo-3.jpg
- /lot/image/album/2013/photo-4.jpg
...

Album content.
~~~
15 changes: 15 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"description": "Simple layout for photo galleries, portfolios, and more.",
"license": "GPL-3.0-or-later",
"name": "mecha-cms/y.bootstrap.album",
"require": {
"mecha-cms/x.excerpt": "^1.1.0",
"mecha-cms/x.image": "^2.4.0",
"mecha-cms/x.view": "^3.0.0"
},
"suggest": {
"mecha-cms/x.panel": "The edit button is not available without this extension.",
"mecha-cms/x.panel.image": "Install this extension if you want to have a proper featured image field in the control panel.",
"mecha-cms/x.user": "The edit button is not available without this extension."
}
}
8 changes: 7 additions & 1 deletion enter.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html data-bs-theme="light">
<html data-bs-theme="<?= $state->y->{'bootstrap.album'}->theme ?? 'light'; ?>">
<head>
<meta charset="utf-8">
<meta content="initial-scale=1,width=device-width" name="viewport">
Expand All @@ -19,5 +19,11 @@
<meta content="#712cf9" name="theme-color">
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" display="none">
<symbol fill="currentColor" id="bi-camera" viewBox="0 0 16 16">
<path d="M15 12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h1.172a3 3 0 0 0 2.12-.879l.83-.828A1 1 0 0 1 6.827 3h2.344a1 1 0 0 1 .707.293l.828.828A3 3 0 0 0 12.828 5H14a1 1 0 0 1 1 1v6zM2 4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-1.172a2 2 0 0 1-1.414-.586l-.828-.828A2 2 0 0 0 9.172 2H6.828a2 2 0 0 0-1.414.586l-.828.828A2 2 0 0 1 3.172 4H2z"></path>
<path d="M8 11a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5zm0 1a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7zM3 6.5a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0z"></path>
</symbol>
</svg>
<?= self::header(); ?>
<main>
10 changes: 8 additions & 2 deletions footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
<?= i('Back to top'); ?>
</a>
</p>
<p class="mb-1">Album example is © Bootstrap, but please download and customize it for yourself!</p>
<p class="mb-0">New to Bootstrap? <a href="https://getbootstrap.com/">Visit the homepage</a> or read our <a href="https://getbootstrap.com/docs/5.3/getting-started/introduction/">getting started guide</a>.</p>
<p class="mb-1">
&#xa9; <?= $date->year; ?> &#xb7; <a href="<?= eat($url); ?>">
<?= $site->title; ?>
</a>
</p>
<p class="mb-0">
<?= $site->description; ?>
</p>
</div>
</footer>
38 changes: 30 additions & 8 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,26 @@
<h4>
<?= $about->title; ?>
</h4>
<p class="text-body-secondary">
<?= $about->excerpt ?? $about->description; ?>
</p>
<div class="text-body-secondary">
<?php if ($excerpt = $about->excerpt): ?>
<?= $excerpt; ?>
<?php else: ?>
<p>
<?= $about->description; ?>
</p>
<?php endif; ?>
<p>
<a class="btn btn-primary btn-sm<?= 0 === strpos($url->current(false, false) . '/', $about->url . '/') ? ' disabled' : ""; ?>" href="<?= eat($about->url); ?>">
<?= i('More'); ?>
</a>
</p>
</div>
<?php else: ?>
<h4>
<?= i('Error'); ?>
</h4>
<p class="text-body-secondary" role="status">
<?= i('Missing %s file.', "<code>.\\lot\\page\\" . strtr(trim($state->routeAbout ?? 'about', '/'), '/', "\\") . ".page</code>"); ?>
<?= i('Missing %s file.', "<code>.\\lot\\page\\" . strtr(trim($state->routeAbout ?? 'about', '/'), '/', "\\") . '.page</code>'); ?>
</p>
<?php endif; ?>
</div>
Expand All @@ -24,15 +35,26 @@
<h4>
<?= $contact->title; ?>
</h4>
<p class="text-body-secondary">
<?= $contact->excerpt ?? $contact->description; ?>
</p>
<div class="text-body-secondary">
<?php if ($excerpt = $contact->excerpt): ?>
<?= $excerpt; ?>
<?php else: ?>
<p>
<?= $contact->description; ?>
</p>
<?php endif; ?>
<p>
<a class="btn btn-primary btn-sm<?= 0 === strpos($url->current(false, false) . '/', $contact->url . '/') ? ' disabled' : ""; ?>" href="<?= eat($contact->url); ?>">
<?= i('More'); ?>
</a>
</p>
</div>
<?php else: ?>
<h4>
<?= i('Error'); ?>
</h4>
<p class="text-body-secondary" role="status">
<?= i('Missing %s file.', "<code>.\\lot\\page\\" . strtr(trim($state->routeContact ?? 'contact', '/'), '/', "\\") . ".page</code>"); ?>
<?= i('Missing %s file.', "<code>.\\lot\\page\\" . strtr(trim($state->routeContact ?? 'contact', '/'), '/', "\\") . '.page</code>'); ?>
</p>
<?php endif; ?>
</div>
Expand Down
Binary file added index.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added index/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added index/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 7 additions & 6 deletions page.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
<?php endif; ?>
<?php if (!$image && !$images): ?>
<div class="align-items-center bg-body-secondary d-flex h-100 justify-content-center p-4 rounded text-body-tertiary">
<svg aria-hidden="true" class="bi bi-camera" fill="currentColor" height="160" viewBox="0 0 16 16" width="160" xmlns="http://www.w3.org/2000/svg">
<path d="M15 12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h1.172a3 3 0 0 0 2.12-.879l.83-.828A1 1 0 0 1 6.827 3h2.344a1 1 0 0 1 .707.293l.828.828A3 3 0 0 0 12.828 5H14a1 1 0 0 1 1 1v6zM2 4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-1.172a2 2 0 0 1-1.414-.586l-.828-.828A2 2 0 0 0 9.172 2H6.828a2 2 0 0 0-1.414.586l-.828.828A2 2 0 0 1 3.172 4H2z"></path>
<path d="M8 11a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5zm0 1a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7zM3 6.5a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0z"></path>
<svg aria-hidden="true" class="bi bi-camera" height="160" width="160">
<use href="#bi-camera"></use>
</svg>
</div>
<?php endif; ?>
Expand All @@ -48,9 +47,11 @@
</div>
</div>
<?php else: ?>
<p role="status">
<?= i('%s does not exist.', 'Page'); ?>
</p>
<div class="alert alert-danger" role="alert">
<p class="mb-0">
<?= i('%s does not exist.', 'Page'); ?>
</p>
</div>
<?php endif; ?>
</div>
</div>
Expand Down
35 changes: 23 additions & 12 deletions pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
<?php else: ?>
<span aria-label="<?= eat($page->title); ?>" class="card-img-top overflow-hidden ratio ratio-16x9" role="img">
<span class="align-items-center bg-body-secondary d-flex h-100 justify-content-center p-4 text-body-tertiary">
<svg aria-hidden="true" class="bi bi-camera" fill="currentColor" height="80" viewBox="0 0 16 16" width="80" xmlns="http://www.w3.org/2000/svg">
<path d="M15 12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h1.172a3 3 0 0 0 2.12-.879l.83-.828A1 1 0 0 1 6.827 3h2.344a1 1 0 0 1 .707.293l.828.828A3 3 0 0 0 12.828 5H14a1 1 0 0 1 1 1v6zM2 4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-1.172a2 2 0 0 1-1.414-.586l-.828-.828A2 2 0 0 0 9.172 2H6.828a2 2 0 0 0-1.414.586l-.828.828A2 2 0 0 1 3.172 4H2z"></path>
<path d="M8 11a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5zm0 1a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7zM3 6.5a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0z"></path>
<svg aria-hidden="true" class="bi bi-camera" height="80" width="80">
<use href="#bi-camera"></use>
</svg>
</span>
</span>
Expand All @@ -42,6 +41,12 @@
<a class="btn btn-outline-secondary btn-sm" href="<?= eat(strtr($page->url, [$url . '/' => $url . '/' . trim($state->x->panel->route ?? 'panel', '/') . '/get/page/']) . '.' . $page->x); ?>">
<?= i('Edit'); ?>
</a>
<?php else: ?>
<?php if (!$x_panel): ?>
<a aria-disabled="true" class="btn btn-outline-secondary btn-sm disabled">
<?= i('Edit'); ?>
</a>
<?php endif; ?>
<?php endif; ?>
</div>
<small class="text-body-secondary">
Expand Down Expand Up @@ -85,19 +90,25 @@
</nav>
<?php else: ?>
<?php if ($site->has('part')): ?>
<p role="status">
<?= i('No more %s to show.', 'pages'); ?>
</p>
<div class="alert alert-danger" role="alert">
<p class="mb-0">
<?= i('No more %s to show.', 'pages'); ?>
</p>
</div>
<?php else: ?>
<p role="status">
<?= i('No %s yet.', 'pages'); ?>
</p>
<div class="alert alert-light" role="alert">
<p class="mb-0">
<?= i('No %s yet.', 'pages'); ?>
</p>
</div>
<?php endif; ?>
<?php endif; ?>
<?php else: ?>
<p role="status">
<?= i('%s does not exist.', 'Page'); ?>
</p>
<div class="alert alert-danger" role="alert">
<p class="mb-0">
<?= i('%s does not exist.', 'Page'); ?>
</p>
</div>
<?php endif; ?>
</div>
</div>
Expand Down
9 changes: 5 additions & 4 deletions state.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@

return [
'hero' => [
'description' => 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.',
'description' => 'Something short and leading about the collection below—its contents, the creator, etc. Make it short and sweet, but not too short so folks don’t simply skip over it entirely.',
'tasks' => [
0 => [
'link' => '/article/1',
'title' => 'Main Action',
'title' => 'Action 1',
'type' => 'primary'
],
1 => [
'link' => '/about',
'title' => 'Secondary Action',
'title' => 'Action 2',
'type' => 'secondary',
]
],
'title' => 'Album Example'
]
],
'theme' => 'light' // Try `dark` ;)
];

0 comments on commit 6be6524

Please sign in to comment.