How to integrate a Wrap Bootstrap theme into an Rails application?

前端 未结 2 1801
不思量自难忘°
不思量自难忘° 2020-12-02 06:22

I have bought a twitter bootstrap theme from wrapbootstrap. I already have a functional rails application. Now, I want to design my application by integrating the bootstrap

2条回答
  •  猫巷女王i
    2020-12-02 07:24

    First check this screencast:

    http://railscasts.com/episodes/328-twitter-bootstrap-basics

    then I would add a bootstrap gem like bootstrap-sass, then add the JS files through the gem by adding them to the manifest, something like this:

    //= require jquery
    //= require jquery_ujs
    //= require bootstrap
    //= require_tree .
    

    then i would get the css files that you bought from wrapboostrap and place them in you assets/stylesheets folder, then add the necesary markup and clases to your app this is how ive done it before.

    hope it helps

    EDIT:

    Markup:

    Check the template you downloaded, lets start with the navbar for example

    Code from template:

    Now you need to place yourself in your app, if the navbar shows in every view on your app, you should mention it on the layouts/application.html.erb something like this:

    
    
    
      Golden Green Chlorella
      <%= stylesheet_link_tag    "application", :media => "all" %>
      <%= javascript_include_tag "application" %>
      <%= csrf_meta_tags %>
    
    
    
    
    <%= render :partial => 'layouts/navbar' %>
    <%= yield %>
    
    
    

    and last, do your navbar partial

    _navbar.html.erb:

    That was only for the navbar, now you need to do the rest, add the markup your template shows you to do, with all your app, its not an easy job, but thats how its done.

提交回复
热议问题