Commit af71752c authored by Hermann Mayer's avatar Hermann Mayer

Page Entity now uses Sluggable Doctrine Extension. Added a help popover (styled…

Page Entity now uses Sluggable Doctrine Extension. Added a help popover (styled and configured in jity.js) to the slug field on the PageType.
parent 627cc4a2
...@@ -52,6 +52,7 @@ stof_doctrine_extensions: ...@@ -52,6 +52,7 @@ stof_doctrine_extensions:
orm: orm:
default: default:
sortable: true sortable: true
sluggable: true
# Swiftmailer Configuration # Swiftmailer Configuration
swiftmailer: swiftmailer:
......
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" && cd "${DIR}/.."
php app/console doctrine:database:drop --force
php app/console doctrine:database:create
php app/console doctrine:schema:create
yes | php app/console doctrine:fixtures:load
rm -rf app/cache/dev
deploy @ 8ff3c33d
Subproject commit 7bd58d17b9eb3e999c0376af18ff0438db251f3e Subproject commit 8ff3c33d5f0f0bd24bdca9c7a62c78a4bf78de67
...@@ -30,7 +30,6 @@ class LoadPageData extends AbstractFixture implements OrderedFixtureInterface ...@@ -30,7 +30,6 @@ class LoadPageData extends AbstractFixture implements OrderedFixtureInterface
// Build Home Page // Build Home Page
$home = new Page(); $home = new Page();
$home $home
->setSlug('about')
->setTitle('Über mich') ->setTitle('Über mich')
->setContent('<img src="{{ asset("bundles/jityhomepage/img/myself-cc3-300px.png") }}" alt="" class="img-polaroid pull-left" /> ->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 Mein Name ist Hermann Mayer, ich wurde am 02. August im Jahre 1992 in Berlin geboren und bin
...@@ -78,7 +77,6 @@ zusätzliche Arbeit bedeutet. ...@@ -78,7 +77,6 @@ zusätzliche Arbeit bedeutet.
// Build Impress Page // Build Impress Page
$impress = new Page(); $impress = new Page();
$impress $impress
->setSlug('impressum')
->setTitle('Impressum') ->setTitle('Impressum')
->setContent('') ->setContent('')
->setCategory($this->getReference('default-category')) ->setCategory($this->getReference('default-category'))
...@@ -96,7 +94,6 @@ zusätzliche Arbeit bedeutet. ...@@ -96,7 +94,6 @@ zusätzliche Arbeit bedeutet.
// Build Contact Page // Build Contact Page
$contact = new Page(); $contact = new Page();
$contact $contact
->setSlug('kontakt')
->setTitle('Kontakt') ->setTitle('Kontakt')
->setContent('') ->setContent('')
->setCategory($this->getReference('default-category')) ->setCategory($this->getReference('default-category'))
......
...@@ -2,11 +2,17 @@ ...@@ -2,11 +2,17 @@
namespace Jity\HomepageBundle\Entity; namespace Jity\HomepageBundle\Entity;
use Gedmo\Mapping\Annotation as Gedmo;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
* @ORM\Entity * @ORM\Entity
* @ORM\Table(name="page") * @ORM\Table(
* name="page",
* indexes={
* @ORM\Index(name="slug_idx", columns={"slug"})
* }
* )
*/ */
class Page class Page
{ {
...@@ -18,7 +24,8 @@ class Page ...@@ -18,7 +24,8 @@ class Page
protected $id; protected $id;
/** /**
* @ORM\Column(type="string", length=100, unique=true) * @Gedmo\Slug(fields={"title"})
* @ORM\Column(type="string", length=200)
*/ */
protected $slug; protected $slug;
...@@ -287,3 +294,4 @@ class Page ...@@ -287,3 +294,4 @@ class Page
return $this->service; return $this->service;
} }
} }
...@@ -26,12 +26,18 @@ class PageType extends AbstractType ...@@ -26,12 +26,18 @@ class PageType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder $builder
->add('slug', null, array(
'label' => 'Schlagzeile (für die Url)'
))
->add('title', null, array( ->add('title', null, array(
'label' => 'Titel der Seite' 'label' => 'Titel der Seite'
)) ))
->add('slug', null, array(
'label' => 'Schlagzeile (für die Url)',
'attr' => array(
'rel' => 'popover',
'data-trigger' => 'focus',
'data-original-title' => 'Information',
'data-content' => 'Der Slug wird automatisch aus dem Titel generiert. Sie können ihn aber auch manuell festgelegt.'
)
))
->add('icon', null, array( ->add('icon', null, array(
'attr' => array( 'attr' => array(
'data-target' => '#icons_modal', 'data-target' => '#icons_modal',
...@@ -41,38 +47,38 @@ class PageType extends AbstractType ...@@ -41,38 +47,38 @@ class PageType extends AbstractType
)) ))
->add('content', null, array( ->add('content', null, array(
'attr' => array( 'attr' => array(
'rows' => '6', 'rows' => '6',
'class' => 'span4', 'class' => 'span4',
'data-target' => '#editor_modal', 'data-target' => '#editor_modal',
'data-toggle' => 'modal' 'data-toggle' => 'modal'
), ),
'label' => 'Inhalt' 'label' => 'Inhalt'
)) ))
->add('service', 'entity', array( ->add('service', 'entity', array(
'class'=>'Jity\HomepageBundle\Entity\Service', 'class' => 'Jity\HomepageBundle\Entity\Service',
'property' => 'title', 'property' => 'title',
'required' => false, 'required' => false,
'label' => 'Service' 'label' => 'Service'
)) ))
->add('category', 'entity', array( ->add('category', 'entity', array(
'class'=>'Jity\HomepageBundle\Entity\Category', 'class' => 'Jity\HomepageBundle\Entity\Category',
'property' => 'name', 'property' => 'name',
'label' => 'Kategorie' 'label' => 'Kategorie'
)) ))
->add('sidebar', 'entity', array( ->add('sidebar', 'entity', array(
'class'=>'Jity\HomepageBundle\Entity\Sidebar', 'class' => 'Jity\HomepageBundle\Entity\Sidebar',
'property' => 'name', 'property' => 'name',
'label' => 'Sidebar' 'label' => 'Sidebar'
)) ))
->add('navigation', 'entity', array( ->add('navigation', 'entity', array(
'class'=>'Jity\HomepageBundle\Entity\Navigation', 'class' => 'Jity\HomepageBundle\Entity\Navigation',
'property' => 'name', 'property' => 'name',
'label' => 'Navigation' 'label' => 'Navigation'
)) ))
->add('author', 'entity', array( ->add('author', 'entity', array(
'class'=>'Jity\HomepageBundle\Entity\User', 'class' => 'Jity\HomepageBundle\Entity\User',
'property' => 'email', 'property' => 'email',
'label' => 'Autor' 'label' => 'Autor'
)) ))
; ;
} }
......
...@@ -324,6 +324,21 @@ input[type="url"], input[type="search"], input[type="tel"], input[type="color"], ...@@ -324,6 +324,21 @@ input[type="url"], input[type="search"], input[type="tel"], input[type="color"],
box-shadow: 0 1px 0 #4D4945 inset; 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;
}
input::-moz-focus-inner, button::-moz-focus-inner { input::-moz-focus-inner, button::-moz-focus-inner {
border: 0; border: 0;
} }
......
$(document).ready(function() { $(document).ready(function() {
// Init google prettify // Init google prettify
prettyPrint(); prettyPrint();
// Start popover on all rel elements
$("*[rel=popover]").popover();
}); });
...@@ -6,5 +6,5 @@ ...@@ -6,5 +6,5 @@
#</IfModule> #</IfModule>
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ maintenance/info.html [QSA,L] RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule> </IfModule>
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