Skip to content

Commit

Permalink
Merge pull request #39 from jedi58/develop
Browse files Browse the repository at this point in the history
Added build process jobs
`Gulpfile.js` has now been added to specify different build tasks during development and release. To start with this adds `sass:compile` which will compile `.scss` files for both the front-end and admin interface into different locations. These can also be monitored during development through the use of `gulp sass:watch` which will run `gulp sass:compile` when changes are made to watched `.scss` files. The default build job is to prepare the install for a release
  • Loading branch information
jedi58 committed Apr 29, 2016
2 parents 2e8c4dc + 6752ef0 commit 95ddbaa
Show file tree
Hide file tree
Showing 23 changed files with 275 additions and 7 deletions.
32 changes: 32 additions & 0 deletions build/gulp/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module.exports = {
paths: {
dist: {
images: {
admin: '',
web: ''
},
js: {
admin: '',
web: ''
},
sass: {
admin: 'web/inadmin/assets/css/',
web: 'web/assets/css/'
}
},
src: {
images: {
admin: '',
web: ''
},
js: {
admin: '',
web: ''
},
sass: {
admin: 'resources/assets/scss/admin/',
web: 'resources/assets/scss/web/'
}
}
}
};
5 changes: 5 additions & 0 deletions build/gulp/tasks/default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var gulp = require('gulp');
gulp.task('default', [
//'js:compile',
'sass:compile'
]);
33 changes: 33 additions & 0 deletions build/gulp/tasks/sass.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
var gulp = require('gulp');
var autoprefixer = require('gulp-autoprefixer');
var config = require('../config');
var cssnano = require('gulp-cssnano');
var rename = require('gulp-rename');
var runSequence = require('gulp-run-sequence');
var sass = require('gulp-ruby-sass');

gulp.task('sass:compile', [
'sass:compile-admin',
'sass:compile-web'
]);
gulp.task('sass:compile-web', function() {
return sass('resources/assets/scss/web/*.scss', { style: 'expanded' })
.pipe(autoprefixer('last 2 version'))
.pipe(gulp.dest('web/assets/css'))
.pipe(rename({suffix: '.min'}))
.pipe(cssnano())
.pipe(gulp.dest('web/assets/css'));
});
gulp.task('sass:compile-admin', function() {
return sass('resources/assets/scss/inadmin/*.scss', { style: 'expanded' })
.pipe(autoprefixer('last 2 version'))
.pipe(gulp.dest('web/inadmin/assets/css'))
.pipe(rename({suffix: '.min'}))
.pipe(cssnano())
.pipe(gulp.dest('web/indamin/assets/css'));
});

gulp.task('sass:watch', function() {
gulp.watch(config.paths.src.sass.admin + '**/*', ['sass:compile']);
gulp.watch(config.paths.src.sass.web + '**/*', ['sass:compile']);
});
2 changes: 2 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var requiredir = require('require-dir');
requiredir('./build/gulp/tasks', { recurse: true });
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"devDependencies": {
"gulp-autoprefixer": "^3.1.0",
"gulp-cssnano": "^2.1.2",
"gulp-rename": "^1.2.2",
"gulp-ruby-sass": "^2.0.6",
"gulp-run-sequence": "^0.3.2",
"require-dir": "^0.3.0"
}
}
4 changes: 4 additions & 0 deletions resources/views/admin__forgot-password-sent.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<section class="reset-confirm">
<h2>Thank you,</h2>
<p>If your account has been located, you will soon receive an email to the email address you provided with instructions to reset your password.</p.
</section>
Empty file.
Empty file.
6 changes: 6 additions & 0 deletions resources/views/admin__signin.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% extends "inadmin/signin.html.twig" %}

{% block form_login_post %}
Links for Twitter | Facebook | Google | Wordpress
{% endblock form_login_post %}

1 change: 1 addition & 0 deletions resources/views/admin__structure__main.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "/inadmin/structure/main.html.twig" %}
3 changes: 3 additions & 0 deletions resources/views/admin__stylesheets.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

{% extends "/inadmin/structure/stylesheets.html.twig" %}

1 change: 1 addition & 0 deletions resources/views/post.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Sign-in template stuff goes here
1 change: 1 addition & 0 deletions resources/views/structure__main.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "/inadmin/structure/main.html.twig" %}
34 changes: 31 additions & 3 deletions src/Inachis/Common/Routing/RoutingManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace Inachis\Component\Common\Routing;

use Klein\Klein;
use Inachis\Component\Common\Application;
use Inachis\Component\Common\Routing\Route;
use Inachis\Component\Common\Configuration\ConfigManager;

