Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
claar committed Feb 27, 2015
2 parents 708e3d3 + 9a574bf commit 6fc4fb7
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 20 deletions.
18 changes: 5 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@
[![Build Status](http://img.shields.io/travis/Anahkiasen/former.svg?style=flat)](https://travis-ci.org/Anahkiasen/former)
[![Latest Stable Version](http://img.shields.io/packagist/v/anahkiasen/former.svg?style=flat)](https://packagist.org/packages/anahkiasen/former)
[![Total Downloads](http://img.shields.io/packagist/dt/anahkiasen/former.svg?style=flat)](https://packagist.org/packages/anahkiasen/former)
[![Scrutinizer Quality Score](http://img.shields.io/scrutinizer/g/Anahkiasen/former.svg?style=flat)](https://scrutinizer-ci.com/g/Anahkiasen/former/)
[![Code Coverage](http://img.shields.io/scrutinizer/coverage/g/Anahkiasen/former.svg?style=flat)](https://scrutinizer-ci.com/g/Anahkiasen/former/)
[![Dependency Status](https://www.versioneye.com/user/projects/54363f5eb2a9c51d400000d0/badge.svg?style=flat)](https://www.versioneye.com/user/projects/54363f5eb2a9c51d400000d0)
[![Support via Gittip](http://img.shields.io/gittip/Anahkiasen.svg?style=flat)](https://www.gittip.com/Anahkiasen/)

### For Laravel 5, use the [4.0 branch](https://github.com/Anahkiasen/former/tree/4.0)
### For Laravel 5, use the [4.0 branch](https://github.com/formers/former/tree/4.0)

Former is the name of a little project I'd like to present you — it's a PHP package that allows you to do all kinds of powerful stuff with forms while remaining pretty simple to use. It's also a really nice guy too once you get to know him.

Expand Down Expand Up @@ -43,12 +39,10 @@ Former::close();
```

Every time you call a method that doesn't actually exist, Former assumes you're trying to set an attribute and creates it magically. That's why you can do in the above example `->rows(10)` ; in case you want to set attributes that contain dashes, just replace them by underscores : `->data_foo('bar')` equals `data-foo="bar"`.
Now of course in case you want to set an attribute that actually contains an underscore (jeez aren't you the little smartass) you can always use the fallback method `setAttribute('data_foo', 'bar')`. You're welcome.
Now of course in case you want to set an attribute that actually contains an underscore you can always use the fallback method `setAttribute('data_foo', 'bar')`. You're welcome.

This is the core of it, but Former offers a lot more. I invite you to consult the wiki to see the extend of what Former does.

Former is developed by [Maxime Fabre][] and [Peter Coles][].

-----

### Table of contents
Expand All @@ -57,8 +51,6 @@ Former is developed by [Maxime Fabre][] and [Peter Coles][].
- [Features][]
- [Anatomy][]

[Peter Coles]: http://petercoles.com
[Maxime Fabre]: http://autopergamene.eu
[Anatomy]: https://github.com/Anahkiasen/former/wiki/Anatomy
[Features]: https://github.com/Anahkiasen/former/wiki/Features
[Getting started]: https://github.com/Anahkiasen/former/wiki/Getting-started
[Anatomy]: https://github.com/formers/former/wiki/Anatomy
[Features]: https://github.com/formers/former/wiki/Features
[Getting started]: https://github.com/formers/former/wiki/Getting-started
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"illuminate/translation": "~4.2"
},
"require-dev": {
"phpunit/phpunit": "~4.1.6",
"phpunit/phpunit": "~4",
"mockery/mockery": "~0.9.1",
"illuminate/database": "~4.2"
},
Expand Down
4 changes: 4 additions & 0 deletions src/Former/Traits/Checkable.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,10 @@ protected function createCheckable($item, $fallbackValue = 1)
if ($this->isOfType('checkbox', 'checkboxes')) {
if ($this->isPushed or ($this->app['former']->getOption('push_checkboxes') and $this->isPushed !== false)) {
$field = $this->app['former']->hidden($name)->forceValue($this->app['former']->getOption('unchecked_value')).$field->render();

// app['former.field'] was overwritten by Former::hidden() call in the line above, so here
// we reset it to $this to enable $this->app['former']->getErrors() to retrieve the correct object
$this->app->instance('former.field', $this);
}
}

Expand Down
10 changes: 8 additions & 2 deletions src/Laravel/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,28 @@ class File
'mpg' => 'video/mpeg',
'mpga' => 'audio/mpeg',
'oda' => 'application/oda',
'odp' => 'application/vnd.oasis.opendocument.presentation',
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
'odt' => 'application/vnd.oasis.opendocument.text',
'pdf' => array('application/pdf', 'application/x-download'),
'php' => array('application/x-httpd-php', 'text/x-php'),
'php3' => 'application/x-httpd-php',
'php4' => 'application/x-httpd-php',
'phps' => 'application/x-httpd-php-source',
'phtml' => 'application/x-httpd-php',
'png' => 'image/png',
'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint'),
'pps' => array('application/mspowerpoint', 'application/vnd.ms-powerpoint'),
'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
'ppt' => array('application/vnd.ms-powerpoint', 'application/powerpoint'),
'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'ps' => 'application/postscript',
'psd' => 'application/x-photoshop',
'qt' => 'video/quicktime',
'ra' => 'audio/x-realaudio',
'ram' => 'audio/x-pn-realaudio',
'rm' => 'audio/x-pn-realaudio',
'rpm' => 'audio/x-pn-realaudio-plugin',
'rtf' => 'text/rtf',
'rtf' => array('application/rtf', 'text/rtf'),
'rtx' => 'text/richtext',
'rv' => 'video/vnd.rn-realvideo',
'sea' => 'application/octet-stream',
Expand Down
2 changes: 1 addition & 1 deletion tests/Fields/CheckboxTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private function matchCheckbox(
$radio = '<input'.$this->attributes($checkAttr).'>';

if (!$inline && $this->former->framework() === 'TwitterBootstrap3') {
unset($labelAttr['class']);
$labelAttr['class'] = "";
}

$control = $label ? '<label'.$this->attributes($labelAttr).'>'.$radio.$label.'</label>' : $radio;
Expand Down
2 changes: 1 addition & 1 deletion tests/Fields/PlainTextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function matchPlainTextInput()
*/
protected function formStaticGroup(
$input = '<div class="form-control-static" id="foo">bar</div>',
$label = '<label class="control-label col-lg-2 col-sm-4">Foo</label>'
$label = '<label for="" class="control-label col-lg-2 col-sm-4">Foo</label>'
) {
return $this->formGroup($input, $label);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Fields/RadioTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private function matchRadio(
$radio = '<input'.$this->attributes($radioAttr).'>';

if (!$inline && $this->former->framework() === 'TwitterBootstrap3') {
unset($labelAttr['class']);
$labelAttr['class'] = "";
}

$control = $label ? '<label'.$this->attributes($labelAttr).'>'.$radio.$label.'</label>' : $radio;
Expand Down
3 changes: 2 additions & 1 deletion tests/TestCases/FormerTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ protected function controlGroupRequired($input, $label = '<label for="foo" class
*/
public function assertHTML($matcher, $input)
{
$this->assertTag(
// assertTag is deprecated, so we silence the E_DEPRECATED notice to make tests pass for now.
@$this->assertTag(
$matcher,
$input,
"Failed asserting that the HTML matches the provided format :\n\t"
Expand Down

0 comments on commit 6fc4fb7

Please sign in to comment.