ineedahero ineedahero - 1 year ago 189
CSS Question

Bootstrap won't work in Redmine plugin

I've spent hours trying to use bootstrap for my rails web app, but it's doing absolutely nothing! I can't call any classes for it!

Here's my index.html.erb:

<div class="center">
<h1>Welcome to the User Database</h1>

<div class="jumbotron">
This is the home page for the User Database.

**<%= link_to "Add new entry", new_user_path, class: "btn btn-primary" %>
<%= button_to "Search", users_search_path, class: "button", :method => :get %>**

<!-- User Image -->
<div class="center">
<%= image_tag('user.jpg', :plugin => 'users') %>

<!-- Style sheet -->
<% content_for :header_tags do %>
<%= stylesheet_link_tag 'style', :plugin => 'users' %>
<% end %>

Notice the bolded code...the link_to line COMPLETELY IGNORES the bootstrap class, like it doesn't even exist! The button_to line works completely fine...

My Gemfile includes bootstrap (yes, I ran bundle install since updating it):

source ''

if <'1.5.0')
abort "Redmine requires Bundler 1.5.0 or higher (you're using #{Bundler::VERSION}).\nPlease update with 'gem update bundler'."

#Trying to get bootstrap...?
gem 'bootstrap-sass', '3.3.6'

gem "rails", "4.2.3"
gem "jquery-rails", "~> 3.1.3"


Also, my css file most certainly includes bootstrap:

@import "bootstrap-sprockets";
@import "bootstrap";

/* mixins, variables, etc. */

/* universal */

body {
padding-top: 0px;

section {
overflow: auto;


I also even included in bootstrap in my application.js:

// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file. JavaScript code in this file should be added after the last require_* statement.
// Read Sprockets README ( for details
// about supported directives.
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require bootstrap-sprockets
//= require_tree .

It just won't work! The only thing I can think of is that I am building my rails app as part of a plugin for Redmine, and that's somehow messing everything up...but I don't see how!


I tried doing this:

<% content_for :header_tags do %>
<%= stylesheet_link_tag 'application', :plugin => 'users' %>
<% end %>

But I get this cryptic error!

ActionController::RoutingError (No route matches [GET] "/plugin_assets/users/stylesheets/bootstrap"):

I don't understand what that means. Why is it looking for bootstrap file in stylesheets directory?? Google has never heard of this error message!

jan jan
Answer Source

Sorry to disappoint, but if you're building a Redmine plugin using Bootstrap, you're doing it wrong. A plugin (no matter for which platform) should offer a seamless user experience with regards to the host platform itself. Since Redmine is not using Bootstrap, there's no reason you should use it for your plugin.

Instead, you should have a look at the app/views directory in Redmine and use the same HTML elements in your plugin. You'll have a more seamless UI and less need for custom CSS... Hope that helps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download