Skip to content

Commit

Permalink
add announcements to blog
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbeig committed Sep 13, 2024
1 parent a97d1bf commit 4ae1b0c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Resources/templates/responsive/blog/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

$this->section('content');

$this->supply('announcements', $this->insert("partials/components/announcements"));

?>

<div class="blog">
Expand Down
6 changes: 2 additions & 4 deletions public/templates/responsive/blog/partials/javascript.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<!-- POST PROCESSING THIS JAVASCRIPT BY GRUNT -->
<!-- build:js assets/js/blog.js -->
<script src="<?= SRC_URL ?>/assets/vendor/slick-carousel/slick/slick.min.js"></script>
<script type="text/javascript" src="<?= SRC_URL ?>/assets/vendor/selection-sharer/selection-sharer.js" ></script>
<script type="text/javascript" src="<?= SRC_URL ?>/assets/vendor/selection-sharer/selection-sharer.js"></script>
<script type="text/javascript" src="<?= SRC_URL ?>/assets/js/components/announcements.js"></script>
<!-- endbuild -->



15 changes: 13 additions & 2 deletions src/Goteo/Controller/BlogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,19 @@
use Goteo\Model\Blog\Post;
use Goteo\Model\Blog\Post\Tag;
use Goteo\Model\Node\NodePost;
use Goteo\Repository\AnnouncementRepository;
use Symfony\Component\HttpFoundation\Request;

class BlogController extends Controller {

private AnnouncementRepository $announcementRepository;

public function __construct() {
$this->dbReplica(true);
$this->dbCache(true);
View::setTheme('responsive');

$this->announcementRepository = new AnnouncementRepository();
}

public function indexAction(Request $request, $section='', $tag='') {
Expand Down Expand Up @@ -56,14 +61,17 @@ public function indexAction(Request $request, $section='', $tag='') {
$blog_sections = Post::getListSections();
$tag = Tag::get($tag);

$announcements = $this->announcementRepository->getActiveList();

return $this->viewResponse('blog/list', [
'banners' => $banners,
'list_posts' => $list_posts,
'blog_sections' => $blog_sections,
'section' => $section,
'tag' => $tag,
'limit' => $limit,
'total' => $total
'total' => $total,
'announcements' => $announcements
]);
}

Expand Down Expand Up @@ -107,11 +115,14 @@ public function postAction(Request $request, $slug)

$related_posts = Post::getList(['tag' => $first_key_tags, 'excluded' => $post->id ], true, 0, $limit = 3, false);

$announcements = $this->announcementRepository->getActiveList();

return $this->viewResponse('blog/post', [
'post' => $post,
'blog_sections' => $blog_sections,
'related_posts' => $related_posts,
'author' => $author
'author' => $author,
'announcements' => $announcements
]);
}
}

0 comments on commit 4ae1b0c

Please sign in to comment.