Skip to content

Commit

Permalink
Merge branch 'devel' into v0.2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Mar 4, 2015
2 parents c1d90ed + 29718fb commit d301902
Show file tree
Hide file tree
Showing 14 changed files with 733 additions and 490 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2013-2014 Nicolas Rodriguez ([email protected]), JBox Web (http://www.jbox-web.com)
Copyright (c) 2013-2015 Nicolas Rodriguez ([email protected]), JBox Web (http://www.jbox-web.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
## Redmine Bootstrap Kit (v0.1)
## Redmine Bootstrap Kit

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

Current version : [JQuery UI Bootstrap 0.5](http://jquery-ui-bootstrap.github.io/jquery-ui-bootstrap/) - 2014-04-19
It includes :

* [JQuery UI Bootstrap 0.5](http://jquery-ui-bootstrap.github.io/jquery-ui-bootstrap/) - 2014-04-19
* [FontAwesome 4.3.0](http://fortawesome.github.io/Font-Awesome/)
* [JQuery TagIt](http://aehlke.github.io/tag-it/)

Just clone it in your Redmine plugins directory :

Expand All @@ -14,6 +18,7 @@ Now, within another Redmine plugins, you can call Bootstrap Kit elements :
```
<% content_for :header_tags do %>
<%= stylesheet_link_tag 'font_awesome', :plugin => 'redmine_bootstrap_kit' %>
<%= stylesheet_link_tag 'bootstrap_custom', :plugin => 'redmine_bootstrap_kit' %>
<%= stylesheet_link_tag 'bootstrap/bootstrap_alert', :plugin => 'redmine_bootstrap_kit' %>
<%= stylesheet_link_tag 'bootstrap/bootstrap_animations', :plugin => 'redmine_bootstrap_kit' %>
<%= stylesheet_link_tag 'bootstrap/bootstrap_close', :plugin => 'redmine_bootstrap_kit' %>
Expand Down Expand Up @@ -52,10 +57,10 @@ Now, within another Redmine plugins, you can call Bootstrap Kit elements :


## Copyrights & License
Redmine Bootstrap Kit is completely free and open source and released under the [MIT License](https://github.com/jbox-web/redmine_bootstrap_kit/blob/devel/LICENSE).

Copyright (c) 2013-2014 Nicolas Rodriguez ([email protected]), JBox Web (http://www.jbox-web.com) [![endorse](https://api.coderwall.com/n-rodriguez/endorsecount.png)](https://coderwall.com/n-rodriguez)
Redmine Bootstrap Kit is completely free and open source and released under the [MIT License](https://github.com/jbox-web/redmine_bootstrap_kit/blob/devel/LICENSE).

Copyright (c) 2013-2015 Nicolas Rodriguez ([email protected]), JBox Web (http://www.jbox-web.com) [![endorse](https://api.coderwall.com/n-rodriguez/endorsecount.png)](https://coderwall.com/n-rodriguez)

## Contribute

Expand Down
21 changes: 21 additions & 0 deletions app/helpers/tag_it_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module TagItHelper

def tag_it_list(id, list_opts = {}, tag_it_opts = {}, &block)
data = { toggle: 'tagit' }
data = data.merge(tag_it_opts)

options = {}
options[:id] = id
options[:data] = data
options = options.merge(list_opts)

if block_given?
content_tag(:ul, options) do
yield
end
else
content_tag(:ul, '', options)
end
end

end
Binary file modified assets/fonts/FontAwesome.otf
Binary file not shown.
Binary file modified assets/fonts/fontawesome-webfont.eot
100755 → 100644
Binary file not shown.
989 changes: 525 additions & 464 deletions assets/fonts/fontawesome-webfont.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/fonts/fontawesome-webfont.ttf
100755 → 100644
Binary file not shown.
Binary file modified assets/fonts/fontawesome-webfont.woff
100755 → 100644
Binary file not shown.
Binary file added assets/fonts/fontawesome-webfont.woff2
Binary file not shown.
70 changes: 70 additions & 0 deletions assets/javascripts/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,73 @@ function setUpModalBox(source, target) {
});
});
}


if (!Array.prototype.remove) {
Array.prototype.remove = function(val) {
var i = this.indexOf(val);
return i>-1 ? this.splice(i, 1) : [];
};
}


function constantize(str) {
if (typeof str !== 'string') {
throw new TypeError('must pass in type of string');
}

if (str.match(/\W|\d/)) {
throw new SyntaxError('must pass in a valid Javascript name');
}

var constant
eval("constant = " + str);
return constant;
};


/*
JQueryTagIt
*/
function setTagIt(){
$('[data-toggle="tagit"]').each(function(){

var data_source = $(this).data('source');
var callback_after_add = $(this).data('after-add');
var callback_after_del = $(this).data('after-delete');

if (data_source != undefined) {
data_source = constantize(data_source);
var source_options = {
afterTagAdded: function(event, ui) {
var value = ui.tag.children('input:hidden').val();
data_source.remove(value);
if (callback_after_add != undefined) { eval(callback_after_add); }
},
afterTagRemoved: function(event, ui) {
var value = ui.tag.children('input:hidden').val();
data_source.push(value);
if (callback_after_del != undefined) { eval(callback_after_del); }
},
autocomplete: {
source: function(request, resolve) {
resolve(data_source);
}
}
}
} else {
var source_options = {};
}

var default_options = {
showAutocompleteOnFocus: true,
placeholderText: $(this).data('placeholder'),
allowDuplicates: false,
caseSensitive: false,
fieldName: $(this).attr('name')
}

tagit_options = $.extend({}, source_options, default_options);
$(this).tagit(tagit_options);
});
}
66 changes: 58 additions & 8 deletions assets/javascripts/jquery_tag_it.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
(function($) {

$.widget('ui.gtagit', {
$.widget('ui.tagit', {
options: {
allowDuplicates : false,
caseSensitive : true,
Expand Down Expand Up @@ -119,7 +119,7 @@
this.tagList = $('<ul></ul>').insertAfter(this.element);
this.options.singleField = true;
this.options.singleFieldNode = this.element;
this.element.css('display', 'none');
this.element.addClass('tagit-hidden-field');
} else {
this.tagList = this.element.find('ul, ol').andSelf().last();
}
Expand Down Expand Up @@ -241,7 +241,7 @@
// Tab will also create a tag, unless the tag input is empty,
// in which case it isn't caught.
if (
event.which === $.ui.keyCode.COMMA ||
(event.which === $.ui.keyCode.COMMA && event.shiftKey === false) ||
event.which === $.ui.keyCode.ENTER ||
(
event.which == $.ui.keyCode.TAB &&
Expand All @@ -266,7 +266,8 @@
}

// Autocomplete will create its own tag from a selection and close automatically.
if (!that.tagInput.data('autocomplete-open')) {
if (!(that.options.autocomplete.autoFocus && that.tagInput.data('autocomplete-open'))) {
that.tagInput.autocomplete('close');
that.createTag(that._cleanedInput());
}
}
Expand All @@ -293,14 +294,63 @@
// while tagSource is left null by default.
autocompleteOptions.source = this.options.tagSource || autocompleteOptions.source;

this.tagInput.autocomplete(autocompleteOptions).bind('autocompleteopen', function(event, ui) {
this.tagInput.autocomplete(autocompleteOptions).bind('autocompleteopen.tagit', function(event, ui) {
that.tagInput.data('autocomplete-open', true);
}).bind('autocompleteclose', function(event, ui) {
that.tagInput.data('autocomplete-open', false)
}).bind('autocompleteclose.tagit', function(event, ui) {
that.tagInput.data('autocomplete-open', false);
});

this.tagInput.autocomplete('widget').addClass('tagit-autocomplete');
}
},

destroy: function() {
$.Widget.prototype.destroy.call(this);

this.element.unbind('.tagit');
this.tagList.unbind('.tagit');

this.tagInput.removeData('autocomplete-open');

this.tagList.removeClass([
'tagit',
'ui-widget',
'ui-widget-content',
'ui-corner-all',
'tagit-hidden-field'
].join(' '));

if (this.element.is('input')) {
this.element.removeClass('tagit-hidden-field');
this.tagList.remove();
} else {
this.element.children('li').each(function() {
if ($(this).hasClass('tagit-new')) {
$(this).remove();
} else {
$(this).removeClass([
'tagit-choice',
'ui-widget-content',
'ui-state-default',
'ui-state-highlight',
'ui-corner-all',
'remove',
'tagit-choice-editable',
'tagit-choice-read-only'
].join(' '));

$(this).text($(this).children('.tagit-label').text());
}
});

if (this.singleFieldNode) {
this.singleFieldNode.remove();
}
}

return this;
},

_cleanedInput: function() {
// Returns the contents of the tag input, cleaned and ready to be passed to createTag
return $.trim(this.tagInput.val().replace(/^"(.*)"$/, '$1'));
Expand Down Expand Up @@ -445,7 +495,7 @@
// Unless options.singleField is set, each tag has a hidden input field inline.
if (!this.options.singleField) {
var escapedValue = label.html();
tag.append('<input type="hidden" style="display:none;" value="' + escapedValue + '" name="' + this.options.fieldName + '" />');
tag.append('<input type="hidden" value="' + escapedValue + '" name="' + this.options.fieldName + '" class="tagit-hidden-field" />');
}

if (this._trigger('beforeTagAdded', null, {
Expand Down
40 changes: 37 additions & 3 deletions assets/stylesheets/bootstrap_custom.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
/*
BOOSTRAP CUSTOM 2
*/
ul.unstyled, ol.unstyled {
list-style: none outside none;
margin: 0;
ol.list-unstyled,
ul.list-unstyled {
list-style-type: none;
padding: 0;
margin: 0;
}

ol.list-inline,
ul.list-inline {
display: inline-flex;
}

dl { margin-bottom: 10px; }
Expand All @@ -29,6 +35,8 @@ dd { margin-left: 10px; }
.dl-small dd { margin-left: 130px; }
.dl-medium dt { width: 110px; }
.dl-medium dd { margin-left: 125px; }
.dl-xsmall dt { width: 50px; }
.dl-xsmall dd { margin-left: 60px; }


/*
Expand All @@ -39,3 +47,29 @@ BOOSTRAP CUSTOM 3
div.flash.warning, .conflict {
background: url("../images/warning.png") no-repeat scroll 8px 18px #FFEBC1;
}


/*BOOTSTRAP LIKE*/
.container {
width: 100%;
display: table;
}

.row {
display: table-row;
}

.col-md-6 {
width: 45%;
display: table-cell;
}

.col-md-12 {
width: 90%;
display: table-cell;
}

.row > .col-md-6,
.row > .col-md-12 {
padding: 0 10px;
}
4 changes: 2 additions & 2 deletions assets/stylesheets/font_awesome.css

Large diffs are not rendered by default.

18 changes: 10 additions & 8 deletions assets/stylesheets/jquery_tag_it.css
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@ ul.tagit li {
float: left;
margin: 2px 5px 2px 0;
}
ul.tagit li.tagit-choice {
ul.tagit li.tagit-choice {
position: relative;
line-height: inherit;
}
input.tagit-hidden-field {
display: none;
}
ul.tagit li.tagit-choice-read-only {
padding: .2em .5em .2em .5em;
}

ul.tagit li.tagit-choice-read-only {
padding: .2em .5em .2em .5em;
}

ul.tagit li.tagit-choice-editable {
padding: .2em 18px .2em .5em;
}
ul.tagit li.tagit-choice-editable {
padding: .2em 18px .2em .5em;
}

ul.tagit li.tagit-new {
padding: .25em 4px .25em 0;
Expand Down

0 comments on commit d301902

Please sign in to comment.