Compare commits
4 Commits
836d3ecc65
...
e5c7bdedc1
Author | SHA1 | Date | |
---|---|---|---|
e5c7bdedc1 | |||
3369ab2873 | |||
91f72d4893 | |||
7c793dac88 |
5
.gitignore
vendored
5
.gitignore
vendored
@ -2,7 +2,6 @@
|
|||||||
composer.phar
|
composer.phar
|
||||||
/vendor/
|
/vendor/
|
||||||
|
|
||||||
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
|
# ---> NPM modules (mainly for Gulp.js)
|
||||||
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
|
node_modules/
|
||||||
# composer.lock
|
|
||||||
|
|
||||||
|
37
assets/styles/gargoyle.scss
Normal file
37
assets/styles/gargoyle.scss
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
$nav-bar-height: 50px;
|
||||||
|
|
||||||
|
body{
|
||||||
|
padding: $nav-bar-height 0 0;
|
||||||
|
background: lightgrey;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav-bar{
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: $nav-bar-height;
|
||||||
|
background: #212121;
|
||||||
|
box-shadow: 0 2px 1px rgba(0, 0, 0, .25);
|
||||||
|
|
||||||
|
.nav-bar-left{
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul{
|
||||||
|
list-style: none;
|
||||||
|
|
||||||
|
li{
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-link a{
|
||||||
|
color: teal;
|
||||||
|
transition: all 230ms ease-in-out;
|
||||||
|
|
||||||
|
&:hover{
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
4
bin/run-php.sh
Executable file
4
bin/run-php.sh
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# start a local instance of the app using PHP's built-in webserver
|
||||||
|
php -S localhost:8080 -t public/ public/index.php
|
24
composer.json
Normal file
24
composer.json
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"name": "bitgoblin/overseer",
|
||||||
|
"description": "Self-hosted inventory tracking web app",
|
||||||
|
"type": "project",
|
||||||
|
"license": "BSD-2-Clause",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"BitGoblin\\Overseer\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Gregory Ballantine",
|
||||||
|
"email": "gballantine@bitgoblin.tech"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"minimum-stability": "stable",
|
||||||
|
"require": {
|
||||||
|
"slim/slim": "^4.10",
|
||||||
|
"slim/psr7": "^1.5",
|
||||||
|
"php-di/php-di": "^6.4",
|
||||||
|
"slim/twig-view": "^3.3"
|
||||||
|
}
|
||||||
|
}
|
1387
composer.lock
generated
Normal file
1387
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
17
gulpfile.js
Normal file
17
gulpfile.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
const gulp = require('gulp');
|
||||||
|
const { watch } = require('gulp');
|
||||||
|
const sass = require('gulp-sass')(require('sass'));
|
||||||
|
|
||||||
|
// compile
|
||||||
|
function styles(cb) {
|
||||||
|
return gulp.src('./assets/styles/**/*.scss')
|
||||||
|
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
|
||||||
|
.pipe(gulp.dest('./public/css'));
|
||||||
|
cb();
|
||||||
|
}
|
||||||
|
|
||||||
|
// by default, watch files
|
||||||
|
exports.default = function() {
|
||||||
|
// compile sass stylesheets
|
||||||
|
watch('assets/styles/**/*.scss', styles);
|
||||||
|
};
|
7882
package-lock.json
generated
Normal file
7882
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
25
package.json
Normal file
25
package.json
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"name": "overseer",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"description": "Self-hosted inventory tracker",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"gulp": "gulp",
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "gitea@git.metaunix.net:BitGoblin/overseer.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"inventory",
|
||||||
|
"tracking"
|
||||||
|
],
|
||||||
|
"author": "Gregory Ballanine <gballantine@bitgoblin.tech>",
|
||||||
|
"license": "BSD-2-Clause",
|
||||||
|
"devDependencies": {
|
||||||
|
"gulp": "^4.0.2",
|
||||||
|
"gulp-sass": "^5.1.0",
|
||||||
|
"sass": "^1.55.0"
|
||||||
|
}
|
||||||
|
}
|
5
public/.htaccess
Normal file
5
public/.htaccess
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# rewrite rules
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteRule ^ index.php [QSA,L]
|
1
public/css/gargoyle.css
Normal file
1
public/css/gargoyle.css
Normal file
@ -0,0 +1 @@
|
|||||||
|
body{padding:50px 0 0;background:#d3d3d3}#nav-bar{position:fixed;top:0;left:0;width:100%;height:50px;background:#212121;box-shadow:0 2px 1px rgba(0,0,0,.25)}#nav-bar .nav-bar-left{float:left}#nav-bar ul{list-style:none}#nav-bar ul li{display:inline-block}#nav-bar .nav-link a{color:teal;transition:all 230ms ease-in-out}#nav-bar .nav-link a:hover{color:green}
|
24
public/index.php
Normal file
24
public/index.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// if we're looking for static files in dev, return false so they can be served.
|
||||||
|
if (PHP_SAPI == 'cli-server') {
|
||||||
|
$url = parse_url($_SERVER['REQUEST_URI']);
|
||||||
|
$file = __DIR__ . $url['path'];
|
||||||
|
|
||||||
|
// check the file types, only serve standard files
|
||||||
|
if (preg_match('/\.(?:png|js|jpg|jpeg|gif|css)$/', $file)) {
|
||||||
|
// does the file exist? If so, return it
|
||||||
|
if (is_file($file))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// file does not exist. return a 404
|
||||||
|
header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found');
|
||||||
|
printf('"%s" does not exist', $_SERVER['REQUEST_URI']);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../src/app.php';
|
||||||
|
|
||||||
|
$app->run();
|
||||||
|
|
19
src/Controllers/Controller.php
Normal file
19
src/Controllers/Controller.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BitGoblin\Overseer\Controllers;
|
||||||
|
|
||||||
|
use Psr\Container\ContainerInterface;
|
||||||
|
|
||||||
|
class Controller {
|
||||||
|
|
||||||
|
protected $container;
|
||||||
|
|
||||||
|
public function __construct(ContainerInterface $container) {
|
||||||
|
$this->container = $container;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get(string $name) {
|
||||||
|
return $this->container->get($name);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
16
src/Controllers/HomeController.php
Normal file
16
src/Controllers/HomeController.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BitGoblin\Overseer\Controllers;
|
||||||
|
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
use Slim\Views\Twig;
|
||||||
|
|
||||||
|
class HomeController extends Controller {
|
||||||
|
|
||||||
|
public function getIndex(Request $request, Response $response): Response {
|
||||||
|
$view = Twig::fromRequest($request);
|
||||||
|
return $view->render($response, 'index.twig');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
25
src/app.php
Normal file
25
src/app.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use DI\Container;
|
||||||
|
use Slim\Factory\AppFactory;
|
||||||
|
use Slim\Views\Twig;
|
||||||
|
use Slim\Views\TwigMiddleware;
|
||||||
|
|
||||||
|
require __DIR__ . '/../vendor/autoload.php';
|
||||||
|
|
||||||
|
// Create new container object and add our config object to it
|
||||||
|
$container = new Container();
|
||||||
|
|
||||||
|
// Set container to create App with on AppFactory
|
||||||
|
AppFactory::setContainer($container);
|
||||||
|
$app = AppFactory::create();
|
||||||
|
|
||||||
|
// create Twig instance
|
||||||
|
$twig = Twig::create('views', ['cache' => false]);
|
||||||
|
// add Twig-View Middleware
|
||||||
|
$app->add(TwigMiddleware::create($app, $twig));
|
||||||
|
|
||||||
|
// load routes
|
||||||
|
require_once __DIR__ . '/routes.php';
|
||||||
|
|
||||||
|
// app starts in public/index.php
|
7
src/routes.php
Normal file
7
src/routes.php
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
|
// index GET route - this page should welcome the user and direct them to the available actions
|
||||||
|
$app->get('/', '\\BitGoblin\\Overseer\\Controllers\\HomeController:getIndex')->setName('index');
|
12
views/index.twig
Normal file
12
views/index.twig
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{% extends 'layout.twig' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<!-- page header -->
|
||||||
|
<header class="row">
|
||||||
|
<div class="columns twelve">
|
||||||
|
<h1>Welcome to Overseer!</h1>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
{% endblock %}
|
32
views/layout.twig
Normal file
32
views/layout.twig
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>{% block title %}{% endblock %} | Overseer</title>
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css">
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css">
|
||||||
|
<link rel="stylesheet" href="/css/gargoyle.css">
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
|
||||||
|
<script src="/js/drake.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- global navigation -->
|
||||||
|
<nav id="nav-bar">
|
||||||
|
<div class="nav-bar-left">
|
||||||
|
<ul>
|
||||||
|
<li class="site-logo">Overseer</li>
|
||||||
|
<li class="nav-link"><a href="/">Home</a></li>
|
||||||
|
<li class="nav-link"><a href="/search">Search</a></li>
|
||||||
|
<li class="nav-link"><a href="/add">Add Item</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<!-- main content -->
|
||||||
|
<div id="main-content" class="container">
|
||||||
|
{% block content %}{% endblock %}
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user