I used a command to make the simple_form gem work well with bootstrap. I'm pretty sure it was:
$ rails g simple_form:install --bootstrap
But I've decided I'm not going to use Bootstrap as my Rails app will be mostly used with mobile phones. I'm going to go with jQuery mobile. I make use of both jQuery Mobile and Bootstrap in my app, at present, and they seem to be clashing sometimes in the use of class names. I'm just going to use jQuery Mobile which I think is sufficient. Any thoughts or useful articles on this would be handy.
So, what would be the command for undoing the above? I know it scattered a few files around the place in my app folder and I'd like to undo it to keep it clean. Thanks.
Run the following two commands:
rails d simple_form:install --bootstrap ## Destroy the existing configurations for simple_form
rails g simple_form:install ## Generate the clean configurations for simple_form
When you initially ran the generator for simple_form with --bootstrap option, it created bootstrap compatible configurations for simple_form. The changes that have been specifically made for bootstrap are spread across multiple files. It would be hard to cherry-pick them and remove unless you know exactly what needs to be removed and what to keep for simple_form.
Related
This devise generator saves a mountain of work by making all the views necessary for authentication:
rails g devise:views
Can the views above be generated but with bootstrap styling already included? E.g. perhaps similar to how rails new has the css=bootstrap option.
Note: I realise that styling is necessarily opinionated, however, it wouldn't be a bad thing since it would be a time-saver.
Maybe you can use rails templates.
An example with bootstrap and devise: https://github.com/lewagon/rails-templates
Note: It might be specific to the Le Wagon setup but I believe you can use the same approach to tailor it to your needs.
This gem adds bootstrap views:
https://github.com/kroger/devise-bootstrap5
Just add these two gems to your gemfile and you're basically done.
...
gem "devise-i18n"
gem "devise-bootstrap5"
...
I installed a new gem to my Rails project - 'phrasing' - which has gem dependencies on multiple Haml gems. I need the gem (it is adding some phenomenal functionality to my project), and need the dependencies to be installed, but now when I run rails generate scaffold, all of the view templates are generated in Haml rather than ERB. I need views to continue to be generated in ERB.
I reviewed several previous StackOverflow articles, but most focus on converting TO Haml, and the answers around making sure that ERB is the default generator refer to removing lines from the config files, which are not there in my case (it appears that the gems are controlling the default layout format somehow).
(Note: While I appreciate that there may be several advantages to using Haml, and I might consider using it in a new project, I'd like to keep this one consistent, and it's already 80% finished in ERB.)
Turns out this was as simple as adding the following into class Application in the config/application.rb file:
config.generators do |g|
g.template_engine :erb
end
Still not sure why the manual override was necessary, but it is. This fixes it.
I followed the instructions in this section:
git buttons
I want to customize the application that follows the example guide rails
I'm trying to implement some cascading style sheets, css files in my application.
I followed the video "CSS3Buttons Gem" but although the buttons work. Now I can see some nice buttons in my application, the application also returns me an error:
When I write the instruction rails g css3buttons console I get this error "Could not find generator css3buttons." Any ideas?
Why do you need to run rails g css3buttons?
In Rails 4 everything works without it:
Gemfile
#get latest available version from GitHub instead of RubyGems
gem 'css3buttons', '~> 1.0.1', git: 'https://github.com/StevenNunez/css3buttons_rails_helpers'
In root folder run bundle install
Add *= require css3buttons on top of others in 'app/assets/stylesheets/application.css'
Add <%= css3buttons_stylesheets %> in 'app/veiws/layouts/application.html.erb' in <head> section
Enjoy.
The generator you listed is to be used for Rails 3.0 apps only (ie. apps that do not use the asset pipeline that was introduced in Rails 3.1).
It doesn't look like the gem has been touched in over two years, so it's last compatibility check was for Rails 3.1. If it works in Rails 4 that's a happy bonus, but if it has problems, you may be out of luck.
through railscasts, I found http://railscasts.com/episodes/328-twitter-bootstrap-basics that with the
gem 'less-rails' (this is the gem https://github.com/seyhunak/twitter-bootstrap-rails)
I can use
rails g bootstrap:themed scaffold-name -f
which applies bootstap to various classes like table, buttons etc. This is amazing timesaver but I am not able to find this for SASS as I am using SASS for my rails app (I am using this gem https://github.com/thomas-mcdonald/bootstrap-sass)
IS there any way to apply bootstap to existing scaffold code as me doing this manually can take lot of time ? OR is there any easy way to put the classes in the .erb files ?
Thanks
Is it possible to customize or find a gem that changes the behaviors of auto generating Tables in the views when I use rails scaffold and change it with Divs instead? Like cleaner templates, I'm using rayan's nifty generators but it uses tables instead of divs .
Any help would be highly appreciate .
Eqbal
I don't know of any such scaffold generator, but you can build one easily by taking Ryan's nifty generators as a starting point. You can modify it to your needs by following these steps:
Fork the repository on Github and clone it.
Change the file /rails_generators/nifty_scaffold/templates/views/erb/index.html.erb to fit your needs.
Commit and push your changes.
Add the newly created Gem to your Gemfile like this:
gem "nifty-generators", :gem => "https://github.com/[your_user]/nifty-generators.git"