padrino/padrino-framework — pull request #1226 by xavriley (2013-04-05 21:48:05+00:00)
Title: Allow users to override admin templates on a file by file basis

This change lets users override single templates by including them in a `generators/templates` folder in the project root. It only uses the files that are there and falls back to the gem otherwise.

For example, if I want to include my company logo in every edit page I can add a file like so:

```
.
├── Gemfile
├── Gemfile.lock
├── Rakefile
├── admin
├── app
... other files in project
├── generators
│ ├── admin_extensions.rb
│ └── templates
│ └── haml
│ └── page
│ └── edit.haml.tt
├── lib
├── models
├── public
...etc
```

The admin generator will use my custom thor template for every edit page and fall back to the gem for everything else.

My use case for this has been when I'd like the admin generator to include image uploads by for models with a field name containing '_img' or a position widget for a field called 'position'. Being able to tweak the admin page generator to do this speeds up development when you have lots of models.

If the folder isn't there it doesn't complain and the generator works as standard. I've added tests for both the admin app and page generator.

What do people think?