gem 'twitter-bootstrap-rails', :git => 'https://github.com/jonochang/twitter-bootstrap-rails.git' # TODO only in :group => :assets # TODO if jruby, then use static assets if config['use_simple_form'] after_everything do gsub_file "config/initializers/simple_form.rb", '# config.label_text = lambda { |label, required| "#{required} #{label}" }', 'config.label_text = lambda { |label, required| "#{label} #{required}" }' original_wrapper = <<-RB config.wrappers :class => :input, :error_class => :field_with_errors do |b| b.use :placeholder b.use :label_input b.use :hint, :tag => :span, :class => :hint b.use :error, :tag => :span, :class => :error end RB new_wrapper = <<-RB config.wrappers :inline, :class => 'clearfix', :error_class => :error do |b| b.use :placeholder b.use :label b.use :tag => 'div', :class => 'input' do |ba| ba.use :input ba.use :error, :tag => :span, :class => :'help-inline' ba.use :hint, :tag => :span, :class => :'help-block' end end config.wrappers :stacked, :class => "clearfix", :error_class => :error do |b| b.use :placeholder b.use :label b.use :hint, :tag => :span, :class => :'help-block' b.use :tag => 'div', :class => 'input' do |input| input.use :input input.use :error, :tag => :span, :class => :'help-inline' end end RB gsub_file "config/initializers/simple_form.rb", original_wrapper, new_wrapper gsub_file "config/initializers/simple_form.rb", "# config.button_class = 'button'", "config.button_class = 'btn'" application_layout_body = <<-ERB <%= yield %> ERB application_layout_body_new = <<-ERB

<%= link_to "TODO Logo", '/' %>

<% if not logged_in? %> <% else %> <% end %>
<% if alert %>
<%= alert %>
<% end %> <% if notice %>
<%= notice %>
<% end %> <%= yield %>
ERB gsub_file 'app/views/layouts/application.html.erb', application_layout_body, application_layout_body_new end create_file "app/assets/stylesheets/application.css.new", <<-CSS /* * This is a manifest file that'll automatically include all the stylesheets available in this directory * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at * the top of the compiled file, but it's generally better to create a new file per style scope. *= require_self *= require_tree . *= require bootstrap-1.3.0.min */ label { margin-right: 20px; } CSS run 'mv app/assets/stylesheets/application.css.new app/assets/stylesheets/application.css' end __END__ name: Twitter Bootstrap Rails description: Add Twitter Bootstrap CSS to project category: stylesheet exclusive: stylesheet tags: [css, stylesheet] run_after: [simple_form] config: - use_simple_form: type: boolean prompt: "Using Simple Form?" if_scroll: simple_form