Commit a16139eb authored by Hermann Mayer's avatar Hermann Mayer

The homepage is now a service instead of a constant slug ('home'). The Default…

The homepage is now a service instead of a constant slug ('home'). The Default Route is not anymore 'home', it is 'page' now. Updated deployment.
parent e7224112
......@@ -43,7 +43,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<h1><a href="{{ path('home') }}">Hermann Mayer</a></h1>
<h1><a href="{{ path('page') }}">Hermann Mayer</a></h1>
</div>
</div>
<div class="navbar-inner">
......@@ -199,9 +199,9 @@
<a target="_blank" href="http://projects.hermann-mayer.net/">Chiliprojects</a> und
<a target="_blank" href="http://ebay-tool.hermann-mayer.net/">eBay Tool</a>.
Allgemeine Informationen können Sie aus folgenden Quellen beziehen:
<a target="_blank" href="{{ path('home', {slug: 'impressum'}) }}">Impressum</a>,
<a target="_blank" href="{{ path('home') }}">Über mich</a> und
<a target="_blank" href="{{ path('home', {slug: 'kontakt'}) }}">Kontakt</a>.
<a href="{{ path('page', {slug: 'impressum'}) }}">Impressum</a>,
<a href="{{ path('page') }}">Über mich</a> und
<a href="{{ path('page', {slug: 'kontakt'}) }}">Kontakt</a>.
</small></p>
</div>
</div>
......
deploy @ 24355c7a
Subproject commit db8afd7f10a339dfd35cfb57ce13efd43b1d300a
Subproject commit 24355c7aa7224f3ac224c5446f7657bc52f71fcd
......@@ -2,17 +2,9 @@
namespace Jity\HomepageBundle\Controller;
use Jity\HomepageBundle\Entity\Navigation;
use Jity\HomepageBundle\Entity\User;
use Jity\HomepageBundle\Entity\Page;
use Jity\HomepageBundle\Entity\Media;
use Jity\HomepageBundle\Entity\Category;
use Jity\HomepageBundle\Entity\Sidebar;
use Jity\HomepageBundle\Entity\SidebarSection;
use Jity\HomepageBundle\JityHomepageBundle;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Jity\HomepageBundle\Entity\Contact;
use Jity\HomepageBundle\Form\ContactType;
use Symfony\Component\HttpFoundation\Response;
/**
......@@ -37,7 +29,7 @@ class DefaultController extends Controller
$em = $this->getDoctrine()->getEntityManager();
// Try to get the requested navigation
$nav = $em->getRepository('Jity\HomepageBundle\Entity\Navigation')->findOneByName($navigation);
$nav = $em->getRepository('JityHomepageBundle:Navigation')->findOneByName($navigation);
$pages = array();
......@@ -87,36 +79,41 @@ class DefaultController extends Controller
* @access public
* @return void
*/
public function showPageAction($slug, $renderService = true, Response $serviceReponse = null)
public function showPageAction($slug = '', $service = '', $renderService = true, Response $serviceReponse = null)
{
// Get Entity Manager
$em = $this->getDoctrine()->getEntityManager();
// Try to get the requested Page
$page = $em->getRepository('Jity\HomepageBundle\Entity\Page')->findOneBySlug($slug);
if (!empty($slug)) {
// Page was not found
if (!$page) {
$page = $em->getRepository('JityHomepageBundle:Page')->findOneBySlug($slug);
if ('home' != $slug) {
throw $this->createNotFoundException(sprintf('Es konnte keine Seite für den Slug "%s" gefunden werden.', $slug));
}
} elseif (!empty($service)) {
$curService = $em->getRepository('JityHomepageBundle:Service')->findOneByName($service);
$page = $curService->getPages()->first();
// We dont want to render a infinite loop here
$renderService = false;
}
// Page was not found
if (!$page) {
return $this->forward('JityHomepageBundle:Default:showInfo', array('template' => 'homepage_notfound'));
}
// On service relation jump into
if ($service = $page->getService() and (true === $renderService)) {
if (($service = $page->getService()) &&
(true === $renderService) &&
('homepage' != $page->getService()->getName())
) {
$serviceReponse = $this->forward('JityHomepageBundle:Service:show', array(
'page' => $page
));
// return new Response($serviceReponse);
}
// echo '<pre>';var_dump($serviceReponse->getContent());exit;
// Return the rendered result
return $this->render('JityHomepageBundle:Default:index.html.twig', array(
'page' => $page,
......
......@@ -2,14 +2,11 @@
namespace Jity\HomepageBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
use Jity\HomepageBundle\Entity\Section;
use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
/**
* SectionController
......
......@@ -2,11 +2,11 @@
namespace Jity\HomepageBundle\Controller;
use Symfony\Component\Form\FormError;
use Jity\HomepageBundle\JityHomepageBundle;
use Jity\HomepageBundle\Form\UserType;
use Jity\HomepageBundle\Entity\User;
use Jity\HomepageBundle\JityHomepageBundle;
use Symfony\Component\Form\FormError;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\SecurityContext;
......@@ -151,7 +151,7 @@ class SecurityController extends Controller
}
}
return $this->redirect($this->generateUrl('home'));
return $this->redirect($this->generateUrl('page'));
}
}
......@@ -94,7 +94,7 @@ class ServiceController extends Controller
// Write flash message and redirect back
$this->get('session')->getFlashBag()->add('success', 'Ihre Mitteilung wurde erfolgreich übermittelt.');
return $this->redirect($this->generateUrl('home', array(
return $this->redirect($this->generateUrl('page', array(
'slug' => 'kontakt'
)));
}
......
......@@ -2,13 +2,13 @@
namespace Jity\HomepageBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Jity\HomepageBundle\Entity\Sidebar;
use Jity\HomepageBundle\Entity\Section;
use Jity\HomepageBundle\Form\SidebarType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
/**
* Sidebar controller.
*
......
......@@ -4,6 +4,7 @@ namespace Jity\HomepageBundle\Controller;
use Jity\HomepageBundle\Form\UserType;
use Jity\HomepageBundle\JityHomepageBundle;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
/**
......
......@@ -30,7 +30,7 @@ class LoadPageData extends AbstractFixture implements OrderedFixtureInterface
// Build Home Page
$home = new Page();
$home
->setSlug('home')
->setSlug('about')
->setTitle('Über mich')
->setContent('<img src="{{ asset("bundles/jityhomepage/img/myself-cc3-300px.png") }}" alt="" class="img-polaroid pull-left" />
Mein Name ist Hermann Mayer, ich wurde am 02. August im Jahre 1992 in Berlin geboren und bin
......@@ -67,6 +67,7 @@ zusätzliche Arbeit bedeutet.
->setSidebar($this->getReference('default-sidebar'))
->setNavigation($this->getReference('default-navigation'))
->setAuthor($this->getReference('admin-user'))
->setService($this->getReference('homepage-service'))
->setIcon('icon-user')
;
......
......@@ -64,7 +64,7 @@ können Sie diese unabhängig von Gerät oder Browser abrufen. Dazu
werden Favoriten für Sie in der Applikation gespeichert.
</p>
<p>
<a href="{{ path(\'home\') }}" class="btn btn-danger" title="Zu den Favoriten hinzufügen">
<a href="{{ path(\'page\') }}" class="btn btn-danger" title="Zu den Favoriten hinzufügen">
<img src="{{ asset("bundles/jityhomepage/img/glyphicons_012_heart_plus.png") }}" />
</a>
</p>')
......
......@@ -26,7 +26,15 @@ class LoadServiceData extends AbstractFixture implements OrderedFixtureInterface
* @return void
*/
public function load(ObjectManager $manager)
{
{
// Build Homepage Service
$homepage = new Service();
$homepage
->setName('homepage')
->setTitle('Homepage')
->setDescription('Definiert die Homepage, den Startpunkt der Applikation.')
;
// Build Contact Service
$contact = new Service();
$contact
......@@ -52,6 +60,7 @@ class LoadServiceData extends AbstractFixture implements OrderedFixtureInterface
;
// Save all Groups
$manager->persist($homepage);
$manager->persist($contact);
$manager->persist($impress);
$manager->persist($blog);
......@@ -60,6 +69,7 @@ class LoadServiceData extends AbstractFixture implements OrderedFixtureInterface
$manager->flush();
// Build Fixture References
$this->addReference('homepage-service', $homepage);
$this->addReference('contact-service', $contact);
$this->addReference('impress-service', $impress);
$this->addReference('blog-service', $blog);
......
......@@ -261,13 +261,17 @@ class Page
}
/**
* Set service
* Set service (optional, therefor no class instance casting)
*
* @param Jity\HomepageBundle\Entity\Service $service
* @return Page
*/
public function setService(\Jity\HomepageBundle\Entity\Service $service)
public function setService($service)
{
if (!is_a($service, '\Jity\HomepageBundle\Entity\Service') && null !== $service) {
return $this;
}
$this->service = $service;
return $this;
......
......@@ -48,6 +48,12 @@ class PageType extends AbstractType
),
'label' => 'Inhalt'
))
->add('service', 'entity', array(
'class'=>'Jity\HomepageBundle\Entity\Service',
'property' => 'title',
'required' => false,
'label' => 'Service'
))
->add('category', 'entity', array(
'class'=>'Jity\HomepageBundle\Entity\Category',
'property' => 'name',
......
......@@ -2,7 +2,7 @@ info:
pattern: /info/{template}
defaults: { _controller: JityHomepageBundle:Default:showInfo }
home:
page:
pattern: /{slug}
defaults: { _controller: JityHomepageBundle:Default:showPage, slug: home }
defaults: { _controller: JityHomepageBundle:Default:showPage, slug: ~, service: homepage }
......@@ -6,12 +6,12 @@
<legend>Administrationsbereich</legend>
<a href="{{ path('home') }}" class="btn btn-danger">
<a href="{{ path('page') }}" class="btn btn-danger">
<i class="icon-user icon-white"></i>
Benutzer
</a>
<a href="{{ path('home') }}" class="btn btn-danger">
<a href="{{ path('page') }}" class="btn btn-danger">
<i class="icon-list-alt icon-white"></i>
Gruppen
</a>
......
......@@ -16,7 +16,7 @@
Kategorien
</a>
<a href="{{ path('home') }}" class="btn btn-danger">
<a href="{{ path('page') }}" class="btn btn-danger">
<i class="icon-globe icon-white"></i>
Navigationen
</a>
......
{% for page in pages %}
{% set pageSlug = page.slug %}
{% set pageUrl = path('home', { 'slug': pageSlug }) %}
{% set pageUrl = path('page', { 'slug': pageSlug }) %}
{% set activeSlug = (pageSlug == currentSlug ? true : false) %}
<li class="{{ activeSlug ? "active" : "" }}">
{% if page.icon is not empty %}
......
......@@ -9,8 +9,8 @@
{% block info_content %}
Diese Applikation wird zur Zeit eingerichtet. Es sollte jedoch in Kürze
eine Startseite verfügbar sein. Entschuldigung für die dadurch
entstandenen Unanhemlichkeiten.
eine Startseite verfügbar sein. Wir entschuldigen uns für die dadurch
entstandenen Unannehmlichkeiten.
{% endblock %}
......@@ -18,9 +18,8 @@
<th>Id</th>
<th width="10%">Slug</th>
<th width="10%">Titel</th>
{% if is_granted('ROLE_ADMIN') %}
<th width="10%">Autor</th>
{% endif %}
<th width="10%">Autor</th>
<th width="10%">Service</th>
<th>Inhalt</th>
<th>Operationen</th>
</tr>
......@@ -31,10 +30,25 @@
<td><a href="{{ path('author_page_show', { 'id': entity.id }) }}">{{ entity.id }}</a></td>
<td>{{ entity.slug }}</td>
<td>{{ entity.title }}</td>
{% if is_granted('ROLE_ADMIN') %}
<td><a href="{{ path('home') }}">{{ entity.author.email }}</a></td>
<td>
<a href="
{% if is_granted('ROLE_ADMIN') %}
{{ path('page') }}
{% else %}
#
{% endif %}
">
{{ entity.author.email }}
</a>
</td>
<td style="text-align: center">
{% if entity.service %}
<i class="icon-ok icon-white"></i><br>{{ entity.service.title }}
{% else %}
<i class="icon-remove icon-white"></i>
{% endif %}
<td>{{ entity.content|slice(0, 500) }}<small>[...]</small></td>
</td>
<td>{{ entity.content|slice(0, 200) }}<small>[...]</small></td>
<td>
<a href="{{ path('author_page_show', { 'id': entity.id }) }}" class="btn btn-danger" title="Anzeigen">
<i class="icon-zoom-in icon-white"></i>
......
......@@ -16,7 +16,7 @@
Senden
</button>
<a href="{{ path('home') }}" class="btn btn-danger">
<a href="{{ path('page') }}" class="btn btn-danger">
<i class="icon-share-alt icon-white"></i>
Zurück zur Homepage
</a>
......
......@@ -10,7 +10,7 @@
<i class="icon-edit icon-white"></i>
Profil Bearbeiten
</a>
<a href="{{ path('home') }}" class="btn btn-danger">
<a href="{{ path('page') }}" class="btn btn-danger">
<i class="icon-star icon-white"></i>
Ihre Favoriten
</a>
......
<IfModule mod_rewrite.c>
RewriteEngine On
#<IfModule mod_vhost_alias.c>
# RewriteBase /
#</IfModule>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ maintaince.html [QSA,L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
#<IfModule mod_vhost_alias.c>
# RewriteBase /
#</IfModule>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<title>Hermann Mayer </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="Hermann Mayer">
<link rel="stylesheet" type="text/css" href="/bundles/jityhomepage/css/00_bootstrap.css" />
<link rel="stylesheet" type="text/css" href="/bundles/jityhomepage/css/50_bootstrap-responsive.css" />
<link rel="stylesheet" type="text/css" href="/bundles/jityhomepage/css/90_jity.css" />
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link rel="icon" href="/favicon.ico" type="image/x-icon">
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,300,600' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="navbar navbar-inverse navbar-static-top">
<div class="navbar-header">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<h1><a href="/app_dev.php/">Hermann Mayer</a></h1>
</div>
</div>
<div class="navbar-inner">
<div class="container">
<div class="nav-collapse collapse">
<p class="navbar-text pull-right">
</p>
<ul class="nav">
</ul>
</div>
</div>
</div>
</div>
<div class="wrapper">
<div class="container">
<div class="row">
<div class="span12">
<div class="hero-unit">
<div class="row">
<div class="span2">
<img src="/bundles/jityhomepage/img/icons/inprogress.png" class="pull-left"/>
</div>
<div class="span7">
<legend>Temporäre Wartungsarbeiten</legend>
<p>
Diese Applikation steht zur Zeit nicht zur Verfügung. Der Grund dafür sind
Wartungsarbeiten. Der normale Betrieb wird in Kürze wieder aufgenommen.
Wir entschuldigen uns für die dadurch entstandenen Unannehmlichkeiten.
</p>
</div>
</div>
</div>
</div>
<br>
</div>
</div>
<div class="push"><!--//--></div>
</div>
<footer>
<div class="container">
<div class="row">
<div class="span2">
<p class="center"><img src="/bundles/jityhomepage/img/signature.png" alt=""></p>
<p class="center"><small >&copy; Hermann Mayer 2012</small></p>
</div>
<div class="span6">
<h5>Über das Projekt</h5>
<p><small>
Diese Website wurde mit <a target="_blank" href="http://symfony.com">Symfony 2</a> und
der <a target="_blank" href="http://twitter.github.com/bootstrap/">Twitter Bootstrap</a> realisiert.
Die Icons wurden zur Verfügung gestellt von <a href="http://glyphicons.com">Glyphicons</a>. Der
<a target="_blank" href="https://gitorious.hermann-mayer.net/jity/jity">Quellcode</a> des Projekts ist Open
Source lizenziert und steht in meinem selbst betriebenen Gitorious zur Verfügung.
Haben Sie fragen, oder Anregungen? Kein Problem &ndash; Nebenstehend finden Sie
weiterführende Verweise zu meinen Kontaktdaten und den Services die ich anbiete.
</small></p>
</div>
<div class="span3">
<h5>Services und Allgemeines</h5>
<p><small>
Unter anderem biete ich folgende Diensten an:
<a target="_blank" href="http://gitorious.hermann-mayer.net">Gitorious</a>,
<a target="_blank" href="http://projects.hermann-mayer.net/">Chiliprojects</a> und
<a target="_blank" href="http://ebay-tool.hermann-mayer.net/">eBay Tool</a>.
Allgemeine Informationen können Sie aus folgenden Quellen beziehen:
<a href="/app_dev.php/impressum">Impressum</a>,
<a href="/app_dev.php/">Über mich</a> und
<a href="/app_dev.php/kontakt">Kontakt</a>.
</small></p>
</div>
</div>
</div>
</footer>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment