Skip to content

Added shared components and dependencies between projects #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 11, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/themes/WordpressStandard/Configuration/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@ final class Assets extends BaseAssets
*/
public function assets()
{
$this->addScript('fastclick', self::VENDOR . '/fastclick/lib');
$this->addScript('svg4everybody.min', self::VENDOR . '/svg4everybody/dist');
$this->addScript('modernizr', self::BUILD_JS, [], '3.0.0', false);

if (WP_DEBUG) {
$this->addStylesheet('app', self::CSS);
$this->addScript('app');
$this->addScript('cookies');
} else {
$this->addStylesheet('app.min', self::CSS);
$this->addScript('app.min', self::BUILD_JS);
Expand Down
2 changes: 0 additions & 2 deletions src/themes/WordpressStandard/Resources/assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@

(function ($) {

$(document).foundation();

})(jQuery);
22 changes: 22 additions & 0 deletions src/themes/WordpressStandard/Resources/assets/js/cookies.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* This file is part of the Wordpress Standard project.
*
* Copyright (c) 2015 LIN3S <info@lin3s.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Gorka Laucirica <gorka.lauzirika@gmail.com>
*/

'use strict';

(function ($) {
if (!localStorage.getItem('cookies')) {
$('.cookies').addClass('cookies--visible');
}
$('.cookies__actions .button').click(function () {
localStorage.setItem('cookies', true);
$('.cookies').removeClass('cookies--visible');
})
}(jQuery));
2 changes: 2 additions & 0 deletions src/themes/WordpressStandard/Resources/assets/scss/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
@import 'layout/footer';

@import 'components/button';
@import 'components/cookies';
@import 'components/deprecation-notice';

@import 'pages/404';
@import 'pages/index';
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// This file is part of the Wordpress Standard project.
//
// Copyright (c) 2015 LIN3S <info@lin3s.com>
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
//
// @author Gorka Laucirica <gorka.lauzirika@gmail.com>

.cookies {
align-items: center;
background: $white;
bottom: 0;
font-size: 12px;
padding: 20px $column-gutter;
position: fixed;
transform: translateY(100%);
transition: transform .3s;
width: 100%;
z-index: 100;
}

.cookies__text {
margin: 0;
}

.cookies--visible {
transform: translateY(0);
}

.cookies__actions {
margin-top: 20px;
text-align: center;
}

@media #{$medium-up} {
.cookies {
display: flex;
font-size: 14px;
}

.cookies__content {
flex: 1;
padding-right: $column-gutter;
}

.cookies__actions {
margin: 0;
}
}

@media #{$large-up} {
.cookies {
font-size: 16px;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// This file is part of the Wordpress Standard project.
//
// Copyright (c) 2015 LIN3S <info@lin3s.com>
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
//
// @author Gorka Laucirica <gorka.lauzirika@gmail.com>

.flexbox .deprecation-notice {
display: none;
}

.deprecation-notice {
background: $white;
bottom: 0;
left: 0;
padding-top: 30px;
position: fixed;
right: 0;
text-align: center;
top: 0;
z-index: 200;
}


.deprecation-notice__title,
.deprecation-notice__content {
margin: auto;
max-width: 500px;
padding: 0 $column-gutter;
}

.deprecation-notice__title {
font-size: 25px;
font-weight: bold;
margin: 10px auto;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<div class="cookies">
<div class="cookies__content">
<p class="cookies__text"><strong>{{ trans('Use of cookies') }}</strong></p>
<p class="cookies__text">{{ trans('This website uses cookies when a user browses through its web pages.
Cookies used by the website are files sent to a web browser via a web server to record the activities
of users on the website and allow more fluid, personalised browsing.') }}
</div>
<div class="cookies__actions">
<a class="button">{{ trans('Accept')}}</a>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div class="deprecation-notice">
{# We suggest to add a logo here #}
<p class="deprecation-notice__title">{{ trans('You are using an outdated browser') }}</p>
<p class="deprecation-notice__content">
{{ trans('In order to deliver the greatest experience to our visitors we use cutting edge web development
techniques that require a modern browser. To view this page please use Google Chrome, Mozilla Firefox or
Internet Explorer 11 or greater') }}
</p>
</div>
6 changes: 6 additions & 0 deletions src/themes/WordpressStandard/Resources/views/layout/base.twig
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@
<body {{function('body_class')}}>
{% block body %}
{% block tagManager %}{% endblock %}
{% block deprecationNotice %}
{% include 'component/deprecation_notice.twig' %}
{% endblock %}
{% block header %}
{% include 'layout/header.twig' %}
{% endblock %}
{% block content %}{% endblock %}
{% block footer %}
{% include 'layout/footer.twig' %}
{% endblock %}
{% block cookies %}
{% include 'component/cookies.twig' %}
{% endblock %}
{% endblock %}
{{function('wp_footer')}}
{% block javascripts %}{% endblock %}
Expand Down
4 changes: 3 additions & 1 deletion src/themes/WordpressStandard/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"name": "wordpress-standard",
"author": "LIN3S",
"dependencies": {
"foundation": "~5.5"
"foundation": "~5.5",
"svg4everybody": "~2.0",
"fastclick": "~1.0"
}
}
18 changes: 15 additions & 3 deletions src/themes/WordpressStandard/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ var gulp = require('gulp'),
sass = require('gulp-sass'),
scsslint = require('gulp-scss-lint'),
svgSprite = require('gulp-svg-sprite'),
uglify = require('gulp-uglify');
uglify = require('gulp-uglify'),
modernizr = require('gulp-modernizr');

var paths = {
assets: './Resources/assets',
Expand Down Expand Up @@ -83,6 +84,17 @@ gulp.task('sprites', function () {
.pipe(gulp.dest(paths.buildSvg));
});

gulp.task('modernizr', function() {
return gulp.src([paths.js + '/*.js'])
.pipe(modernizr({
'options' : [
'setClasses', 'addTest', 'html5printshiv', 'testProp', 'fnBind'
],
'tests' : ['objectfit', 'flexbox']
}))
.pipe(gulp.dest(paths.buildJs))
});

gulp.task('js:prod', function () {
return gulp.src([paths.js + '/*.js'])
.pipe(concat('app.min.js'))
Expand All @@ -95,6 +107,6 @@ gulp.task('watch', function () {
gulp.watch(watch.svg, ['sprites']);
});

gulp.task('default', ['sass', 'sprites']);
gulp.task('default', ['sass', 'sprites', 'modernizr']);

gulp.task('prod', ['sass:prod', 'js:prod', 'sprites']);
gulp.task('prod', ['sass:prod', 'js:prod', 'sprites', 'modernizr']);
19 changes: 10 additions & 9 deletions src/themes/WordpressStandard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
"main": "gulpfile.js",
"author": "LIN3S",
"devDependencies": {
"gulp": "^3.9",
"gulp": "^3.9",
"gulp-autoprefixer": "^2.3",
"gulp-concat": "^2.6",
"gulp-file": "^0.2",
"gulp-minify-css": "^1.2",
"gulp-rename": "^1.2",
"gulp-sass": "^2.0",
"gulp-scss-lint": "^0.3",
"gulp-svg-sprite": "^1.2",
"gulp-uglify": "^1.4"
"gulp-concat": "^2.6",
"gulp-file": "^0.2",
"gulp-minify-css": "^1.2",
"gulp-modernizr": "0.0.0",
"gulp-rename": "^1.2",
"gulp-sass": "^2.0",
"gulp-scss-lint": "^0.3",
"gulp-svg-sprite": "^1.2",
"gulp-uglify": "^1.4"
}
}