include buttons in a rails application - ruby-on-rails

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.

Related

How to implement the social sharing in rails app?

I want to implement the social sharing feature of the articles which have been posted in my rails app. I tried following the documentation of gem 'social-share-button' where the following steps were followed :
step 1: Add //= require rails-social-share-button in app/assets/javascripts/application.js
step 2: Add *= require rails-social-share-button in app/assets/stylesheets/application.css
step 3: use the social_share_button_tag helper method in views to display the social share buttons. for e.g = rails_social_share_button_tag('Share to Facebook', url: article_path(#article), desc: #article.content)
Error:
undefined method `rails_social_share_button_tag' for #<#:0x00005574ff28ec30>
You're missing a step or two from the gem's readme. The order of the instructions in the readme is a little misleading. Did you run rails generate rails_social_share_button:install? You may also want to check the contents of the "config/initializers/rails_social_share_button.rb" file after you've run that generator.
Alternatively, you may want to use the "social-share-button" gem. It looks like the one you're using, with its longer name, is a copy of everything in shorter-named "social-share-button" gem. Also it looks like the "social-share-button" gem has been around longer and is better maintained, as it already includes one bugfix that the gem you're using does not. I'd recommend first switching gems and then running bundle install. After switching gems, you should run the generator command listed in the readme for social-share-button, check the config file as the readme recommends, and then update your views accordingly.

Remove Bootstrap from my simple_form gem after install?

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.

Can't find spree folder in views in rails 4 app. How do i customize it?

I just integrated spree and zurb foundation on a rails 4 app and spree did not add any .html.erb files in views so I am not able to figure out how to customize the default layout of spree.
harriss-air:montrealfixed harrisrobin$ spree install --auto-accept
gemfile spree
gemfile spree_gateway
gemfile spree_auth_devise
run bundle install from "."
identical config/initializers/spree.rb
identical config/spree.yml
remove public/index.html
append public/robots.txt
exist app/assets/javascripts/store
exist app/assets/javascripts/admin
exist app/assets/stylesheets/store
exist app/assets/stylesheets/admin
exist app/assets/images/store
exist app/assets/images/admin
identical app/assets/javascripts/store/all.js
identical app/assets/stylesheets/store/all.css
identical app/assets/javascripts/admin/all.js
identical app/assets/stylesheets/admin/all.css
exist app/overrides
append db/seeds.rb
copying migrations
creating database
running migrations
loading seed data
loading sample data
insert config/routes.rb
**************************************************
We added the following line to your application's config/routes.rb file:
mount Spree::Core::Engine, :at => '/'
**************************************************
Spree has been installed successfully. You're all ready to go!
Everything goes smoothly when i install it.. but my app > views file is still the same, no spree folder. I can only see application.html.erb in layouts. So the question is.. how do i customize spree on rails 4 ? more specifically, how do i do the latter using zurb-foundation.
Spree provides a helpful customization guide located here:
http://guides.spreecommerce.com/developer/view.html
The views are being loaded from the Spree gem. You can type bundle show spree_frontend in order to see where the files are located on your filesystem. It should give you the list of files shown here (depending on your version):
https://github.com/spree/spree/tree/v2.1.2/frontend
Adding zurb-foundation in to Spree is going to be an invasive change. You may want to start with some smaller changes first to get the hang of customizing Spree.
Ok so to find the loaded views you have to use "bundle show spree" as gmacdougall suggested.
Can anyone please point me towards the right direction for integrating the foundation framework on a rails spree project ?
Thank you !
EDIT : while i did not find anything for foundation, i figured out that overriding the views so that it works with the foundation framework can be a lot of work and might not be a good idea for a noob like myself, so i found this
https://github.com/jdutil/spree_bootstrap
This replaces the spree front end with twitter bootstrap. Would have preferred Zurb Foundation but this is good!

less-rails-bootstrap ... where are the less files

I don't know if this is a ridiculous question however I am creating a website with RefineryCMS, Ruby, and Rails. I chose to speed up some things by using Twitter's Bootstrap via the less-rails-bootstrap gem. I do however need to customize some colors and such though I can't seem to locate any of the less files. I looked in the logs and see references to things such as 'twitter/bootstrap.css' though I'm not able to locate this or where the less files live.
Where are these things? Else, how to do you override the defaults?
When you complete with gem install and bundle install command , you should :
rails g bootstrap:install
This will insert some files in your app/assets dir , including bootstrap_and_overrides.css.less in app/assets/stylesheets.
You can learn more in this Railscast.
UPDATE: (Jan 25 2014): Valuable information form the comment of #Niels Abildgaard:
According to GitHub repository of less-rails-bootstrap gem, Rails generator command shoud be :
rails generate less_rails_bootstrap:custom_bootstrap

How to transform views in bootstrap-sass?

I've watched the Railscast video Twitter Bootstrap Basics. It describes how to use the LESS version of the Twitter Bootstrap for Rails named twitter-bootstrap-rails.
As SASS is part of Rails and I got some issues installing the LESS-version, I'm trying to use the SASS version named bootstrap-sass instead.
In the video he describes the command rails g bootstrap:themed products -f which converts standard layout to take advantage of the capabilities in Twitter Bootstrap. How can I do this in the bootstrap-sass gem?
This is not a direct answer, but my solution to a similar problem.
I like to download the full bootstrap download, grab bootstrap.css
run it through http://css2sass.heroku.com/
and take that and put in in app/assets/stylesheets as bootstrap.sass
This usually generates on or two errors in the sass with some funky nesting, but its non-essential stuff and I just clean it up real quick after loading a page on localhost

Resources