FAILURE-GEM
Failuregem aims to be a timesafer for railsapps. Why should you copy&paste all the usefull GEMs in your Gemfile every time you start a new App?! Failuregem Includes couple of usefull Gems to start rightaway with Rails programming:
- Active_link_to
- Bootstrap
- Bootstrap Datepicker
- CanCanCan
- Capistrano
- Capistrano Postgresql
- Capistrano Rails
- Capistrano Rbenv
- Devise
- Devise CAS Authenticatable
- Font-Awesome-Rails
- Jquery-Rails
- Paperclip
- Rails Admin
- Rails Real Favicon
- Simple Form
- Will Paginate Bootstrap
Installation
Add it to your Gemfile:
gem 'failuregem'
Run the following command to install it:
bundle install
Install all GEMs
Run the following command to install & configure all included GEMs:
rails g simple_form:install --bootstrap
rails g devise:install
rails g devise User
rails g devise:views
rails g cancan:ability
rails g rails_admin:install
#Create Basic Configuration Files for Capistrano
bundle exec cap install
Import GEMs in application.scss
@import "bootstrap";
@import "font-awesome";
@import "bootstrap-datepicker3";
Import GEMs in application.js
//= require jquery3
//= require popper
//= require bootstrap
//= require bootstrap-datepicker/core
//= require bootstrap-datepicker/locales/bootstrap-datepicker.de.js
For using ActiveLinkTo please use the official documentation
Failuregem has the newest Bootstrap version included but you still have to import it to your application.scss To do that you have to rewrite application.css to application.scss
$ mv app/assets/stylesheets/application.css app/assets/stylesheets/application.scss
// Import Bootstrap in application.scss
@import "bootstrap";
Add Bootstrap dependencies and Bootstrap to your application.js
:
//= require jquery3
//= require popper
//= require bootstrap-sprockets
While bootstrap-sprockets
provides individual Bootstrap components
for ease of debugging, you may alternatively require
the concatenated bootstrap
for faster compilation:
//= require jquery3
//= require popper
//= require bootstrap
Add this line to app/assets/stylesheets/application.css
@import "bootstrap-datepicker3"
Add this line to app/assets/javascripts/application.js
//= require bootstrap-datepicker
The default includes support for all languages. You can fine tune the included locales to suit your needs:
//= require bootstrap-datepicker/core
//= require bootstrap-datepicker/locales/bootstrap-datepicker.es.js
//= require bootstrap-datepicker/locales/bootstrap-datepicker.fr.js
Using bootstrap-datepicker-rails
Just use the simple data-provide='datepicker'
attribute.
<input type="text" data-provide='datepicker' >
Or call datepicker() with any selector.
<input type="text" class='datepicker' >
<script type="text/javascript">
$(document).ready(function(){
$('.datepicker').datepicker();
});
</script>
To install CanCanCan you still have to load the installer
rails g cancan:ability
See Defining Abilities for details.
cap production deploy
When you run cap, Capistrano dutifully connects to your server(s) via SSH and executes the steps necessary to deploy your project. You can define those steps yourself by writing Rake tasks, or by using pre-built task libraries provided by the Capistrano community.
For more information please check the Documentation.
To install Devise you still have to load the installer
rails generate devise:install
In the following command you will replace MODEL
with the class name used for the application’s users (it’s frequently User
but could also be Admin
). This will create a model (if one does not exist) and configure it with the default Devise modules. The generator also configures your config/routes.rb
file to point to the Devise controller.
rails generate devise MODEL
Once devise_cas_authenticatable is installed, add the following to your user model:
devise :cas_authenticatable
To include the newest Font-Awesome you have to import to your application.scss
@import "font-awesome";
For using Paperclip please use the official documentation
To install RailsAdmin you still have to load the installer
rails g rails_admin:install
Provide a namespace for the routes when asked
Start a server rails s
and administer your data at /admin. (if you chose default namespace: /admin)
Go to RealFaviconGenerator for Ruby on Rails, submit your image and craft your icons.
Simple Form can be easily integrated to the Bootstrap.
To do that you have to use the bootstrap
option in the install generator, like this:
rails generate simple_form:install --bootstrap
No longer maintained
In the view, use the renderer: BootstrapPagination::Rails
option with the will_paginate
helper, for example:
<%= will_paginate @collection, renderer: BootstrapPagination::Rails %>