Expand All @@ -22,7 +23,7 @@ class RoutingManager
public function __construct()
{
$this->klein = new Klein();
$this->addErrorHandlers();
$this->addDefaultRoutes();
}
/**
* Returns an instance of {@link RoutingManager}
Expand Down Expand Up @@ -71,13 +72,40 @@ public function dispatch()
{
$this->klein->dispatch();
}
/**
*
*/
public function addDefaultRoutes()
{
$this->registerViewHandler();
$this->registerErrorHandlers();
}
/**
*
*/
public function registerViewHandler()
{
$router = $this->klein;
$this->klein->respond(function ($request, $response, $service, $app) use ($router) {
$app->register('twig', function () {
$loader = new \Twig_Loader_Filesystem(array(
Application::getApplicationRoot() . 'resources/views/',
Application::getApplicationRoot() . 'src/Inachis/Common/views/'
));
$options = array(); //ConfigManager::load('system');
//cache = true|false
//auto_reload = true|false
return new \Twig_Environment($loader, $options);
});
});
}
/**
* Adds default responder routes for error handling and standard admin interface pages
*/
private function addErrorHandlers()
private function registerErrorHandlers()
{
$router = $this->klein;
$router->onHttpError(function ($code, $router) {
$this->klein->onHttpError(function ($code, $router) {
if ($code >= 400 && $code < 500) {
// @todo replace with templated error page
$router->response()->body(
Expand Down
Empty file.
Empty file.
Empty file.
31 changes: 31 additions & 0 deletions src/Inachis/Common/views/inadmin/signin.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{% extends "admin__structure__main.html.twig" %}
{% block content %}

{% block form_login_pre %}{% endblock form_login_pre %}
{% block form_login %}
<form action="/inadmin/signin" method="post" class="form form_login" autocomplete="off">
<fieldset>
<legend>Sign in using email address</legend>
<p>
<label id="form-login__username-label" for="form-login__username">Username</label>
<input aria-required="true" aria-labelledby="form-login__username-label" class="text" id="form-login__username" name="loginUsername" type="text" value="{{ data.loginUsername }}" placeholder="Username" />
</p>

<p>
<label id="form-login__username-label" for="form-login__password">Password</label>
<input aria-required="true" aria-labelledby="form-login__username-label" class="text" id="form-login__username" name="loginPassword" placeholder="Password" type="password" value="" />
</p>
<p>
<button class="button button--info" type="submit">Login</button>
<label for="form-login__remember" class="form-login__remember-label">
<input id="form-login__remember" name="rememberMe" type="checkbox" value="1"{% if data.rememberMe is defined and data.rememberMe == '1' %} checked="checked"{% endif %} />
{{ lang.adminRememberMe }} Keep me logged in
</label>
</p>
</fieldset>
<p><a href="/forgot-password" title="Reset your password"><span>{{ lang.adminForgotPassword }}Forgot password?</span></a></p>
</form>
{% endblock form_login %}
{% block form_login_post %}{% endblock form_login_post %}

{% endblock content %}
20 changes: 20 additions & 0 deletions src/Inachis/Common/views/inadmin/structure/main.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{{ settings.language }}" lang="{{ settings.language }}" dir="{{ settings.textdirection }}">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>{{ data.page.title }}{% if data.page.title != '' %} / {% endif %}{{ settings.siteTitle }}</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="robots" content="noindex,nofollow" />
<link rel="Shortcut Icon" type="image/x-icon" href="{{ settings.domain }}/favicon.ico" />
<link rel="icon" type="image/x-icon" href="{{ settings.domain }}/favicon.ico" />
<link rel="apple-touch-icon" href="{{ settings.domain }}/images/apple-touch.png" />
<link rel="P3Pv1" href="{{ settings.domain }}/w3c/p3p.xml" />
<link rel="index" title="Fauna.me" href="{{ settings.domain }}" />
{% include "admin__stylesheets.html.twig" %}
</head>
<body>
{% block content %}{% endblock content %}
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% block stylesheets %}
<link type="text/css" rel="stylesheet" href="/inadmin/css/styles.css" media="screen" />
{% endblock stylesheets %}
62 changes: 62 additions & 0 deletions src/Inachis/Common/views/structure/main.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{{ settings.language }}" lang="{{ settings.language }}" dir="{{ settings.textdirection }}">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>{{ data.page.title }}{% if data.page.title != '' %} / {% endif %}{{ settings.siteTitle }}</title>
<base href="{{ settings.domain }}" >
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta http-equiv="keywords" content="{{ data.page.keywords }}" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Last-Update" content="{{ data.page.lastModifiedDate }}" />
<meta http-equiv="Content-Language" content="en" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="Author" content="{{ data.page.author.name }}" />
<meta name="Copyright" content="&copy; {{ settings.copyright }}" />
<meta name="keywords" content="{% if data.page.keywords is not empty %}, {{ data.page.keywords }}{% endif %}" />
<meta name="description" content="{{ data.page.description }}" />
<meta name="abstract" content="{{ settings.abstract }}" />
<meta name="robots" content="index,follow" />
<meta name="googlebot" content="NOODP" />
<meta name="language" content="{{ settings.language }}" />
<meta name="revised" content="{{ data.page.lastModifiedDateFriendly }}" />
<meta name="ICBM" content="{{ data.page.geo.position }}" />
<meta name="geo.position" content="{{ data.page.geo.position }}" />
<meta name="geo.placename" content="{{ data.page.geo.placename }}" />
<meta name="geo.region" content="{{ data.page.geo.region }}" />
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" />
<link rel="schema.DCTERMS" href="http://purl.org/dc/terms/" />
<meta name="DC.title" content="{{ settings.siteTitle }}" />
<meta name="DC.creator" content="{{ data.page.author.name }}" />
<meta name="DC.subject" content="{{ data.page.keywords }}" />
<meta name="DC.description" content="{{ data.page.description }}" />
<meta name="DC.type" scheme="DCTERMS.DCMIType" content="Text" />
<meta name="DC.format" content="text/html" />
<meta name="DC.identifier" scheme="DCTERMS.URI" content="{{ settings.domain }}" />
<meta name="generator" content="inachis" />
<link rel="canonical" href="{{ date.page.self }}" />
<link rel="search" type="application/opensearchdescription+xml" title="Fauna.me" href="/search.xml" />
<link rel="Shortcut Icon" type="image/x-icon" href="{{ settings.domain }}/favicon.ico" />
<link rel="icon" type="image/x-icon" href="{{ settings.domain }}/favicon.ico" />
<link rel="apple-touch-icon" href="{{ settings.domain }}/images/apple-touch.png" />
<link rel="P3Pv1" href="{{ settings.domain }}/w3c/p3p.xml" />
<link rel="index" title="Fauna.me" href="{{ settings.domain }}" />
{% include "stylesheet.html.twig" %}
</head>
<body>
<div id="site_wrapper">
{% include "structure_mast.twig" %}
<div id="wrapper">
<section id="main" role="main"{% if type is defined and type == 'paddlingless' %}class="no_padding"{% endif %}>
{% block content %}{% endblock %}
</section>
{% if type is not defined or type != 'paddlingless' %}
<aside id="column">
{% include "structure_column.twig" %}
</aside>
{% endif %}
</div>
{% include "structure_footer.twig" %}
</div>
</body>
</html>
8 changes: 8 additions & 0 deletions src/Inachis/Common/views/structure/stylesheets.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% block stylesheets %}
<link type="text/css" rel="stylesheet" href="/min/f=/css/default.css{% if data.google_map is defined and data.google_map %},/css/leaflet.css{% endif %}" media="screen" />
<link type="text/css" rel="stylesheet" href="/min/f=/css/print.css" media="print" />
<!--[if lt IE 9]>
<link type="text/css" rel="stylesheet" href="/min/f=/css/ie.css" media="screen" />
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
{% endblock stylesheets %}
26 changes: 22 additions & 4 deletions src/Inachis/CoreBundle/Controller/AccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,37 @@ class AccountController
{
public static function getSignin($request, $response, $service, $app)
{
$response->body('Signin page');
$data = array(
'data' => array(
'loginUsername' => $request->paramsPost()->get('loginUsername'),
'rememberMe' => $request->cookies()->get('rememberMe')
)
);
$response->body($app->twig->render('admin__signin.html.twig', $data));
}
public static function getSignout($request, $response, $service, $app)
{
$response->body('Show signed out message');
// need to perform actual signout
$response->body($app->twig->render('admin__signed-out.html.twig'));
}
public static function getForgotPassword($request, $response, $service, $app)
{
$response->body('Show request for forgotten password reset');
$data = array(
'data' => array(
"resetEmailAddress" => $request->paramsPost()->get('resetEmailAddress')
),
'error' =>array(
//validate email address format
)
);
$response->body($app->twig->render('admin__forgot-password.html.twig', $data));
}
public static function getForgotPasswordSent($request, $response, $service, $app)
{
$response->body('Show confirmation for forgotten password');
if (false) {
// if request contains errors then use self::getForgotPassword($request, $response, $service, $app) instead
}
$response->body($app->twig->render('admin__forgot-password-sent.html.twig', array()));
}
public static function getAdminList($request, $response, $service, $app)
{
Expand Down

0 comments on commit 95ddbaa

Please sign in to comment.