Skip to content

Commit ee8099c

Browse files
uikolasjaviereguiluz
authored andcommitted
Show better message when SQLite is not enabled
1 parent a5bec08 commit ee8099c

26 files changed

+466
-212
lines changed

app/AppKernel.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ public function registerBundles()
2222
new CodeExplorerBundle\CodeExplorerBundle(),
2323
new AppBundle\AppBundle(),
2424
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(), // used for initial population of non-SQLite databases in production envs
25-
// uncomment the following line if your application sends emails
26-
// new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
25+
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
2726
];
2827

2928
// Some bundles are only used while developing the application or during

app/Resources/translations/messages.en.xlf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,10 @@
243243
<source>menu.logout</source>
244244
<target>Logout</target>
245245
</trans-unit>
246+
<trans-unit id="menu.rss">
247+
<source>menu.rss</source>
248+
<target>Blog Posts RSS</target>
249+
</trans-unit>
246250

247251
<trans-unit id="post.to_publish_a_comment">
248252
<source>post.to_publish_a_comment</source>
@@ -277,6 +281,15 @@
277281
<target>Post deleted successfully!</target>
278282
</trans-unit>
279283

284+
<trans-unit id="notification.comment_created">
285+
<source>notification.comment_created</source>
286+
<target>Your post received a comment!</target>
287+
</trans-unit>
288+
<trans-unit id="notification.comment_created.description">
289+
<source>notification.comment_created.description</source>
290+
<target><![CDATA[Your post "%title%" has received a new comment. You can read the comment by following <a href="%link%">this link</a>]]></target>
291+
</trans-unit>
292+
280293
<trans-unit id="help.app_description">
281294
<source>help.app_description</source>
282295
<target><![CDATA[This is a <strong>demo application</strong> built in the Symfony Framework to illustrate the recommended way of developing Symfony applications.]]></target>
@@ -317,6 +330,15 @@
317330
<source>help.more_information</source>
318331
<target><![CDATA[For more information, check out the <a href="http://symfony.com/doc">Symfony doc</a>.]]></target>
319332
</trans-unit>
333+
334+
<trans-unit id="rss.title">
335+
<source>rss.title</source>
336+
<target>Symfony Demo blog</target>
337+
</trans-unit>
338+
<trans-unit id="rss.description">
339+
<source>rss.description</source>
340+
<target>Most recent posts published on the Symfony Demo blog</target>
341+
</trans-unit>
320342
</body>
321343
</file>
322344
</xliff>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{{ include('blog/_delete_post_confirmation.html.twig') }}
2+
<form action="{{ url('admin_post_delete', { id: post.id }) }}" method="post" data-confirmation="true">
3+
<input type="hidden" name="token" value="{{ csrf_token('delete') }}" />
4+
<input type="submit" value="{{ 'action.delete_post'|trans }}" class="btn btn-lg btn-block btn-danger" />
5+
</form>

app/Resources/views/admin/blog/edit.html.twig

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,15 @@
66
<h1>{{ 'title.edit_post'|trans({'%id%': post.id}) }}</h1>
77

88
{{ include('admin/blog/_form.html.twig', {
9-
form: edit_form,
9+
form: form,
1010
button_label: 'action.save'|trans,
1111
include_back_to_home_link: true,
1212
}, with_context = false) }}
1313
{% endblock %}
1414

1515
{% block sidebar %}
1616
<div class="section actions">
17-
{{ include('admin/blog/_form.html.twig', {
18-
form: delete_form,
19-
button_label: 'action.delete_post'|trans,
20-
button_css: 'btn btn-lg btn-block btn-danger',
21-
show_confirmation: true,
22-
}, with_context = false) }}
17+
{{ include('admin/blog/_delete_form.html.twig', { post: post }, with_context = false) }}
2318
</div>
2419

2520
{{ parent() }}

app/Resources/views/admin/blog/show.html.twig

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,10 @@
3838
</div>
3939

4040
<div class="section">
41-
{{ include('admin/blog/_form.html.twig', {
42-
form: delete_form,
43-
button_label: 'action.delete_post'|trans,
44-
button_css: 'btn btn-lg btn-block btn-danger',
45-
show_confirmation: true,
46-
}, with_context = false) }}
41+
{{ include('admin/blog/_delete_form.html.twig', { post: post }, with_context = false) }}
4742
</div>
4843

44+
{{ parent() }}
45+
4946
{{ show_source_code(_self) }}
5047
{% endblock %}

app/Resources/views/base.html.twig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<meta charset="UTF-8" />
1010
<meta name="viewport" content="width=device-width, initial-scale=1"/>
1111
<title>{% block title %}Symfony Demo application{% endblock %}</title>
12+
<link rel="alternate" type="application/rss+xml" title="{{ 'rss.title'|trans }}" href="{{ path('blog_rss') }}">
1213
{% block stylesheets %}
1314
<link rel="stylesheet" href="{{ asset('css/bootstrap-flatly-3.3.7.min.css') }}">
1415
<link rel="stylesheet" href="{{ asset('css/font-awesome-4.6.3.min.css') }}">
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<div class="section rss">
2+
<a href="{{ path('blog_rss') }}">
3+
<i class="fa fa-rss" aria-hidden="true"></i> {{ 'menu.rss'|trans }}
4+
</a>
5+
</div>

app/Resources/views/blog/index.html.twig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@
2828
{{ parent() }}
2929

3030
{{ show_source_code(_self) }}
31+
{{ include('blog/_rss.html.twig') }}
3132
{% endblock %}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<rss version="2.0">
3+
<channel>
4+
<title>{{ 'rss.title'|trans }}</title>
5+
<description>{{ 'rss.description'|trans }}</description>
6+
<pubDate>{{ 'now'|date('r', timezone='GMT') }}</pubDate>
7+
<lastBuildDate>{{ (posts|last).publishedAt|default('now')|date('r', timezone='GMT') }}</lastBuildDate>
8+
<link>{{ url('blog_index') }}</link>
9+
<language>{{ app.request.locale }}</language>
10+
11+
{% for post in posts %}
12+
<item>
13+
<title>{{ post.title }}</title>
14+
<description>{{ post.summary }}</description>
15+
<link>{{ url('blog_post', {'slug': post.slug}) }}</link>
16+
<guid>{{ url('blog_post', {'slug': post.slug}) }}</guid>
17+
<pubDate>{{ post.publishedAt|date(format='r', timezone='GMT') }}</pubDate>
18+
<author>{{ post.authorEmail }}</author>
19+
</item>
20+
{% endfor %}
21+
</channel>
22+
</rss>

app/Resources/views/blog/post_show.html.twig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
{% for comment in post.comments %}
3232
<div class="row post-comment">
33+
<a name="comment_{{ comment.id }}"></a>
3334
<h4 class="col-sm-3">
3435
<strong>{{ comment.authorEmail }}</strong> {{ 'post.commented_on'|trans }}
3536
{# it's not mandatory to set the timezone in localizeddate(). This is done to
@@ -63,4 +64,5 @@
6364
{{ parent() }}
6465

6566
{{ show_source_code(_self) }}
67+
{{ include('blog/_rss.html.twig') }}
6668
{% endblock %}

0 commit comments

Comments
 (0)