Adminlte Generators
AdminLTE generators provides easy AdminLTE integration with Rails 4. AdminLTE is a rich Twitter Bootstrap admin template.
Installation
Add this line to your application's Gemfile:
gem 'adminlte-generators'
Run bundle install:
bundle install
Generators
Get started:
$ rails generate adminlte:install
From now on, any time you generate a controller or scaffold, you'll get AdminLTE template. Sidebar and Header are also generated just for you.
Usage
To print the options and usage run the command rails generate adminlte:install --help
Options
Template engines
Currently only erb is supported.
Stylesheet engines
Currently only scss is supported.
Named layout
You could provide a name for generated layout (usefull if you've got few layouts in your app).
Simply run:
rails generate adminlte:install --layout_name=admin
Default skin
AdminLTE comes with blue skin by default. If you wish to change it to black just run:
rails generate adminlte:install --skin=black
Skip turbolinks
Run the generator with option --skip-turbolinks
to remove turbolinks references from the generated layout.
Helpers
Oh, btw you'll get 2 navigation helpers for free.
For sidebar links you could use nav_link
helper:
<%= nav_link root_path do %>
<i class="fa fa-dashboard"></i> <span>Dashboard</span>
<% end %>
And if you want to create a treeview, just use treeview_link
helper:
<%= treeview_link 'Lots of links here' do %>
<%= nav_link you_shall_not_path do %>
<i class="fa fa-angle-double-right"></i>
One Way
<% end %>
<%= nav_link you_shall__path do %>
<i class="fa fa-angle-double-right"></i>
Another
<% end %>
<% end %>
Known issues
There is an known issue with gem spring
. In case if after running rails g adminlte:install
your app will keep using default rails scaffold templates - you may need to restart spring or simply run your rails g scaffold Model
or rails g controller ControllerName
in another terminal window.
If someone know how to fix this - please let me know or simply create a pull request.
Contributing
- Fork it ( https://github.com/chukcha-wtf/adminlte-generators/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Credits
TODO:
Write tests for generators