项目作者: jbox-web

项目描述 :
A Redmine plugin which makes developing your own Redmine plugin easy ;)
高级语言: JavaScript
项目地址: git://github.com/jbox-web/redmine_bootstrap_kit.git
创建时间: 2014-04-19T14:17:26Z
项目社区:https://github.com/jbox-web/redmine_bootstrap_kit

开源协议:MIT License

下载


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 :

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

What’s included?

It provides the following Rails helper methods :

BootstrapKit assets loader :

  1. 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 :

  1. bootstrap_switch_tag(opts = {}, &block)

FontAwesome :

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

AjaxHelper :

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

PresenterHelper :

  1. present(object, klass = nil, *args)

JQuery TagIt :

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

WillPaginateHelper :

  1. paginate(collection, opts = {})

ZeroClipboardHelper:

  1. 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 :

  1. class MyPluginController < ApplicationController
  2. ...
  3. helper :redmine_bootstrap_kit
  4. end

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

  1. <% content_for :header_tags do %>
  2. <%= bootstrap_load_base %>
  3. <%= bootstrap_load_module(:alerts) %>
  4. <%= bootstrap_load_module(:label) %>
  5. <%= bootstrap_load_module(:modals) %>
  6. <%= bootstrap_load_module(:pagination) %>
  7. <%= bootstrap_load_module(:switch) %>
  8. <%= bootstrap_load_module(:tables) %>
  9. <%= bootstrap_load_module(:tabs) %>
  10. <%= bootstrap_load_module(:font_awesome) %>
  11. <%= bootstrap_load_module(:dropdown) %>
  12. <%= bootstrap_load_module(:tooltip) %>
  13. <%= bootstrap_load_module(:notify) %>
  14. <%= bootstrap_load_module(:tag_it) %>
  15. <% 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 :

  1. <% content_for :header_tags do %>
  2. <%= bootstrap_load_base %>
  3. <%= bootstrap_load_module(:switch) %>
  4. <% end %>
  5. <p>
  6. <label>This is a switch button</label>
  7. <%= bootstrap_switch_tag do %>
  8. <%= hidden_field_tag "extra[enable]", "false" %>
  9. <%= check_box_tag "extra[enable]" %>
  10. <% end %>
  11. </p>
  12. <%= javascript_tag do %>
  13. $(document).ready(function() { setBootstrapSwitch(); });
  14. <% end %>

To create TagIt lists

In your views :

  1. <% content_for :header_tags do %>
  2. <%= bootstrap_load_base %>
  3. <%= bootstrap_load_module(:tag_it) %>
  4. <% end %>
  5. <p>
  6. <label>This is a TagIt list</label>
  7. </p>
  8. <%= tag_it_list 'plugin_emails_list',
  9. { name: 'plugin[emails_list][]' },
  10. { placeholder: '+ add email' } do %>
  11. <li>john@doe.com</li>
  12. <li>jane@doe.com</li>
  13. <% end %>
  14. <%= javascript_tag do %>
  15. $(document).ready(function() { setTagIt(); });
  16. <% 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