RailsUiKit
Tool for developing markup (UI) in Rails.
Inspired by Cameron Daigle (Hashrocket) series of posts:
- http://hashrocket.com/blog/posts/managing-design-handoffs-with-the-ui-controller
- http://hashrocket.com/blog/posts/the-ui-controller-part-2-faking-it
- http://hashrocket.com/blog/posts/the-ui-controller-part-3-the-ui-helper
What included in the gem:
- controller for browsing list of UI templates
- helpers for creating sample data in the UI templates (read more about using in the above links)
This gem is compatible with Rails 3 and 4.
Installation and configuration
Add the next line to your application's Gemfile:
gem 'rails_ui_kit', group: :development
Note: If you want to use gem functionality on staging or production environment, don't forget to restrict access for /ui
resource if it necessary.
And then execute:
$ bundle
Mount engine routes in application config/routes.rb
:
Rails.application.routes.draw do
mount RailsUiKit::Engine => '/', as: 'rails_ui_kit'
end
Create your own layout in app/views/layouts
(e.g. ui.html.erb
) and define ui_layout
method in your ApplicationController
:
class ApplicationController < ActionController::Base
protected
def ui_layout
'ui'
end
end
Usage
Create UI templates in application app/views/ui/
folder.
Browse /ui/
path within app url in the browser to view the list of UI templates (partials and folders will be ignored).
Override / add functionality
Just create file in config/initializers/
, e.g.:
# config/initializers/ui_helper_override.rb
module UiHelper
def lorem_awesome
'woot'
end
end
Contributing
- Fork it ( http://github.com/puffy/rails_ui_kit/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 new Pull Request