first draft

This commit is contained in:
Kevin Papst
2016-10-20 22:10:41 +02:00
parent 94a35ff914
commit 579b962c85
186 changed files with 30734 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
{#
By default, forms enable client-side validation. This means that you can't
test the server-side validation errors from the browser. To temporarily
disable this validation, add the 'novalidate' attribute:
{{ form_start(form, { method: ..., action: ..., attr: { novalidate: 'novalidate' } }) }}
#}
{{ form_start(form, { method: 'POST', action: path('comment_new', { 'postSlug': post.slug }) }) }}
{# instead of displaying form fields one by one, you can also display them
all with their default options and styles just by calling to this function:
{{ form_widget(form) }}
#}
<fieldset>
<legend>{{ 'title.add_comment'|trans }}</legend>
{# Render any global form error (e.g. when a constraint on a public getter method failed) #}
{{ form_errors(form) }}
<div class="form-group {% if not form.content.vars.valid %}has-error{% endif %}">
{{ form_label(form.content, 'label.content', { label_attr: { class: 'hidden' }}) }}
{# Render any errors for the "content" field (e.g. when a class property constraint failed) #}
{{ form_errors(form.content) }}
{{ form_widget(form.content, { attr: { rows: 10 } }) }}
</div>
<div class="form-group">
<button class="btn btn-primary pull-right" type="submit">{{ 'action.publish_comment'|trans }}</button>
</div>
</fieldset>
{{ form_end(form) }}

View File

@@ -0,0 +1,19 @@
{# Bootstrap modal, see http://getbootstrap.com/javascript/#modals #}
<div class="modal fade" id="confirmationModal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<h4>{{ 'delete_post_modal.title'|trans }}</h4>
<p>{{ 'delete_post_modal.body'|trans }}</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" id="btnNo" data-dismiss="modal">
{{ 'label.cancel'|trans }}
</button>
<button type="button" class="btn btn-danger" id="btnYes" data-dismiss="modal">
{{ 'label.delete_post'|trans }}
</button>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,15 @@
<div class="section about">
<div class="well well-lg">
<p>
{{ 'help.app_description'|trans|raw }}
</p>
<p>
{{ 'help.more_information'|trans|raw }}
</p>
</div>
</div>
{# it's not mandatory to set the timezone in localizeddate(). This is done to
avoid errors when the 'intl' PHP extension is not available and the application
is forced to use the limited "intl polyfill", which only supports UTC and GMT #}
<!-- Fragment rendered on {{ 'now'|localizeddate('long', 'long', null, 'UTC') }} -->

View File

@@ -0,0 +1,11 @@
{% extends 'base.html.twig' %}
{% block body_id 'comment_form_error' %}
{% block main %}
<h1 class="text-danger">{{ 'title.comment_error'|trans }}</h1>
<div class="well">
{{ include('blog/_comment_form.html.twig') }}
</div>
{% endblock %}

View File

@@ -0,0 +1,27 @@
{% extends 'base.html.twig' %}
{% block body_id 'blog_index' %}
{% block main %}
{% for post in posts %}
<article class="post">
<h2>
<a href="{{ path('blog_post', { slug: post.slug }) }}">
{{ post.title }}
</a>
</h2>
{{ post.summary|md2html }}
</article>
{% else %}
<div class="well">{{ 'post.no_posts_found'|trans }}</div>
{% endfor %}
<div class="navigation text-center">
{{ pagerfanta(posts, 'twitter_bootstrap3_translated', { routeName: 'blog_index_paginated' }) }}
</div>
{% endblock %}
{% block sidebar %}
{{ parent() }}
{% endblock %}

View File

@@ -0,0 +1,64 @@
{% extends 'base.html.twig' %}
{% block body_id 'blog_post_show' %}
{% block main %}
<h1>{{ post.title }}</h1>
{{ post.content|md2html }}
<div id="post-add-comment" class="well">
{# The 'IS_AUTHENTICATED_FULLY' role ensures that the user has entered
his/her credentials (login + password) during this session. If he/she
is automatically logged via the 'Remember Me' functionality, he/she won't
be able to add a comment.
See http://symfony.com/doc/current/cookbook/security/remember_me.html#forcing-the-user-to-re-authenticate-before-accessing-certain-resources
#}
{% if is_granted('IS_AUTHENTICATED_FULLY') %}
{{ render(controller('AppBundle:Blog:commentForm', { 'id': post.id })) }}
{% else %}
<p>
<a class="btn btn-success" href="{{ path('security_login') }}">
<i class="fa fa-sign-in"></i> {{ 'action.sign_in'|trans }}
</a>
{{ 'post.to_publish_a_comment'|trans }}
</p>
{% endif %}
</div>
<h3>{{ 'post.num_comments'|transchoice(post.comments|length) }}</h3>
{% for comment in post.comments %}
<div class="row post-comment">
<h4 class="col-sm-3">
<strong>{{ comment.authorEmail }}</strong> {{ 'post.commented_on'|trans }}
{# it's not mandatory to set the timezone in localizeddate(). This is done to
avoid errors when the 'intl' PHP extension is not available and the application
is forced to use the limited "intl polyfill", which only supports UTC and GMT #}
<strong>{{ comment.publishedAt|localizeddate('medium', 'short', null, 'UTC') }}</strong>
</h4>
<div class="col-sm-9">
{{ comment.content|md2html }}
</div>
</div>
{% else %}
<div class="post-comment">
<p>{{ 'post.no_comments'|trans }}</p>
</div>
{% endfor %}
{% endblock %}
{% block sidebar %}
{% if app.user and post.isAuthor(app.user) %}
<div class="section">
<a class="btn btn-lg btn-block btn-success" href="{{ path('admin_post_edit', { id: post.id }) }}">
<i class="fa fa-edit"></i> {{ 'action.edit_post'|trans }}
</a>
</div>
{% endif %}
{# the parent() function includes the contents defined by the parent template
('base.html.twig') for this block ('sidebar'). This is a very convenient way
to share common contents in different templates #}
{{ parent() }}
{% endblock %}