gentelella-rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +107 -0
- data/Rakefile +30 -0
- data/assets/javascripts/autosize.js +254 -0
- data/assets/javascripts/bootstrap-progressbar.js +168 -0
- data/assets/javascripts/bootstrap-wysiwyg.js +306 -0
- data/assets/javascripts/data_tables.coffee +12 -0
- data/assets/javascripts/data_tables/jquery.data_tables.js +15277 -0
- data/assets/javascripts/data_tables/net-bs.bootstrap.js +182 -0
- data/assets/javascripts/data_tables/net-buttons-bs.buttons.js +68 -0
- data/assets/javascripts/data_tables/net-buttons.buttons.flash.js +1325 -0
- data/assets/javascripts/data_tables/net-buttons.buttons.html5.js +1322 -0
- data/assets/javascripts/data_tables/net-buttons.buttons.js +1634 -0
- data/assets/javascripts/data_tables/net-buttons.buttons.print.js +172 -0
- data/assets/javascripts/data_tables/net-fixedheader.js +672 -0
- data/assets/javascripts/data_tables/net-keytable.js +883 -0
- data/assets/javascripts/data_tables/net-responsive-bs.js +81 -0
- data/assets/javascripts/data_tables/net-responsive.js +1232 -0
- data/assets/javascripts/data_tables/net-scroller.js +1349 -0
- data/assets/javascripts/echarts.js +56282 -0
- data/assets/javascripts/echarts.map.world.js +27 -0
- data/assets/javascripts/fullcalendar.js +14206 -0
- data/assets/javascripts/gauge.coffee +524 -0
- data/assets/javascripts/gentelella.coffee +50 -0
- data/assets/javascripts/jquery.autocomplete.js +979 -0
- data/assets/javascripts/jquery.easypiechart.js +360 -0
- data/assets/javascripts/jquery.flot.curvedLines.js +483 -0
- data/assets/javascripts/jquery.flot.curved_lines.js +483 -0
- data/assets/javascripts/jquery.flot.orderBars.js +201 -0
- data/assets/javascripts/jquery.flot.order_bars.js +201 -0
- data/assets/javascripts/jquery.flot.spline.js +212 -0
- data/assets/javascripts/jquery.hotkeys.js +204 -0
- data/assets/javascripts/jquery.mCustomScrollbar.concat.min.js +6 -0
- data/assets/javascripts/jquery.mCustomScrollbar.js +2425 -0
- data/assets/javascripts/jquery.sparkline.js +3063 -0
- data/assets/javascripts/jquery.tagsinput.js +390 -0
- data/assets/javascripts/jquery.vmap.js +1281 -0
- data/assets/javascripts/jqvmap/maps/continents/jquery.vmap.africa.js +2 -0
- data/assets/javascripts/jqvmap/maps/continents/jquery.vmap.asia.js +2 -0
- data/assets/javascripts/jqvmap/maps/continents/jquery.vmap.australia.js +2 -0
- data/assets/javascripts/jqvmap/maps/continents/jquery.vmap.europe.js +2 -0
- data/assets/javascripts/jqvmap/maps/continents/jquery.vmap.north-america.js +2 -0
- data/assets/javascripts/jqvmap/maps/continents/jquery.vmap.south-america.js +2 -0
- data/assets/javascripts/jqvmap/maps/jquery.vmap.algeria.js +2 -0
- data/assets/javascripts/jqvmap/maps/jquery.vmap.argentina.js +1 -0
- data/assets/javascripts/jqvmap/maps/jquery.vmap.brazil.js +2 -0
- data/assets/javascripts/jqvmap/maps/jquery.vmap.canada.js +2 -0
- data/assets/javascripts/jqvmap/maps/jquery.vmap.europe.js +2 -0
- data/assets/javascripts/jqvmap/maps/jquery.vmap.france.js +1 -0
- data/assets/javascripts/jqvmap/maps/jquery.vmap.germany.js +2 -0
- data/assets/javascripts/jqvmap/maps/jquery.vmap.greece.js +1 -0
- data/assets/javascripts/jqvmap/maps/jquery.vmap.iran.js +6 -0
- data/assets/javascripts/jqvmap/maps/jquery.vmap.iraq.js +1 -0
- data/assets/javascripts/jqvmap/maps/jquery.vmap.russia.js +2 -0
- data/assets/javascripts/jqvmap/maps/jquery.vmap.tunisia.js +2 -0
- data/assets/javascripts/jqvmap/maps/jquery.vmap.turkey.js +11 -0
- data/assets/javascripts/jqvmap/maps/jquery.vmap.usa.js +2 -0
- data/assets/javascripts/jqvmap/maps/jquery.vmap.world.js +2 -0
- data/assets/javascripts/jszip.js +9344 -0
- data/assets/javascripts/morris.js +1892 -0
- data/assets/javascripts/parsley.js.map +1 -0
- data/assets/javascripts/pdfmake.js +68149 -0
- data/assets/javascripts/pnotify.buttons.js +8 -0
- data/assets/javascripts/pnotify.js +31 -0
- data/assets/javascripts/pnotify.nonblock.js +6 -0
- data/assets/javascripts/prettify.coffee +29 -0
- data/assets/javascripts/prettify/lang-apollo.js +51 -0
- data/assets/javascripts/prettify/lang-basic.js +32 -0
- data/assets/javascripts/prettify/lang-clj.js +64 -0
- data/assets/javascripts/prettify/lang-css.js +159 -0
- data/assets/javascripts/prettify/lang-dart.js +88 -0
- data/assets/javascripts/prettify/lang-erlang.js +92 -0
- data/assets/javascripts/prettify/lang-go.js +58 -0
- data/assets/javascripts/prettify/lang-hs.js +101 -0
- data/assets/javascripts/prettify/lang-lisp.js +94 -0
- data/assets/javascripts/prettify/lang-llvm.js +61 -0
- data/assets/javascripts/prettify/lang-lua.js +59 -0
- data/assets/javascripts/prettify/lang-matlab.js +180 -0
- data/assets/javascripts/prettify/lang-ml.js +56 -0
- data/assets/javascripts/prettify/lang-mumps.js +139 -0
- data/assets/javascripts/prettify/lang-n.js +65 -0
- data/assets/javascripts/prettify/lang-pascal.js +32 -0
- data/assets/javascripts/prettify/lang-proto.js +35 -0
- data/assets/javascripts/prettify/lang-r.js +57 -0
- data/assets/javascripts/prettify/lang-rd.js +47 -0
- data/assets/javascripts/prettify/lang-scala.js +54 -0
- data/assets/javascripts/prettify/lang-sql.js +58 -0
- data/assets/javascripts/prettify/lang-tcl.js +62 -0
- data/assets/javascripts/prettify/lang-tex.js +46 -0
- data/assets/javascripts/prettify/lang-vb.js +66 -0
- data/assets/javascripts/prettify/lang-vhdl.js +34 -0
- data/assets/javascripts/prettify/lang-wiki.js +53 -0
- data/assets/javascripts/prettify/lang-xq.js +67 -0
- data/assets/javascripts/prettify/lang-yaml.js +27 -0
- data/assets/javascripts/prettify/prettify.js +1655 -0
- data/assets/javascripts/prettify/run_prettify.js +1905 -0
- data/assets/javascripts/raphael.js +8330 -0
- data/assets/javascripts/skycons.js +730 -0
- data/assets/javascripts/starrr.js +98 -0
- data/assets/javascripts/vfs_fonts.js +1 -0
- data/assets/stylesheets/bootstrap-progressbar-3.3.0-3.x.x.scss +74 -0
- data/assets/stylesheets/bootstrap-wysiwyg.css +88 -0
- data/assets/stylesheets/data_tables/net-bs.bootstrap.css +185 -0
- data/assets/stylesheets/data_tables/net-buttons-bs.buttons.css +102 -0
- data/assets/stylesheets/data_tables/net-fixedheader-bs.bootstrap.css +20 -0
- data/assets/stylesheets/data_tables/net-responsive-bs.bootstrap.css +181 -0
- data/assets/stylesheets/data_tables/net-scroller-bs.bootstrap.css +24 -0
- data/assets/stylesheets/fullcalendar.css +1406 -0
- data/assets/stylesheets/fullcalendar.print.css +208 -0
- data/assets/stylesheets/gentelella.scss +39 -0
- data/assets/stylesheets/jquery.mCustomScrollbar.css +1267 -0
- data/assets/stylesheets/jqvmap.css +50 -0
- data/assets/stylesheets/morris.css +2 -0
- data/assets/stylesheets/pnotify.buttons.css +1 -0
- data/assets/stylesheets/pnotify.css +1 -0
- data/assets/stylesheets/pnotify.nonblock.css +1 -0
- data/assets/stylesheets/prettify/prettify.css +52 -0
- data/assets/stylesheets/starrr.css +8 -0
- data/lib/generators/gentelella/install/USAGE +9 -0
- data/lib/generators/gentelella/install/install_generator.rb +14 -0
- data/lib/generators/gentelella/install/templates/gentelella-custom.js +5067 -0
- data/lib/generators/gentelella/install/templates/gentelella-custom.scss +4241 -0
- data/lib/gentelella-rails.rb +58 -0
- data/lib/gentelella/engine.rb +15 -0
- data/lib/gentelella/version.rb +3 -0
- data/lib/tasks/bower.rake +153 -0
- data/lib/tasks/gentelella/rails_tasks.rake +4 -0
- metadata +409 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 213433b7da57a97b9d35671dcc39784d9f667df3
|
4
|
+
data.tar.gz: 6c250be5fcc05641daf6b4337cef52241380efa6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c25a0740ddc5e7b4e63f4334c8b7b3f8542732afacc4b77c139b834ce936c4d0615dbc2794111aed323976e716531dce580ecb75566f3c295da108b8d5f50a4a
|
7
|
+
data.tar.gz: 84441340dd11f3a55c56555dfe9902091a1b74476ea784df2d1a986f75e6837aceb07d689434afcc7ffdb8df0db2b1d6ee7485fb7ad3d68398376ee76dd9cc80
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2017 mwlang
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
# Gentelella Rails
|
2
|
+
|
3
|
+
This is mostly an experimental effort to inject the Gentelella theme into Rails assets pipeline.
|
4
|
+
|
5
|
+
My goal in building this gem was to learn:
|
6
|
+
|
7
|
+
* how to automate bower updates
|
8
|
+
* package up only the files needed for the gem to function in production
|
9
|
+
* load everything up with just one or two requires in the Rails app that uses it
|
10
|
+
|
11
|
+
Beware that this gem furnishes a fairly comprehensive theme and pulls in *many* other libraries such as:
|
12
|
+
|
13
|
+
* jquery and jquery_ujs
|
14
|
+
* bootstrap-sass and font-awesome-sass
|
15
|
+
* icheck
|
16
|
+
* nprogress
|
17
|
+
* moment JS
|
18
|
+
* bootstrap date range picker
|
19
|
+
* fastclick
|
20
|
+
* ChartJS
|
21
|
+
* jquery Flot
|
22
|
+
* DateJS
|
23
|
+
* Switchery
|
24
|
+
* Select2
|
25
|
+
* Parsley JS
|
26
|
+
|
27
|
+
Where possible, I utilized well-maintained Rails gems for the above. However, if the gems were
|
28
|
+
out of date, I utilized the Bower supplied version.
|
29
|
+
|
30
|
+
You may also find the demo [Rails 5.x project on github](https://github.com/mwlang/gentelella-rails-demo)
|
31
|
+
|
32
|
+
## Theme Demo
|
33
|
+
![Gentelella Bootstrap Admin Template](https://github.com/mwlang/gentelella-rails-demo/blob/master/public/images/gentelella-admin-template-preview.jpg "Gentelella Theme Browser Preview")
|
34
|
+
|
35
|
+
**[Template Demo](https://colorlib.com/polygon/gentelella/index.html)**
|
36
|
+
|
37
|
+
## Installation
|
38
|
+
Add the following to your Rails application's Gemfile and bundle install:
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
gem 'gentelella-rails'
|
42
|
+
```
|
43
|
+
|
44
|
+
Then perform the following:
|
45
|
+
|
46
|
+
```bash
|
47
|
+
bundle install
|
48
|
+
rails g gentelella:install
|
49
|
+
```
|
50
|
+
|
51
|
+
Add the following to your assets/javascripts/application.js
|
52
|
+
|
53
|
+
```javascript
|
54
|
+
//= require gentelella
|
55
|
+
//= require gentelella-custom
|
56
|
+
```
|
57
|
+
|
58
|
+
If you're working with jquery.vmap, then your application.js will look something like this:
|
59
|
+
|
60
|
+
```javascript
|
61
|
+
//= require gentelella
|
62
|
+
//= require jqvmap/maps/jquery.vmap.world
|
63
|
+
//= require jqvmap/maps/jquery.vmap.usa
|
64
|
+
//= require jquery.vmap.sampledata
|
65
|
+
//= require gentelella-custom
|
66
|
+
```
|
67
|
+
|
68
|
+
There is no need to include bootstrap-sprockets, font-awesome, jquery, etc. as these are all included via
|
69
|
+
the gem when you "require gentelella"
|
70
|
+
|
71
|
+
Finally, add the stylesheet directives to your assets/stylesheets/application.scss
|
72
|
+
|
73
|
+
```sass
|
74
|
+
@import "gentelella";
|
75
|
+
@import "gentelella-custom";
|
76
|
+
```
|
77
|
+
|
78
|
+
This will pull in all necessary stylesheets including bootstrap, font-awesome, etc., which the theme uses.
|
79
|
+
|
80
|
+
```ruby
|
81
|
+
gem 'gentelella-rails'
|
82
|
+
```
|
83
|
+
|
84
|
+
## Contributing
|
85
|
+
I don't have any personal plans to utilize this theme in my projects, so if this project is of interest,
|
86
|
+
fork and send pull requests and I will publish!
|
87
|
+
|
88
|
+
The gem should be fairly easy to update to latest JS libraries as they come available.
|
89
|
+
If the JS or CSS libraries are via a rubygem, then:
|
90
|
+
|
91
|
+
```bash
|
92
|
+
bundle update GEMNAME
|
93
|
+
```
|
94
|
+
|
95
|
+
If the libraries are supplied by bower then:
|
96
|
+
|
97
|
+
```bash
|
98
|
+
rake bower:update
|
99
|
+
rake bower:vendor
|
100
|
+
```
|
101
|
+
|
102
|
+
## Credits
|
103
|
+
The original [theme](https://github.com/puikinsh/gentelella) was developed by
|
104
|
+
[Colorlib](https://colorlib.com/) and released under MIT license.
|
105
|
+
|
106
|
+
## License
|
107
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Gentelella'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
require 'bundler/gem_tasks'
|
18
|
+
load 'lib/tasks/bower.rake'
|
19
|
+
|
20
|
+
require 'rake/testtask'
|
21
|
+
|
22
|
+
Rake::TestTask.new(:test) do |t|
|
23
|
+
t.libs << 'lib'
|
24
|
+
t.libs << 'test'
|
25
|
+
t.pattern = 'test/**/*_test.rb'
|
26
|
+
t.verbose = false
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
task default: :test
|
@@ -0,0 +1,254 @@
|
|
1
|
+
/*!
|
2
|
+
Autosize 3.0.15
|
3
|
+
license: MIT
|
4
|
+
http://www.jacklmoore.com/autosize
|
5
|
+
*/
|
6
|
+
(function (global, factory) {
|
7
|
+
if (typeof define === 'function' && define.amd) {
|
8
|
+
define(['exports', 'module'], factory);
|
9
|
+
} else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
|
10
|
+
factory(exports, module);
|
11
|
+
} else {
|
12
|
+
var mod = {
|
13
|
+
exports: {}
|
14
|
+
};
|
15
|
+
factory(mod.exports, mod);
|
16
|
+
global.autosize = mod.exports;
|
17
|
+
}
|
18
|
+
})(this, function (exports, module) {
|
19
|
+
'use strict';
|
20
|
+
|
21
|
+
var set = typeof Set === 'function' ? new Set() : (function () {
|
22
|
+
var list = [];
|
23
|
+
|
24
|
+
return {
|
25
|
+
has: function has(key) {
|
26
|
+
return Boolean(list.indexOf(key) > -1);
|
27
|
+
},
|
28
|
+
add: function add(key) {
|
29
|
+
list.push(key);
|
30
|
+
},
|
31
|
+
'delete': function _delete(key) {
|
32
|
+
list.splice(list.indexOf(key), 1);
|
33
|
+
} };
|
34
|
+
})();
|
35
|
+
|
36
|
+
var createEvent = function createEvent(name) {
|
37
|
+
return new Event(name);
|
38
|
+
};
|
39
|
+
try {
|
40
|
+
new Event('test');
|
41
|
+
} catch (e) {
|
42
|
+
// IE does not support `new Event()`
|
43
|
+
createEvent = function (name) {
|
44
|
+
var evt = document.createEvent('Event');
|
45
|
+
evt.initEvent(name, true, false);
|
46
|
+
return evt;
|
47
|
+
};
|
48
|
+
}
|
49
|
+
|
50
|
+
function assign(ta) {
|
51
|
+
var _ref = arguments[1] === undefined ? {} : arguments[1];
|
52
|
+
|
53
|
+
var _ref$setOverflowX = _ref.setOverflowX;
|
54
|
+
var setOverflowX = _ref$setOverflowX === undefined ? true : _ref$setOverflowX;
|
55
|
+
var _ref$setOverflowY = _ref.setOverflowY;
|
56
|
+
var setOverflowY = _ref$setOverflowY === undefined ? true : _ref$setOverflowY;
|
57
|
+
|
58
|
+
if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || set.has(ta)) return;
|
59
|
+
|
60
|
+
var heightOffset = null;
|
61
|
+
var overflowY = null;
|
62
|
+
var clientWidth = ta.clientWidth;
|
63
|
+
|
64
|
+
function init() {
|
65
|
+
var style = window.getComputedStyle(ta, null);
|
66
|
+
|
67
|
+
overflowY = style.overflowY;
|
68
|
+
|
69
|
+
if (style.resize === 'vertical') {
|
70
|
+
ta.style.resize = 'none';
|
71
|
+
} else if (style.resize === 'both') {
|
72
|
+
ta.style.resize = 'horizontal';
|
73
|
+
}
|
74
|
+
|
75
|
+
if (style.boxSizing === 'content-box') {
|
76
|
+
heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
|
77
|
+
} else {
|
78
|
+
heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
|
79
|
+
}
|
80
|
+
// Fix when a textarea is not on document body and heightOffset is Not a Number
|
81
|
+
if (isNaN(heightOffset)) {
|
82
|
+
heightOffset = 0;
|
83
|
+
}
|
84
|
+
|
85
|
+
update();
|
86
|
+
}
|
87
|
+
|
88
|
+
function changeOverflow(value) {
|
89
|
+
{
|
90
|
+
// Chrome/Safari-specific fix:
|
91
|
+
// When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space
|
92
|
+
// made available by removing the scrollbar. The following forces the necessary text reflow.
|
93
|
+
var width = ta.style.width;
|
94
|
+
ta.style.width = '0px';
|
95
|
+
// Force reflow:
|
96
|
+
/* jshint ignore:start */
|
97
|
+
ta.offsetWidth;
|
98
|
+
/* jshint ignore:end */
|
99
|
+
ta.style.width = width;
|
100
|
+
}
|
101
|
+
|
102
|
+
overflowY = value;
|
103
|
+
|
104
|
+
if (setOverflowY) {
|
105
|
+
ta.style.overflowY = value;
|
106
|
+
}
|
107
|
+
|
108
|
+
resize();
|
109
|
+
}
|
110
|
+
|
111
|
+
function resize() {
|
112
|
+
var htmlTop = window.pageYOffset;
|
113
|
+
var bodyTop = document.body.scrollTop;
|
114
|
+
var originalHeight = ta.style.height;
|
115
|
+
|
116
|
+
ta.style.height = 'auto';
|
117
|
+
|
118
|
+
var endHeight = ta.scrollHeight + heightOffset;
|
119
|
+
|
120
|
+
if (ta.scrollHeight === 0) {
|
121
|
+
// If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.
|
122
|
+
ta.style.height = originalHeight;
|
123
|
+
return;
|
124
|
+
}
|
125
|
+
|
126
|
+
ta.style.height = endHeight + 'px';
|
127
|
+
|
128
|
+
// used to check if an update is actually necessary on window.resize
|
129
|
+
clientWidth = ta.clientWidth;
|
130
|
+
|
131
|
+
// prevents scroll-position jumping
|
132
|
+
document.documentElement.scrollTop = htmlTop;
|
133
|
+
document.body.scrollTop = bodyTop;
|
134
|
+
}
|
135
|
+
|
136
|
+
function update() {
|
137
|
+
var startHeight = ta.style.height;
|
138
|
+
|
139
|
+
resize();
|
140
|
+
|
141
|
+
var style = window.getComputedStyle(ta, null);
|
142
|
+
|
143
|
+
if (style.height !== ta.style.height) {
|
144
|
+
if (overflowY !== 'visible') {
|
145
|
+
changeOverflow('visible');
|
146
|
+
}
|
147
|
+
} else {
|
148
|
+
if (overflowY !== 'hidden') {
|
149
|
+
changeOverflow('hidden');
|
150
|
+
}
|
151
|
+
}
|
152
|
+
|
153
|
+
if (startHeight !== ta.style.height) {
|
154
|
+
var evt = createEvent('autosize:resized');
|
155
|
+
ta.dispatchEvent(evt);
|
156
|
+
}
|
157
|
+
}
|
158
|
+
|
159
|
+
var pageResize = function pageResize() {
|
160
|
+
if (ta.clientWidth !== clientWidth) {
|
161
|
+
update();
|
162
|
+
}
|
163
|
+
};
|
164
|
+
|
165
|
+
var destroy = (function (style) {
|
166
|
+
window.removeEventListener('resize', pageResize, false);
|
167
|
+
ta.removeEventListener('input', update, false);
|
168
|
+
ta.removeEventListener('keyup', update, false);
|
169
|
+
ta.removeEventListener('autosize:destroy', destroy, false);
|
170
|
+
ta.removeEventListener('autosize:update', update, false);
|
171
|
+
set['delete'](ta);
|
172
|
+
|
173
|
+
Object.keys(style).forEach(function (key) {
|
174
|
+
ta.style[key] = style[key];
|
175
|
+
});
|
176
|
+
}).bind(ta, {
|
177
|
+
height: ta.style.height,
|
178
|
+
resize: ta.style.resize,
|
179
|
+
overflowY: ta.style.overflowY,
|
180
|
+
overflowX: ta.style.overflowX,
|
181
|
+
wordWrap: ta.style.wordWrap });
|
182
|
+
|
183
|
+
ta.addEventListener('autosize:destroy', destroy, false);
|
184
|
+
|
185
|
+
// IE9 does not fire onpropertychange or oninput for deletions,
|
186
|
+
// so binding to onkeyup to catch most of those events.
|
187
|
+
// There is no way that I know of to detect something like 'cut' in IE9.
|
188
|
+
if ('onpropertychange' in ta && 'oninput' in ta) {
|
189
|
+
ta.addEventListener('keyup', update, false);
|
190
|
+
}
|
191
|
+
|
192
|
+
window.addEventListener('resize', pageResize, false);
|
193
|
+
ta.addEventListener('input', update, false);
|
194
|
+
ta.addEventListener('autosize:update', update, false);
|
195
|
+
set.add(ta);
|
196
|
+
|
197
|
+
if (setOverflowX) {
|
198
|
+
ta.style.overflowX = 'hidden';
|
199
|
+
ta.style.wordWrap = 'break-word';
|
200
|
+
}
|
201
|
+
|
202
|
+
init();
|
203
|
+
}
|
204
|
+
|
205
|
+
function destroy(ta) {
|
206
|
+
if (!(ta && ta.nodeName && ta.nodeName === 'TEXTAREA')) return;
|
207
|
+
var evt = createEvent('autosize:destroy');
|
208
|
+
ta.dispatchEvent(evt);
|
209
|
+
}
|
210
|
+
|
211
|
+
function update(ta) {
|
212
|
+
if (!(ta && ta.nodeName && ta.nodeName === 'TEXTAREA')) return;
|
213
|
+
var evt = createEvent('autosize:update');
|
214
|
+
ta.dispatchEvent(evt);
|
215
|
+
}
|
216
|
+
|
217
|
+
var autosize = null;
|
218
|
+
|
219
|
+
// Do nothing in Node.js environment and IE8 (or lower)
|
220
|
+
if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
|
221
|
+
autosize = function (el) {
|
222
|
+
return el;
|
223
|
+
};
|
224
|
+
autosize.destroy = function (el) {
|
225
|
+
return el;
|
226
|
+
};
|
227
|
+
autosize.update = function (el) {
|
228
|
+
return el;
|
229
|
+
};
|
230
|
+
} else {
|
231
|
+
autosize = function (el, options) {
|
232
|
+
if (el) {
|
233
|
+
Array.prototype.forEach.call(el.length ? el : [el], function (x) {
|
234
|
+
return assign(x, options);
|
235
|
+
});
|
236
|
+
}
|
237
|
+
return el;
|
238
|
+
};
|
239
|
+
autosize.destroy = function (el) {
|
240
|
+
if (el) {
|
241
|
+
Array.prototype.forEach.call(el.length ? el : [el], destroy);
|
242
|
+
}
|
243
|
+
return el;
|
244
|
+
};
|
245
|
+
autosize.update = function (el) {
|
246
|
+
if (el) {
|
247
|
+
Array.prototype.forEach.call(el.length ? el : [el], update);
|
248
|
+
}
|
249
|
+
return el;
|
250
|
+
};
|
251
|
+
}
|
252
|
+
|
253
|
+
module.exports = autosize;
|
254
|
+
});
|
@@ -0,0 +1,168 @@
|
|
1
|
+
/*!
|
2
|
+
* bootstrap-progressbar v0.9.0 by @minddust
|
3
|
+
* Copyright (c) 2012-2015 Stephan Groß
|
4
|
+
*
|
5
|
+
* http://www.minddust.com/project/bootstrap-progressbar/
|
6
|
+
*
|
7
|
+
* Licensed under the MIT license:
|
8
|
+
* http://www.opensource.org/licenses/MIT
|
9
|
+
*/
|
10
|
+
(function($) {
|
11
|
+
|
12
|
+
'use strict';
|
13
|
+
|
14
|
+
// PROGRESSBAR CLASS DEFINITION
|
15
|
+
// ============================
|
16
|
+
|
17
|
+
var Progressbar = function(element, options) {
|
18
|
+
this.$element = $(element);
|
19
|
+
this.options = $.extend({}, Progressbar.defaults, options);
|
20
|
+
};
|
21
|
+
|
22
|
+
Progressbar.defaults = {
|
23
|
+
transition_delay: 300,
|
24
|
+
refresh_speed: 50,
|
25
|
+
display_text: 'none',
|
26
|
+
use_percentage: true,
|
27
|
+
percent_format: function(percent) { return percent + '%'; },
|
28
|
+
amount_format: function(amount_part, amount_max, amount_min) { return amount_part + ' / ' + amount_max; },
|
29
|
+
update: $.noop,
|
30
|
+
done: $.noop,
|
31
|
+
fail: $.noop
|
32
|
+
};
|
33
|
+
|
34
|
+
Progressbar.prototype.transition = function() {
|
35
|
+
var $this = this.$element;
|
36
|
+
var $parent = $this.parent();
|
37
|
+
var $back_text = this.$back_text;
|
38
|
+
var $front_text = this.$front_text;
|
39
|
+
var options = this.options;
|
40
|
+
var data_transitiongoal = parseInt($this.attr('data-transitiongoal'));
|
41
|
+
var aria_valuemin = parseInt($this.attr('aria-valuemin')) || 0;
|
42
|
+
var aria_valuemax = parseInt($this.attr('aria-valuemax')) || 100;
|
43
|
+
var is_vertical = $parent.hasClass('vertical');
|
44
|
+
var update = options.update && typeof options.update === 'function' ? options.update : Progressbar.defaults.update;
|
45
|
+
var done = options.done && typeof options.done === 'function' ? options.done : Progressbar.defaults.done;
|
46
|
+
var fail = options.fail && typeof options.fail === 'function' ? options.fail : Progressbar.defaults.fail;
|
47
|
+
|
48
|
+
if (isNaN(data_transitiongoal)) {
|
49
|
+
fail('data-transitiongoal not set');
|
50
|
+
return;
|
51
|
+
}
|
52
|
+
var percentage = Math.round(100 * (data_transitiongoal - aria_valuemin) / (aria_valuemax - aria_valuemin));
|
53
|
+
|
54
|
+
if (options.display_text === 'center' && !$back_text && !$front_text) {
|
55
|
+
this.$back_text = $back_text = $('<span>').addClass('progressbar-back-text').prependTo($parent);
|
56
|
+
this.$front_text = $front_text = $('<span>').addClass('progressbar-front-text').prependTo($this);
|
57
|
+
|
58
|
+
var parent_size;
|
59
|
+
|
60
|
+
if (is_vertical) {
|
61
|
+
parent_size = $parent.css('height');
|
62
|
+
$back_text.css({height: parent_size, 'line-height': parent_size});
|
63
|
+
$front_text.css({height: parent_size, 'line-height': parent_size});
|
64
|
+
|
65
|
+
$(window).resize(function() {
|
66
|
+
parent_size = $parent.css('height');
|
67
|
+
$back_text.css({height: parent_size, 'line-height': parent_size});
|
68
|
+
$front_text.css({height: parent_size, 'line-height': parent_size});
|
69
|
+
}); // normal resizing would brick the structure because width is in px
|
70
|
+
}
|
71
|
+
else {
|
72
|
+
parent_size = $parent.css('width');
|
73
|
+
$front_text.css({width: parent_size});
|
74
|
+
|
75
|
+
$(window).resize(function() {
|
76
|
+
parent_size = $parent.css('width');
|
77
|
+
$front_text.css({width: parent_size});
|
78
|
+
}); // normal resizing would brick the structure because width is in px
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
setTimeout(function() {
|
83
|
+
var current_percentage;
|
84
|
+
var current_value;
|
85
|
+
var this_size;
|
86
|
+
var parent_size;
|
87
|
+
var text;
|
88
|
+
|
89
|
+
if (is_vertical) {
|
90
|
+
$this.css('height', percentage + '%');
|
91
|
+
}
|
92
|
+
else {
|
93
|
+
$this.css('width', percentage + '%');
|
94
|
+
}
|
95
|
+
|
96
|
+
var progress = setInterval(function() {
|
97
|
+
if (is_vertical) {
|
98
|
+
this_size = $this.height();
|
99
|
+
parent_size = $parent.height();
|
100
|
+
}
|
101
|
+
else {
|
102
|
+
this_size = $this.width();
|
103
|
+
parent_size = $parent.width();
|
104
|
+
}
|
105
|
+
|
106
|
+
current_percentage = Math.round(100 * this_size / parent_size);
|
107
|
+
current_value = Math.round(aria_valuemin + this_size / parent_size * (aria_valuemax - aria_valuemin));
|
108
|
+
|
109
|
+
if (current_percentage >= percentage) {
|
110
|
+
current_percentage = percentage;
|
111
|
+
current_value = data_transitiongoal;
|
112
|
+
done($this);
|
113
|
+
clearInterval(progress);
|
114
|
+
}
|
115
|
+
|
116
|
+
if (options.display_text !== 'none') {
|
117
|
+
text = options.use_percentage ? options.percent_format(current_percentage) : options.amount_format(current_value, aria_valuemax, aria_valuemin);
|
118
|
+
|
119
|
+
if (options.display_text === 'fill') {
|
120
|
+
$this.text(text);
|
121
|
+
}
|
122
|
+
else if (options.display_text === 'center') {
|
123
|
+
$back_text.text(text);
|
124
|
+
$front_text.text(text);
|
125
|
+
}
|
126
|
+
}
|
127
|
+
$this.attr('aria-valuenow', current_value);
|
128
|
+
|
129
|
+
update(current_percentage, $this);
|
130
|
+
}, options.refresh_speed);
|
131
|
+
}, options.transition_delay);
|
132
|
+
};
|
133
|
+
|
134
|
+
|
135
|
+
// PROGRESSBAR PLUGIN DEFINITION
|
136
|
+
// =============================
|
137
|
+
|
138
|
+
var old = $.fn.progressbar;
|
139
|
+
|
140
|
+
$.fn.progressbar = function(option) {
|
141
|
+
return this.each(function () {
|
142
|
+
var $this = $(this);
|
143
|
+
var data = $this.data('bs.progressbar');
|
144
|
+
var options = typeof option === 'object' && option;
|
145
|
+
|
146
|
+
if (data && options) {
|
147
|
+
$.extend(data.options, options);
|
148
|
+
}
|
149
|
+
|
150
|
+
if (!data) {
|
151
|
+
$this.data('bs.progressbar', (data = new Progressbar(this, options)));
|
152
|
+
}
|
153
|
+
data.transition();
|
154
|
+
});
|
155
|
+
};
|
156
|
+
|
157
|
+
$.fn.progressbar.Constructor = Progressbar;
|
158
|
+
|
159
|
+
|
160
|
+
// PROGRESSBAR NO CONFLICT
|
161
|
+
// =======================
|
162
|
+
|
163
|
+
$.fn.progressbar.noConflict = function () {
|
164
|
+
$.fn.progressbar = old;
|
165
|
+
return this;
|
166
|
+
};
|
167
|
+
|
168
|
+
})(window.jQuery);
|