Commit e012e662 authored by Hermann Mayer's avatar Hermann Mayer

Page Entity now uses Timestampable. Jity Style was splitted into structure and…

Page Entity now uses Timestampable. Jity Style was splitted into structure and color themes. Implemented a theme switch (dark/bright).
parent e3ca58bd
<!DOCTYPE html> <!DOCTYPE html>
<html lang="de"> <html lang="de">
<head> <head>
{% render 'JityHomepageBundle:Default:overallProcess' %}
<meta charset="utf-8"> <meta charset="utf-8">
<title>Hermann Mayer {% block title %}{% endblock %}</title> <title>Hermann Mayer {% block title %}{% endblock %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
...@@ -10,12 +13,30 @@ ...@@ -10,12 +13,30 @@
{% stylesheets {% stylesheets
'@JityHomepageBundle/Resources/public/css/*.css' '@JityHomepageBundle/Resources/public/css/*.css'
'@JityHomepageBundle/Resources/public/js/google-code-prettify/*.css' '@JityHomepageBundle/Resources/public/js/google-code-prettify/*.css'
filter='?yui_css' filter='?yui_css'
%} %}
<link rel="stylesheet" type="text/css" href="{{ asset_url }}" /> <link rel="stylesheet" type="text/css" href="{{ asset_url }}" />
{% endstylesheets %} {% endstylesheets %}
<!-- Theming -->
{% set theme = app.session.get('theme') %}
<script>theme = {current: "{{ theme }}"};</script>
{% stylesheets '@JityHomepageBundle/Resources/public/css/theme/10_jity_dark.css' filter='?yui_css' %}
{% if theme == 'dark' %}
<link rel="stylesheet" type="text/css" href="{{ asset_url }}" />
{% endif %}
<script>theme.dark = "{{ asset_url }}";</script>
{% endstylesheets %}
{% stylesheets '@JityHomepageBundle/Resources/public/css/theme/10_jity_bright.css' filter='?yui_css' %}
{% if theme == 'bright' %}
<link rel="stylesheet" type="text/css" href="{{ asset_url }}" />
{% endif %}
<script>theme.bright = "{{ asset_url }}";</script>
{% endstylesheets %}
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]--> <![endif]-->
...@@ -33,8 +54,6 @@ ...@@ -33,8 +54,6 @@
<body> <body>
{% render 'JityHomepageBundle:Default:overallProcess' %}
<div class="navbar navbar-inverse navbar-static-top"> <div class="navbar navbar-inverse navbar-static-top">
<div class="navbar-header"> <div class="navbar-header">
<div class="container"> <div class="container">
...@@ -71,6 +90,18 @@ ...@@ -71,6 +90,18 @@
</form> </form>
<ul class="nav pull-right"> <ul class="nav pull-right">
<li>
<a href="#" id="themeSwitchBtn" data-theme="{{ theme }}">
<img src="
{% if theme == 'dark' %}
{{ asset('bundles/jityhomepage/img/glyphicons_231_sun.png') }}
{% elseif theme == 'bright' %}
{{ asset('bundles/jityhomepage/img/glyphicons_230_moon.png') }}
{% endif %}
" />
</a>
</li>
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">
<img src="{{ asset('bundles/jityhomepage/img/glyphicons_003_user.png') }}" /> <img src="{{ asset('bundles/jityhomepage/img/glyphicons_003_user.png') }}" />
......
...@@ -53,6 +53,7 @@ stof_doctrine_extensions: ...@@ -53,6 +53,7 @@ stof_doctrine_extensions:
default: default:
sortable: true sortable: true
sluggable: true sluggable: true
timestampable: true
# Swiftmailer Configuration # Swiftmailer Configuration
swiftmailer: swiftmailer:
......
deploy @ 9b2410c7
Subproject commit 0dcf13d6932e34f044a11b13b850960db5fa2ec0 Subproject commit 9b2410c7596d12c7f794dde6446a81db17080844
...@@ -69,6 +69,22 @@ class DefaultController extends Controller ...@@ -69,6 +69,22 @@ class DefaultController extends Controller
$this->get('session')->set('develWarningFlag', true); $this->get('session')->set('develWarningFlag', true);
} }
// A cookie is set on change in the frontend.
// If we find this cookie use this, else use our session var.
if ($this->get('request')->cookies->has('theme')) {
$theme = $this->get('request')->cookies->get('theme');
$this->get('session')->set('theme', $theme);
} else {
$theme = $this->get('session')->get('theme');
if (empty($theme)) {
$this->get('session')->set('theme', 'dark');
}
}
return new Response(); return new Response();
} }
......
...@@ -74,6 +74,18 @@ class Page ...@@ -74,6 +74,18 @@ class Page
**/ **/
protected $service; protected $service;
/**
* @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/
private $createdAt;
/**
* @Gedmo\Timestampable(on="update")
* @ORM\Column(type="datetime")
*/
private $updatedAt;
/** /**
* __construct * __construct
...@@ -293,5 +305,25 @@ class Page ...@@ -293,5 +305,25 @@ class Page
{ {
return $this->service; return $this->service;
} }
/**
* getCreatedAt
*
* @return void
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* getUpdatedAt
*
* @return void
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
} }
/**********************************
* Coloring and Styling
*********************************/
html, body {
background-color: #151515;
}
.hero-unit {
background-image: url("/bundles/jityhomepage/img/noise.png");
background-repeat: repeat;
background-color: #DFDFDF;
}
.wrapper {
background-color: #D1D1D1;
background-image: url("/bundles/jityhomepage/img/noise.png");
background-repeat: repeat;
}
.wrapper > .container, .wrapper > .container-fluid {
color: #1E1E1E;
}
legend, .form_embedded_label {
color: #1E1E1E;
border-color: #B54718;
}
.table-striped tbody tr:nth-child(2n+1) td, .table-striped tbody tr:nth-child(2n+1) th {
background-color: #D5D5D5;
background-image: url("/bundles/jityhomepage/img/noise.png");
background-repeat: repeat;
}
.table th, .table td {
border-top-color: #E6E6E6;
}
.hero-unit > hr {
border-top-color: #DFDFDF;
}
#sidebar {
border-left-color: #B54718;
}
textarea, input[type="text"], input[type="password"], input[type="datetime"],
input[type="datetime-local"], input[type="date"], input[type="month"],
input[type="time"], input[type="week"], input[type="number"], input[type="email"],
input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input {
color: #111111;
background-color: #E5E5E5;
border-color: #CCCCCC;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) inset, 0 1px 0 rgba(255, 255, 255, 0.15);
background-image: url("/bundles/jityhomepage/img/noise.png");
background-repeat: repeat;
}
.alert-danger, .alert-error {
background-color: #B93623;
border-color: #A82514;
color: #D9D9D9;
}
footer {
color: #666;
background: #151515;
border-top-color: #4A4539;
}
.navbar-header {
background-color: #444444;
border-bottom-color: #BB4919;
}
.navbar-header > .container > h1 > a {
color: #fff;
}
a {
color: #D2551C;
}
a:hover, a:focus {
color: #D21B0E;
}
.btn-danger {
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#E95B1F), to(#BB4919));
background-image: -webkit-linear-gradient(top, #E95B1F, #BB4919);
background-image: -o-linear-gradient(top, #E95B1F, #BB4919);
background-image: linear-gradient(to bottom, #E95B1F, #BB4919);
background-image: -moz-linear-gradient(center top , #E95B1F, #BB4919) !important;
}
.img-polaroid {
background-color: #4A4539;
}
.form_embedded_label {
border-bottom-color: #B54718;
}
.form-actions {
border-top-color: #4D4945;
}
.dropdown-menu .divider {
background-color: #404040;
border-bottom-color: #282828;
}
.alert-info {
background-color: #1B5193;
border-color: #0E2B4E;
color: #D9D9D9;
}
.alert-success {
background-color: #6E931F;
border-color: #30400D;
color: #D9D9D9;
}
.modal {
display: none;
background-color: #000;
}
.modal-header {
background-color: #282624;
border-bottom-color: #B54718;
color: #89827B;
}
.modal-header .close {
color: #fff;
text-shadow: 0 1px 0 #000;
}
.modal-body {
background-color: #201F1D;
color: #8F8F8F;
}
.modal-footer {
background-color: #282624;
border-top-color: #4D4945;
box-shadow: 0 1px 0 #4D4945 inset;
}
.popover-title {
background-color: #3D3D3B;
border-bottom-color: #B54718;
color: #89827B;
}
.popover {
background-color: #313130;
color: #8F8F8F;
}
.popover.right .arrow {
border-right-color: #313130;
}
#previewCage {
border-top-color: #722C0F;
}
pre {
background-color: #282624;
color: #8F8F8F;
}
hr {
color: #722C0F;
background-color: #722C0F;
}
.the-icons li:hover {
background-color: #2C2A28;
}
.sortable {
border-top-color: #722C0F;
background-color: #181818;
}
.sortable.sortable-new {
background-image: url("/bundles/jityhomepage/img/new-sortable-bg.png");
}
.sortable.sortable-existing {
background-image: url("/bundles/jityhomepage/img/existing-sortable-bg.png");
}
.sortable .dragbar {
background-color: #0F0F0F;
border-right-color: #282624;
}
.sortable .controllpanel {
background-color: #0F0F0F;
border-left-color: #282624;
border-bottom-color: #282624;
}
.ui-state-highlight {
box-shadow: inset 0px 0px 20px #000000;
background-color: #181818;
border-bottom-color: #515151;
border-right-color: #515151;
}
.breadcrumb {
background-image: linear-gradient(to bottom, #363636, #282624);
background-color: #282624;
}
.breadcrumb li {
text-shadow: 0 1px 0 #000000;
}
/**********************************
* Coloring and Styling
*********************************/
html, body {
background-color: #151515;
}
.hero-unit {
background-color: #282624;
}
.wrapper {
background-color: #201f1d;
}
.wrapper > .container, .wrapper > .container-fluid {
color: #8F8F8F;
}
footer {
color: #666;
background: #151515;
border-top-color: #4A4539;
}
.table-striped tbody tr:nth-child(2n+1) td, .table-striped tbody tr:nth-child(2n+1) th {
background-color: #282624;
}
.table th, .table td {
border-top-color: #4A4539;
}
.hero-unit > hr {
border-top-color: #8f887d;
}
.navbar-header {
background-color: #444444;
border-bottom-color: #BB4919;
}
.navbar-header > .container > h1 > a {
color: #fff;
}
a {
color: #D2551C;
}
a:hover, a:focus {
color: #D21B0E;
}
.btn-danger {
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#E95B1F), to(#BB4919));
background-image: -webkit-linear-gradient(top, #E95B1F, #BB4919);
background-image: -o-linear-gradient(top, #E95B1F, #BB4919);
background-image: linear-gradient(to bottom, #E95B1F, #BB4919);
background-image: -moz-linear-gradient(center top , #E95B1F, #BB4919) !important;
}
.img-polaroid {
background-color: #4A4539;
}
#sidebar {
border-left-color: #722C0F;
}
legend, .form_embedded_label {
color: #89827B;
border-color: #B54718;
}
.form_embedded_label {
border-bottom-color: #B54718;
}
textarea, input[type="text"], input[type="password"], input[type="datetime"],
input[type="datetime-local"], input[type="date"], input[type="month"],
input[type="time"], input[type="week"], input[type="number"], input[type="email"],
input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input {
color: #CCCCCC;
background-color: #515151;
border-color: #111111;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) inset, 0 1px 0 rgba(255, 255, 255, 0.15);
}
.form-actions {
border-top-color: #4D4945;
}
.dropdown-menu .divider {
background-color: #404040;
border-bottom-color: #282828;
}
.alert-danger, .alert-error {
background-color: #932B1C;
border-color: #A82514;
color: #D9D9D9;
}
.alert-info {
background-color: #1B5193;
border-color: #0E2B4E;
color: #D9D9D9;
}
.alert-success {
background-color: #6E931F;
border-color: #30400D;
color: #D9D9D9;
}
.modal {
display: none;
background-color: #000;
}
.modal-header {
background-color: #282624;
border-bottom-color: #B54718;
color: #89827B;
}
.modal-header .close {
color: #fff;
text-shadow: 0 1px 0 #000;
}
.modal-body {
background-color: #201F1D;
color: #8F8F8F;
}
.modal-footer {
background-color: #282624;
border-top-color: #4D4945;
box-shadow: 0 1px 0 #4D4945 inset;
}
.popover-title {
background-color: #3D3D3B;
border-bottom-color: #B54718;
color: #89827B;
}
.popover {
background-color: #313130;
color: #8F8F8F;
}
.popover.right .arrow {
border-right-color: #313130;
}
#previewCage {
border-top-color: #722C0F;
}
pre {
background-color: #282624;
color: #8F8F8F;
}
hr {
color: #722C0F;
background-color: #722C0F;
}
.the-icons li:hover {
background-color: #2C2A28;
}
.sortable {
border-top-color: #722C0F;
background-color: #181818;
}
.sortable.sortable-new {
background-image: url("/bundles/jityhomepage/img/new-sortable-bg.png");
}
.sortable.sortable-existing {
background-image: url("/bundles/jityhomepage/img/existing-sortable-bg.png");
}
.sortable .dragbar {
background-color: #0F0F0F;
border-right-color: #282624;
}
.sortable .controllpanel {
background-color: #0F0F0F;
border-left-color: #282624;
border-bottom-color: #282624;
}
.ui-state-highlight {
box-shadow: inset 0px 0px 20px #000000;
background-color: #181818;
border-bottom-color: #515151;
border-right-color: #515151;
}
.breadcrumb {
background-image: linear-gradient(to bottom, #363636, #282624);
background-color: #282624;
}
.breadcrumb li {
text-shadow: 0 1px 0 #000000;
}
...@@ -4,6 +4,69 @@ $(document).ready(function() { ...@@ -4,6 +4,69 @@ $(document).ready(function() {
prettyPrint(); prettyPrint();
// Start popover on all rel elements // Start popover on all rel elements
$("*[rel=popover]").popover(); $('*[rel=popover]').popover();
function getLinkElement(href)
{
var externals = document.getElementsByTagName('link');
for (var i = 0; i < externals.length; i++) {
var cur = $(externals[i]);
if (href == cur.attr('href')) {
return cur;
}
}
return;
}
function setCookie(name, value, expire)
{
var ex = new Date();
ex.setDate(ex.getDate() + expire);
var value = escape(value) + ((expire == null) ? "" : "; expires=" + ex.toUTCString());
document.cookie = name + "=" + value;
}
// Init Theme Switcher
$('#themeSwitchBtn').click(function (){
var btn = $(this);
var btnImg = btn.find('img');
var link = getLinkElement(theme.bright);
if (!link) {
var link = getLinkElement(theme.dark);
}
if ('dark' == btn.attr('data-theme')) {
// Set current theme
btn.attr('data-theme', 'bright');
btnImg.attr('src', '/bundles/jityhomepage/img/glyphicons_230_moon.png');
link.attr('href', theme.bright);
setCookie('theme', 'bright');
theme.current = 'bright';
} else if ('bright' == btn.attr('data-theme')) {
// Set current theme
btn.attr('data-theme', 'dark');
btnImg.attr('src', '/bundles/jityhomepage/img/glyphicons_231_sun.png');
link.attr('href', theme.dark);
setCookie('theme', 'dark');
theme.current = 'dark';
}
// console.log(link);
// console.log(btn.attr('data-theme'));