major refactoring and cleanup

This commit is contained in:
Kevin Papst
2016-10-23 00:12:32 +02:00
parent 5a85b1d37e
commit c492d30be3
70 changed files with 1304 additions and 4027 deletions

View File

@@ -1,25 +0,0 @@
{#
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, { attr: { novalidate: 'novalidate' } }) }}
#}
{% if show_confirmation|default(false) %}
{% set attr = {'data-confirmation': 'true'} %}
{{ include('blog/_delete_post_confirmation.html.twig') }}
{% endif %}
{{ form_start(form, { attr: attr|default({}) }) }}
{{ form_widget(form) }}
<input type="submit" value="{{ button_label|default('label.create_post'|trans) }}"
class="{{ button_css|default("btn btn-primary") }}" />
{% if include_back_to_home_link|default(false) %}
<a href="{{ path('admin_post_index') }}" class="btn btn-link">
{{ 'action.back_to_list'|trans }}
</a>
{% endif %}
{{ form_end(form) }}

View File

@@ -1,26 +0,0 @@
{% extends 'admin/layout.html.twig' %}
{% block body_id 'admin_post_edit' %}
{% block main %}
<h1>{{ 'title.edit_post'|trans({'%id%': post.id}) }}</h1>
{{ include('admin/blog/_form.html.twig', {
form: edit_form,
button_label: 'action.save'|trans,
include_back_to_home_link: true,
}, with_context = false) }}
{% endblock %}
{% block sidebar %}
<div class="section actions">
{{ include('admin/blog/_form.html.twig', {
form: delete_form,
button_label: 'action.delete_post'|trans,
button_css: 'btn btn-lg btn-block btn-danger',
show_confirmation: true,
}, with_context = false) }}
</div>
{{ parent() }}
{% endblock %}

View File

@@ -1,57 +0,0 @@
{% extends 'admin/layout.html.twig' %}
{% block body_id 'admin_post_index' %}
{% block main %}
<h1>{{ 'title.post_list'|trans }}</h1>
<table class="table table-striped">
<thead>
<tr>
<th>{{ 'label.title'|trans }}</th>
<th><i class="fa fa-user"></i> {{ 'label.author'|trans }}</th>
<th><i class="fa fa-calendar"></i> {{ 'label.published_at'|trans }}</th>
<th><i class="fa fa-cogs"></i> {{ 'label.actions'|trans }}</th>
</tr>
</thead>
<tbody>
{% for post in posts %}
<tr>
<td>{{ post.title }}</td>
<td>{{ post.authorEmail }}</td>
{# 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 #}
<td>{% if post.publishedAt %}{{ post.publishedAt|localizeddate('short', 'short', null, 'UTC') }}{% endif %}</td>
<td>
<div class="item-actions">
<a href="{{ path('admin_post_show', { id: post.id }) }}" class="btn btn-sm btn-default">
{{ 'action.show'|trans }}
</a>
{% if post.isAuthor(app.user) %}
<a href="{{ path('admin_post_edit', { id: post.id }) }}" class="btn btn-sm btn-primary">
<i class="fa fa-edit"></i> {{ 'action.edit'|trans }}
</a>
{% endif %}
</div>
</td>
</tr>
{% else %}
<tr>
<td colspan="4" align="center">{{ 'post.no_posts_found'|trans }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}
{% block sidebar %}
<div class="section actions">
<a href="{{ path('admin_post_new') }}" class="btn btn-lg btn-block btn-success">
<i class="fa fa-plus"></i> {{ 'action.create_post'|trans }}
</a>
</div>
{{ parent() }}
{% endblock %}

View File

@@ -1,27 +0,0 @@
{% extends 'admin/layout.html.twig' %}
{% block body_id 'admin_post_new' %}
{% block main %}
<h1>{{ 'title.post_new'|trans }}</h1>
{{ form_start(form) }}
{{ form_row(form.title) }}
{{ form_row(form.summary) }}
{{ form_row(form.content) }}
{{ form_row(form.authorEmail) }}
{{ form_row(form.publishedAt) }}
<input type="submit" value="{{ 'label.create_post'|trans }}" class="btn btn-primary" />
{{ form_widget(form.saveAndCreateNew, { label: 'label.save_and_create_new', attr: { class: 'btn btn-primary' } }) }}
<a href="{{ path('admin_post_index') }}" class="btn btn-link">
{{ 'action.back_to_list'|trans }}
</a>
{{ form_end(form) }}
{% endblock %}
{% block sidebar %}
{{ parent() }}
{% endblock %}

View File

@@ -1,48 +0,0 @@
{% extends 'admin/layout.html.twig' %}
{% block body_id 'admin_post_show' %}
{% block main %}
<h1>{{ post.title }}</h1>
<table class="table">
<tbody>
<tr>
<th>{{ 'label.summary'|trans }}</th>
<td>{{ post.summary|md2html }}</td>
</tr>
<tr>
<th>{{ 'label.content'|trans }}</th>
<td>{{ post.content|md2html }}</td>
</tr>
<tr>
<th>{{ 'label.author'|trans }}</th>
<td><p>{{ post.authorEmail }}</p></td>
</tr>
<tr>
<th>{{ 'label.published_at'|trans }}</th>
{# 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 #}
<td><p>{{ post.publishedAt|localizeddate('long', 'medium', null, 'UTC') }}</p></td>
</tr>
</tbody>
</table>
{% endblock %}
{% block sidebar %}
<div class="section">
<a href="{{ path('admin_post_edit', { id: post.id }) }}" class="btn btn-lg btn-block btn-success">
<i class="fa fa-edit"></i> {{ 'action.edit_contents'|trans }}
</a>
</div>
<div class="section">
{{ include('admin/blog/_form.html.twig', {
form: delete_form,
button_label: 'action.delete_post'|trans,
button_css: 'btn btn-lg btn-block btn-danger',
show_confirmation: true,
}, with_context = false) }}
</div>
{% endblock %}

View File

@@ -1,9 +0,0 @@
{#
This is the base template of the all backend pages.
See http://symfony.com/doc/current/book/templating.html#template-inheritance-and-layouts
#}
{% extends 'base.html.twig' %}
{% block header_navigation_links %}
{{ knp_menu_render('admin', {'template': 'menu/admin_menu.html.twig'}) }}
{% endblock %}