Skip to content

Commit 5e7fa55

Browse files
committed
Merge branch '2.5'
* 2.5: Cleaned up javascript code Added a code example for emailing on 4xx and 5xx errors without 404's changed submit button label Missing apostrophe in source example. Added missing closing parenthesis to example. Fixed link to documentation standards fix Twig-extensions links Missing space Removed extra parenthesis
2 parents 1117741 + f11d31f commit 5e7fa55

File tree

9 files changed

+31
-14
lines changed

9 files changed

+31
-14
lines changed

best_practices/business-logic.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Now you can use the custom slugger in any controller class, such as the
104104
// ...
105105
106106
if ($form->isSubmitted() && $form->isValid()) {
107-
$slug = $this->get('slugger')->slugify($post->getTitle()));
107+
$slug = $this->get('slugger')->slugify($post->getTitle());
108108
$post->setSlug($slug);
109109
110110
// ...

book/forms.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ from inside a controller::
103103
$form = $this->createFormBuilder($task)
104104
->add('task', 'text')
105105
->add('dueDate', 'date')
106-
->add('save', 'submit', array('label' => 'Create Post'))
106+
->add('save', 'submit', array('label' => 'Create Task'))
107107
->getForm();
108108

109109
return $this->render('AcmeTaskBundle:Default:new.html.twig', array(
@@ -219,7 +219,7 @@ controller::
219219
$form = $this->createFormBuilder($task)
220220
->add('task', 'text')
221221
->add('dueDate', 'date')
222-
->add('save', 'submit', array('label' => 'Create Post'))
222+
->add('save', 'submit', array('label' => 'Create Task'))
223223
->getForm();
224224

225225
$form->handleRequest($request);
@@ -297,7 +297,7 @@ To do this, add a second button with the caption "Save and add" to your form::
297297
$form = $this->createFormBuilder($task)
298298
->add('task', 'text')
299299
->add('dueDate', 'date')
300-
->add('save', 'submit', array('label' => 'Create Post'))
300+
->add('save', 'submit', array('label' => 'Create Task'))
301301
->add('saveAndAdd', 'submit', array('label' => 'Save and Add'))
302302
->getForm();
303303

components/form/introduction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ by ``handleRequest()`` to determine whether a form has been submitted):
514514
$formBuilder = $formFactory->createBuilder('form', null, array(
515515
'action' => '/search',
516516
'method' => 'GET',
517-
);
517+
));
518518
519519
// ...
520520

contributing/documentation/overview.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ memorable name for the new branch:
6868
6969
**Step 5.** Now make your changes in the documentation. Add, tweak, reword and
7070
even remove any content, but make sure that you comply with the
71-
doc:`/contributing/documentation/standards`.
71+
:doc:`/contributing/documentation/standards`.
7272

7373
**Step 6.** **Push** the changes to your forked repository:
7474

cookbook/doctrine/dbal.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ mapping type:
166166
// app/config/config.php
167167
$container->loadFromExtension('doctrine', array(
168168
'dbal' => array(
169-
mapping_types' => array(
169+
'mapping_types' => array(
170170
'enum' => 'string',
171171
),
172172
),

cookbook/logging/monolog_email.rst

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ it is broken down.
1919
handlers:
2020
mail:
2121
type: fingers_crossed
22+
# 500 errors are logged at the critical level
2223
action_level: critical
24+
# to also log 400 level errors (but not 404's):
25+
# action_level: error
26+
# excluded_404:
27+
# - ^/
2328
handler: buffered
2429
buffered:
2530
type: buffer
@@ -48,6 +53,12 @@ it is broken down.
4853
type="fingers_crossed"
4954
action-level="critical"
5055
handler="buffered"
56+
<!--
57+
To also log 400 level errors (but not 404's):
58+
action-level="error"
59+
And add this child inside this monolog:handler
60+
<monolog:excluded-404>^/</monolog:excluded-404>
61+
-->
5162
/>
5263
<monolog:handler
5364
name="buffered"
@@ -81,6 +92,11 @@ it is broken down.
8192
'mail' => array(
8293
'type' => 'fingers_crossed',
8394
'action_level' => 'critical',
95+
// to also log 400 level errors (but not 404's):
96+
// 'action_level' => 'error',
97+
// 'excluded_404s' => array(
98+
// '^/',
99+
// ),
84100
'handler' => 'buffered',
85101
),
86102
'buffered' => array(
@@ -108,7 +124,8 @@ setting means that the output is then passed onto the ``buffered`` handler.
108124
.. tip::
109125

110126
If you want both 400 level and 500 level errors to trigger an email,
111-
set the ``action_level`` to ``error`` instead of ``critical``.
127+
set the ``action_level`` to ``error`` instead of ``critical``. See the
128+
code above for an example.
112129

113130
The ``buffered`` handler simply keeps all the messages for a request and
114131
then passes them onto the nested handler in one go. If you do not use this

cookbook/security/voters_data_permission.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ edit a particular object. Here's an example implementation:
9898
// check if the voter is used correct, only allow one attribute
9999
// this isn't a requirement, it's just one easy way for you to
100100
// design your voter
101-
if(1 !== count($attributes)) {
101+
if (1 !== count($attributes)) {
102102
throw new \InvalidArgumentException(
103103
'Only one attribute is allowed for VIEW or EDIT'
104104
);

cookbook/templating/twig_extension.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ Learning further
126126
For a more in-depth look into Twig Extensions, please take a look at the
127127
`Twig extensions documentation`_.
128128

129-
.. _`Twig official extension repository`: https://github.com/fabpot/Twig-extensions
129+
.. _`Twig official extension repository`: https://github.com/twigphp/Twig-extensions
130130
.. _`Twig extensions documentation`: http://twig.sensiolabs.org/doc/advanced.html#creating-an-extension
131131
.. _`global variables`: http://twig.sensiolabs.org/doc/advanced.html#id1
132132
.. _`functions`: http://twig.sensiolabs.org/doc/advanced.html#id2

reference/forms/types/collection.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ you need is the JavaScript:
180180
var emailCount = '{{ form.emails|length }}';
181181

182182
jQuery(document).ready(function() {
183-
jQuery('#add-another-email').click(function() {
183+
jQuery('#add-another-email').click(function(e) {
184+
e.preventDefault();
185+
184186
var emailList = jQuery('#email-fields-list');
185187

186188
// grab the prototype template
@@ -193,9 +195,7 @@ you need is the JavaScript:
193195

194196
// create a new list element and add it to the list
195197
var newLi = jQuery('<li></li>').html(newWidget);
196-
newLi.appendTo(jQuery('#email-fields-list'));
197-
198-
return false;
198+
newLi.appendTo(emailList);
199199
});
200200
})
201201
</script>

0 commit comments

Comments
 (0)