Variants gem — be boss of your views
Your views are full of conditions and looks like mess of if and else's you should know how hard work with it. Variants created to solve this promblem.
This project uses Semantic Versioning for release numbering.
Usage
app/views/layouts/application.html.haml
:
%ul
- if v :logged_in?
%li= link_to 'Sign Out', sign_out_path
- else
%li= link_to 'Sign In', sign_in_path
%li= link_to 'Sign Up', sign_up_path
If you want to see some page as if you are logged in you can just pass GET param:
http://example.dev/?logged_in?=true
Installation
Puts this line into Gemfile
then run $ bundle
:
gem 'variants', '0.2.0'
Or if you are old-school Rails 2 developer put this into config/environment.rb
and run $ rake gems:install
:
config.gem 'variants', :version => '0.2.0'
Or manually install variants gem: $ gem install variants
API
TODO: Write full API
Roadmap
TODO: Write roadmap
Contributors
- @kossnocorp
Special thanks to @brainopia.
License
The MIT License
Copyright (c) 2011 Sasha Koss
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.