├── AUTHORS ├── Gemfile ├── LICENSE ├── README.md ├── app └── helpers │ ├── assets_loader_base.rb │ ├── bootstrap │ ├── assets_loader.rb │ ├── dropdown_helper.rb │ ├── font_awesome_helper.rb │ ├── label_helper.rb │ ├── switch_helper.rb │ ├── tab_helper.rb │ ├── tag_it_helper.rb │ └── will_paginate_helper.rb │ ├── bootstrap_helper.rb │ ├── code_mirror │ ├── assets_loader.rb │ └── colorizer_helper.rb │ ├── code_mirror_helper.rb │ ├── high_charts │ └── assets_loader.rb │ ├── high_charts_helper.rb │ ├── jquery_file_tree │ ├── assets_loader.rb │ └── doc_tree_helper.rb │ ├── jquery_file_tree_helper.rb │ ├── redmine_bootstrap_kit │ ├── ajax_helper.rb │ └── presenter_helper.rb │ ├── redmine_bootstrap_kit_helper.rb │ ├── zero_clipboard │ ├── assets_loader.rb │ └── zero_clipboard_helper.rb │ └── zero_clipboard_helper.rb ├── assets ├── fonts │ ├── FontAwesome.otf │ ├── fontawesome-webfont.eot │ ├── fontawesome-webfont.svg │ ├── fontawesome-webfont.ttf │ ├── fontawesome-webfont.woff │ └── fontawesome-webfont.woff2 ├── images │ ├── button_selected.svg │ ├── jquery_file_tree │ │ ├── application.png │ │ ├── code.png │ │ ├── css.png │ │ ├── db.png │ │ ├── directory.png │ │ ├── doc.png │ │ ├── file.png │ │ ├── film.png │ │ ├── flash.png │ │ ├── folder_open.png │ │ ├── html.png │ │ ├── java.png │ │ ├── linux.png │ │ ├── music.png │ │ ├── pdf.png │ │ ├── php.png │ │ ├── picture.png │ │ ├── ppt.png │ │ ├── psd.png │ │ ├── ruby.png │ │ ├── script.png │ │ ├── spinner.gif │ │ ├── txt.png │ │ ├── xls.png │ │ └── zip.png │ ├── paste.png │ └── warning.png ├── javascripts │ ├── bootstrap │ │ ├── bootstrap_alert.js │ │ ├── bootstrap_alert_helper.js │ │ ├── bootstrap_modal.js │ │ ├── bootstrap_notify.js │ │ ├── bootstrap_sortable_helper.js │ │ ├── bootstrap_switch.js │ │ ├── bootstrap_switch_helper.js │ │ ├── bootstrap_tooltip.js │ │ ├── bootstrap_tooltip_helper.js │ │ ├── bootstrap_transitions.js │ │ ├── jquery_dropdown.js │ │ ├── jquery_tag_it.js │ │ └── jquery_tag_it_helper.js │ ├── clipboard │ │ ├── clipboard.min.js │ │ └── clipboard_helper.js │ ├── codemirror │ │ ├── addon │ │ │ ├── comment │ │ │ │ └── comment.js │ │ │ ├── display │ │ │ │ ├── fullscreen.css │ │ │ │ ├── fullscreen.js │ │ │ │ └── placeholder.js │ │ │ ├── edit │ │ │ │ ├── closebrackets.js │ │ │ │ ├── closetag.js │ │ │ │ ├── continuelist.js │ │ │ │ ├── matchbrackets.js │ │ │ │ ├── matchtags.js │ │ │ │ └── trailingspace.js │ │ │ ├── runmode │ │ │ │ ├── colorize.js │ │ │ │ ├── runmode-standalone.js │ │ │ │ └── runmode.js │ │ │ └── selection │ │ │ │ ├── active-line.js │ │ │ │ └── mark-selection.js │ │ ├── codemirror.js │ │ ├── keymap │ │ │ ├── emacs.js │ │ │ ├── extra.js │ │ │ └── vim.js │ │ └── mode │ │ │ ├── meta.js │ │ │ ├── nginx │ │ │ ├── index.html │ │ │ └── nginx.js │ │ │ ├── php │ │ │ ├── index.html │ │ │ └── php.js │ │ │ ├── python │ │ │ ├── index.html │ │ │ └── python.js │ │ │ ├── ruby │ │ │ ├── index.html │ │ │ └── ruby.js │ │ │ └── yaml │ │ │ ├── index.html │ │ │ └── yaml.js │ ├── highcharts │ │ ├── highcharts.js │ │ └── modules │ │ │ └── drilldown.js │ └── jquery_file_tree │ │ ├── helper.js │ │ ├── jquery_easing.js │ │ └── jquery_file_tree.js └── stylesheets │ ├── bootstrap │ ├── animate.css │ ├── bootstrap_alert.css │ ├── bootstrap_animations.css │ ├── bootstrap_close.css │ ├── bootstrap_custom.css │ ├── bootstrap_label.css │ ├── bootstrap_pagination.css │ ├── bootstrap_switch.css │ ├── bootstrap_tables.css │ ├── bootstrap_tabs.css │ ├── bootstrap_tooltip.css │ ├── images │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ ├── ui-bg_glass_75_dadada_1x400.png │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png │ │ ├── ui-bg_glass_75_ffffff_1x400.png │ │ ├── ui-bg_highlight-soft_75_cccccc_1x100.png │ │ ├── ui-bg_inset-soft_95_fef1ec_1x100.png │ │ ├── ui-icons_222222_256x240.png │ │ ├── ui-icons_2e83ff_256x240.png │ │ ├── ui-icons_454545_256x240.png │ │ ├── ui-icons_888888_256x240.png │ │ ├── ui-icons_cd0a0a_256x240.png │ │ └── ui-icons_f6cf3b_256x240.png │ ├── jquery_dropdown.css │ └── jquery_tag_it.css │ ├── bootstrap_custom.css │ ├── clipboard │ └── clipboard.css │ ├── codemirror │ ├── addon │ │ └── display │ │ │ └── fullscreen.css │ └── codemirror.css │ ├── font-awesome.css │ └── jquery_file_tree │ └── jquery_file_tree.css ├── config └── locales │ ├── en.yml │ └── fr.yml └── init.rb /AUTHORS: -------------------------------------------------------------------------------- 1 | Nicolas Rodriguez 2 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | gem 'will_paginate' 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Redmine Bootstrap Kit Plugin 2 | 3 | [![GitHub license](https://img.shields.io/github/license/jbox-web/redmine_bootstrap_kit.svg)](https://github.com/jbox-web/redmine_bootstrap_kit/blob/devel/LICENSE) 4 | [![GitHub release](https://img.shields.io/github/release/jbox-web/redmine_bootstrap_kit.svg)](https://github.com/jbox-web/redmine_bootstrap_kit/releases/latest) 5 | [![Code Climate](https://codeclimate.com/github/jbox-web/redmine_bootstrap_kit.png)](https://codeclimate.com/github/jbox-web/redmine_bootstrap_kit) 6 | 7 | ### A Redmine plugin which makes developing your own Redmine plugin easy ;) 8 | 9 | ## Why? 10 | 11 | As Redmine does not support asset pipeline, we need to install JQuery plugins as Redmine plugins to load them globally. 12 | 13 | It provides : 14 | 15 | * [BootstrapSwitch 1.8](https://github.com/nostalgiaz/bootstrap-switch) 16 | * [CodeMirror 3.2](https://github.com/codemirror/codemirror) 17 | * [jQuery FileTree](https://github.com/daverogers/jQueryFileTree) 18 | * [jQuery TagIt](http://aehlke.github.io/tag-it/) 19 | * [jQuery UI Bootstrap 0.5](http://jquery-ui-bootstrap.github.io/jquery-ui-bootstrap/) - 2014-04-19 20 | * [FontAwesome 4.7.0](http://fortawesome.github.io/Font-Awesome/) 21 | * [Highcharts 4.1.4](https://github.com/highslide-software/highcharts.com) 22 | * [ZeroClipboard 2.3.0](https://github.com/zeroclipboard/zeroclipboard) 23 | * [Bootstrap Notify](https://github.com/mouse0270/bootstrap-notify) 24 | 25 | And a set of various Rails helper methods (see below). 26 | 27 | ## Installation 28 | 29 | Just clone it in your Redmine plugins directory : 30 | 31 | ```sh 32 | cd REDMINE_ROOT/plugins 33 | git clone https://github.com/jbox-web/redmine_bootstrap_kit.git 34 | ``` 35 | 36 | ## What's included? 37 | 38 | It provides the following Rails helper methods : 39 | 40 | #### BootstrapKit assets loader : 41 | 42 | ```ruby 43 | bootstrap_load_module(rbk_module) 44 | ``` 45 | 46 | This method loads all JS and CSS files needed by the required module. 47 | 48 | The following modules are available : 49 | 50 | * alerts 51 | * label 52 | * modals 53 | * pagination 54 | * switch 55 | * tables 56 | * tabs 57 | * font_awesome 58 | * dropdown 59 | * tooltip 60 | * notify 61 | * tag_it 62 | 63 | #### BootstrapSwitch : 64 | 65 | ```ruby 66 | bootstrap_switch_tag(opts = {}, &block) 67 | ``` 68 | 69 | #### FontAwesome : 70 | 71 | ```ruby 72 | fa_icon(icon, opts = {}) 73 | label_with_icon(label, icon, icon_opts = {}) 74 | ``` 75 | 76 | #### AjaxHelper : 77 | 78 | ```ruby 79 | render_flash_messages_as_js(target = '#flash-messages', opts = {}) 80 | js_render_template(target, template, opts = {}) 81 | js_render_partial(target, partial, opts = {}) 82 | js_render(target, content, opts = {}) 83 | ``` 84 | 85 | #### PresenterHelper : 86 | 87 | ```ruby 88 | present(object, klass = nil, *args) 89 | ``` 90 | 91 | #### JQuery TagIt : 92 | 93 | ```ruby 94 | tag_it_list(id, list_opts = {}, tag_it_opts = {}, &block) 95 | ``` 96 | 97 | #### WillPaginateHelper : 98 | 99 | ```ruby 100 | paginate(collection, opts = {}) 101 | ``` 102 | 103 | #### ZeroClipboardHelper: 104 | 105 | ```ruby 106 | zero_clipboard_button_for(target) 107 | ``` 108 | 109 | ## How to use? 110 | 111 | To use Redmine Bootstrap Kit helper methods you must first add ```:redmine_bootstrap_kit``` helper in your controller : 112 | 113 | ```ruby 114 | class MyPluginController < ApplicationController 115 | ... 116 | 117 | helper :redmine_bootstrap_kit 118 | 119 | end 120 | ``` 121 | 122 | Then with the ```bootstrap_load_module``` method you can load the desired assets in your views : 123 | 124 | ```html+erb 125 | <% content_for :header_tags do %> 126 | <%= bootstrap_load_base %> 127 | <%= bootstrap_load_module(:alerts) %> 128 | <%= bootstrap_load_module(:label) %> 129 | <%= bootstrap_load_module(:modals) %> 130 | <%= bootstrap_load_module(:pagination) %> 131 | <%= bootstrap_load_module(:switch) %> 132 | <%= bootstrap_load_module(:tables) %> 133 | <%= bootstrap_load_module(:tabs) %> 134 | <%= bootstrap_load_module(:font_awesome) %> 135 | <%= bootstrap_load_module(:dropdown) %> 136 | <%= bootstrap_load_module(:tooltip) %> 137 | <%= bootstrap_load_module(:notify) %> 138 | <%= bootstrap_load_module(:tag_it) %> 139 | <% end %> 140 | ``` 141 | 142 | The ```bootstrap_load_base``` method call is needed if you want to use provided JS helpers (see below). 143 | 144 | 145 | ## To create BootstrapSwitch buttons 146 | 147 | In your views : 148 | 149 | ```html+erb 150 | <% content_for :header_tags do %> 151 | <%= bootstrap_load_base %> 152 | <%= bootstrap_load_module(:switch) %> 153 | <% end %> 154 | 155 |

156 | 157 | <%= bootstrap_switch_tag do %> 158 | <%= hidden_field_tag "extra[enable]", "false" %> 159 | <%= check_box_tag "extra[enable]" %> 160 | <% end %> 161 |

162 | 163 | <%= javascript_tag do %> 164 | $(document).ready(function() { setBootstrapSwitch(); }); 165 | <% end %> 166 | ``` 167 | 168 | ## To create TagIt lists 169 | 170 | In your views : 171 | 172 | ```html+erb 173 | <% content_for :header_tags do %> 174 | <%= bootstrap_load_base %> 175 | <%= bootstrap_load_module(:tag_it) %> 176 | <% end %> 177 | 178 |

179 | 180 |

181 | 182 | <%= tag_it_list 'plugin_emails_list', 183 | { name: 'plugin[emails_list][]' }, 184 | { placeholder: '+ add email' } do %> 185 |
  • john@doe.com
  • 186 |
  • jane@doe.com
  • 187 | <% end %> 188 | 189 | <%= javascript_tag do %> 190 | $(document).ready(function() { setTagIt(); }); 191 | <% end %> 192 | ``` 193 | 194 | ## Contribute 195 | 196 | You can contribute to this plugin in many ways such as : 197 | * Helping with documentation 198 | * Contributing code (features or bugfixes) 199 | * Reporting a bug 200 | * Submitting translations 201 | -------------------------------------------------------------------------------- /app/helpers/assets_loader_base.rb: -------------------------------------------------------------------------------- 1 | module AssetsLoaderBase 2 | 3 | def rbk_include_js(js) 4 | javascript_include_tag(js, plugin: 'redmine_bootstrap_kit') + "\n" 5 | end 6 | 7 | 8 | def rbk_include_css(css) 9 | stylesheet_link_tag(css, plugin: 'redmine_bootstrap_kit') + "\n" 10 | end 11 | 12 | end 13 | -------------------------------------------------------------------------------- /app/helpers/bootstrap/assets_loader.rb: -------------------------------------------------------------------------------- 1 | module Bootstrap::AssetsLoader 2 | 3 | def bootstrap_load_base 4 | rbk_include_css('bootstrap_custom') + 5 | bs_include_css('bootstrap_custom') 6 | end 7 | 8 | 9 | def bootstrap_load_module(bs_module) 10 | method = "load_bs_module_#{bs_module}" 11 | self.send(method) 12 | end 13 | 14 | 15 | private 16 | 17 | 18 | def bs_include_js(js) 19 | rbk_include_js("bootstrap/#{js}") 20 | end 21 | 22 | 23 | def bs_include_css(css) 24 | rbk_include_css("bootstrap/#{css}") 25 | end 26 | 27 | 28 | def load_bs_module_alerts 29 | bs_include_js('bootstrap_alert') + 30 | bs_include_js('bootstrap_alert_helper') + 31 | bs_include_js('bootstrap_transitions') + 32 | bs_include_css('bootstrap_alert') + 33 | bs_include_css('bootstrap_animations') + 34 | bs_include_css('bootstrap_close') 35 | end 36 | 37 | 38 | def load_bs_module_label 39 | bs_include_css('bootstrap_label') 40 | end 41 | 42 | 43 | def load_bs_module_modals 44 | bs_include_js('bootstrap_modal') 45 | end 46 | 47 | 48 | def load_bs_module_pagination 49 | bs_include_css('bootstrap_pagination') 50 | end 51 | 52 | 53 | def load_bs_module_sortable 54 | bs_include_js('bootstrap_sortable_helper') 55 | end 56 | 57 | 58 | def load_bs_module_switch 59 | bs_include_js('bootstrap_switch') + 60 | bs_include_js('bootstrap_switch_helper') + 61 | bs_include_css('bootstrap_switch') 62 | end 63 | 64 | 65 | def load_bs_module_tables 66 | bs_include_css('bootstrap_tables') 67 | end 68 | 69 | 70 | def load_bs_module_tabs 71 | bs_include_css('bootstrap_tabs') 72 | end 73 | 74 | 75 | def load_bs_module_font_awesome 76 | rbk_include_css('font-awesome') 77 | end 78 | 79 | 80 | def load_bs_module_dropdown 81 | bs_include_js('jquery_dropdown') + 82 | bs_include_css('jquery_dropdown') 83 | end 84 | 85 | 86 | def load_bs_module_tooltip 87 | bs_include_js('bootstrap_tooltip') + 88 | bs_include_js('bootstrap_tooltip_helper') + 89 | bs_include_css('bootstrap_tooltip') 90 | end 91 | 92 | 93 | def load_bs_module_notify 94 | bs_include_js('bootstrap_notify') + 95 | bs_include_css('animate') 96 | end 97 | 98 | 99 | def load_bs_module_tag_it 100 | bs_include_js('jquery_tag_it') + 101 | bs_include_js('jquery_tag_it_helper') + 102 | bs_include_css('jquery_tag_it') 103 | end 104 | 105 | end 106 | -------------------------------------------------------------------------------- /app/helpers/bootstrap/dropdown_helper.rb: -------------------------------------------------------------------------------- 1 | module Bootstrap::DropdownHelper 2 | 3 | def dropdown_menu(id, &block) 4 | content_tag(:div, id: id, class: 'dropdown dropdown-tip dropdown-relative') do 5 | content_tag(:ul, class: 'dropdown-menu') do 6 | yield block 7 | end 8 | end 9 | end 10 | 11 | 12 | def dropdown_button(target, opts = {}) 13 | options = opts.merge({type: 'button', data: { dropdown: "##{target}" }}) 14 | content = ' '.html_safe 15 | button_tag(content, options) 16 | end 17 | 18 | end 19 | -------------------------------------------------------------------------------- /app/helpers/bootstrap/font_awesome_helper.rb: -------------------------------------------------------------------------------- 1 | module Bootstrap::FontAwesomeHelper 2 | 3 | def checked_image2(checked = true) 4 | if checked 5 | image_tag 'toggle_check.png' 6 | else 7 | image_tag 'exclamation.png' 8 | end 9 | end 10 | 11 | 12 | def bool_to_icon(bool) 13 | if bool 14 | fa_icon('fa-check') 15 | else 16 | fa_icon('fa-warning') 17 | end 18 | end 19 | 20 | 21 | def label_with_icon(label, icon, icon_opts = {}) 22 | fa_icon(icon, icon_opts.merge(aligned: true)) + label 23 | end 24 | 25 | 26 | def fa_icon(icon, opts = {}) 27 | inverse = opts.delete(:inverse){ false } 28 | fixed = opts.delete(:fixed){ false } 29 | aligned = opts.delete(:aligned){ false } 30 | css_class = [ 'fa', 'fa-lg' ] 31 | css_class.push(icon) 32 | css_class.push('fa-inverse') if inverse 33 | css_class.push('fa-align') if aligned 34 | css_class.push('fa-fw') if fixed 35 | css_class.delete('fa-lg') if fixed 36 | klass = [opts.delete(:class), css_class].flatten.compact 37 | content_tag(:i, '', class: klass) 38 | end 39 | 40 | end 41 | -------------------------------------------------------------------------------- /app/helpers/bootstrap/label_helper.rb: -------------------------------------------------------------------------------- 1 | module Bootstrap::LabelHelper 2 | 3 | def label_with_tag(label, opts = {}) 4 | opts[:class] = opts[:class].push('label') 5 | content_tag(:span, label, opts) 6 | end 7 | 8 | 9 | def label_with_default_tag(label = '', opts = {}, &block) 10 | label = yield if block_given? 11 | opts = opts.merge(class: ['label-default']) 12 | label_with_tag(label, opts) 13 | end 14 | 15 | 16 | def label_with_success_tag(label = '', opts = {}, &block) 17 | label = yield if block_given? 18 | opts = opts.merge(class: ['label-success']) 19 | label_with_tag(label, opts) 20 | end 21 | 22 | 23 | def label_with_info_tag(label = '', opts = {}, &block) 24 | label = yield if block_given? 25 | opts = opts.merge(class: ['label-info']) 26 | label_with_tag(label, opts) 27 | end 28 | 29 | 30 | def label_with_danger_tag(label = '', opts = {}, &block) 31 | label = yield if block_given? 32 | opts = opts.merge(class: ['label-important']) 33 | label_with_tag(label, opts) 34 | end 35 | 36 | 37 | def label_with_warning_tag(label = '', opts = {}, &block) 38 | label = yield if block_given? 39 | opts = opts.merge(class: ['label-warning']) 40 | label_with_tag(label, opts) 41 | end 42 | 43 | 44 | def label_with_primary_tag(label = '', opts = {}, &block) 45 | label = yield if block_given? 46 | opts = opts.merge(class: ['label-primary']) 47 | label_with_tag(label, opts) 48 | end 49 | 50 | end 51 | -------------------------------------------------------------------------------- /app/helpers/bootstrap/switch_helper.rb: -------------------------------------------------------------------------------- 1 | module Bootstrap::SwitchHelper 2 | 3 | def bootstrap_switch_tag(opts = {}, &block) 4 | css_class = opts.delete(:class){ '' } 5 | options = { data: bootstrapswitch_default_data } 6 | options = options.deep_merge(opts) 7 | options[:class] = ['bootstrap-switch', 'switch-small'].push(css_class) 8 | content_tag(:span, options) do 9 | yield if block_given? 10 | end 11 | end 12 | 13 | 14 | def bootstrapswitch_default_data 15 | { 'on' => 'primary', 'off' => 'default', 'on-label' => l(:label_yes), 'off-label' => l(:label_no) } 16 | end 17 | 18 | end 19 | -------------------------------------------------------------------------------- /app/helpers/bootstrap/tab_helper.rb: -------------------------------------------------------------------------------- 1 | module Bootstrap::TabHelper 2 | 3 | def tab_content(&block) 4 | content_tag(:div, class: 'tab-content') do 5 | content_tag(:div, class: 'tab-pane active') do 6 | yield block 7 | end 8 | end 9 | end 10 | 11 | end 12 | -------------------------------------------------------------------------------- /app/helpers/bootstrap/tag_it_helper.rb: -------------------------------------------------------------------------------- 1 | module Bootstrap::TagItHelper 2 | 3 | def tag_it_list(id, list_opts = {}, tag_it_opts = {}, &block) 4 | data = { toggle: 'tagit' } 5 | data = data.merge(tag_it_opts) 6 | 7 | options = {} 8 | options[:id] = id 9 | options[:data] = data 10 | options = options.merge(list_opts) 11 | 12 | if block_given? 13 | content_tag(:ul, options) do 14 | yield 15 | end 16 | else 17 | content_tag(:ul, '', options) 18 | end 19 | end 20 | 21 | end 22 | -------------------------------------------------------------------------------- /app/helpers/bootstrap/will_paginate_helper.rb: -------------------------------------------------------------------------------- 1 | require 'will_paginate/view_helpers/action_view' 2 | 3 | module Bootstrap::WillPaginateHelper 4 | 5 | def paginate(collection, opts = {}) 6 | will_paginate collection, pagination_default_options.deep_merge(opts) 7 | end 8 | 9 | 10 | def pagination_default_options 11 | { 12 | renderer: Bootstrap::WillPaginateHelper::LinkRenderer, 13 | remote: true, 14 | next_label: '»', 15 | previous_label: '«', 16 | param_name: :page, 17 | reverse: false, 18 | class: 'pagination pagination-small pagination-centered', 19 | params: {} 20 | } 21 | end 22 | 23 | 24 | class LinkRenderer < ::WillPaginate::ActionView::LinkRenderer 25 | 26 | def to_html 27 | if @options.has_key?(:reverse) && @options[:reverse] == true 28 | my_pagination = pagination.reverse 29 | else 30 | my_pagination = pagination 31 | end 32 | 33 | html = my_pagination.map do |item| 34 | item.is_a?(Fixnum) ? 35 | page_number(item) : 36 | send(item) 37 | end.join(@options[:link_separator]) 38 | 39 | @options[:container] ? html_container(html) : html 40 | end 41 | 42 | 43 | def html_container(html) 44 | tag(:div, "", container_attributes) 45 | end 46 | 47 | 48 | def page_number(page) 49 | unless page == current_page 50 | tag(:li, link(page, page, :rel => rel_value(page))) 51 | else 52 | tag(:li, link(page, '#'), :class => 'active') 53 | end 54 | end 55 | 56 | 57 | def previous_or_next_page(page, text, classname) 58 | if page 59 | tag(:li, link(text, page, :class => classname)) 60 | else 61 | tag(:li, "#{text}", :class => classname + ' disabled') 62 | end 63 | end 64 | 65 | 66 | def link(text, target, attributes = {}) 67 | if @options.has_key?(:remote) && @options[:remote] == true 68 | attributes['data-remote'] = true 69 | end 70 | super 71 | end 72 | 73 | 74 | def gap 75 | text = @template.will_paginate_translate(:page_gap) { '…' } 76 | %(
  • #{text}
  • ) 77 | end 78 | 79 | end 80 | end 81 | -------------------------------------------------------------------------------- /app/helpers/bootstrap_helper.rb: -------------------------------------------------------------------------------- 1 | module BootstrapHelper 2 | include AssetsLoaderBase 3 | include Bootstrap::AssetsLoader 4 | include Bootstrap::DropdownHelper 5 | include Bootstrap::FontAwesomeHelper 6 | include Bootstrap::LabelHelper 7 | include Bootstrap::SwitchHelper 8 | include Bootstrap::TabHelper 9 | include Bootstrap::TagItHelper 10 | include Bootstrap::WillPaginateHelper 11 | end 12 | -------------------------------------------------------------------------------- /app/helpers/code_mirror/assets_loader.rb: -------------------------------------------------------------------------------- 1 | module CodeMirror::AssetsLoader 2 | 3 | def code_mirror_load_base 4 | cm_include_js('codemirror') + 5 | cm_include_css('codemirror') 6 | end 7 | 8 | 9 | def code_mirror_load_addon(cm_addon) 10 | method = "load_cm_addon_#{cm_addon}" 11 | self.send(method) 12 | end 13 | 14 | 15 | def code_mirror_load_language(cm_lang) 16 | cm_include_js("mode/#{cm_lang}/#{cm_lang}") 17 | end 18 | 19 | 20 | def code_mirror_load_full_editor 21 | code_mirror_load_base + 22 | code_mirror_load_addon(:keymap_extra) + 23 | code_mirror_load_addon(:active_line) + 24 | code_mirror_load_addon(:matchbrackets) + 25 | code_mirror_load_addon(:closebrackets) + 26 | code_mirror_load_addon(:fullscreen) + 27 | code_mirror_load_addon(:comment) 28 | end 29 | 30 | 31 | private 32 | 33 | 34 | def cm_include_js(js) 35 | rbk_include_js("codemirror/#{js}") 36 | end 37 | 38 | 39 | def cm_include_css(css) 40 | rbk_include_css("codemirror/#{css}") 41 | end 42 | 43 | 44 | def load_cm_addon_keymap_extra 45 | cm_include_js('keymap/extra') 46 | end 47 | 48 | 49 | def load_cm_addon_active_line 50 | cm_include_js('addon/selection/active-line') 51 | end 52 | 53 | 54 | def load_cm_addon_matchbrackets 55 | cm_include_js('addon/edit/matchbrackets') 56 | end 57 | 58 | 59 | def load_cm_addon_closebrackets 60 | cm_include_js('addon/edit/closebrackets') 61 | end 62 | 63 | 64 | def load_cm_addon_fullscreen 65 | cm_include_js('addon/display/fullscreen') + 66 | cm_include_css('addon/display/fullscreen') 67 | end 68 | 69 | 70 | def load_cm_addon_comment 71 | cm_include_js('addon/comment/comment') 72 | end 73 | 74 | end 75 | -------------------------------------------------------------------------------- /app/helpers/code_mirror/colorizer_helper.rb: -------------------------------------------------------------------------------- 1 | require 'coderay' 2 | 3 | module CodeMirror::ColorizerHelper 4 | 5 | def colorize_code(text) 6 | CodeRay.scan(text, :ruby).div(line_numbers: :table).html_safe 7 | end 8 | 9 | end 10 | -------------------------------------------------------------------------------- /app/helpers/code_mirror_helper.rb: -------------------------------------------------------------------------------- 1 | module CodeMirrorHelper 2 | include AssetsLoaderBase 3 | include CodeMirror::AssetsLoader 4 | include CodeMirror::ColorizerHelper 5 | end 6 | -------------------------------------------------------------------------------- /app/helpers/high_charts/assets_loader.rb: -------------------------------------------------------------------------------- 1 | module HighCharts::AssetsLoader 2 | 3 | def high_charts_load_base 4 | hc_include_js('highcharts') 5 | end 6 | 7 | 8 | def high_charts_load_module(hc_module) 9 | method = "load_hc_module_#{hc_module}" 10 | self.send(method) 11 | end 12 | 13 | 14 | private 15 | 16 | 17 | def hc_include_js(js) 18 | rbk_include_js("highcharts/#{js}") 19 | end 20 | 21 | 22 | def hc_include_css(css) 23 | rbk_include_css("highcharts/#{css}") 24 | end 25 | 26 | 27 | def load_hc_module_drilldown 28 | hc_include_js('modules/drilldown') 29 | end 30 | 31 | end 32 | -------------------------------------------------------------------------------- /app/helpers/high_charts_helper.rb: -------------------------------------------------------------------------------- 1 | module HighChartsHelper 2 | include AssetsLoaderBase 3 | include HighCharts::AssetsLoader 4 | end 5 | -------------------------------------------------------------------------------- /app/helpers/jquery_file_tree/assets_loader.rb: -------------------------------------------------------------------------------- 1 | module JqueryFileTree::AssetsLoader 2 | 3 | def jquery_file_tree_load_base 4 | jft_include_js('jquery_file_tree') + 5 | jft_include_js('jquery_easing') + 6 | jft_include_js('helper') + 7 | jft_include_css('jquery_file_tree') 8 | end 9 | 10 | 11 | private 12 | 13 | 14 | def jft_include_js(js) 15 | rbk_include_js("jquery_file_tree/#{js}") 16 | end 17 | 18 | 19 | def jft_include_css(css) 20 | rbk_include_css("jquery_file_tree/#{css}") 21 | end 22 | 23 | end 24 | -------------------------------------------------------------------------------- /app/helpers/jquery_file_tree/doc_tree_helper.rb: -------------------------------------------------------------------------------- 1 | module JqueryFileTree::DocTreeHelper 2 | 3 | def create_doc_tree(id, tree_url, content_url, opts = {}) 4 | create_doc_tree_html(id, tree_url, content_url, opts) + create_doc_tree_js(id) 5 | end 6 | 7 | 8 | def render_doc_tree(parent, dir) 9 | content_tag(:ul, class: 'jqueryFileTree', style: 'display: none;') do 10 | render_dir_tree(parent, dir[0]) + 11 | render_file_tree(parent, dir[1]) 12 | end 13 | end 14 | 15 | 16 | private 17 | 18 | 19 | def render_dir_tree(parent, dirs) 20 | s = '' 21 | dirs.each do |dir| 22 | s << content_tag(:li, link_to(dir, '#', rel: "#{parent}#{dir}/"), class: 'directory collapsed') 23 | end 24 | s.html_safe 25 | end 26 | 27 | 28 | def render_file_tree(parent, files) 29 | s = '' 30 | files.each do |file| 31 | s << content_tag(:li, link_to(file, '#', rel: "#{parent}#{file}"), class: "file #{file_extension_icon(file)}") 32 | end 33 | s.html_safe 34 | end 35 | 36 | 37 | def file_extension_icon(file) 38 | "ext_#{File.extname(file)[1..-1]}" 39 | end 40 | 41 | 42 | def create_doc_tree_html(id, tree_url, content_url, opts = {}) 43 | options = opts.merge({ id: id, data: { tree_url: tree_url, content_url: content_url } }) 44 | content_tag(:div, '', options) 45 | end 46 | 47 | 48 | def create_doc_tree_js(id) 49 | content_tag 'script', type: 'text/javascript' do 50 | raw " 51 | $(document).ready( function() { 52 | $('##{id}').fileTree({ root: '', script: $('##{id}').data('tree-url') }, function(file) { 53 | var url = $('##{id}').data('content-url'); 54 | openFile(url, file); 55 | }); 56 | }); 57 | " 58 | end 59 | end 60 | 61 | end 62 | -------------------------------------------------------------------------------- /app/helpers/jquery_file_tree_helper.rb: -------------------------------------------------------------------------------- 1 | module JqueryFileTreeHelper 2 | include AssetsLoaderBase 3 | include JqueryFileTree::AssetsLoader 4 | include JqueryFileTree::DocTreeHelper 5 | end 6 | -------------------------------------------------------------------------------- /app/helpers/redmine_bootstrap_kit/ajax_helper.rb: -------------------------------------------------------------------------------- 1 | module RedmineBootstrapKit::AjaxHelper 2 | 3 | def render_flash_messages_as_js(target = '#flash-messages', opts = {}) 4 | js_render(target, render_flash_messages, opts).html_safe 5 | end 6 | 7 | 8 | def js_render_template(target, template, opts = {}) 9 | locals = opts.delete(:locals){ {} } 10 | content = render(template: template, locals: locals) 11 | js_render(target, content, opts) 12 | end 13 | 14 | 15 | def js_render_partial(target, partial, opts = {}) 16 | locals = opts.delete(:locals){ {} } 17 | content = render(partial: partial, locals: locals) 18 | js_render(target, content, opts) 19 | end 20 | 21 | 22 | def js_render(target, content, opts = {}) 23 | method = opts.delete(:method){ :inject } 24 | "$('#{target}').#{js_rendering_method(method)}(\"#{escape_javascript(content)}\");\n".html_safe 25 | end 26 | 27 | 28 | def js_rendering_method(method) 29 | case method 30 | when :append 31 | 'append' 32 | when :inject 33 | 'html' 34 | when :replace 35 | 'replaceWith' 36 | end 37 | end 38 | 39 | end 40 | -------------------------------------------------------------------------------- /app/helpers/redmine_bootstrap_kit/presenter_helper.rb: -------------------------------------------------------------------------------- 1 | module RedmineBootstrapKit::PresenterHelper 2 | 3 | def present(object, klass = nil, *args) 4 | klass ||= "#{object.class.base_class}Presenter".constantize 5 | presenter = klass.new(object, self, *args) 6 | yield presenter if block_given? 7 | presenter 8 | end 9 | 10 | end 11 | -------------------------------------------------------------------------------- /app/helpers/redmine_bootstrap_kit_helper.rb: -------------------------------------------------------------------------------- 1 | module RedmineBootstrapKitHelper 2 | include RedmineBootstrapKit::AjaxHelper 3 | include RedmineBootstrapKit::PresenterHelper 4 | 5 | include BootstrapHelper 6 | include CodeMirrorHelper 7 | include HighChartsHelper 8 | include JqueryFileTreeHelper 9 | include ZeroClipboardHelper 10 | end 11 | -------------------------------------------------------------------------------- /app/helpers/zero_clipboard/assets_loader.rb: -------------------------------------------------------------------------------- 1 | module ZeroClipboard::AssetsLoader 2 | 3 | def zero_clipboard_load_base 4 | zc_include_js('clipboard.min') + 5 | zc_include_js('clipboard_helper') + 6 | zc_include_css('clipboard') 7 | end 8 | 9 | 10 | private 11 | 12 | 13 | def zc_include_js(js) 14 | rbk_include_js("clipboard/#{js}") 15 | end 16 | 17 | 18 | def zc_include_css(css) 19 | rbk_include_css("clipboard/#{css}") 20 | end 21 | 22 | end 23 | -------------------------------------------------------------------------------- /app/helpers/zero_clipboard/zero_clipboard_helper.rb: -------------------------------------------------------------------------------- 1 | module ZeroClipboard::ZeroClipboardHelper 2 | 3 | def zero_clipboard_button_for(target) 4 | render_zero_clipboard_button(target) + render_zero_clipboard_javascript(target) 5 | end 6 | 7 | 8 | private 9 | 10 | 11 | def render_zero_clipboard_button(target) 12 | opts = { id: "zc_#{target}", class: 'clipboard_button', data: zero_clipboard_options.merge('clipboard-target' => "##{target}") } 13 | content_tag(:div, image_tag('paste.png', plugin: 'redmine_bootstrap_kit'), opts) 14 | end 15 | 16 | 17 | def render_zero_clipboard_javascript(target) 18 | javascript_tag("setZeroClipBoard('#zc_#{target}');") 19 | end 20 | 21 | 22 | def zero_clipboard_options 23 | { 'label-copied' => l(:label_copied_to_clipboard), 'label-to-copy' => l(:label_copy_to_clipboard) } 24 | end 25 | 26 | end 27 | -------------------------------------------------------------------------------- /app/helpers/zero_clipboard_helper.rb: -------------------------------------------------------------------------------- 1 | module ZeroClipboardHelper 2 | include AssetsLoaderBase 3 | include ZeroClipboard::AssetsLoader 4 | include ZeroClipboard::ZeroClipboardHelper 5 | end 6 | -------------------------------------------------------------------------------- /assets/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /assets/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /assets/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /assets/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /assets/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /assets/images/button_selected.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/application.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/application.png -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/code.png -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/css.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/css.png -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/db.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/db.png -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/directory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/directory.png -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/doc.png -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/file.png -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/film.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/film.png -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/flash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/flash.png -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/folder_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/folder_open.png -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/html.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/html.png -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/java.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/java.png -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/linux.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/linux.png -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/music.png -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/pdf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/pdf.png -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/php.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/php.png -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/picture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/picture.png -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/ppt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/ppt.png -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/psd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/psd.png -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/ruby.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/ruby.png -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/script.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/script.png -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/spinner.gif -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/txt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/txt.png -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/xls.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/xls.png -------------------------------------------------------------------------------- /assets/images/jquery_file_tree/zip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/jquery_file_tree/zip.png -------------------------------------------------------------------------------- /assets/images/paste.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/paste.png -------------------------------------------------------------------------------- /assets/images/warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbox-web/redmine_bootstrap_kit/c992de1a47df5be86377c49e069e7230652bd1e7/assets/images/warning.png -------------------------------------------------------------------------------- /assets/javascripts/bootstrap/bootstrap_alert.js: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * bootstrap-alert.js v2.3.2 3 | * http://getbootstrap.com/2.3.2/javascript.html#alerts 4 | * ========================================================== 5 | * Copyright 2013 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | 21 | !function ($) { 22 | 23 | "use strict"; // jshint ;_; 24 | 25 | 26 | /* ALERT CLASS DEFINITION 27 | * ====================== */ 28 | 29 | var dismiss = '[data-dismiss="alert"]' 30 | , Alert = function (el) { 31 | $(el).on('click', dismiss, this.close) 32 | } 33 | 34 | Alert.prototype.close = function (e) { 35 | var $this = $(this) 36 | , selector = $this.attr('data-target') 37 | , $parent 38 | 39 | if (!selector) { 40 | selector = $this.attr('href') 41 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 42 | } 43 | 44 | $parent = $(selector) 45 | 46 | e && e.preventDefault() 47 | 48 | $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent()) 49 | 50 | $parent.trigger(e = $.Event('close')) 51 | 52 | if (e.isDefaultPrevented()) return 53 | 54 | $parent.removeClass('in') 55 | 56 | function removeElement() { 57 | $parent 58 | .trigger('closed') 59 | .remove() 60 | } 61 | 62 | $.support.transition && $parent.hasClass('fade') ? 63 | $parent.on($.support.transition.end, removeElement) : 64 | removeElement() 65 | } 66 | 67 | 68 | /* ALERT PLUGIN DEFINITION 69 | * ======================= */ 70 | 71 | var old = $.fn.alert 72 | 73 | $.fn.alert = function (option) { 74 | return this.each(function () { 75 | var $this = $(this) 76 | , data = $this.data('alert') 77 | if (!data) $this.data('alert', (data = new Alert(this))) 78 | if (typeof option == 'string') data[option].call($this) 79 | }) 80 | } 81 | 82 | $.fn.alert.Constructor = Alert 83 | 84 | 85 | /* ALERT NO CONFLICT 86 | * ================= */ 87 | 88 | $.fn.alert.noConflict = function () { 89 | $.fn.alert = old 90 | return this 91 | } 92 | 93 | 94 | /* ALERT DATA-API 95 | * ============== */ 96 | 97 | $(document).on('click.alert.data-api', dismiss, Alert.prototype.close) 98 | 99 | }(window.jQuery); 100 | -------------------------------------------------------------------------------- /assets/javascripts/bootstrap/bootstrap_alert_helper.js: -------------------------------------------------------------------------------- 1 | /* 2 | BootstrapAlert 3 | */ 4 | function setBootstrapAlert(){ 5 | $('.alert').each(function(index, element){ 6 | $(element).alert(); 7 | }); 8 | } 9 | 10 | function addAlertMessage(object){ 11 | $(object.target) 12 | .append( 13 | $('
    ') 14 | .attr('class', 'alert fade in ' + object.type) 15 | .html(object.message) 16 | .prepend( 17 | $(' {1} {2}
    '};String.format=function(){for(var t=arguments[0],e=1;e .progress-bar').removeClass("progress-bar-"+t.settings.type),t.settings.type=s,this.$ele.addClass("alert-"+s).find('[data-notify="progressbar"] > .progress-bar').addClass("progress-bar-"+s);break;case"icon":var i=this.$ele.find('[data-notify="icon"]');"class"==t.settings.icon_type.toLowerCase()?i.removeClass(t.settings.content.icon).addClass(s):(i.is("img")||i.find("img"),i.attr("src",s));break;case"url":this.$ele.find('[data-notify="url"]').attr("href",s);break;case"target":this.$ele.find('[data-notify="url"]').attr("target",s);break;default:this.$ele.find('[data-notify="'+e+'"]').html(s)}var n=this.$ele.outerHeight()+parseInt(t.settings.spacing)+parseInt(t.settings.offset.y);t.reposition(n)},close:function(){t.close()}}},buildNotify:function(){var e=this.settings.content;this.$ele=t(String.format(this.settings.template,this.settings.type,e.title,e.message,e.url,e.target)),this.$ele.attr("data-notify-position",this.settings.placement.from+"-"+this.settings.placement.align),this.settings.allow_dismiss||this.$ele.find('[data-notify="dismiss"]').css("display","none"),this.settings.delay<=0&&this.$ele.find('[data-notify="progressbar"]').remove()},setIcon:function(){"class"==this.settings.icon_type.toLowerCase()?this.$ele.find('[data-notify="icon"]').addClass(this.settings.content.icon):this.$ele.find('[data-notify="icon"]').is("img")?this.$ele.find('[data-notify="icon"]').attr("src",this.settings.content.icon):this.$ele.find('[data-notify="icon"]').append('Notify Icon')},styleURL:function(){this.$ele.find('[data-notify="url"]').css({backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)",height:"100%",left:"0px",position:"absolute",top:"0px",width:"100%",zIndex:this.settings.z_index+1}),this.$ele.find('[data-notify="dismiss"]').css({position:"absolute",right:"10px",top:"5px",zIndex:this.settings.z_index+2})},placement:function(){var e=this,s=this.settings.offset.y,i={display:"inline-block",margin:"0px auto",position:this.settings.position?this.settings.position:"body"===this.settings.element?"fixed":"absolute",transition:"all .5s ease-in-out",zIndex:this.settings.z_index},n=!1,a=this.settings;switch(t('[data-notify-position="'+this.settings.placement.from+"-"+this.settings.placement.align+'"]:not([data-closing="true"])').each(function(){return s=Math.max(s,parseInt(t(this).css(a.placement.from))+parseInt(t(this).outerHeight())+parseInt(a.spacing))}),1==this.settings.newest_on_top&&(s=this.settings.offset.y),i[this.settings.placement.from]=s+"px",this.settings.placement.align){case"left":case"right":i[this.settings.placement.align]=this.settings.offset.x+"px";break;case"center":i.left=0,i.right=0}this.$ele.css(i).addClass(this.settings.animate.enter),t(this.settings.element).append(this.$ele),1==this.settings.newest_on_top&&(s=parseInt(s)+parseInt(this.settings.spacing)+this.$ele.outerHeight(),this.reposition(s)),t.isFunction(e.settings.onShow)&&e.settings.onShow.call(this.$ele),this.$ele.one(this.animations.start,function(){n=!0}).one(this.animations.end,function(){t.isFunction(e.settings.onShown)&&e.settings.onShown.call(this)}),setTimeout(function(){n||t.isFunction(e.settings.onShown)&&e.settings.onShown.call(this)},600)},bind:function(){var e=this;if(this.$ele.find('[data-notify="dismiss"]').on("click",function(){e.close()}),this.$ele.mouseover(function(){t(this).data("data-hover","true")}).mouseout(function(){t(this).data("data-hover","false")}),this.$ele.data("data-hover","false"),this.settings.delay>0){e.$ele.data("notify-delay",e.settings.delay);var s=setInterval(function(){var t=parseInt(e.$ele.data("notify-delay"))-e.settings.timer;if("false"===e.$ele.data("data-hover")&&"pause"==e.settings.mouse_over||"pause"!=e.settings.mouse_over){var i=(e.settings.delay-t)/e.settings.delay*100;e.$ele.data("notify-delay",t),e.$ele.find('[data-notify="progressbar"] > div').attr("aria-valuenow",i).css("width",i+"%")}t<=-e.settings.timer&&(clearInterval(s),e.close())},e.settings.timer)}},close:function(){var e=this,s=parseInt(this.$ele.css(this.settings.placement.from)),i=!1;this.$ele.data("closing","true").addClass(this.settings.animate.exit),e.reposition(s),t.isFunction(e.settings.onClose)&&e.settings.onClose.call(this.$ele),this.$ele.one(this.animations.start,function(){i=!0}).one(this.animations.end,function(){t(this).remove(),t.isFunction(e.settings.onClosed)&&e.settings.onClosed.call(this)}),setTimeout(function(){i||(e.$ele.remove(),e.settings.onClosed&&e.settings.onClosed(e.$ele))},600)},reposition:function(e){var s=this,i='[data-notify-position="'+this.settings.placement.from+"-"+this.settings.placement.align+'"]:not([data-closing="true"])',n=this.$ele.nextAll(i);1==this.settings.newest_on_top&&(n=this.$ele.prevAll(i)),n.each(function(){t(this).css(s.settings.placement.from,e),e=parseInt(e)+parseInt(s.settings.spacing)+t(this).outerHeight()})}}),t.notify=function(t,s){var i=new e(this,t,s);return i.notify},t.notifyDefaults=function(e){return s=t.extend(!0,{},s,e)},t.notifyClose=function(e){"undefined"==typeof e||"all"==e?t("[data-notify]").find('[data-notify="dismiss"]').trigger("click"):t('[data-notify-position="'+e+'"]').find('[data-notify="dismiss"]').trigger("click")}}); -------------------------------------------------------------------------------- /assets/javascripts/bootstrap/bootstrap_sortable_helper.js: -------------------------------------------------------------------------------- 1 | // Return a helper with preserved width of cells 2 | var fixHelper = function(e, ui) { 3 | ui.children().each(function() { 4 | $(this).width($(this).width()); 5 | }); 6 | return ui; 7 | }; 8 | 9 | 10 | function setSortableElement(element, form) { 11 | $(element).sortable({ 12 | helper: fixHelper, 13 | axis: 'y', 14 | update: function(event, ui) { 15 | $.post($(form).data('update-url'), $(this).sortable('serialize'), null, 'script'); 16 | } 17 | }); 18 | } 19 | -------------------------------------------------------------------------------- /assets/javascripts/bootstrap/bootstrap_switch.js: -------------------------------------------------------------------------------- 1 | /*! ============================================================ 2 | * bootstrapSwitch v1.8 by Larentis Mattia @SpiritualGuru 3 | * http://www.larentis.eu/ 4 | * 5 | * Enhanced for radiobuttons by Stein, Peter @BdMdesigN 6 | * http://www.bdmdesign.org/ 7 | * 8 | * Project site: 9 | * http://www.larentis.eu/switch/ 10 | * ============================================================ 11 | * Licensed under the Apache License, Version 2.0 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * ============================================================ */ 14 | !function($){"use strict";$.fn['bootstrapSwitch']=function(method){var inputSelector='input[type!="hidden"]';var methods={init:function(){return this.each(function(){var $element=$(this),$div,$switchLeft,$switchRight,$label,$form=$element.closest('form'),myClasses="",classes=$element.attr('class'),color,moving,onLabel="ON",offLabel="OFF",icon=false,textLabel=false;$.each(['switch-mini','switch-small','switch-large'],function(i,el){if(classes.indexOf(el)>=0)myClasses=el});$element.addClass('has-switch');if($element.data('on')!==undefined)color="switch-"+$element.data('on');if($element.data('on-label')!==undefined)onLabel=$element.data('on-label');if($element.data('off-label')!==undefined)offLabel=$element.data('off-label');if($element.data('label-icon')!==undefined)icon=$element.data('label-icon');if($element.data('text-label')!==undefined)textLabel=$element.data('text-label');$switchLeft=$('').addClass("switch-left").addClass(myClasses).addClass(color).html(onLabel);color='';if($element.data('off')!==undefined)color="switch-"+$element.data('off');$switchRight=$('').addClass("switch-right").addClass(myClasses).addClass(color).html(offLabel);$label=$('