Commit 24c148af authored by Antonin's avatar Antonin

Améliorations des news.

parent af77bcaa
......@@ -101,4 +101,8 @@ h1.title {
.home_center {
padding-left: 15px;
padding-right: 15px;
}
.panel-heading h1 {
margin-top: 0px;
}
\ No newline at end of file
......@@ -10,6 +10,7 @@
namespace Application\Sonata\NewsBundle\Entity;
use Sonata\NewsBundle\Model\CommentInterface;
use Sonata\NewsBundle\Entity\BasePost as BasePost;
/**
......@@ -28,6 +29,15 @@ class Post extends BasePost
*/
protected $id;
/**
* {@inheritdoc}
*/
public function __construct()
{
parent::__construct();
$this->setCommentsDefaultStatus(CommentInterface::STATUS_MODERATE);
}
/**
* Get id
*
......
{#
This file is part of the Sonata package.
(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
{% extends sonata_block.templates.block_base %}
{% block block %}
<div class="sonata-news-block-recent-comment panel panel-default">
{% if settings.title %}
<div class="panel-heading">
<h3 class="panel-title sonata-news-block-recent-comment"><i class="fa fa-comments fa-fw"></i> {{ settings.title }}</h3>
</div>
{% endif %}
<div class="panel-body">
<div class="sonata-blog-post-container list-group">
{% for comment in pager.getResults() %}
{% if context.getSetting('mode') == 'admin' %}
<a class="list-group-item" href="{{ url('admin_sonata_news_comment_edit', { 'id': comment.id }) }}">
<span class="label label-{{ comment|sonata_status_class }}">
{% if comment.status == constant('Sonata\\NewsBundle\\Model\\CommentInterface::STATUS_INVALID') %}
{{ 'label_comment_invalid'|trans({}, 'SonataNewsBundle') }}
{% elseif comment.status == constant('Sonata\\NewsBundle\\Model\\CommentInterface::STATUS_VALID') %}
{{ 'label_comment_valid'|trans({}, 'SonataNewsBundle') }}
{% elseif comment.status == constant('Sonata\\NewsBundle\\Model\\CommentInterface::STATUS_MODERATE') %}
{{ 'label_comment_moderate'|trans({}, 'SonataNewsBundle') }}
{% else %}
{{ 'label_unknown_status'|trans({}, 'SonataNewsBundle') }}
{% endif %}
</span>&nbsp;
{{ comment.name }} - {{ comment.message|truncate(30) }}
</a>
{% else %}
<a class="list-group-item" href="{{ url('sonata_news_view', { 'permalink': sonata_news_permalink(comment.post) }) }}">{{ comment.name }} - {{ comment.message|truncate(30) }}
</a>
{% endif %}
{% else %}
<a href="#">{{ 'no_comment_found'|trans({}, 'SonataNewsBundle') }}</a>
{% endfor %}
</div>
{% if context.getSetting('mode') == 'admin' %}
<a href="{{ url('admin_sonata_news_comment_list') }}" class="btn btn-primary btn-block"><i class="fa fa-list"></i> {{ 'view_all_comments'|trans({}, 'SonataNewsBundle') }}</a>
{% endif %}
</div>
</div>
{% endblock %}
{% block sonata_page_breadcrumb %}
<div class="row-fluid clearfix">
{{ sonata_block_render_event('breadcrumb', { 'context': 'news_post', 'post': post, 'current_uri': app.request.requestUri }) }}
</div>
{% endblock %}
<article class="sonata-blog-post-container">
<div class="panel panel-default">
<div class="panel-heading">
<header>
<h1 class="sonata-blog-post-title">
<a href="{{ url('sonata_news_view', { 'permalink': sonata_news_permalink(post) }) }}">{{ post.title }}</a>
</h1>
<p>
<span class="label label-default"><i class="glyphicon glyphicon-calendar"></i> {{ post.publicationDateStart | format_date }}</span>
<span class="sonata-blog-post-author">{{ 'archive_author'|trans({'%author%': post.author }, 'SonataNewsBundle') }}</span>
</p>
<div class="sonata-blog-post-information">
<div class="sonata-blog-post-tag-container">
<div class="sonata-blog-post-tag-title">
{% if post.tags|length > 1 %}
<i class="glyphicon glyphicon-tags"></i>
{% else %}
<i class="glyphicon glyphicon-tag"></i>
{% endif %}
{{ 'published_under'|transchoice(post.tags|length, {}, 'SonataNewsBundle') }}
</div>
<div class="sonata-blog-post-tag-list">
{% for tag in post.tags %}
<a href="{{ url('sonata_news_tag', { 'tag': tag.slug } ) }}">{{ tag.name }}</a>
{% endfor %}
</div>
</div>
</div>
</header>
</div>
<div class="panel-body">
{% media post.image, 'wide' %}
{{ post.content|raw }}
</div>
</div>
<div class="well">
{% render(controller('SonataNewsBundle:Post:comments', {'postId': post.id})) %}
</div>
{% if post.iscommentable %}
{% render(controller('SonataNewsBundle:Post:addCommentForm', {
'postId': post.id,
'form': form
})) %}
{% else %}
<div>
{{ 'message_comments_are_closed'|trans({}, 'SonataNewsBundle') }}
</div>
{% endif %}
</article>
......@@ -101,4 +101,8 @@ h1.title {
.home_center {
padding-left: 15px;
padding-right: 15px;
}
.panel-heading h1 {
margin-top: 0px;
}
\ No newline at end of file
......@@ -101,4 +101,8 @@ h1.title {
.home_center {
padding-left: 15px;
padding-right: 15px;
}
.panel-heading h1 {
margin-top: 0px;
}
\ No newline at end of file
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