A Redmine plugin which makes developing your own Redmine plugin easy ;)
Switch branches/tags
Clone or download
Latest commit c992de1 May 9, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app/helpers Switch from ZeroClipboard to clipboard.js Mar 28, 2017
assets Switch from ZeroClipboard to clipboard.js Mar 28, 2017
config/locales Fix truncated switch buttons Jul 4, 2014
AUTHORS Add AUTHORS file Sep 8, 2015
Gemfile Remove source from Gemfile Dec 31, 2016
LICENSE Add AUTHORS file Sep 8, 2015
README.md Update README.md May 9, 2018
init.rb Devel branch should have the latest code Mar 11, 2015

README.md

Redmine Bootstrap Kit Plugin

GitHub license GitHub release Code Climate

A Redmine plugin which makes developing your own Redmine plugin easy ;)

Why?

As Redmine does not support asset pipeline, we need to install JQuery plugins as Redmine plugins to load them globally.

It provides :

And a set of various Rails helper methods (see below).

Installation

Just clone it in your Redmine plugins directory :

cd REDMINE_ROOT/plugins
git clone https://github.com/jbox-web/redmine_bootstrap_kit.git

What's included?

It provides the following Rails helper methods :

BootstrapKit assets loader :

bootstrap_load_module(rbk_module)

This method loads all JS and CSS files needed by the required module.

The following modules are available :

  • alerts
  • label
  • modals
  • pagination
  • switch
  • tables
  • tabs
  • font_awesome
  • dropdown
  • tooltip
  • notify
  • tag_it

BootstrapSwitch :

bootstrap_switch_tag(opts = {}, &block)

FontAwesome :

fa_icon(icon, opts = {})
label_with_icon(label, icon, icon_opts = {})

AjaxHelper :

render_flash_messages_as_js(target = '#flash-messages', opts = {})
js_render_template(target, template, opts = {})
js_render_partial(target, partial, opts = {})
js_render(target, content, opts = {})

PresenterHelper :

present(object, klass = nil, *args)

JQuery TagIt :

tag_it_list(id, list_opts = {}, tag_it_opts = {}, &block)

WillPaginateHelper :

paginate(collection, opts = {})

ZeroClipboardHelper:

zero_clipboard_button_for(target)

How to use?

To use Redmine Bootstrap Kit helper methods you must first add :redmine_bootstrap_kit helper in your controller :

class MyPluginController < ApplicationController
  ...

  helper :redmine_bootstrap_kit

end

Then with the bootstrap_load_module method you can load the desired assets in your views :

<% content_for :header_tags do %>
  <%= bootstrap_load_base %>
  <%= bootstrap_load_module(:alerts) %>
  <%= bootstrap_load_module(:label) %>
  <%= bootstrap_load_module(:modals) %>
  <%= bootstrap_load_module(:pagination) %>
  <%= bootstrap_load_module(:switch) %>
  <%= bootstrap_load_module(:tables) %>
  <%= bootstrap_load_module(:tabs) %>
  <%= bootstrap_load_module(:font_awesome) %>
  <%= bootstrap_load_module(:dropdown) %>
  <%= bootstrap_load_module(:tooltip) %>
  <%= bootstrap_load_module(:notify) %>
  <%= bootstrap_load_module(:tag_it) %>
<% end %>

The bootstrap_load_base method call is needed if you want to use provided JS helpers (see below).

To create BootstrapSwitch buttons

In your views :

<% content_for :header_tags do %>
  <%= bootstrap_load_base %>
  <%= bootstrap_load_module(:switch) %>
<% end %>

<p>
  <label>This is a switch button</label>
  <%= bootstrap_switch_tag do %>
    <%= hidden_field_tag "extra[enable]", "false" %>
    <%= check_box_tag "extra[enable]" %>
  <% end %>
</p>

<%= javascript_tag do %>
  $(document).ready(function() { setBootstrapSwitch(); });
<% end %>

To create TagIt lists

In your views :

<% content_for :header_tags do %>
  <%= bootstrap_load_base %>
  <%= bootstrap_load_module(:tag_it) %>
<% end %>

<p>
  <label>This is a TagIt list</label>
</p>

<%= tag_it_list 'plugin_emails_list',
                { name: 'plugin[emails_list][]' },
                { placeholder: '+ add email' } do %>
  <li>john@doe.com</li>
  <li>jane@doe.com</li>
<% end %>

<%= javascript_tag do %>
  $(document).ready(function() { setTagIt(); });
<% end %>

Contribute

You can contribute to this plugin in many ways such as :

  • Helping with documentation
  • Contributing code (features or bugfixes)
  • Reporting a bug
  • Submitting translations