Permalink
Browse files

use dynamic snippets

  • Loading branch information...
chemix committed Jun 25, 2014
1 parent 229592e commit d4e73defeb07033c4da59f5c3ee4892abbeb63e6
Showing with 14 additions and 2 deletions.
  1. +13 −1 app/presenters/AdminPresenter.php
  2. +1 −1 app/templates/Admin/default.latte
@@ -19,12 +19,19 @@ class AdminPresenter extends BasePresenter
public function renderDefault()
{
$this->template->wallPosts = $this->wallposts->getAllPosts();
if (!isset($this->template->wallPosts)) {
$this->template->wallPosts = $this->wallposts->getAllPosts();
}
}
public function handleEnablePost($postId)
{
if ($this->wallposts->enablePost($postId)) {
$this->template->wallPosts = $this->isAjax()
? array($this->wallposts->getOne($postId))
: $this->wallposts->getAllPosts();
$this->flashMessage('Post enabled');
$this->redrawControl('flashes');
$this->redrawControl('wallposts');
@@ -39,6 +46,11 @@ public function handleEnablePost($postId)
public function handleDisablePost($postId)
{
if ($this->wallposts->disablePost($postId)) {
$this->template->wallPosts = $this->isAjax()
? array($this->wallposts->getOne($postId))
: $this->wallposts->getAllPosts();
$this->flashMessage('Post disabled');
$this->redrawControl('flashes');
$this->redrawControl('wallposts');
@@ -5,7 +5,7 @@

{snippet wallposts}
{foreach $wallPosts as $post}
<div class="row">
<div class="row" n:snippet="item-$post->id">
<div class="large-2 columns small-3">
{if $post->picture}
<img src="{$post->picture}">

0 comments on commit d4e73de

Please sign in to comment.