Skip to content

Commit

Permalink
add basic samples for the publication workflow
Browse files Browse the repository at this point in the history
Fixes symfony-cmf#184
worked together with @christoph-hautzinger
  • Loading branch information
m3co-code committed Dec 12, 2014
1 parent fc7b656 commit b242e14
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/tests/HomepageTest.php
Expand Up @@ -29,7 +29,7 @@ public function testContents()
$this->assertCount(1, $crawler->filter('h1:contains(Homepage)'));
$this->assertCount(1, $crawler->filter('h2:contains("Welcome to the Symfony CMF Demo")'));

$menuCount = $this->isSearchSupported() ? 21 : 20;
$menuCount = $this->isSearchSupported() ? 22 : 21;
$this->assertCount($menuCount, $crawler->filter('ul.menu_main li'));
}

Expand Down
4 changes: 4 additions & 0 deletions src/Sandbox/MainBundle/DataFixtures/PHPCR/LoadMenuData.php
Expand Up @@ -67,6 +67,10 @@ public function load(ObjectManager $manager)
$this->createMenuNode($manager, $demo, 'test-item', 'Normal Symfony Route', null, null, 'test');
$this->createMenuNode($manager, $demo, 'external-item', 'External Link', null, 'http://cmf.symfony.com/');

$publicationDemo = $this->createMenuNode($manager, $main, 'publication-demo-item', 'Publication Demo', $manager->find(null, "$content_path/publication_demo"));
$this->createMenuNode($manager, $publicationDemo, 'not-published', 'Not published', $manager->find(null, "$content_path/not_published"));
$this->createMenuNode($manager, $publicationDemo, 'published-tomorrow', 'Published tomorrow', $manager->find(null, "$content_path/published_tomorrow"));

$singlelocale = $this->createMenuNode($manager, $main, 'singlelocale-item', array('en' => 'singlelocale'), $manager->find(null, "$content_path/singlelocale"));
$this->createMenuNode($manager, $singlelocale, 'singlelocale-sub-item', array('en' => 'singlelocale child'), $manager->find(null, "$content_path/singlelocale"));

Expand Down
16 changes: 16 additions & 0 deletions src/Sandbox/MainBundle/DataFixtures/PHPCR/LoadRoutingData.php
Expand Up @@ -165,6 +165,22 @@ public function load(ObjectManager $manager)
$singlelocale->setContent($manager->find(null, "$content_path/singlelocale"));
$manager->persist($singlelocale);

// publication demos
$publicationDemo = new Route;
$publicationDemo->setPosition($parent, 'publicationdemo');
$publicationDemo->setContent($manager->find(null, "$content_path/publication_demo"));
$manager->persist($publicationDemo);

$notPublished = new Route;
$notPublished->setPosition($publicationDemo, 'notpublished');
$notPublished->setContent($manager->find(null, "$content_path/not_published"));
$manager->persist($notPublished);

$publishedTomorrow = new Route;
$publishedTomorrow->setPosition($publicationDemo, 'publishedtomorrow');
$publishedTomorrow->setContent($manager->find(null, "$content_path/published_tomorrow"));
$manager->persist($publishedTomorrow);

$manager->flush();
}
}
Expand Up @@ -67,6 +67,11 @@ public function load(ObjectManager $manager)
$page->setBody($overview['body']);
}


if (isset($overview['publishable']) && $overview['publishable'] === false) {
$page->setPublishable(false);
}

if (!empty($overview['publishStartDate'])) {
$page->setPublishStartDate(new \DateTime($overview['publishStartDate']));
}
Expand Down
29 changes: 28 additions & 1 deletion src/Sandbox/MainBundle/Resources/data/page.yml
Expand Up @@ -151,7 +151,34 @@ static:
blocks:
additionalInfoBlock:
class: Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ContainerBlock

-
name: "publication_demo"
title: "Publication demo"
body: |
<p>There are two not published pages as children nodes of this item. You should be able to see them in the Admin GUI.</p>
<p>You have the possibilities to disable publication at all or to specify a time range in that a page should appear.</p>
blocks:
additionalInfoBlock:
class: Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ContainerBlock
-
name: "not_published"
title: "Not published"
publishable: false
body: |
<p>You should see this only in the Admin GUI.</p>
blocks:
additionalInfoBlock:
class: Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ContainerBlock
-
name: "published_tomorrow"
title: "Published tomorrow"
publishStartDate: tomorrow
publishEndDate: "+1 year"
body: |
<p>You should see this only in the Admin GUI, tomorrow...</p>
blocks:
additionalInfoBlock:
class: Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ContainerBlock
-
name: "singlelocale"
title:
Expand Down

0 comments on commit b242e14

Please sign in to comment.