diff --git a/.gitignore b/.gitignore
index 2d12c6d2..65cbda82 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,7 @@
/Gemfile.lock
*.gem
coverage/
+log/
+tmp/
.ruby-version
+history.yml
diff --git a/.travis.yml b/.travis.yml
index 66b5ca9a..f68ed763 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,7 @@
language: ruby
rvm:
- - 2.1.2
- - 2.0.0
- - 1.9.3
+ - 2.3.0
+ - 2.2.4
+ - 2.1.8
script: "rake test"
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 00000000..6b22e83f
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,16 @@
+
+## Have an Issue?
+
+Dashing is no longer being actively maintained.
+
+1. Check the [Troubleshooting Guide](https://github.com/Shopify/dashing/wiki#how-tos) in the wiki.
+2. Use the [GitHub Issue Search](https://help.github.com/articles/searching-issues/) to check if the issue has already been reported.
+3. You can ask your issue on the tracker, but your best bet is to go to [Stack Overflow](http://stackoverflow.com/questions/tagged/dashing)
+
+
+
+
+If you feel that you have a really amazing, super neato idea that should be a part of Dashing, it may be a good candidate for an external Gem which supercharges a project. An excellent example of this is
+[dashing-contrib](https://github.com/QubitProducts/dashing-contrib). If you
+do create a third-party extension for Dashing, please add it [here](https://github.com/Shopify/dashing/wiki/Additional-Widgets#other-third-party-tools).
+
diff --git a/MIT-LICENSE b/MIT-LICENSE
index f85bef72..ac9f2bf4 100644
--- a/MIT-LICENSE
+++ b/MIT-LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2015 Shopify
+Copyright (c) 2016 Shopify
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/README.md b/README.md
index 4aee91f8..fb9f286a 100644
--- a/README.md
+++ b/README.md
@@ -5,5 +5,7 @@ Dashing is a Sinatra based framework that lets you build beautiful dashboards. I
[Check out the homepage](http://shopify.github.com/dashing).
+Note: Dashing is no longer being actively maintained. Read about it [here](https://github.com/Shopify/dashing/issues/711). There is a fork of the project being maintained at at [https://github.com/dashing-io/dashing](https://github.com/dashing-io/dashing)
+
# License
Distributed under the [MIT license](MIT-LICENSE)
diff --git a/dashing.gemspec b/dashing.gemspec
index 2f9df4a5..5ec586b0 100644
--- a/dashing.gemspec
+++ b/dashing.gemspec
@@ -2,8 +2,8 @@
Gem::Specification.new do |s|
s.name = 'dashing'
- s.version = '1.3.4'
- s.date = '2014-05-30'
+ s.version = '1.3.7'
+ s.date = '2016-04-11'
s.executables = %w(dashing)
@@ -12,6 +12,7 @@ Gem::Specification.new do |s|
s.author = "Daniel Beauchamp"
s.email = 'daniel.beauchamp@shopify.com'
s.homepage = 'http://shopify.github.com/dashing'
+ s.license = "MIT"
s.files = Dir['README.md', 'javascripts/**/*', 'templates/**/*','templates/**/.[a-z]*', 'lib/**/*']
@@ -22,9 +23,9 @@ Gem::Specification.new do |s|
s.add_dependency('sinatra-contrib', '~> 1.4.2')
s.add_dependency('thin', '~> 1.6.1')
s.add_dependency('rufus-scheduler', '~> 2.0.24')
- s.add_dependency('thor', '~> 0.18.1')
+ s.add_dependency('thor', '> 0.18.1')
s.add_dependency('sprockets', '~> 2.10.1')
- s.add_dependency('rack', '~> 1.5.2')
+ s.add_dependency('rack', '~> 1.5.4')
s.add_development_dependency('rake', '~> 10.1.0')
s.add_development_dependency('haml', '~> 4.0.4')
@@ -32,4 +33,4 @@ Gem::Specification.new do |s|
s.add_development_dependency('mocha', '~> 0.14.0')
s.add_development_dependency('fakeweb', '~> 1.3.0')
s.add_development_dependency('simplecov', '~> 0.8.2')
-end
\ No newline at end of file
+end
diff --git a/javascripts/dashing.coffee b/javascripts/dashing.coffee
index e5875d8c..20a99874 100644
--- a/javascripts/dashing.coffee
+++ b/javascripts/dashing.coffee
@@ -40,7 +40,6 @@ class Dashing.Widget extends Batman.View
@mixin($(@node).data())
Dashing.widgets[@id] ||= []
Dashing.widgets[@id].push(@)
- @mixin(Dashing.lastEvents[@id]) # in case the events from the server came before the widget was rendered
type = Batman.Filters.dashize(@view)
$(@node).addClass("widget widget-#{type} #{@id}")
@@ -55,6 +54,12 @@ class Dashing.Widget extends Batman.View
@::on 'ready', ->
Dashing.Widget.fire 'ready'
+ # In case the events from the server came before the widget was rendered
+ lastData = Dashing.lastEvents[@id]
+ if lastData
+ @mixin(lastData)
+ @onData(lastData)
+
receiveData: (data) =>
@mixin(data)
@onData(data)
@@ -109,8 +114,8 @@ source.addEventListener 'message', (e) ->
if lastEvents[data.id]?.updatedAt != data.updatedAt
if Dashing.debugMode
console.log("Received data for #{data.id}", data)
+ lastEvents[data.id] = data
if widgets[data.id]?.length > 0
- lastEvents[data.id] = data
for widget in widgets[data.id]
widget.receiveData(data)
diff --git a/lib/dashing/app.rb b/lib/dashing/app.rb
index 0e7f7bb6..b11352d2 100644
--- a/lib/dashing/app.rb
+++ b/lib/dashing/app.rb
@@ -23,6 +23,11 @@ def production?
def protected!
# override with auth logic
end
+
+ def authenticated?(token)
+ return true unless settings.auth_token
+ token && Rack::Utils.secure_compare(settings.auth_token, token)
+ end
end
set :root, Dir.pwd
@@ -89,8 +94,7 @@ def protected!
request.body.rewind
body = JSON.parse(request.body.read)
body['dashboard'] ||= params['id']
- auth_token = body.delete("auth_token")
- if !settings.auth_token || settings.auth_token == auth_token
+ if authenticated?(body.delete("auth_token"))
send_event(params['id'], body, 'dashboards')
204 # response without entity body
else
@@ -102,8 +106,7 @@ def protected!
post '/widgets/:id' do
request.body.rewind
body = JSON.parse(request.body.read)
- auth_token = body.delete("auth_token")
- if !settings.auth_token || settings.auth_token == auth_token
+ if authenticated?(body.delete("auth_token"))
send_event(params['id'], body)
204 # response without entity body
else
diff --git a/lib/dashing/cli.rb b/lib/dashing/cli.rb
index 27d8f6b0..4b93f892 100644
--- a/lib/dashing/cli.rb
+++ b/lib/dashing/cli.rb
@@ -38,12 +38,12 @@ def generate(type, name)
puts "Invalid generator. Either use widget, dashboard, or job"
end
- desc "install GIST_ID", "Installs a new widget from a gist."
- def install(gist_id)
+ desc "install GIST_ID [--skip]", "Installs a new widget from a gist (skip overwrite)."
+ def install(gist_id, *args)
gist = Downloader.get_gist(gist_id)
public_url = "https://gist.github.com/#{gist_id}"
- install_widget_from_gist(gist)
+ install_widget_from_gist(gist, args.include?('--skip'))
print set_color("Don't forget to edit the ", :yellow)
print set_color("Gemfile ", :yellow, :bold)
@@ -89,15 +89,15 @@ def run_command(command)
system(command)
end
- def install_widget_from_gist(gist)
+ def install_widget_from_gist(gist, skip_overwrite)
gist['files'].each do |file, details|
if file =~ /\.(html|coffee|scss)\z/
widget_name = File.basename(file, '.*')
new_path = File.join(Dir.pwd, 'widgets', widget_name, file)
- create_file(new_path, details['content'])
+ create_file(new_path, details['content'], :skip => skip_overwrite)
elsif file.end_with?('.rb')
new_path = File.join(Dir.pwd, 'jobs', file)
- create_file(new_path, details['content'])
+ create_file(new_path, details['content'], :skip => skip_overwrite)
end
end
end
diff --git a/templates/project/assets/fonts/FontAwesome.otf b/templates/project/assets/fonts/FontAwesome.otf
new file mode 100644
index 00000000..3ed7f8b4
Binary files /dev/null and b/templates/project/assets/fonts/FontAwesome.otf differ
diff --git a/templates/project/assets/fonts/fontawesome-webfont.eot b/templates/project/assets/fonts/fontawesome-webfont.eot
index 0662cb96..9b6afaed 100644
Binary files a/templates/project/assets/fonts/fontawesome-webfont.eot and b/templates/project/assets/fonts/fontawesome-webfont.eot differ
diff --git a/templates/project/assets/fonts/fontawesome-webfont.svg b/templates/project/assets/fonts/fontawesome-webfont.svg
index 2edb4ec3..d05688e9 100644
--- a/templates/project/assets/fonts/fontawesome-webfont.svg
+++ b/templates/project/assets/fonts/fontawesome-webfont.svg
@@ -14,10 +14,11 @@
+
-
+
-
+
@@ -30,7 +31,7 @@
-
+
@@ -52,7 +53,7 @@
-
+
@@ -77,11 +78,11 @@
-
-
-
-
-
+
+
+
+
+
@@ -109,8 +110,8 @@
-
-
+
+
@@ -143,17 +144,17 @@
-
-
+
+
-
+
-
+
-
+
@@ -176,14 +177,14 @@
-
+
-
+
@@ -218,8 +219,8 @@
-
-
+
+
@@ -247,10 +248,10 @@
-
+
-
+
@@ -274,14 +275,14 @@
-
+
-
-
+
+
@@ -310,7 +311,7 @@
-
+
@@ -342,11 +343,11 @@
-
+
-
-
+
+
@@ -361,14 +362,14 @@
-
+
-
-
+
+
@@ -379,7 +380,7 @@
-
+
@@ -390,10 +391,265 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/templates/project/assets/fonts/fontawesome-webfont.ttf b/templates/project/assets/fonts/fontawesome-webfont.ttf
index d3659246..26dea795 100644
Binary files a/templates/project/assets/fonts/fontawesome-webfont.ttf and b/templates/project/assets/fonts/fontawesome-webfont.ttf differ
diff --git a/templates/project/assets/fonts/fontawesome-webfont.woff b/templates/project/assets/fonts/fontawesome-webfont.woff
index b9bd17e1..dc35ce3c 100644
Binary files a/templates/project/assets/fonts/fontawesome-webfont.woff and b/templates/project/assets/fonts/fontawesome-webfont.woff differ
diff --git a/templates/project/assets/fonts/fontawesome-webfont.woff2 b/templates/project/assets/fonts/fontawesome-webfont.woff2
new file mode 100644
index 00000000..500e5172
Binary files /dev/null and b/templates/project/assets/fonts/fontawesome-webfont.woff2 differ
diff --git a/templates/project/assets/javascripts/dashing.gridster.coffee b/templates/project/assets/javascripts/dashing.gridster.coffee
index e25c5618..7c1f94ad 100644
--- a/templates/project/assets/javascripts/dashing.gridster.coffee
+++ b/templates/project/assets/javascripts/dashing.gridster.coffee
@@ -26,9 +26,7 @@ Dashing.showGridsterInstructions = ->
- ")
+ });\n")
$ ->
$('#save-gridster').leanModal()
diff --git a/templates/project/assets/javascripts/gridster/jquery.gridster.js b/templates/project/assets/javascripts/gridster/jquery.gridster.js
deleted file mode 100644
index 9451c9aa..00000000
--- a/templates/project/assets/javascripts/gridster/jquery.gridster.js
+++ /dev/null
@@ -1,3263 +0,0 @@
-/*! gridster.js - v0.1.0 - 2013-02-15
-* http://gridster.net/
-* Copyright (c) 2013 ducksboard; Licensed MIT */
-
-;(function($, window, document, undefined){
- /**
- * Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)
- * to simulate DOM elements on the screen.
- * Coords is used by Gridster to create a faux grid with any DOM element can
- * collide.
- *
- * @class Coords
- * @param {HTMLElement|Object} obj The jQuery HTMLElement or a object with: left,
- * top, width and height properties.
- * @return {Object} Coords instance.
- * @constructor
- */
- function Coords(obj) {
- if (obj[0] && $.isPlainObject(obj[0])) {
- this.data = obj[0];
- }else {
- this.el = obj;
- }
-
- this.isCoords = true;
- this.coords = {};
- this.init();
- return this;
- }
-
-
- var fn = Coords.prototype;
-
-
- fn.init = function(){
- this.set();
- this.original_coords = this.get();
- };
-
-
- fn.set = function(update, not_update_offsets) {
- var el = this.el;
-
- if (el && !update) {
- this.data = el.offset();
- this.data.width = el.width();
- this.data.height = el.height();
- }
-
- if (el && update && !not_update_offsets) {
- var offset = el.offset();
- this.data.top = offset.top;
- this.data.left = offset.left;
- }
-
- var d = this.data;
-
- this.coords.x1 = d.left;
- this.coords.y1 = d.top;
- this.coords.x2 = d.left + d.width;
- this.coords.y2 = d.top + d.height;
- this.coords.cx = d.left + (d.width / 2);
- this.coords.cy = d.top + (d.height / 2);
- this.coords.width = d.width;
- this.coords.height = d.height;
- this.coords.el = el || false ;
-
- return this;
- };
-
-
- fn.update = function(data){
- if (!data && !this.el) {
- return this;
- }
-
- if (data) {
- var new_data = $.extend({}, this.data, data);
- this.data = new_data;
- return this.set(true, true);
- }
-
- this.set(true);
- return this;
- };
-
-
- fn.get = function(){
- return this.coords;
- };
-
-
- //jQuery adapter
- $.fn.coords = function() {
- if (this.data('coords') ) {
- return this.data('coords');
- }
-
- var ins = new Coords(this, arguments[0]);
- this.data('coords', ins);
- return ins;
- };
-
-}(jQuery, window, document));
-
-;(function($, window, document, undefined){
-
- var defaults = {
- colliders_context: document.body
- // ,on_overlap: function(collider_data){},
- // on_overlap_start : function(collider_data){},
- // on_overlap_stop : function(collider_data){}
- };
-
-
- /**
- * Detects collisions between a DOM element against other DOM elements or
- * Coords objects.
- *
- * @class Collision
- * @uses Coords
- * @param {HTMLElement} el The jQuery wrapped HTMLElement.
- * @param {HTMLElement|Array} colliders Can be a jQuery collection
- * of HTMLElements or an Array of Coords instances.
- * @param {Object} [options] An Object with all options you want to
- * overwrite:
- * @param {Function} [options.on_overlap_start] Executes a function the first
- * time each `collider ` is overlapped.
- * @param {Function} [options.on_overlap_stop] Executes a function when a
- * `collider` is no longer collided.
- * @param {Function} [options.on_overlap] Executes a function when the
- * mouse is moved during the collision.
- * @return {Object} Collision instance.
- * @constructor
- */
- function Collision(el, colliders, options) {
- this.options = $.extend(defaults, options);
- this.$element = el;
- this.last_colliders = [];
- this.last_colliders_coords = [];
- if (typeof colliders === 'string' || colliders instanceof jQuery) {
- this.$colliders = $(colliders,
- this.options.colliders_context).not(this.$element);
- }else{
- this.colliders = $(colliders);
- }
-
- this.init();
- }
-
-
- var fn = Collision.prototype;
-
-
- fn.init = function() {
- this.find_collisions();
- };
-
-
- fn.overlaps = function(a, b) {
- var x = false;
- var y = false;
-
- if ((b.x1 >= a.x1 && b.x1 <= a.x2) ||
- (b.x2 >= a.x1 && b.x2 <= a.x2) ||
- (a.x1 >= b.x1 && a.x2 <= b.x2)
- ) { x = true; }
-
- if ((b.y1 >= a.y1 && b.y1 <= a.y2) ||
- (b.y2 >= a.y1 && b.y2 <= a.y2) ||
- (a.y1 >= b.y1 && a.y2 <= b.y2)
- ) { y = true; }
-
- return (x && y);
- };
-
-
- fn.detect_overlapping_region = function(a, b){
- var regionX = '';
- var regionY = '';
-
- if (a.y1 > b.cy && a.y1 < b.y2) { regionX = 'N'; }
- if (a.y2 > b.y1 && a.y2 < b.cy) { regionX = 'S'; }
- if (a.x1 > b.cx && a.x1 < b.x2) { regionY = 'W'; }
- if (a.x2 > b.x1 && a.x2 < b.cx) { regionY = 'E'; }
-
- return (regionX + regionY) || 'C';
- };
-
-
- fn.calculate_overlapped_area_coords = function(a, b){
- var x1 = Math.max(a.x1, b.x1);
- var y1 = Math.max(a.y1, b.y1);
- var x2 = Math.min(a.x2, b.x2);
- var y2 = Math.min(a.y2, b.y2);
-
- return $({
- left: x1,
- top: y1,
- width : (x2 - x1),
- height: (y2 - y1)
- }).coords().get();
- };
-
-
- fn.calculate_overlapped_area = function(coords){
- return (coords.width * coords.height);
- };
-
-
- fn.manage_colliders_start_stop = function(new_colliders_coords, start_callback, stop_callback){
- var last = this.last_colliders_coords;
-
- for (var i = 0, il = last.length; i < il; i++) {
- if ($.inArray(last[i], new_colliders_coords) === -1) {
- start_callback.call(this, last[i]);
- }
- }
-
- for (var j = 0, jl = new_colliders_coords.length; j < jl; j++) {
- if ($.inArray(new_colliders_coords[j], last) === -1) {
- stop_callback.call(this, new_colliders_coords[j]);
- }
-
- }
- };
-
-
- fn.find_collisions = function(player_data_coords){
- var self = this;
- var colliders_coords = [];
- var colliders_data = [];
- var $colliders = (this.colliders || this.$colliders);
- var count = $colliders.length;
- var player_coords = self.$element.coords()
- .update(player_data_coords || false).get();
-
- while(count--){
- var $collider = self.$colliders ?
- $($colliders[count]) : $colliders[count];
- var $collider_coords_ins = ($collider.isCoords) ?
- $collider : $collider.coords();
- var collider_coords = $collider_coords_ins.get();
- var overlaps = self.overlaps(player_coords, collider_coords);
-
- if (!overlaps) {
- continue;
- }
-
- var region = self.detect_overlapping_region(
- player_coords, collider_coords);
-
- //todo: make this an option
- if (region === 'C'){
- var area_coords = self.calculate_overlapped_area_coords(
- player_coords, collider_coords);
- var area = self.calculate_overlapped_area(area_coords);
- var collider_data = {
- area: area,
- area_coords : area_coords,
- region: region,
- coords: collider_coords,
- player_coords: player_coords,
- el: $collider
- };
-
- if (self.options.on_overlap) {
- self.options.on_overlap.call(this, collider_data);
- }
- colliders_coords.push($collider_coords_ins);
- colliders_data.push(collider_data);
- }
- }
-
- if (self.options.on_overlap_stop || self.options.on_overlap_start) {
- this.manage_colliders_start_stop(colliders_coords,
- self.options.on_overlap_stop, self.options.on_overlap_start);
- }
-
- this.last_colliders_coords = colliders_coords;
-
- return colliders_data;
- };
-
-
- fn.get_closest_colliders = function(player_data_coords){
- var colliders = this.find_collisions(player_data_coords);
-
- colliders.sort(function(a, b) {
- /* if colliders are being overlapped by the "C" (center) region,
- * we have to set a lower index in the array to which they are placed
- * above in the grid. */
- if (a.region === 'C' && b.region === 'C') {
- if (a.coords.y1 < b.coords.y1 || a.coords.x1 < b.coords.x1) {
- return - 1;
- }else{
- return 1;
- }
- }
-
- if (a.area < b.area) {
- return 1;
- }
-
- return 1;
- });
- return colliders;
- };
-
-
- //jQuery adapter
- $.fn.collision = function(collider, options) {
- return new Collision( this, collider, options );
- };
-
-
-}(jQuery, window, document));
-
-;(function(window, undefined) {
- /* Debounce and throttle functions taken from underscore.js */
- window.debounce = function(func, wait, immediate) {
- var timeout;
- return function() {
- var context = this, args = arguments;
- var later = function() {
- timeout = null;
- if (!immediate) func.apply(context, args);
- };
- if (immediate && !timeout) func.apply(context, args);
- clearTimeout(timeout);
- timeout = setTimeout(later, wait);
- };
- };
-
-
- window.throttle = function(func, wait) {
- var context, args, timeout, throttling, more, result;
- var whenDone = debounce(
- function(){ more = throttling = false; }, wait);
- return function() {
- context = this; args = arguments;
- var later = function() {
- timeout = null;
- if (more) func.apply(context, args);
- whenDone();
- };
- if (!timeout) timeout = setTimeout(later, wait);
- if (throttling) {
- more = true;
- } else {
- result = func.apply(context, args);
- }
- whenDone();
- throttling = true;
- return result;
- };
- };
-
-})(window);
-
-;(function($, window, document, undefined){
-
- var defaults = {
- items: '.gs_w',
- distance: 1,
- limit: true,
- offset_left: 0,
- autoscroll: true,
- ignore_dragging: ['INPUT', 'TEXTAREA', 'SELECT', 'BUTTON'],
- handle: null
- // drag: function(e){},
- // start : function(e, ui){},
- // stop : function(e){}
- };
-
- var $window = $(window);
- var isTouch = !!('ontouchstart' in window);
- var pointer_events = {
- start: isTouch ? 'touchstart' : 'mousedown.draggable',
- move: isTouch ? 'touchmove' : 'mousemove.draggable',
- end: isTouch ? 'touchend' : 'mouseup.draggable'
- };
-
- /**
- * Basic drag implementation for DOM elements inside a container.
- * Provide start/stop/drag callbacks.
- *
- * @class Draggable
- * @param {HTMLElement} el The HTMLelement that contains all the widgets
- * to be dragged.
- * @param {Object} [options] An Object with all options you want to
- * overwrite:
- * @param {HTMLElement|String} [options.items] Define who will
- * be the draggable items. Can be a CSS Selector String or a
- * collection of HTMLElements.
- * @param {Number} [options.distance] Distance in pixels after mousedown
- * the mouse must move before dragging should start.
- * @param {Boolean} [options.limit] Constrains dragging to the width of
- * the container
- * @param {offset_left} [options.offset_left] Offset added to the item
- * that is being dragged.
- * @param {Number} [options.drag] Executes a callback when the mouse is
- * moved during the dragging.
- * @param {Number} [options.start] Executes a callback when the drag
- * starts.
- * @param {Number} [options.stop] Executes a callback when the drag stops.
- * @return {Object} Returns `el`.
- * @constructor
- */
- function Draggable(el, options) {
- this.options = $.extend({}, defaults, options);
- this.$body = $(document.body);
- this.$container = $(el);
- this.$dragitems = $(this.options.items, this.$container);
- this.is_dragging = false;
- this.player_min_left = 0 + this.options.offset_left;
- this.init();
- }
-
- var fn = Draggable.prototype;
-
- fn.init = function() {
- this.calculate_positions();
- this.$container.css('position', 'relative');
- this.disabled = false;
- this.events();
-
- this.on_window_resize = throttle($.proxy(this.calculate_positions, this), 200);
- $(window).bind('resize', this.on_window_resize);
- };
-
- fn.events = function() {
- this.proxied_on_select_start = $.proxy(this.on_select_start, this);
- this.$container.on('selectstart', this.proxied_on_select_start);
-
- this.proxied_drag_handler = $.proxy(this.drag_handler, this);
- this.$container.on(pointer_events.start, this.options.items, this.proxied_drag_handler);
-
- this.proxied_pointer_events_end = $.proxy(function(e) {
- this.is_dragging = false;
- if (this.disabled) { return; }
- this.$body.off(pointer_events.move);
- if (this.drag_start) {
- this.on_dragstop(e);
- }
- }, this);
- this.$body.on(pointer_events.end, this.proxied_pointer_events_end);
- };
-
- fn.get_actual_pos = function($el) {
- var pos = $el.position();
- return pos;
- };
-
-
- fn.get_mouse_pos = function(e) {
- if (isTouch) {
- var oe = e.originalEvent;
- e = oe.touches.length ? oe.touches[0] : oe.changedTouches[0];
- }
-
- return {
- left: e.clientX,
- top: e.clientY
- };
- };
-
-
- fn.get_offset = function(e) {
- e.preventDefault();
- var mouse_actual_pos = this.get_mouse_pos(e);
- var diff_x = Math.round(
- mouse_actual_pos.left - this.mouse_init_pos.left);
- var diff_y = Math.round(mouse_actual_pos.top - this.mouse_init_pos.top);
-
- var left = Math.round(this.el_init_offset.left + diff_x - this.baseX);
- var top = Math.round(
- this.el_init_offset.top + diff_y - this.baseY + this.scrollOffset);
-
- if (this.options.limit) {
- if (left > this.player_max_left) {
- left = this.player_max_left;
- }else if(left < this.player_min_left) {
- left = this.player_min_left;
- }
- }
-
- return {
- left: left,
- top: top,
- mouse_left: mouse_actual_pos.left,
- mouse_top: mouse_actual_pos.top
- };
- };
-
-
- fn.manage_scroll = function(offset) {
- /* scroll document */
- var nextScrollTop;
- var scrollTop = $window.scrollTop();
- var min_window_y = scrollTop;
- var max_window_y = min_window_y + this.window_height;
-
- var mouse_down_zone = max_window_y - 50;
- var mouse_up_zone = min_window_y + 50;
-
- var abs_mouse_left = offset.mouse_left;
- var abs_mouse_top = min_window_y + offset.mouse_top;
-
- var max_player_y = (this.doc_height - this.window_height +
- this.player_height);
-
- if (abs_mouse_top >= mouse_down_zone) {
- nextScrollTop = scrollTop + 30;
- if (nextScrollTop < max_player_y) {
- $window.scrollTop(nextScrollTop);
- this.scrollOffset = this.scrollOffset + 30;
- }
- }
-
- if (abs_mouse_top <= mouse_up_zone) {
- nextScrollTop = scrollTop - 30;
- if (nextScrollTop > 0) {
- $window.scrollTop(nextScrollTop);
- this.scrollOffset = this.scrollOffset - 30;
- }
- }
- };
-
-
- fn.calculate_positions = function(e) {
- this.window_height = $window.height();
- };
-
-
- fn.drag_handler = function(e) {
- var node = e.target.nodeName;
- if (this.disabled || e.which !== 1 && !isTouch) {
- return;
- }
-
- if (this.ignore_drag(e)) {
- return;
- }
-
- var self = this;
- var first = true;
- this.$player = $(e.currentTarget);
-
- this.el_init_pos = this.get_actual_pos(this.$player);
- this.mouse_init_pos = this.get_mouse_pos(e);
- this.offsetY = this.mouse_init_pos.top - this.el_init_pos.top;
-
- this.on_pointer_events_move = function(mme){
- var mouse_actual_pos = self.get_mouse_pos(mme);
- var diff_x = Math.abs(
- mouse_actual_pos.left - self.mouse_init_pos.left);
- var diff_y = Math.abs(
- mouse_actual_pos.top - self.mouse_init_pos.top);
- if (!(diff_x > self.options.distance ||
- diff_y > self.options.distance)
- ) {
- return false;
- }
-
- if (first) {
- first = false;
- self.on_dragstart.call(self, mme);
- return false;
- }
-
- if (self.is_dragging === true) {
- self.on_dragmove.call(self, mme);
- }
-
- return false;
- };
-
- this.$body.on(pointer_events.move, this.on_pointer_events_move);
-
- return false;
- };
-
-
- fn.on_dragstart = function(e) {
- e.preventDefault();
- this.drag_start = true;
- this.is_dragging = true;
- var offset = this.$container.offset();
- this.baseX = Math.round(offset.left);
- this.baseY = Math.round(offset.top);
- this.doc_height = $(document).height();
-
- if (this.options.helper === 'clone') {
- this.$helper = this.$player.clone()
- .appendTo(this.$container).addClass('helper');
- this.helper = true;
- }else{
- this.helper = false;
- }
- this.scrollOffset = 0;
- this.el_init_offset = this.$player.offset();
- this.player_width = this.$player.width();
- this.player_height = this.$player.height();
- this.player_max_left = (this.$container.width() - this.player_width +
- this.options.offset_left);
-
- if (this.options.start) {
- this.options.start.call(this.$player, e, {
- helper: this.helper ? this.$helper : this.$player
- });
- }
- return false;
- };
-
-
- fn.on_dragmove = function(e) {
- var offset = this.get_offset(e);
-
- this.options.autoscroll && this.manage_scroll(offset);
-
- (this.helper ? this.$helper : this.$player).css({
- 'position': 'absolute',
- 'left' : offset.left,
- 'top' : offset.top
- });
-
- var ui = {
- 'position': {
- 'left': offset.left,
- 'top': offset.top
- }
- };
-
- if (this.options.drag) {
- this.options.drag.call(this.$player, e, ui);
- }
- return false;
- };
-
-
- fn.on_dragstop = function(e) {
- var offset = this.get_offset(e);
- this.drag_start = false;
-
- var ui = {
- 'position': {
- 'left': offset.left,
- 'top': offset.top
- }
- };
-
- if (this.options.stop) {
- this.options.stop.call(this.$player, e, ui);
- }
-
- if (this.helper) {
- this.$helper.remove();
- }
-
- return false;
- };
-
- fn.on_select_start = function(e) {
- if (this.disabled) { return; }
-
- if (this.ignore_drag(e)) {
- return;
- }
-
- return false;
- };
-
- fn.enable = function() {
- this.disabled = false;
- };
-
- fn.disable = function() {
- this.disabled = true;
- };
-
-
- fn.destroy = function(){
- this.disable();
-
- this.$container.off('selectstart', this.proxied_on_select_start);
- this.$container.off(pointer_events.start, this.proxied_drag_handler);
- this.$body.off(pointer_events.end, this.proxied_pointer_events_end);
- this.$body.off(pointer_events.move, this.on_pointer_events_move);
- $(window).unbind('resize', this.on_window_resize);
-
- $.removeData(this.$container, 'drag');
- };
-
- fn.ignore_drag = function(event) {
- if (this.options.handle) {
- return !$(event.target).is(this.options.handle);
- }
-
- return $.inArray(event.target.nodeName, this.options.ignore_dragging) >= 0;
- };
-
- //jQuery adapter
- $.fn.drag = function ( options ) {
- return this.each(function () {
- if (!$.data(this, 'drag')) {
- $.data(this, 'drag', new Draggable( this, options ));
- }
- });
- };
-
-
-}(jQuery, window, document));
-
-;(function($, window, document, undefined) {
-
- var defaults = {
- namespace: '',
- widget_selector: 'li',
- widget_margins: [10, 10],
- widget_base_dimensions: [400, 225],
- extra_rows: 0,
- extra_cols: 0,
- min_cols: 1,
- min_rows: 15,
- max_size_x: 6,
- autogenerate_stylesheet: true,
- avoid_overlapped_widgets: true,
- serialize_params: function($w, wgd) {
- return {
- col: wgd.col,
- row: wgd.row,
- size_x: wgd.size_x,
- size_y: wgd.size_y
- };
- },
- collision: {},
- draggable: {
- distance: 4
- }
- };
-
-
- /**
- * @class Gridster
- * @uses Draggable
- * @uses Collision
- * @param {HTMLElement} el The HTMLelement that contains all the widgets.
- * @param {Object} [options] An Object with all options you want to
- * overwrite:
- * @param {HTMLElement|String} [options.widget_selector] Define who will
- * be the draggable widgets. Can be a CSS Selector String or a
- * collection of HTMLElements
- * @param {Array} [options.widget_margins] Margin between widgets.
- * The first index for the horizontal margin (left, right) and
- * the second for the vertical margin (top, bottom).
- * @param {Array} [options.widget_base_dimensions] Base widget dimensions
- * in pixels. The first index for the width and the second for the
- * height.
- * @param {Number} [options.extra_cols] Add more columns in addition to
- * those that have been calculated.
- * @param {Number} [options.extra_rows] Add more rows in addition to
- * those that have been calculated.
- * @param {Number} [options.min_cols] The minimum required columns.
- * @param {Number} [options.min_rows] The minimum required rows.
- * @param {Number} [options.max_size_x] The maximum number of columns
- * that a widget can span.
- * @param {Boolean} [options.autogenerate_stylesheet] If true, all the
- * CSS required to position all widgets in their respective columns
- * and rows will be generated automatically and injected to the
- * `
` of the document. You can set this to false, and write
- * your own CSS targeting rows and cols via data-attributes like so:
- * `[data-col="1"] { left: 10px; }`
- * @param {Boolean} [options.avoid_overlapped_widgets] Avoid that widgets loaded
- * from the DOM can be overlapped. It is helpful if the positions were
- * bad stored in the database or if there was any conflict.
- * @param {Function} [options.serialize_params] Return the data you want
- * for each widget in the serialization. Two arguments are passed:
- * `$w`: the jQuery wrapped HTMLElement, and `wgd`: the grid
- * coords object (`col`, `row`, `size_x`, `size_y`).
- * @param {Object} [options.collision] An Object with all options for
- * Collision class you want to overwrite. See Collision docs for
- * more info.
- * @param {Object} [options.draggable] An Object with all options for
- * Draggable class you want to overwrite. See Draggable docs for more
- * info.
- *
- * @constructor
- */
- function Gridster(el, options) {
- this.options = $.extend(true, defaults, options);
- this.$el = $(el);
- this.$wrapper = this.$el.parent();
- this.$widgets = this.$el.children(this.options.widget_selector).addClass('gs_w');
- this.widgets = [];
- this.$changed = $([]);
- this.wrapper_width = this.$wrapper.width();
- this.min_widget_width = (this.options.widget_margins[0] * 2) +
- this.options.widget_base_dimensions[0];
- this.min_widget_height = (this.options.widget_margins[1] * 2) +
- this.options.widget_base_dimensions[1];
- this.init();
- }
-
- Gridster.generated_stylesheets = [];
-
- var fn = Gridster.prototype;
-
- fn.init = function() {
- this.generate_grid_and_stylesheet();
- this.get_widgets_from_DOM();
- this.set_dom_grid_height();
- this.$wrapper.addClass('ready');
- this.draggable();
-
- this.on_window_resize = throttle($.proxy(this.recalculate_faux_grid, this), 200);
-
- $(window).bind('resize', this.on_window_resize);
- };
-
-
- /**
- * Disables dragging.
- *
- * @method disable
- * @return {Class} Returns the instance of the Gridster Class.
- */
- fn.disable = function() {
- this.$wrapper.find('.player-revert').removeClass('player-revert');
- this.drag_api.disable();
- return this;
- };
-
-
- /**
- * Enables dragging.
- *
- * @method enable
- * @return {Class} Returns the instance of the Gridster Class.
- */
- fn.enable = function() {
- this.drag_api.enable();
- return this;
- };
-
-
- /**
- * Add a new widget to the grid.
- *
- * @method add_widget
- * @param {String|HTMLElement} html The string representing the HTML of the widget
- * or the HTMLElement.
- * @param {Number} [size_x] The nº of rows the widget occupies horizontally.
- * @param {Number} [size_y] The nº of columns the widget occupies vertically.
- * @param {Number} [col] The column the widget should start in.
- * @param {Number} [row] The row the widget should start in.
- * @return {HTMLElement} Returns the jQuery wrapped HTMLElement representing.
- * the widget that was just created.
- */
- fn.add_widget = function(html, size_x, size_y, col, row) {
- var pos;
- size_x || (size_x = 1);
- size_y || (size_y = 1);
-
- if (!col & !row) {
- pos = this.next_position(size_x, size_y);
- }else{
- pos = {
- col: col,
- row: row
- };
-
- this.empty_cells(col, row, size_x, size_y);
- }
-
- var $w = $(html).attr({
- 'data-col': pos.col,
- 'data-row': pos.row,
- 'data-sizex' : size_x,
- 'data-sizey' : size_y
- }).addClass('gs_w').appendTo(this.$el).hide();
-
- this.$widgets = this.$widgets.add($w);
-
- this.register_widget($w);
-
- this.add_faux_rows(pos.size_y);
- //this.add_faux_cols(pos.size_x);
-
- this.set_dom_grid_height();
-
- return $w.fadeIn();
- };
-
-
-
- /**
- * Change the size of a widget.
- *
- * @method resize_widget
- * @param {HTMLElement} $widget The jQuery wrapped HTMLElement
- * representing the widget.
- * @param {Number} size_x The number of columns that will occupy the widget.
- * @param {Number} size_y The number of rows that will occupy the widget.
- * @return {HTMLElement} Returns $widget.
- */
- fn.resize_widget = function($widget, size_x, size_y) {
- var wgd = $widget.coords().grid;
- size_x || (size_x = wgd.size_x);
- size_y || (size_y = wgd.size_y);
-
- if (size_x > this.cols) {
- size_x = this.cols;
- }
-
- var old_cells_occupied = this.get_cells_occupied(wgd);
- var old_size_x = wgd.size_x;
- var old_size_y = wgd.size_y;
- var old_col = wgd.col;
- var new_col = old_col;
- var wider = size_x > old_size_x;
- var taller = size_y > old_size_y;
-
- if (old_col + size_x - 1 > this.cols) {
- var diff = old_col + (size_x - 1) - this.cols;
- var c = old_col - diff;
- new_col = Math.max(1, c);
- }
-
- var new_grid_data = {
- col: new_col,
- row: wgd.row,
- size_x: size_x,
- size_y: size_y
- };
-
- var new_cells_occupied = this.get_cells_occupied(new_grid_data);
-
- var empty_cols = [];
- $.each(old_cells_occupied.cols, function(i, col) {
- if ($.inArray(col, new_cells_occupied.cols) === -1) {
- empty_cols.push(col);
- }
- });
-
- var occupied_cols = [];
- $.each(new_cells_occupied.cols, function(i, col) {
- if ($.inArray(col, old_cells_occupied.cols) === -1) {
- occupied_cols.push(col);
- }
- });
-
- var empty_rows = [];
- $.each(old_cells_occupied.rows, function(i, row) {
- if ($.inArray(row, new_cells_occupied.rows) === -1) {
- empty_rows.push(row);
- }
- });
-
- var occupied_rows = [];
- $.each(new_cells_occupied.rows, function(i, row) {
- if ($.inArray(row, old_cells_occupied.rows) === -1) {
- occupied_rows.push(row);
- }
- });
-
- this.remove_from_gridmap(wgd);
-
- if (occupied_cols.length) {
- var cols_to_empty = [
- new_col, wgd.row, size_x, Math.min(old_size_y, size_y), $widget
- ];
- this.empty_cells.apply(this, cols_to_empty);
- }
-
- if (occupied_rows.length) {
- var rows_to_empty = [new_col, wgd.row, size_x, size_y, $widget];
- this.empty_cells.apply(this, rows_to_empty);
- }
-
- wgd.col = new_col;
- wgd.size_x = size_x;
- wgd.size_y = size_y;
- this.add_to_gridmap(new_grid_data, $widget);
-
- //update coords instance attributes
- $widget.data('coords').update({
- width: (size_x * this.options.widget_base_dimensions[0] +
- ((size_x - 1) * this.options.widget_margins[0]) * 2),
- height: (size_y * this.options.widget_base_dimensions[1] +
- ((size_y - 1) * this.options.widget_margins[1]) * 2)
- });
-
- if (size_y > old_size_y) {
- this.add_faux_rows(size_y - old_size_y);
- }
-
- if (size_x > old_size_x) {
- this.add_faux_cols(size_x - old_size_x);
- }
-
- $widget.attr({
- 'data-col': new_col,
- 'data-sizex': size_x,
- 'data-sizey': size_y
- });
-
- if (empty_cols.length) {
- var cols_to_remove_holes = [
- empty_cols[0], wgd.row,
- empty_cols.length,
- Math.min(old_size_y, size_y),
- $widget
- ];
-
- this.remove_empty_cells.apply(this, cols_to_remove_holes);
- }
-
- if (empty_rows.length) {
- var rows_to_remove_holes = [
- new_col, wgd.row, size_x, size_y, $widget
- ];
- this.remove_empty_cells.apply(this, rows_to_remove_holes);
- }
-
- return $widget;
- };
-
- /**
- * Move down widgets in cells represented by the arguments col, row, size_x,
- * size_y
- *
- * @method empty_cells
- * @param {Number} col The column where the group of cells begin.
- * @param {Number} row The row where the group of cells begin.
- * @param {Number} size_x The number of columns that the group of cells
- * occupy.
- * @param {Number} size_y The number of rows that the group of cells
- * occupy.
- * @param {HTMLElement} $exclude Exclude widgets from being moved.
- * @return {Class} Returns the instance of the Gridster Class.
- */
- fn.empty_cells = function(col, row, size_x, size_y, $exclude) {
- var $nexts = this.widgets_below({
- col: col,
- row: row - size_y,
- size_x: size_x,
- size_y: size_y
- });
-
- $nexts.not($exclude).each($.proxy(function(i, w) {
- var wgd = $(w).coords().grid;
- if (!(wgd.row <= (row + size_y - 1))) { return; }
- var diff = (row + size_y) - wgd.row;
- this.move_widget_down($(w), diff);
- }, this));
-
- this.set_dom_grid_height();
-
- return this;
- };
-
-
- /**
- * Move up widgets below cells represented by the arguments col, row, size_x,
- * size_y.
- *
- * @method remove_empty_cells
- * @param {Number} col The column where the group of cells begin.
- * @param {Number} row The row where the group of cells begin.
- * @param {Number} size_x The number of columns that the group of cells
- * occupy.
- * @param {Number} size_y The number of rows that the group of cells
- * occupy.
- * @param {HTMLElement} exclude Exclude widgets from being moved.
- * @return {Class} Returns the instance of the Gridster Class.
- */
- fn.remove_empty_cells = function(col, row, size_x, size_y, exclude) {
- var $nexts = this.widgets_below({
- col: col,
- row: row,
- size_x: size_x,
- size_y: size_y
- });
-
- $nexts.not(exclude).each($.proxy(function(i, widget) {
- this.move_widget_up( $(widget), size_y );
- }, this));
-
- this.set_dom_grid_height();
-
- return this;
- };
-
-
- /**
- * Get the most left column below to add a new widget.
- *
- * @method next_position
- * @param {Number} size_x The nº of rows the widget occupies horizontally.
- * @param {Number} size_y The nº of columns the widget occupies vertically.
- * @return {Object} Returns a grid coords object representing the future
- * widget coords.
- */
- fn.next_position = function(size_x, size_y) {
- size_x || (size_x = 1);
- size_y || (size_y = 1);
- var ga = this.gridmap;
- var cols_l = ga.length;
- var valid_pos = [];
- var rows_l;
-
- for (var c = 1; c < cols_l; c++) {
- rows_l = ga[c].length;
- for (var r = 1; r <= rows_l; r++) {
- var can_move_to = this.can_move_to({
- size_x: size_x,
- size_y: size_y
- }, c, r);
-
- if (can_move_to) {
- valid_pos.push({
- col: c,
- row: r,
- size_y: size_y,
- size_x: size_x
- });
- }
- }
- }
-
- if (valid_pos.length) {
- return this.sort_by_row_and_col_asc(valid_pos)[0];
- }
- return false;
- };
-
-
- /**
- * Remove a widget from the grid.
- *
- * @method remove_widget
- * @param {HTMLElement} el The jQuery wrapped HTMLElement you want to remove.
- * @param {Boolean|Function} silent If true, widgets below the removed one
- * will not move up. If a Function is passed it will be used as callback.
- * @param {Function} callback Function executed when the widget is removed.
- * @return {Class} Returns the instance of the Gridster Class.
- */
- fn.remove_widget = function(el, silent, callback) {
- var $el = el instanceof jQuery ? el : $(el);
- var wgd = $el.coords().grid;
-
- // if silent is a function assume it's a callback
- if ($.isFunction(silent)) {
- callback = silent;
- silent = false;
- }
-
- this.cells_occupied_by_placeholder = {};
- this.$widgets = this.$widgets.not($el);
-
- var $nexts = this.widgets_below($el);
-
- this.remove_from_gridmap(wgd);
-
- $el.fadeOut($.proxy(function() {
- $el.remove();
-
- if (!silent) {
- $nexts.each($.proxy(function(i, widget) {
- this.move_widget_up( $(widget), wgd.size_y );
- }, this));
- }
-
- this.set_dom_grid_height();
-
- if (callback) {
- callback.call(this, el);
- }
- }, this));
- };
-
-
- /**
- * Remove all widgets from the grid.
- *
- * @method remove_all_widgets
- * @param {Function} callback Function executed for each widget removed.
- * @return {Class} Returns the instance of the Gridster Class.
- */
- fn.remove_all_widgets = function(callback) {
- this.$widgets.each($.proxy(function(i, el){
- this.remove_widget(el, true, callback);
- }, this));
-
- return this;
- };
-
-
- /**
- * Returns a serialized array of the widgets in the grid.
- *
- * @method serialize
- * @param {HTMLElement} [$widgets] The collection of jQuery wrapped
- * HTMLElements you want to serialize. If no argument is passed all widgets
- * will be serialized.
- * @return {Array} Returns an Array of Objects with the data specified in
- * the serialize_params option.
- */
- fn.serialize = function($widgets) {
- $widgets || ($widgets = this.$widgets);
- var result = [];
- $widgets.each($.proxy(function(i, widget) {
- result.push(this.options.serialize_params(
- $(widget), $(widget).coords().grid ) );
- }, this));
-
- return result;
- };
-
-
- /**
- * Returns a serialized array of the widgets that have changed their
- * position.
- *
- * @method serialize_changed
- * @return {Array} Returns an Array of Objects with the data specified in
- * the serialize_params option.
- */
- fn.serialize_changed = function() {
- return this.serialize(this.$changed);
- };
-
-
- /**
- * Creates the grid coords object representing the widget a add it to the
- * mapped array of positions.
- *
- * @method register_widget
- * @return {Array} Returns the instance of the Gridster class.
- */
- fn.register_widget = function($el) {
-
- var wgd = {
- 'col': parseInt($el.attr('data-col'), 10),
- 'row': parseInt($el.attr('data-row'), 10),
- 'size_x': parseInt($el.attr('data-sizex'), 10),
- 'size_y': parseInt($el.attr('data-sizey'), 10),
- 'el': $el
- };
-
- if (this.options.avoid_overlapped_widgets &&
- !this.can_move_to(
- {size_x: wgd.size_x, size_y: wgd.size_y}, wgd.col, wgd.row)
- ) {
- wgd = this.next_position(wgd.size_x, wgd.size_y);
- wgd.el = $el;
- $el.attr({
- 'data-col': wgd.col,
- 'data-row': wgd.row,
- 'data-sizex': wgd.size_x,
- 'data-sizey': wgd.size_y
- });
- }
-
- // attach Coord object to player data-coord attribute
- $el.data('coords', $el.coords());
-
- // Extend Coord object with grid position info
- $el.data('coords').grid = wgd;
-
- this.add_to_gridmap(wgd, $el);
-
- return this;
- };
-
-
- /**
- * Update in the mapped array of positions the value of cells represented by
- * the grid coords object passed in the `grid_data` param.
- *
- * @param {Object} grid_data The grid coords object representing the cells
- * to update in the mapped array.
- * @param {HTMLElement|Boolean} value Pass `false` or the jQuery wrapped
- * HTMLElement, depends if you want to delete an existing position or add
- * a new one.
- * @method update_widget_position
- * @return {Class} Returns the instance of the Gridster Class.
- */
- fn.update_widget_position = function(grid_data, value) {
- this.for_each_cell_occupied(grid_data, function(col, row) {
- if (!this.gridmap[col]) { return this; }
- this.gridmap[col][row] = value;
- });
- return this;
- };
-
-
- /**
- * Remove a widget from the mapped array of positions.
- *
- * @method remove_from_gridmap
- * @param {Object} grid_data The grid coords object representing the cells
- * to update in the mapped array.
- * @return {Class} Returns the instance of the Gridster Class.
- */
- fn.remove_from_gridmap = function(grid_data) {
- return this.update_widget_position(grid_data, false);
- };
-
-
- /**
- * Add a widget to the mapped array of positions.
- *
- * @method add_to_gridmap
- * @param {Object} grid_data The grid coords object representing the cells
- * to update in the mapped array.
- * @param {HTMLElement|Boolean} value The value to set in the specified
- * position .
- * @return {Class} Returns the instance of the Gridster Class.
- */
- fn.add_to_gridmap = function(grid_data, value) {
- this.update_widget_position(grid_data, value || grid_data.el);
-
- if (grid_data.el) {
- var $widgets = this.widgets_below(grid_data.el);
- $widgets.each($.proxy(function(i, widget) {
- this.move_widget_up( $(widget));
- }, this));
- }
- };
-
-
- /**
- * Make widgets draggable.
- *
- * @uses Draggable
- * @method draggable
- * @return {Class} Returns the instance of the Gridster Class.
- */
- fn.draggable = function() {
- var self = this;
- var draggable_options = $.extend(true, {}, this.options.draggable, {
- offset_left: this.options.widget_margins[0],
- start: function(event, ui) {
- self.$widgets.filter('.player-revert')
- .removeClass('player-revert');
-
- self.$player = $(this);
- self.$helper = self.options.draggable.helper === 'clone' ?
- $(ui.helper) : self.$player;
- self.helper = !self.$helper.is(self.$player);
-
- self.on_start_drag.call(self, event, ui);
- self.$el.trigger('gridster:dragstart');
- },
- stop: function(event, ui) {
- self.on_stop_drag.call(self, event, ui);
- self.$el.trigger('gridster:dragstop');
- },
- drag: throttle(function(event, ui) {
- self.on_drag.call(self, event, ui);
- self.$el.trigger('gridster:drag');
- }, 60)
- });
-
- this.drag_api = this.$el.drag(draggable_options).data('drag');
- return this;
- };
-
-
- /**
- * This function is executed when the player begins to be dragged.
- *
- * @method on_start_drag
- * @param {Event} event The original browser event
- * @param {Object} ui A prepared ui object.
- */
- fn.on_start_drag = function(event, ui) {
-
- this.$helper.add(this.$player).add(this.$wrapper).addClass('dragging');
-
- this.$player.addClass('player');
- this.player_grid_data = this.$player.coords().grid;
- this.placeholder_grid_data = $.extend({}, this.player_grid_data);
-
- //set new grid height along the dragging period
- this.$el.css('height', this.$el.height() +
- (this.player_grid_data.size_y * this.min_widget_height));
-
- var colliders = this.faux_grid;
- var coords = this.$player.data('coords').coords;
-
- this.cells_occupied_by_player = this.get_cells_occupied(
- this.player_grid_data);
- this.cells_occupied_by_placeholder = this.get_cells_occupied(
- this.placeholder_grid_data);
-
- this.last_cols = [];
- this.last_rows = [];
-
-
- // see jquery.collision.js
- this.collision_api = this.$helper.collision(
- colliders, this.options.collision);
-
- this.$preview_holder = $('', {
- 'class': 'preview-holder',
- 'data-row': this.$player.attr('data-row'),
- 'data-col': this.$player.attr('data-col'),
- css: {
- width: coords.width,
- height: coords.height
- }
- }).appendTo(this.$el);
-
- if (this.options.draggable.start) {
- this.options.draggable.start.call(this, event, ui);
- }
- };
-
-
- /**
- * This function is executed when the player is being dragged.
- *
- * @method on_drag
- * @param {Event} event The original browser event
- * @param {Object} ui A prepared ui object.
- */
- fn.on_drag = function(event, ui) {
- //break if dragstop has been fired
- if (this.$player === null) {
- return false;
- }
-
- var abs_offset = {
- left: ui.position.left + this.baseX,
- top: ui.position.top + this.baseY
- };
-
- this.colliders_data = this.collision_api.get_closest_colliders(
- abs_offset);
-
- this.on_overlapped_column_change(
- this.on_start_overlapping_column,
- this.on_stop_overlapping_column
- );
-
- this.on_overlapped_row_change(
- this.on_start_overlapping_row,
- this.on_stop_overlapping_row
- );
-
- if (this.helper && this.$player) {
- this.$player.css({
- 'left': ui.position.left,
- 'top': ui.position.top
- });
- }
-
- if (this.options.draggable.drag) {
- this.options.draggable.drag.call(this, event, ui);
- }
- };
-
- /**
- * This function is executed when the player stops being dragged.
- *
- * @method on_stop_drag
- * @param {Event} event The original browser event
- * @param {Object} ui A prepared ui object.
- */
- fn.on_stop_drag = function(event, ui) {
- this.$helper.add(this.$player).add(this.$wrapper)
- .removeClass('dragging');
-
- ui.position.left = ui.position.left + this.baseX;
- ui.position.top = ui.position.top + this.baseY;
- this.colliders_data = this.collision_api.get_closest_colliders(ui.position);
-
- this.on_overlapped_column_change(
- this.on_start_overlapping_column,
- this.on_stop_overlapping_column
- );
-
- this.on_overlapped_row_change(
- this.on_start_overlapping_row,
- this.on_stop_overlapping_row
- );
-
- this.$player.addClass('player-revert').removeClass('player')
- .attr({
- 'data-col': this.placeholder_grid_data.col,
- 'data-row': this.placeholder_grid_data.row
- }).css({
- 'left': '',
- 'top': ''
- });
-
- this.$changed = this.$changed.add(this.$player);
-
- this.cells_occupied_by_player = this.get_cells_occupied(
- this.placeholder_grid_data);
- this.set_cells_player_occupies(
- this.placeholder_grid_data.col, this.placeholder_grid_data.row);
-
- this.$player.coords().grid.row = this.placeholder_grid_data.row;
- this.$player.coords().grid.col = this.placeholder_grid_data.col;
-
- if (this.options.draggable.stop) {
- this.options.draggable.stop.call(this, event, ui);
- }
-
- this.$preview_holder.remove();
-
- this.$player = null;
- this.$helper = null;
- this.placeholder_grid_data = {};
- this.player_grid_data = {};
- this.cells_occupied_by_placeholder = {};
- this.cells_occupied_by_player = {};
-
- this.set_dom_grid_height();
- };
-
-
- /**
- * Executes the callbacks passed as arguments when a column begins to be
- * overlapped or stops being overlapped.
- *
- * @param {Function} start_callback Function executed when a new column
- * begins to be overlapped. The column is passed as first argument.
- * @param {Function} stop_callback Function executed when a column stops
- * being overlapped. The column is passed as first argument.
- * @method on_overlapped_column_change
- * @return {Class} Returns the instance of the Gridster Class.
- */
- fn.on_overlapped_column_change = function(start_callback, stop_callback) {
- if (!this.colliders_data.length) {
- return this;
- }
- var cols = this.get_targeted_columns(
- this.colliders_data[0].el.data.col);
-
- var last_n_cols = this.last_cols.length;
- var n_cols = cols.length;
- var i;
-
- for (i = 0; i < n_cols; i++) {
- if ($.inArray(cols[i], this.last_cols) === -1) {
- (start_callback || $.noop).call(this, cols[i]);
- }
- }
-
- for (i = 0; i< last_n_cols; i++) {
- if ($.inArray(this.last_cols[i], cols) === -1) {
- (stop_callback || $.noop).call(this, this.last_cols[i]);
- }
- }
-
- this.last_cols = cols;
-
- return this;
- };
-
-
- /**
- * Executes the callbacks passed as arguments when a row starts to be
- * overlapped or stops being overlapped.
- *
- * @param {Function} start_callback Function executed when a new row begins
- * to be overlapped. The row is passed as first argument.
- * @param {Function} end_callback Function executed when a row stops being
- * overlapped. The row is passed as first argument.
- * @method on_overlapped_row_change
- * @return {Class} Returns the instance of the Gridster Class.
- */
- fn.on_overlapped_row_change = function(start_callback, end_callback) {
- if (!this.colliders_data.length) {
- return this;
- }
- var rows = this.get_targeted_rows(this.colliders_data[0].el.data.row);
- var last_n_rows = this.last_rows.length;
- var n_rows = rows.length;
- var i;
-
- for (i = 0; i < n_rows; i++) {
- if ($.inArray(rows[i], this.last_rows) === -1) {
- (start_callback || $.noop).call(this, rows[i]);
- }
- }
-
- for (i = 0; i < last_n_rows; i++) {
- if ($.inArray(this.last_rows[i], rows) === -1) {
- (end_callback || $.noop).call(this, this.last_rows[i]);
- }
- }
-
- this.last_rows = rows;
- };
-
-
- /**
- * Sets the current position of the player
- *
- * @param {Number} col
- * @param {Number} row
- * @param {Boolean} no_player
- * @method set_player
- * @return {object}
- */
- fn.set_player = function(col, row, no_player) {
- var self = this;
- if (!no_player) {
- this.empty_cells_player_occupies();
- }
- var cell = !no_player ? self.colliders_data[0].el.data : {col: col};
- var to_col = cell.col;
- var to_row = row || cell.row;
-
- this.player_grid_data = {
- col: to_col,
- row: to_row,
- size_y : this.player_grid_data.size_y,
- size_x : this.player_grid_data.size_x
- };
-
- this.cells_occupied_by_player = this.get_cells_occupied(
- this.player_grid_data);
-
- var $overlapped_widgets = this.get_widgets_overlapped(
- this.player_grid_data);
-
- var constraints = this.widgets_constraints($overlapped_widgets);
-
- this.manage_movements(constraints.can_go_up, to_col, to_row);
- this.manage_movements(constraints.can_not_go_up, to_col, to_row);
-
- /* if there is not widgets overlapping in the new player position,
- * update the new placeholder position. */
- if (!$overlapped_widgets.length) {
- var pp = this.can_go_player_up(this.player_grid_data);
- if (pp !== false) {
- to_row = pp;
- }
- this.set_placeholder(to_col, to_row);
- }
-
- return {
- col: to_col,
- row: to_row
- };
- };
-
-
- /**
- * See which of the widgets in the $widgets param collection can go to
- * a upper row and which not.
- *
- * @method widgets_contraints
- * @param {jQuery} $widgets A jQuery wrapped collection of
- * HTMLElements.
- * @return {object} Returns a literal Object with two keys: `can_go_up` &
- * `can_not_go_up`. Each contains a set of HTMLElements.
- */
- fn.widgets_constraints = function($widgets) {
- var $widgets_can_go_up = $([]);
- var $widgets_can_not_go_up;
- var wgd_can_go_up = [];
- var wgd_can_not_go_up = [];
-
- $widgets.each($.proxy(function(i, w) {
- var $w = $(w);
- var wgd = $w.coords().grid;
- if (this.can_go_widget_up(wgd)) {
- $widgets_can_go_up = $widgets_can_go_up.add($w);
- wgd_can_go_up.push(wgd);
- }else{
- wgd_can_not_go_up.push(wgd);
- }
- }, this));
-
- $widgets_can_not_go_up = $widgets.not($widgets_can_go_up);
-
- return {
- can_go_up: this.sort_by_row_asc(wgd_can_go_up),
- can_not_go_up: this.sort_by_row_desc(wgd_can_not_go_up)
- };
- };
-
-
- /**
- * Sorts an Array of grid coords objects (representing the grid coords of
- * each widget) in ascending way.
- *
- * @method sort_by_row_asc
- * @param {Array} widgets Array of grid coords objects
- * @return {Array} Returns the array sorted.
- */
- fn.sort_by_row_asc = function(widgets) {
- widgets = widgets.sort(function(a, b) {
- if (!a.row) {
- a = $(a).coords().grid;
- b = $(b).coords().grid;
- }
-
- if (a.row > b.row) {
- return 1;
- }
- return -1;
- });
-
- return widgets;
- };
-
-
- /**
- * Sorts an Array of grid coords objects (representing the grid coords of
- * each widget) placing first the empty cells upper left.
- *
- * @method sort_by_row_and_col_asc
- * @param {Array} widgets Array of grid coords objects
- * @return {Array} Returns the array sorted.
- */
- fn.sort_by_row_and_col_asc = function(widgets) {
- widgets = widgets.sort(function(a, b) {
- if (a.row > b.row || a.row === b.row && a.col > b.col) {
- return 1;
- }
- return -1;
- });
-
- return widgets;
- };
-
-
- /**
- * Sorts an Array of grid coords objects by column (representing the grid
- * coords of each widget) in ascending way.
- *
- * @method sort_by_col_asc
- * @param {Array} widgets Array of grid coords objects
- * @return {Array} Returns the array sorted.
- */
- fn.sort_by_col_asc = function(widgets) {
- widgets = widgets.sort(function(a, b) {
- if (a.col > b.col) {
- return 1;
- }
- return -1;
- });
-
- return widgets;
- };
-
-
- /**
- * Sorts an Array of grid coords objects (representing the grid coords of
- * each widget) in descending way.
- *
- * @method sort_by_row_desc
- * @param {Array} widgets Array of grid coords objects
- * @return {Array} Returns the array sorted.
- */
- fn.sort_by_row_desc = function(widgets) {
- widgets = widgets.sort(function(a, b) {
- if (a.row + a.size_y < b.row + b.size_y) {
- return 1;
- }
- return -1;
- });
- return widgets;
- };
-
-
- /**
- * Sorts an Array of grid coords objects (representing the grid coords of
- * each widget) in descending way.
- *
- * @method manage_movements
- * @param {jQuery} $widgets A jQuery collection of HTMLElements
- * representing the widgets you want to move.
- * @param {Number} to_col The column to which we want to move the widgets.
- * @param {Number} to_row The row to which we want to move the widgets.
- * @return {Class} Returns the instance of the Gridster Class.
- */
- fn.manage_movements = function($widgets, to_col, to_row) {
- $.each($widgets, $.proxy(function(i, w) {
- var wgd = w;
- var $w = wgd.el;
-
- var can_go_widget_up = this.can_go_widget_up(wgd);
-
- if (can_go_widget_up) {
- //target CAN go up
- //so move widget up
- this.move_widget_to($w, can_go_widget_up);
- this.set_placeholder(to_col, can_go_widget_up + wgd.size_y);
-
- } else {
- //target can't go up
- var can_go_player_up = this.can_go_player_up(
- this.player_grid_data);
-
- if (!can_go_player_up) {
- // target can't go up
- // player cant't go up
- // so we need to move widget down to a position that dont
- // overlaps player
- var y = (to_row + this.player_grid_data.size_y) - wgd.row;
-
- this.move_widget_down($w, y);
- this.set_placeholder(to_col, to_row);
- }
- }
- }, this));
-
- return this;
- };
-
- /**
- * Determines if there is a widget in the row and col given. Or if the
- * HTMLElement passed as first argument is the player.
- *
- * @method is_player
- * @param {Number|HTMLElement} col_or_el A jQuery wrapped collection of
- * HTMLElements.
- * @param {Number} [row] The column to which we want to move the widgets.
- * @return {Boolean} Returns true or false.
- */
- fn.is_player = function(col_or_el, row) {
- if (row && !this.gridmap[col_or_el]) { return false; }
- var $w = row ? this.gridmap[col_or_el][row] : col_or_el;
- return $w && ($w.is(this.$player) || $w.is(this.$helper));
- };
-
-
- /**
- * Determines if the widget that is being dragged is currently over the row
- * and col given.
- *
- * @method is_player_in
- * @param {Number} col The column to check.
- * @param {Number} row The row to check.
- * @return {Boolean} Returns true or false.
- */
- fn.is_player_in = function(col, row) {
- var c = this.cells_occupied_by_player || {};
- return $.inArray(col, c.cols) >= 0 && $.inArray(row, c.rows) >= 0;
- };
-
-
- /**
- * Determines if the placeholder is currently over the row and col given.
- *
- * @method is_placeholder_in
- * @param {Number} col The column to check.
- * @param {Number} row The row to check.
- * @return {Boolean} Returns true or false.
- */
- fn.is_placeholder_in = function(col, row) {
- var c = this.cells_occupied_by_placeholder || {};
- return this.is_placeholder_in_col(col) && $.inArray(row, c.rows) >= 0;
- };
-
-
- /**
- * Determines if the placeholder is currently over the column given.
- *
- * @method is_placeholder_in_col
- * @param {Number} col The column to check.
- * @return {Boolean} Returns true or false.
- */
- fn.is_placeholder_in_col = function(col) {
- var c = this.cells_occupied_by_placeholder || [];
- return $.inArray(col, c.cols) >= 0;
- };
-
-
- /**
- * Determines if the cell represented by col and row params is empty.
- *
- * @method is_empty
- * @param {Number} col The column to check.
- * @param {Number} row The row to check.
- * @return {Boolean} Returns true or false.
- */
- fn.is_empty = function(col, row) {
- if (typeof this.gridmap[col] !== 'undefined' &&
- typeof this.gridmap[col][row] !== 'undefined' &&
- this.gridmap[col][row] === false
- ) {
- return true;
- }
- return false;
- };
-
-
- /**
- * Determines if the cell represented by col and row params is occupied.
- *
- * @method is_occupied
- * @param {Number} col The column to check.
- * @param {Number} row The row to check.
- * @return {Boolean} Returns true or false.
- */
- fn.is_occupied = function(col, row) {
- if (!this.gridmap[col]) {
- return false;
- }
-
- if (this.gridmap[col][row]) {
- return true;
- }
- return false;
- };
-
-
- /**
- * Determines if there is a widget in the cell represented by col/row params.
- *
- * @method is_widget
- * @param {Number} col The column to check.
- * @param {Number} row The row to check.
- * @return {Boolean|HTMLElement} Returns false if there is no widget,
- * else returns the jQuery HTMLElement
- */
- fn.is_widget = function(col, row) {
- var cell = this.gridmap[col];
- if (!cell) {
- return false;
- }
-
- cell = cell[row];
-
- if (cell) {
- return cell;
- }
-
- return false;
- };
-
-
- /**
- * Determines if there is a widget in the cell represented by col/row
- * params and if this is under the widget that is being dragged.
- *
- * @method is_widget_under_player
- * @param {Number} col The column to check.
- * @param {Number} row The row to check.
- * @return {Boolean} Returns true or false.
- */
- fn.is_widget_under_player = function(col, row) {
- if (this.is_widget(col, row)) {
- return this.is_player_in(col, row);
- }
- return false;
- };
-
-
- /**
- * Get widgets overlapping with the player or with the object passed
- * representing the grid cells.
- *
- * @method get_widgets_under_player
- * @return {HTMLElement} Returns a jQuery collection of HTMLElements
- */
- fn.get_widgets_under_player = function(cells) {
- cells || (cells = this.cells_occupied_by_player || {cols: [], rows: []});
- var $widgets = $([]);
-
- $.each(cells.cols, $.proxy(function(i, col) {
- $.each(cells.rows, $.proxy(function(i, row) {
- if(this.is_widget(col, row)) {
- $widgets = $widgets.add(this.gridmap[col][row]);
- }
- }, this));
- }, this));
-
- return $widgets;
- };
-
-
- /**
- * Put placeholder at the row and column specified.
- *
- * @method set_placeholder
- * @param {Number} col The column to which we want to move the
- * placeholder.
- * @param {Number} row The row to which we want to move the
- * placeholder.
- * @return {Class} Returns the instance of the Gridster Class.
- */
- fn.set_placeholder = function(col, row) {
- var phgd = $.extend({}, this.placeholder_grid_data);
- var $nexts = this.widgets_below({
- col: phgd.col,
- row: phgd.row,
- size_y: phgd.size_y,
- size_x: phgd.size_x
- });
-
- // Prevents widgets go out of the grid
- var right_col = (col + phgd.size_x - 1);
- if (right_col > this.cols) {
- col = col - (right_col - col);
- }
-
- var moved_down = this.placeholder_grid_data.row < row;
- var changed_column = this.placeholder_grid_data.col !== col;
-
- this.placeholder_grid_data.col = col;
- this.placeholder_grid_data.row = row;
-
- this.cells_occupied_by_placeholder = this.get_cells_occupied(
- this.placeholder_grid_data);
-
- this.$preview_holder.attr({
- 'data-row' : row,
- 'data-col' : col
- });
-
- if (moved_down || changed_column) {
- $nexts.each($.proxy(function(i, widget) {
- this.move_widget_up(
- $(widget), this.placeholder_grid_data.col - col + phgd.size_y);
- }, this));
- }
-
-
- var $widgets_under_ph = this.get_widgets_under_player(this.cells_occupied_by_placeholder);
- if ($widgets_under_ph.length) {
- $widgets_under_ph.each($.proxy(function(i, widget) {
- var $w = $(widget);
- this.move_widget_down(
- $w, row + phgd.size_y - $w.data('coords').grid.row);
- }, this));
- }
-
- };
-
-
- /**
- * Determines whether the player can move to a position above.
- *
- * @method can_go_player_up
- * @param {Object} widget_grid_data The actual grid coords object of the
- * player.
- * @return {Number|Boolean} If the player can be moved to an upper row
- * returns the row number, else returns false.
- */
- fn.can_go_player_up = function(widget_grid_data) {
- var p_bottom_row = widget_grid_data.row + widget_grid_data.size_y - 1;
- var result = true;
- var upper_rows = [];
- var min_row = 10000;
- var $widgets_under_player = this.get_widgets_under_player();
-
- /* generate an array with columns as index and array with upper rows
- * empty as value */
- this.for_each_column_occupied(widget_grid_data, function(tcol) {
- var grid_col = this.gridmap[tcol];
- var r = p_bottom_row + 1;
- upper_rows[tcol] = [];
-
- while (--r > 0) {
- if (this.is_empty(tcol, r) || this.is_player(tcol, r) ||
- this.is_widget(tcol, r) &&
- grid_col[r].is($widgets_under_player)
- ) {
- upper_rows[tcol].push(r);
- min_row = r < min_row ? r : min_row;
- }else{
- break;
- }
- }
-
- if (upper_rows[tcol].length === 0) {
- result = false;
- return true; //break
- }
-
- upper_rows[tcol].sort();
- });
-
- if (!result) { return false; }
-
- return this.get_valid_rows(widget_grid_data, upper_rows, min_row);
- };
-
-
- /**
- * Determines whether a widget can move to a position above.
- *
- * @method can_go_widget_up
- * @param {Object} widget_grid_data The actual grid coords object of the
- * widget we want to check.
- * @return {Number|Boolean} If the widget can be moved to an upper row
- * returns the row number, else returns false.
- */
- fn.can_go_widget_up = function(widget_grid_data) {
- var p_bottom_row = widget_grid_data.row + widget_grid_data.size_y - 1;
- var result = true;
- var upper_rows = [];
- var min_row = 10000;
-
- /* generate an array with columns as index and array with topmost rows
- * empty as value */
- this.for_each_column_occupied(widget_grid_data, function(tcol) {
- var grid_col = this.gridmap[tcol];
- upper_rows[tcol] = [];
-
- var r = p_bottom_row + 1;
- // iterate over each row
- while (--r > 0) {
- if (this.is_widget(tcol, r) && !this.is_player_in(tcol, r)) {
- if (!grid_col[r].is(widget_grid_data.el)) {
- break;
- }
- }
-
- if (!this.is_player(tcol, r) &&
- !this.is_placeholder_in(tcol, r) &&
- !this.is_player_in(tcol, r)) {
- upper_rows[tcol].push(r);
- }
-
- if (r < min_row) {
- min_row = r;
- }
- }
-
- if (upper_rows[tcol].length === 0) {
- result = false;
- return true; //break
- }
-
- upper_rows[tcol].sort();
- });
-
- if (!result) { return false; }
-
- return this.get_valid_rows(widget_grid_data, upper_rows, min_row);
- };
-
-
- /**
- * Search a valid row for the widget represented by `widget_grid_data' in
- * the `upper_rows` array. Iteration starts from row specified in `min_row`.
- *
- * @method get_valid_rows
- * @param {Object} widget_grid_data The actual grid coords object of the
- * player.
- * @param {Array} upper_rows An array with columns as index and arrays
- * of valid rows as values.
- * @param {Number} min_row The upper row from which the iteration will start.
- * @return {Number|Boolean} Returns the upper row valid from the `upper_rows`
- * for the widget in question.
- */
- fn.get_valid_rows = function(widget_grid_data, upper_rows, min_row) {
- var p_top_row = widget_grid_data.row;
- var p_bottom_row = widget_grid_data.row + widget_grid_data.size_y - 1;
- var size_y = widget_grid_data.size_y;
- var r = min_row - 1;
- var valid_rows = [];
-
- while (++r <= p_bottom_row ) {
- var common = true;
- $.each(upper_rows, function(col, rows) {
- if ($.isArray(rows) && $.inArray(r, rows) === -1) {
- common = false;
- }
- });
-
- if (common === true) {
- valid_rows.push(r);
- if (valid_rows.length === size_y) {
- break;
- }
- }
- }
-
- var new_row = false;
- if (size_y === 1) {
- if (valid_rows[0] !== p_top_row) {
- new_row = valid_rows[0] || false;
- }
- }else{
- if (valid_rows[0] !== p_top_row) {
- new_row = this.get_consecutive_numbers_index(
- valid_rows, size_y);
- }
- }
-
- return new_row;
- };
-
-
- fn.get_consecutive_numbers_index = function(arr, size_y) {
- var max = arr.length;
- var result = [];
- var first = true;
- var prev = -1; // or null?
-
- for (var i=0; i < max; i++) {
- if (first || arr[i] === prev + 1) {
- result.push(i);
- if (result.length === size_y) {
- break;
- }
- first = false;
- }else{
- result = [];
- first = true;
- }
-
- prev = arr[i];
- }
-
- return result.length >= size_y ? arr[result[0]] : false;
- };
-
-
- /**
- * Get widgets overlapping with the player.
- *
- * @method get_widgets_overlapped
- * @return {jQuery} Returns a jQuery collection of HTMLElements.
- */
- fn.get_widgets_overlapped = function() {
- var $w;
- var $widgets = $([]);
- var used = [];
- var rows_from_bottom = this.cells_occupied_by_player.rows.slice(0);
- rows_from_bottom.reverse();
-
- $.each(this.cells_occupied_by_player.cols, $.proxy(function(i, col) {
- $.each(rows_from_bottom, $.proxy(function(i, row) {
- // if there is a widget in the player position
- if (!this.gridmap[col]) { return true; } //next iteration
- var $w = this.gridmap[col][row];
- if (this.is_occupied(col, row) && !this.is_player($w) &&
- $.inArray($w, used) === -1
- ) {
- $widgets = $widgets.add($w);
- used.push($w);
- }
-
- }, this));
- }, this));
-
- return $widgets;
- };
-
-
- /**
- * This callback is executed when the player begins to collide with a column.
- *
- * @method on_start_overlapping_column
- * @param {Number} col The collided column.
- * @return {jQuery} Returns a jQuery collection of HTMLElements.
- */
- fn.on_start_overlapping_column = function(col) {
- this.set_player(col, false);
- };
-
-
- /**
- * A callback executed when the player begins to collide with a row.
- *
- * @method on_start_overlapping_row
- * @param {Number} row The collided row.
- * @return {jQuery} Returns a jQuery collection of HTMLElements.
- */
- fn.on_start_overlapping_row = function(row) {
- this.set_player(false, row);
- };
-
-
- /**
- * A callback executed when the the player ends to collide with a column.
- *
- * @method on_stop_overlapping_column
- * @param {Number} col The collided row.
- * @return {jQuery} Returns a jQuery collection of HTMLElements.
- */
- fn.on_stop_overlapping_column = function(col) {
- this.set_player(col, false);
-
- var self = this;
- this.for_each_widget_below(col, this.cells_occupied_by_player.rows[0],
- function(tcol, trow) {
- self.move_widget_up(this, self.player_grid_data.size_y);
- });
- };
-
-
- /**
- * This callback is executed when the player ends to collide with a row.
- *
- * @method on_stop_overlapping_row
- * @param {Number} row The collided row.
- * @return {jQuery} Returns a jQuery collection of HTMLElements.
- */
- fn.on_stop_overlapping_row = function(row) {
- this.set_player(false, row);
-
- var self = this;
- var cols = this.cells_occupied_by_player.cols;
- for (var c = 0, cl = cols.length; c < cl; c++) {
- this.for_each_widget_below(cols[c], row, function(tcol, trow) {
- self.move_widget_up(this, self.player_grid_data.size_y);
- });
- }
- };
-
-
- /**
- * Move a widget to a specific row. The cell or cells must be empty.
- * If the widget has widgets below, all of these widgets will be moved also
- * if they can.
- *
- * @method move_widget_to
- * @param {HTMLElement} $widget The jQuery wrapped HTMLElement of the
- * widget is going to be moved.
- * @return {Class} Returns the instance of the Gridster Class.
- */
- fn.move_widget_to = function($widget, row) {
- var self = this;
- var widget_grid_data = $widget.coords().grid;
- var diff = row - widget_grid_data.row;
- var $next_widgets = this.widgets_below($widget);
-
- var can_move_to_new_cell = this.can_move_to(
- widget_grid_data, widget_grid_data.col, row, $widget);
-
- if (can_move_to_new_cell === false) {
- return false;
- }
-
- this.remove_from_gridmap(widget_grid_data);
- widget_grid_data.row = row;
- this.add_to_gridmap(widget_grid_data);
- $widget.attr('data-row', row);
- this.$changed = this.$changed.add($widget);
-
-
- $next_widgets.each(function(i, widget) {
- var $w = $(widget);
- var wgd = $w.coords().grid;
- var can_go_up = self.can_go_widget_up(wgd);
- if (can_go_up && can_go_up !== wgd.row) {
- self.move_widget_to($w, can_go_up);
- }
- });
-
- return this;
- };
-
-
- /**
- * Move up the specified widget and all below it.
- *
- * @method move_widget_up
- * @param {HTMLElement} $widget The widget you want to move.
- * @param {Number} [y_units] The number of cells that the widget has to move.
- * @return {Class} Returns the instance of the Gridster Class.
- */
- fn.move_widget_up = function($widget, y_units) {
- var el_grid_data = $widget.coords().grid;
- var actual_row = el_grid_data.row;
- var moved = [];
- var can_go_up = true;
- y_units || (y_units = 1);
-
- if (!this.can_go_up($widget)) { return false; } //break;
-
- this.for_each_column_occupied(el_grid_data, function(col) {
- // can_go_up
- if ($.inArray($widget, moved) === -1) {
- var widget_grid_data = $widget.coords().grid;
- var next_row = actual_row - y_units;
- next_row = this.can_go_up_to_row(
- widget_grid_data, col, next_row);
-
- if (!next_row) {
- return true;
- }
-
- var $next_widgets = this.widgets_below($widget);
-
- this.remove_from_gridmap(widget_grid_data);
- widget_grid_data.row = next_row;
- this.add_to_gridmap(widget_grid_data);
- $widget.attr('data-row', widget_grid_data.row);
- this.$changed = this.$changed.add($widget);
-
- moved.push($widget);
-
- $next_widgets.each($.proxy(function(i, widget) {
- this.move_widget_up($(widget), y_units);
- }, this));
- }
- });
-
- };
-
-
- /**
- * Move down the specified widget and all below it.
- *
- * @method move_widget_down
- * @param {jQuery} $widget The jQuery object representing the widget
- * you want to move.
- * @param {Number} y_units The number of cells that the widget has to move.
- * @return {Class} Returns the instance of the Gridster Class.
- */
- fn.move_widget_down = function($widget, y_units) {
- var el_grid_data = $widget.coords().grid;
- var actual_row = el_grid_data.row;
- var moved = [];
- var y_diff = y_units;
-
- if (!$widget) { return false; }
-
- if ($.inArray($widget, moved) === -1) {
-
- var widget_grid_data = $widget.coords().grid;
- var next_row = actual_row + y_units;
- var $next_widgets = this.widgets_below($widget);
-
- this.remove_from_gridmap(widget_grid_data);
-
- $next_widgets.each($.proxy(function(i, widget) {
- var $w = $(widget);
- var wd = $w.coords().grid;
- var tmp_y = this.displacement_diff(
- wd, widget_grid_data, y_diff);
-
- if (tmp_y > 0) {
- this.move_widget_down($w, tmp_y);
- }
- }, this));
-
- widget_grid_data.row = next_row;
- this.update_widget_position(widget_grid_data, $widget);
- $widget.attr('data-row', widget_grid_data.row);
- this.$changed = this.$changed.add($widget);
-
- moved.push($widget);
- }
- };
-
-
- /**
- * Check if the widget can move to the specified row, else returns the
- * upper row possible.
- *
- * @method can_go_up_to_row
- * @param {Number} widget_grid_data The current grid coords object of the
- * widget.
- * @param {Number} col The target column.
- * @param {Number} row The target row.
- * @return {Boolean|Number} Returns the row number if the widget can move
- * to the target position, else returns false.
- */
- fn.can_go_up_to_row = function(widget_grid_data, col, row) {
- var ga = this.gridmap;
- var result = true;
- var urc = []; // upper_rows_in_columns
- var actual_row = widget_grid_data.row;
- var r;
-
- /* generate an array with columns as index and array with
- * upper rows empty in the column */
- this.for_each_column_occupied(widget_grid_data, function(tcol) {
- var grid_col = ga[tcol];
- urc[tcol] = [];
-
- r = actual_row;
- while (r--) {
- if (this.is_empty(tcol, r) &&
- !this.is_placeholder_in(tcol, r)
- ) {
- urc[tcol].push(r);
- }else{
- break;
- }
- }
-
- if (!urc[tcol].length) {
- result = false;
- return true;
- }
-
- });
-
- if (!result) { return false; }
-
- /* get common rows starting from upper position in all the columns
- * that widget occupies */
- r = row;
- for (r = 1; r < actual_row; r++) {
- var common = true;
-
- for (var uc = 0, ucl = urc.length; uc < ucl; uc++) {
- if (urc[uc] && $.inArray(r, urc[uc]) === -1) {
- common = false;
- }
- }
-
- if (common === true) {
- result = r;
- break;
- }
- }
-
- return result;
- };
-
-
- fn.displacement_diff = function(widget_grid_data, parent_bgd, y_units) {
- var actual_row = widget_grid_data.row;
- var diffs = [];
- var parent_max_y = parent_bgd.row + parent_bgd.size_y;
-
- this.for_each_column_occupied(widget_grid_data, function(col) {
- var temp_y_units = 0;
-
- for (var r = parent_max_y; r < actual_row; r++) {
- if (this.is_empty(col, r)) {
- temp_y_units = temp_y_units + 1;
- }
- }
-
- diffs.push(temp_y_units);
- });
-
- var max_diff = Math.max.apply(Math, diffs);
- y_units = (y_units - max_diff);
-
- return y_units > 0 ? y_units : 0;
- };
-
-
- /**
- * Get widgets below a widget.
- *
- * @method widgets_below
- * @param {HTMLElement} $el The jQuery wrapped HTMLElement.
- * @return {jQuery} A jQuery collection of HTMLElements.
- */
- fn.widgets_below = function($el) {
- var el_grid_data = $.isPlainObject($el) ? $el : $el.coords().grid;
- var self = this;
- var ga = this.gridmap;
- var next_row = el_grid_data.row + el_grid_data.size_y - 1;
- var $nexts = $([]);
-
- this.for_each_column_occupied(el_grid_data, function(col) {
- self.for_each_widget_below(col, next_row, function(tcol, trow) {
- if (!self.is_player(this) && $.inArray(this, $nexts) === -1) {
- $nexts = $nexts.add(this);
- return true; // break
- }
- });
- });
-
- return this.sort_by_row_asc($nexts);
- };
-
-
- /**
- * Update the array of mapped positions with the new player position.
- *
- * @method set_cells_player_occupies
- * @param {Number} col The new player col.
- * @param {Number} col The new player row.
- * @return {Class} Returns the instance of the Gridster Class.
- */
- fn.set_cells_player_occupies = function(col, row) {
- this.remove_from_gridmap(this.placeholder_grid_data);
- this.placeholder_grid_data.col = col;
- this.placeholder_grid_data.row = row;
- this.add_to_gridmap(this.placeholder_grid_data, this.$player);
- return this;
- };
-
-
- /**
- * Remove from the array of mapped positions the reference to the player.
- *
- * @method empty_cells_player_occupies
- * @return {Class} Returns the instance of the Gridster Class.
- */
- fn.empty_cells_player_occupies = function() {
- this.remove_from_gridmap(this.placeholder_grid_data);
- return this;
- };
-
-
- fn.can_go_up = function($el) {
- var el_grid_data = $el.coords().grid;
- var initial_row = el_grid_data.row;
- var prev_row = initial_row - 1;
- var ga = this.gridmap;
- var upper_rows_by_column = [];
-
- var result = true;
- if (initial_row === 1) { return false; }
-
- this.for_each_column_occupied(el_grid_data, function(col) {
- var $w = this.is_widget(col, prev_row);
-
- if (this.is_occupied(col, prev_row) ||
- this.is_player(col, prev_row) ||
- this.is_placeholder_in(col, prev_row) ||
- this.is_player_in(col, prev_row)
- ) {
- result = false;
- return true; //break
- }
- });
-
- return result;
- };
-
-
-
- /**
- * Check if it's possible to move a widget to a specific col/row. It takes
- * into account the dimensions (`size_y` and `size_x` attrs. of the grid
- * coords object) the widget occupies.
- *
- * @method can_move_to
- * @param {Object} widget_grid_data The grid coords object that represents
- * the widget.
- * @param {Object} col The col to check.
- * @param {Object} row The row to check.
- * @param {Number} [max_row] The max row allowed.
- * @return {Boolean} Returns true if all cells are empty, else return false.
- */
- fn.can_move_to = function(widget_grid_data, col, row, max_row) {
- var ga = this.gridmap;
- var $w = widget_grid_data.el;
- var future_wd = {
- size_y: widget_grid_data.size_y,
- size_x: widget_grid_data.size_x,
- col: col,
- row: row
- };
- var result = true;
-
- //Prevents widgets go out of the grid
- var right_col = col + widget_grid_data.size_x - 1;
- if (right_col > this.cols) {
- return false;
- }
-
- if (max_row && max_row < row + widget_grid_data.size_y - 1) {
- return false;
- }
-
- this.for_each_cell_occupied(future_wd, function(tcol, trow) {
- var $tw = this.is_widget(tcol, trow);
- if ($tw && (!widget_grid_data.el || $tw.is($w))) {
- result = false;
- }
- });
-
- return result;
- };
-
-
- /**
- * Given the leftmost column returns all columns that are overlapping
- * with the player.
- *
- * @method get_targeted_columns
- * @param {Number} [from_col] The leftmost column.
- * @return {Array} Returns an array with column numbers.
- */
- fn.get_targeted_columns = function(from_col) {
- var max = (from_col || this.player_grid_data.col) +
- (this.player_grid_data.size_x - 1);
- var cols = [];
- for (var col = from_col; col <= max; col++) {
- cols.push(col);
- }
- return cols;
- };
-
-
- /**
- * Given the upper row returns all rows that are overlapping with the player.
- *
- * @method get_targeted_rows
- * @param {Number} [from_row] The upper row.
- * @return {Array} Returns an array with row numbers.
- */
- fn.get_targeted_rows = function(from_row) {
- var max = (from_row || this.player_grid_data.row) +
- (this.player_grid_data.size_y - 1);
- var rows = [];
- for (var row = from_row; row <= max; row++) {
- rows.push(row);
- }
- return rows;
- };
-
- /**
- * Get all columns and rows that a widget occupies.
- *
- * @method get_cells_occupied
- * @param {Object} el_grid_data The grid coords object of the widget.
- * @return {Object} Returns an object like `{ cols: [], rows: []}`.
- */
- fn.get_cells_occupied = function(el_grid_data) {
- var cells = { cols: [], rows: []};
- var i;
- if (arguments[1] instanceof jQuery) {
- el_grid_data = arguments[1].coords().grid;
- }
-
- for (i = 0; i < el_grid_data.size_x; i++) {
- var col = el_grid_data.col + i;
- cells.cols.push(col);
- }
-
- for (i = 0; i < el_grid_data.size_y; i++) {
- var row = el_grid_data.row + i;
- cells.rows.push(row);
- }
-
- return cells;
- };
-
-
- /**
- * Iterate over the cells occupied by a widget executing a function for
- * each one.
- *
- * @method for_each_cell_occupied
- * @param {Object} el_grid_data The grid coords object that represents the
- * widget.
- * @param {Function} callback The function to execute on each column
- * iteration. Column and row are passed as arguments.
- * @return {Class} Returns the instance of the Gridster Class.
- */
- fn.for_each_cell_occupied = function(grid_data, callback) {
- this.for_each_column_occupied(grid_data, function(col) {
- this.for_each_row_occupied(grid_data, function(row) {
- callback.call(this, col, row);
- });
- });
- return this;
- };
-
-
- /**
- * Iterate over the columns occupied by a widget executing a function for
- * each one.
- *
- * @method for_each_column_occupied
- * @param {Object} el_grid_data The grid coords object that represents
- * the widget.
- * @param {Function} callback The function to execute on each column
- * iteration. The column number is passed as first argument.
- * @return {Class} Returns the instance of the Gridster Class.
- */
- fn.for_each_column_occupied = function(el_grid_data, callback) {
- for (var i = 0; i < el_grid_data.size_x; i++) {
- var col = el_grid_data.col + i;
- callback.call(this, col, el_grid_data);
- }
- };
-
-
- /**
- * Iterate over the rows occupied by a widget executing a function for
- * each one.
- *
- * @method for_each_row_occupied
- * @param {Object} el_grid_data The grid coords object that represents
- * the widget.
- * @param {Function} callback The function to execute on each column
- * iteration. The row number is passed as first argument.
- * @return {Class} Returns the instance of the Gridster Class.
- */
- fn.for_each_row_occupied = function(el_grid_data, callback) {
- for (var i = 0; i < el_grid_data.size_y; i++) {
- var row = el_grid_data.row + i;
- callback.call(this, row, el_grid_data);
- }
- };
-
-
-
- fn._traversing_widgets = function(type, direction, col, row, callback) {
- var ga = this.gridmap;
- if (!ga[col]) { return; }
-
- var cr, max;
- var action = type + '/' + direction;
- if (arguments[2] instanceof jQuery) {
- var el_grid_data = arguments[2].coords().grid;
- col = el_grid_data.col;
- row = el_grid_data.row;
- callback = arguments[3];
- }
- var matched = [];
- var trow = row;
-
-
- var methods = {
- 'for_each/above': function() {
- while (trow--) {
- if (trow > 0 && this.is_widget(col, trow) &&
- $.inArray(ga[col][trow], matched) === -1
- ) {
- cr = callback.call(ga[col][trow], col, trow);
- matched.push(ga[col][trow]);
- if (cr) { break; }
- }
- }
- },
- 'for_each/below': function() {
- for (trow = row + 1, max = ga[col].length; trow < max; trow++) {
- if (this.is_widget(col, trow) &&
- $.inArray(ga[col][trow], matched) === -1
- ) {
- cr = callback.call(ga[col][trow], col, trow);
- matched.push(ga[col][trow]);
- if (cr) { break; }
- }
- }
- }
- };
-
- if (methods[action]) {
- methods[action].call(this);
- }
- };
-
-
- /**
- * Iterate over each widget above the column and row specified.
- *
- * @method for_each_widget_above
- * @param {Number} col The column to start iterating.
- * @param {Number} row The row to start iterating.
- * @param {Function} callback The function to execute on each widget
- * iteration. The value of `this` inside the function is the jQuery
- * wrapped HTMLElement.
- * @return {Class} Returns the instance of the Gridster Class.
- */
- fn.for_each_widget_above = function(col, row, callback) {
- this._traversing_widgets('for_each', 'above', col, row, callback);
- return this;
- };
-
-
- /**
- * Iterate over each widget below the column and row specified.
- *
- * @method for_each_widget_below
- * @param {Number} col The column to start iterating.
- * @param {Number} row The row to start iterating.
- * @param {Function} callback The function to execute on each widget
- * iteration. The value of `this` inside the function is the jQuery wrapped
- * HTMLElement.
- * @return {Class} Returns the instance of the Gridster Class.
- */
- fn.for_each_widget_below = function(col, row, callback) {
- this._traversing_widgets('for_each', 'below', col, row, callback);
- return this;
- };
-
-
- /**
- * Returns the highest occupied cell in the grid.
- *
- * @method get_highest_occupied_cell
- * @return {Object} Returns an object with `col` and `row` numbers.
- */
- fn.get_highest_occupied_cell = function() {
- var r;
- var gm = this.gridmap;
- var rows = [];
- var row_in_col = [];
- for (var c = gm.length - 1; c >= 1; c--) {
- for (r = gm[c].length - 1; r >= 1; r--) {
- if (this.is_widget(c, r)) {
- rows.push(r);
- row_in_col[r] = c;
- break;
- }
- }
- }
-
- var highest_row = Math.max.apply(Math, rows);
-
- this.highest_occupied_cell = {
- col: row_in_col[highest_row],
- row: highest_row
- };
-
- return this.highest_occupied_cell;
- };
-
-
- fn.get_widgets_from = function(col, row) {
- var ga = this.gridmap;
- var $widgets = $();
-
- if (col) {
- $widgets = $widgets.add(
- this.$widgets.filter(function() {
- var tcol = $(this).attr('data-col');
- return (tcol === col || tcol > col);
- })
- );
- }
-
- if (row) {
- $widgets = $widgets.add(
- this.$widgets.filter(function() {
- var trow = $(this).attr('data-row');
- return (trow === row || trow > row);
- })
- );
- }
-
- return $widgets;
- };
-
-
- /**
- * Set the current height of the parent grid.
- *
- * @method set_dom_grid_height
- * @return {Object} Returns the instance of the Gridster class.
- */
- fn.set_dom_grid_height = function() {
- var r = this.get_highest_occupied_cell().row;
- this.$el.css('height', r * this.min_widget_height);
- return this;
- };
-
-
- /**
- * It generates the neccessary styles to position the widgets.
- *
- * @method generate_stylesheet
- * @param {Number} rows Number of columns.
- * @param {Number} cols Number of rows.
- * @return {Object} Returns the instance of the Gridster class.
- */
- fn.generate_stylesheet = function(opts) {
- var styles = '';
- var max_size_x = this.options.max_size_x;
- var max_rows = 0;
- var max_cols = 0;
- var i;
- var rules;
-
- opts || (opts = {});
- opts.cols || (opts.cols = this.cols);
- opts.rows || (opts.rows = this.rows);
- opts.namespace || (opts.namespace = this.options.namespace);
- opts.widget_base_dimensions ||
- (opts.widget_base_dimensions = this.options.widget_base_dimensions);
- opts.widget_margins ||
- (opts.widget_margins = this.options.widget_margins);
- opts.min_widget_width = (opts.widget_margins[0] * 2) +
- opts.widget_base_dimensions[0];
- opts.min_widget_height = (opts.widget_margins[1] * 2) +
- opts.widget_base_dimensions[1];
-
- // don't duplicate stylesheets for the same configuration
- var serialized_opts = $.param(opts);
- if ($.inArray(serialized_opts, Gridster.generated_stylesheets) >= 0) {
- return false;
- }
-
- Gridster.generated_stylesheets.push(serialized_opts);
-
- /* generate CSS styles for cols */
- for (i = opts.cols; i >= 0; i--) {
- styles += (opts.namespace + ' [data-col="'+ (i + 1) + '"] { left:' +
- ((i * opts.widget_base_dimensions[0]) +
- (i * opts.widget_margins[0]) +
- ((i + 1) * opts.widget_margins[0])) + 'px;} ');
- }
-
- /* generate CSS styles for rows */
- for (i = opts.rows; i >= 0; i--) {
- styles += (opts.namespace + ' [data-row="' + (i + 1) + '"] { top:' +
- ((i * opts.widget_base_dimensions[1]) +
- (i * opts.widget_margins[1]) +
- ((i + 1) * opts.widget_margins[1]) ) + 'px;} ');
- }
-
- for (var y = 1; y <= opts.rows; y++) {
- styles += (opts.namespace + ' [data-sizey="' + y + '"] { height:' +
- (y * opts.widget_base_dimensions[1] +
- (y - 1) * (opts.widget_margins[1] * 2)) + 'px;}');
- }
-
- for (var x = 1; x <= max_size_x; x++) {
- styles += (opts.namespace + ' [data-sizex="' + x + '"] { width:' +
- (x * opts.widget_base_dimensions[0] +
- (x - 1) * (opts.widget_margins[0] * 2)) + 'px;}');
- }
-
- return this.add_style_tag(styles);
- };
-
-
- /**
- * Injects the given CSS as string to the head of the document.
- *
- * @method add_style_tag
- * @param {String} css The styles to apply.
- * @return {Object} Returns the instance of the Gridster class.
- */
- fn.add_style_tag = function(css) {
- var d = document;
- var tag = d.createElement('style');
-
- d.getElementsByTagName('head')[0].appendChild(tag);
- tag.setAttribute('type', 'text/css');
-
- if (tag.styleSheet) {
- tag.styleSheet.cssText = css;
- }else{
- tag.appendChild(document.createTextNode(css));
- }
- return this;
- };
-
-
- /**
- * Generates a faux grid to collide with it when a widget is dragged and
- * detect row or column that we want to go.
- *
- * @method generate_faux_grid
- * @param {Number} rows Number of columns.
- * @param {Number} cols Number of rows.
- * @return {Object} Returns the instance of the Gridster class.
- */
- fn.generate_faux_grid = function(rows, cols) {
- this.faux_grid = [];
- this.gridmap = [];
- var col;
- var row;
- for (col = cols; col > 0; col--) {
- this.gridmap[col] = [];
- for (row = rows; row > 0; row--) {
- this.add_faux_cell(row, col);
- }
- }
- return this;
- };
-
-
- /**
- * Add cell to the faux grid.
- *
- * @method add_faux_cell
- * @param {Number} row The row for the new faux cell.
- * @param {Number} col The col for the new faux cell.
- * @return {Object} Returns the instance of the Gridster class.
- */
- fn.add_faux_cell = function(row, col) {
- var coords = $({
- left: this.baseX + ((col - 1) * this.min_widget_width),
- top: this.baseY + (row -1) * this.min_widget_height,
- width: this.min_widget_width,
- height: this.min_widget_height,
- col: col,
- row: row,
- original_col: col,
- original_row: row
- }).coords();
-
- if (!$.isArray(this.gridmap[col])) {
- this.gridmap[col] = [];
- }
-
- this.gridmap[col][row] = false;
- this.faux_grid.push(coords);
-
- return this;
- };
-
-
- /**
- * Add rows to the faux grid.
- *
- * @method add_faux_rows
- * @param {Number} rows The number of rows you want to add to the faux grid.
- * @return {Object} Returns the instance of the Gridster class.
- */
- fn.add_faux_rows = function(rows) {
- var actual_rows = this.rows;
- var max_rows = actual_rows + (rows || 1);
-
- for (var r = max_rows; r > actual_rows; r--) {
- for (var c = this.cols; c >= 1; c--) {
- this.add_faux_cell(r, c);
- }
- }
-
- this.rows = max_rows;
-
- if (this.options.autogenerate_stylesheet) {
- this.generate_stylesheet();
- }
-
- return this;
- };
-
- /**
- * Add cols to the faux grid.
- *
- * @method add_faux_cols
- * @param {Number} cols The number of cols you want to add to the faux grid.
- * @return {Object} Returns the instance of the Gridster class.
- */
- fn.add_faux_cols = function(cols) {
- var actual_cols = this.cols;
- var max_cols = actual_cols + (cols || 1);
-
- for (var c = actual_cols; c < max_cols; c++) {
- for (var r = this.rows; r >= 1; r--) {
- this.add_faux_cell(r, c);
- }
- }
-
- this.cols = max_cols;
-
- if (this.options.autogenerate_stylesheet) {
- this.generate_stylesheet();
- }
-
- return this;
- };
-
-
- /**
- * Recalculates the offsets for the faux grid. You need to use it when
- * the browser is resized.
- *
- * @method recalculate_faux_grid
- * @return {Object} Returns the instance of the Gridster class.
- */
- fn.recalculate_faux_grid = function() {
- var aw = this.$wrapper.width();
- this.baseX = ($(window).width() - aw) / 2;
- this.baseY = this.$wrapper.offset().top;
-
- $.each(this.faux_grid, $.proxy(function(i, coords) {
- this.faux_grid[i] = coords.update({
- left: this.baseX + (coords.data.col -1) * this.min_widget_width,
- top: this.baseY + (coords.data.row -1) * this.min_widget_height
- });
-
- }, this));
-
- return this;
- };
-
-
- /**
- * Get all widgets in the DOM and register them.
- *
- * @method get_widgets_from_DOM
- * @return {Object} Returns the instance of the Gridster class.
- */
- fn.get_widgets_from_DOM = function() {
- this.$widgets.each($.proxy(function(i, widget) {
- this.register_widget($(widget));
- }, this));
- return this;
- };
-
-
- /**
- * Calculate columns and rows to be set based on the configuration
- * parameters, grid dimensions, etc ...
- *
- * @method generate_grid_and_stylesheet
- * @return {Object} Returns the instance of the Gridster class.
- */
- fn.generate_grid_and_stylesheet = function() {
- var aw = this.$wrapper.width();
- var ah = this.$wrapper.height();
-
- var cols = Math.floor(aw / this.min_widget_width) +
- this.options.extra_cols;
-
- var actual_cols = this.$widgets.map(function() {
- return $(this).attr('data-col');
- });
- actual_cols = Array.prototype.slice.call(actual_cols, 0);
- //needed to pass tests with phantomjs
- actual_cols.length || (actual_cols = [0]);
-
- var min_cols = Math.max.apply(Math, actual_cols);
-
- // get all rows that could be occupied by the current widgets
- var max_rows = this.options.extra_rows;
- this.$widgets.each(function(i, w) {
- max_rows += (+$(w).attr('data-sizey'));
- });
-
- this.cols = Math.max(min_cols, cols, this.options.min_cols);
- this.rows = Math.max(max_rows, this.options.min_rows);
-
- this.baseX = ($(window).width() - aw) / 2;
- this.baseY = this.$wrapper.offset().top;
-
- if (this.options.autogenerate_stylesheet) {
- this.generate_stylesheet();
- }
-
- return this.generate_faux_grid(this.rows, this.cols);
- };
-
- /**
- * Destroy this gridster by removing any sign of its presence, making it easy to avoid memory leaks
- *
- * @method destroy
- * @return {undefined}
- */
- fn.destroy = function(){
- // remove bound callback on window resize
- $(window).unbind('resize', this.on_window_resize);
-
- if(this.drag_api){
- this.drag_api.destroy();
- }
-
- // lastly, remove gridster element
- // this will additionally cause any data associated to this element to be removed, including this
- // very gridster instance
- this.$el.remove();
- };
-
-
- //jQuery adapter
- $.fn.gridster = function(options) {
- return this.each(function() {
- if (!$(this).data('gridster')) {
- $(this).data('gridster', new Gridster( this, options ));
- }
- });
- };
-
- $.Gridster = fn;
-
-}(jQuery, window, document));
\ No newline at end of file
diff --git a/templates/project/assets/javascripts/gridster/jquery.gridster.min.js b/templates/project/assets/javascripts/gridster/jquery.gridster.min.js
new file mode 100644
index 00000000..ac34904e
--- /dev/null
+++ b/templates/project/assets/javascripts/gridster/jquery.gridster.min.js
@@ -0,0 +1,2 @@
+/*! gridster.js - v0.5.1 - 2014-03-26 - * http://gridster.net/ - Copyright (c) 2014 ducksboard; Licensed MIT */ (function(t){function i(i){return i[0]&&t.isPlainObject(i[0])?this.data=i[0]:this.el=i,this.isCoords=!0,this.coords={},this.init(),this}var e=i.prototype;e.init=function(){this.set(),this.original_coords=this.get()},e.set=function(t,i){var e=this.el;if(e&&!t&&(this.data=e.offset(),this.data.width=e.width(),this.data.height=e.height()),e&&t&&!i){var s=e.offset();this.data.top=s.top,this.data.left=s.left}var r=this.data;return r.left===undefined&&(r.left=r.x1),r.top===undefined&&(r.top=r.y1),this.coords.x1=r.left,this.coords.y1=r.top,this.coords.x2=r.left+r.width,this.coords.y2=r.top+r.height,this.coords.cx=r.left+r.width/2,this.coords.cy=r.top+r.height/2,this.coords.width=r.width,this.coords.height=r.height,this.coords.el=e||!1,this},e.update=function(i){if(!i&&!this.el)return this;if(i){var e=t.extend({},this.data,i);return this.data=e,this.set(!0,!0)}return this.set(!0),this},e.get=function(){return this.coords},e.destroy=function(){this.el.removeData("coords"),delete this.el},t.fn.coords=function(){if(this.data("coords"))return this.data("coords");var t=new i(this,arguments[0]);return this.data("coords",t),t}})(jQuery,window,document),function(t,i,e){function s(i,e,s){this.options=t.extend(r,s),this.$element=i,this.last_colliders=[],this.last_colliders_coords=[],this.set_colliders(e),this.init()}var r={colliders_context:e.body,overlapping_region:"C"},o=s.prototype;o.init=function(){this.find_collisions()},o.overlaps=function(t,i){var e=!1,s=!1;return(i.x1>=t.x1&&i.x1<=t.x2||i.x2>=t.x1&&i.x2<=t.x2||t.x1>=i.x1&&t.x2<=i.x2)&&(e=!0),(i.y1>=t.y1&&i.y1<=t.y2||i.y2>=t.y1&&i.y2<=t.y2||t.y1>=i.y1&&t.y2<=i.y2)&&(s=!0),e&&s},o.detect_overlapping_region=function(t,i){var e="",s="";return t.y1>i.cy&&t.y1i.y1&&t.y2i.cx&&t.x1i.x1&&t.x2o;o++)-1===t.inArray(r[o],i)&&e.call(this,r[o]);for(var h=0,n=i.length;n>h;h++)-1===t.inArray(i[h],r)&&s.call(this,i[h])},o.find_collisions=function(i){for(var e=this,s=this.options.overlapping_region,r=[],o=[],a=this.colliders||this.$colliders,h=a.length,n=e.$element.coords().update(i||!1).get();h--;){var _=e.$colliders?t(a[h]):a[h],d=_.isCoords?_:_.coords(),l=d.get(),c=e.overlaps(n,l);if(c){var p=e.detect_overlapping_region(n,l);if(p===s||"all"===s){var g=e.calculate_overlapped_area_coords(n,l),u=e.calculate_overlapped_area(g),f={area:u,area_coords:g,region:p,coords:l,player_coords:n,el:_};e.options.on_overlap&&e.options.on_overlap.call(this,f),r.push(d),o.push(f)}}}return(e.options.on_overlap_stop||e.options.on_overlap_start)&&this.manage_colliders_start_stop(r,e.options.on_overlap_start,e.options.on_overlap_stop),this.last_colliders_coords=r,o},o.get_closest_colliders=function(t){var i=this.find_collisions(t);return i.sort(function(t,i){return"C"===t.region&&"C"===i.region?t.coords.y1this.player_max_left?r=this.player_max_left:this.player_min_left>r&&(r=this.player_min_left)),{position:{left:r,top:o},pointer:{left:i.left,top:i.top,diff_left:e+this.scroll_offset_x,diff_top:s+this.scroll_offset_y}}},d.get_drag_data=function(t){var i=this.get_offset(t);return i.$player=this.$player,i.$helper=this.helper?this.$helper:this.$player,i},d.set_limits=function(t){return t||(t=this.$container.width()),this.player_max_left=t-this.player_width+-this.options.offset_left,this.options.container_width=t,this},d.scroll_in=function(i,s){var r,h=a[i],n=50,d=30,l="x"===i,c=l?this.window_width:this.window_height,p=l?t(e).width():t(e).height(),g=l?this.$player.width():this.$player.height(),u=o["scroll"+_(h)](),f=u,w=f+c,m=w-n,y=f+n,v=f+s.pointer[h],z=p-c+g;return v>=m&&(r=u+d,z>r&&(o["scroll"+_(h)](r),this["scroll_offset_"+i]+=d)),y>=v&&(r=u-d,r>0&&(o["scroll"+_(h)](r),this["scroll_offset_"+i]-=d)),this},d.manage_scroll=function(t){this.scroll_in("x",t),this.scroll_in("y",t)},d.calculate_dimensions=function(){this.window_height=o.height(),this.window_width=o.width()},d.drag_handler=function(i){if(i.target.nodeName,!this.disabled&&(1===i.which||h)&&!this.ignore_drag(i)){var e=this,s=!0;return this.$player=t(i.currentTarget),this.el_init_pos=this.get_actual_pos(this.$player),this.mouse_init_pos=this.get_mouse_pos(i),this.offsetY=this.mouse_init_pos.top-this.el_init_pos.top,this.$body.on(n.move,function(t){var i=e.get_mouse_pos(t),r=Math.abs(i.left-e.mouse_init_pos.left),o=Math.abs(i.top-e.mouse_init_pos.top);return r>e.options.distance||o>e.options.distance?s?(s=!1,e.on_dragstart.call(e,t),!1):(e.is_dragging===!0&&e.on_dragmove.call(e,t),!1):!1}),h?undefined:!1}},d.on_dragstart=function(t){if(t.preventDefault(),this.is_dragging)return this;this.drag_start=this.is_dragging=!0;var i=this.$container.offset();return this.baseX=Math.round(i.left),this.baseY=Math.round(i.top),this.initial_container_width=this.options.container_width||this.$container.width(),"clone"===this.options.helper?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.helper=!1,this.scroll_offset_y=0,this.scroll_offset_x=0,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_height=this.$player.height(),this.set_limits(this.options.container_width),this.options.start&&this.options.start.call(this.$player,t,this.get_drag_data(t)),!1},d.on_dragmove=function(t){var i=this.get_drag_data(t);this.options.autoscroll&&this.manage_scroll(i),this.options.move_element&&(this.helper?this.$helper:this.$player).css({position:"absolute",left:i.position.left,top:i.position.top});var e=this.last_position||i.position;return i.prev_position=e,this.options.drag&&this.options.drag.call(this.$player,t,i),this.last_position=i.position,!1},d.on_dragstop=function(t){var i=this.get_drag_data(t);return this.drag_start=!1,this.options.stop&&this.options.stop.call(this.$player,t,i),this.helper&&this.options.remove_helper&&this.$helper.remove(),!1},d.on_select_start=function(t){return this.disabled||this.ignore_drag(t)?undefined:!1},d.enable=function(){this.disabled=!1},d.disable=function(){this.disabled=!0},d.destroy=function(){this.disable(),this.$container.off(".gridster-draggable"),this.$body.off(".gridster-draggable"),t(i).off(".gridster-draggable"),t.removeData(this.$container,"drag")},d.ignore_drag=function(i){return this.options.handle?!t(i.target).is(this.options.handle):t.isFunction(this.options.ignore_dragging)?this.options.ignore_dragging(i):t(i.target).is(this.options.ignore_dragging.join(", "))},t.fn.drag=function(t){return new s(this,t)}}(jQuery,window,document),function(t,i,e){function s(i,e){this.options=t.extend(!0,{},r,e),this.$el=t(i),this.$wrapper=this.$el.parent(),this.$widgets=this.$el.children(this.options.widget_selector).addClass("gs-w"),this.widgets=[],this.$changed=t([]),this.wrapper_width=this.$wrapper.width(),this.min_widget_width=2*this.options.widget_margins[0]+this.options.widget_base_dimensions[0],this.min_widget_height=2*this.options.widget_margins[1]+this.options.widget_base_dimensions[1],this.generated_stylesheets=[],this.$style_tags=t([]),this.init()}var r={namespace:"",widget_selector:"li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,max_cols:1/0,min_rows:15,max_size_x:!1,autogrow_cols:!1,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,serialize_params:function(t,i){return{col:i.col,row:i.row,size_x:i.size_x,size_y:i.size_y}},collision:{},draggable:{items:".gs-w",distance:4},resize:{enabled:!1,axes:["both"],handle_append_to:"",handle_class:"gs-resize-handle",max_size:[1/0,1/0],min_size:[1,1]}};s.generated_stylesheets=[];var o=s.prototype;o.init=function(){this.options.resize.enabled&&this.setup_resize(),this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.set_dom_grid_width(),this.$wrapper.addClass("ready"),this.draggable(),this.options.resize.enabled&&this.resizable(),t(i).bind("resize.gridster",throttle(t.proxy(this.recalculate_faux_grid,this),200))},o.disable=function(){return this.$wrapper.find(".player-revert").removeClass("player-revert"),this.drag_api.disable(),this},o.enable=function(){return this.drag_api.enable(),this},o.disable_resize=function(){return this.$el.addClass("gs-resize-disabled"),this.resize_api.disable(),this},o.enable_resize=function(){return this.$el.removeClass("gs-resize-disabled"),this.resize_api.enable(),this},o.add_widget=function(i,e,s,r,o,a,h){var n;e||(e=1),s||(s=1),!r&!o?n=this.next_position(e,s):(n={col:r,row:o},this.empty_cells(r,o,e,s));var _=t(i).attr({"data-col":n.col,"data-row":n.row,"data-sizex":e,"data-sizey":s}).addClass("gs-w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(_),this.register_widget(_),this.add_faux_rows(n.size_y),a&&this.set_widget_max_size(_,a),h&&this.set_widget_min_size(_,h),this.set_dom_grid_width(),this.set_dom_grid_height(),this.drag_api.set_limits(this.cols*this.min_widget_width),_.fadeIn()},o.set_widget_min_size=function(t,i){if(t="number"==typeof t?this.$widgets.eq(t):t,!t.length)return this;var e=t.data("coords").grid;return e.min_size_x=i[0],e.min_size_y=i[1],this},o.set_widget_max_size=function(t,i){if(t="number"==typeof t?this.$widgets.eq(t):t,!t.length)return this;var e=t.data("coords").grid;return e.max_size_x=i[0],e.max_size_y=i[1],this},o.add_resize_handle=function(i){var e=this.options.resize.handle_append_to;return t(this.resize_handle_tpl).appendTo(e?t(e,i):i),this},o.resize_widget=function(t,i,e,s){var r=t.coords().grid,o=r.col,a=this.options.max_cols,h=r.size_y,n=r.col,_=n;i||(i=r.size_x),e||(e=r.size_y),1/0!==a&&(i=Math.min(i,a-o+1)),e>h&&this.add_faux_rows(Math.max(e-h,0));var d=o+i-1;d>this.cols&&this.add_faux_cols(d-this.cols);var l={col:_,row:r.row,size_x:i,size_y:e};return this.mutate_widget_in_gridmap(t,r,l),this.set_dom_grid_height(),this.set_dom_grid_width(),s&&s.call(this,l.size_x,l.size_y),t},o.mutate_widget_in_gridmap=function(i,e,s){e.size_x;var r=e.size_y,o=this.get_cells_occupied(e),a=this.get_cells_occupied(s),h=[];t.each(o.cols,function(i,e){-1===t.inArray(e,a.cols)&&h.push(e)});var n=[];t.each(a.cols,function(i,e){-1===t.inArray(e,o.cols)&&n.push(e)});var _=[];t.each(o.rows,function(i,e){-1===t.inArray(e,a.rows)&&_.push(e)});var d=[];if(t.each(a.rows,function(i,e){-1===t.inArray(e,o.rows)&&d.push(e)}),this.remove_from_gridmap(e),n.length){var l=[s.col,s.row,s.size_x,Math.min(r,s.size_y),i];this.empty_cells.apply(this,l)}if(d.length){var c=[s.col,s.row,s.size_x,s.size_y,i];this.empty_cells.apply(this,c)}if(e.col=s.col,e.row=s.row,e.size_x=s.size_x,e.size_y=s.size_y,this.add_to_gridmap(s,i),i.removeClass("player-revert"),i.data("coords").update({width:s.size_x*this.options.widget_base_dimensions[0]+2*(s.size_x-1)*this.options.widget_margins[0],height:s.size_y*this.options.widget_base_dimensions[1]+2*(s.size_y-1)*this.options.widget_margins[1]}),i.attr({"data-col":s.col,"data-row":s.row,"data-sizex":s.size_x,"data-sizey":s.size_y}),h.length){var p=[h[0],s.row,h.length,Math.min(r,s.size_y),i];this.remove_empty_cells.apply(this,p)}if(_.length){var g=[s.col,s.row,s.size_x,s.size_y,i];this.remove_empty_cells.apply(this,g)}return this.move_widget_up(i),this},o.empty_cells=function(i,e,s,r,o){var a=this.widgets_below({col:i,row:e-r,size_x:s,size_y:r});return a.not(o).each(t.proxy(function(i,s){var o=t(s).coords().grid;if(e+r-1>=o.row){var a=e+r-o.row;this.move_widget_down(t(s),a)}},this)),this.set_dom_grid_height(),this},o.remove_empty_cells=function(i,e,s,r,o){var a=this.widgets_below({col:i,row:e,size_x:s,size_y:r});return a.not(o).each(t.proxy(function(i,e){this.move_widget_up(t(e),r)},this)),this.set_dom_grid_height(),this},o.next_position=function(t,i){t||(t=1),i||(i=1);for(var e,s=this.gridmap,r=s.length,o=[],a=1;r>a;a++){e=s[a].length;for(var h=1;e>=h;h++){var n=this.can_move_to({size_x:t,size_y:i},a,h);n&&o.push({col:a,row:h,size_y:i,size_x:t})}}return o.length?this.sort_by_row_and_col_asc(o)[0]:!1},o.remove_widget=function(i,e,s){var r=i instanceof t?i:t(i),o=r.coords().grid;t.isFunction(e)&&(s=e,e=!1),this.cells_occupied_by_placeholder={},this.$widgets=this.$widgets.not(r);var a=this.widgets_below(r);return this.remove_from_gridmap(o),r.fadeOut(t.proxy(function(){r.remove(),e||a.each(t.proxy(function(i,e){this.move_widget_up(t(e),o.size_y)},this)),this.set_dom_grid_height(),s&&s.call(this,i)},this)),this},o.remove_all_widgets=function(i){return this.$widgets.each(t.proxy(function(t,e){this.remove_widget(e,!0,i)},this)),this},o.serialize=function(i){i||(i=this.$widgets);var e=[];return i.each(t.proxy(function(i,s){e.push(this.options.serialize_params(t(s),t(s).coords().grid))},this)),e},o.serialize_changed=function(){return this.serialize(this.$changed)},o.register_widget=function(i){var e={col:parseInt(i.attr("data-col"),10),row:parseInt(i.attr("data-row"),10),size_x:parseInt(i.attr("data-sizex"),10),size_y:parseInt(i.attr("data-sizey"),10),max_size_x:parseInt(i.attr("data-max-sizex"),10)||!1,max_size_y:parseInt(i.attr("data-max-sizey"),10)||!1,min_size_x:parseInt(i.attr("data-min-sizex"),10)||!1,min_size_y:parseInt(i.attr("data-min-sizey"),10)||!1,el:i};return this.options.avoid_overlapped_widgets&&!this.can_move_to({size_x:e.size_x,size_y:e.size_y},e.col,e.row)&&(t.extend(e,this.next_position(e.size_x,e.size_y)),i.attr({"data-col":e.col,"data-row":e.row,"data-sizex":e.size_x,"data-sizey":e.size_y})),i.data("coords",i.coords()),i.data("coords").grid=e,this.add_to_gridmap(e,i),this.options.resize.enabled&&this.add_resize_handle(i),this},o.update_widget_position=function(t,i){return this.for_each_cell_occupied(t,function(t,e){return this.gridmap[t]?(this.gridmap[t][e]=i,undefined):this}),this},o.remove_from_gridmap=function(t){return this.update_widget_position(t,!1)},o.add_to_gridmap=function(i,e){if(this.update_widget_position(i,e||i.el),i.el){var s=this.widgets_below(i.el);s.each(t.proxy(function(i,e){this.move_widget_up(t(e))},this))}},o.draggable=function(){var i=this,e=t.extend(!0,{},this.options.draggable,{offset_left:this.options.widget_margins[0],offset_top:this.options.widget_margins[1],container_width:this.cols*this.min_widget_width,limit:!0,ignore_dragging:["INPUT","TEXTAREA","SELECT","BUTTON","."+this.options.resize.handle_class],start:function(e,s){i.$widgets.filter(".player-revert").removeClass("player-revert"),i.$player=t(this),i.$helper=t(s.$helper),i.helper=!i.$helper.is(i.$player),i.on_start_drag.call(i,e,s),i.$el.trigger("gridster:dragstart")},stop:function(t,e){i.on_stop_drag.call(i,t,e),i.$el.trigger("gridster:dragstop")},drag:throttle(function(t,e){i.on_drag.call(i,t,e),i.$el.trigger("gridster:drag")},60)});return this.drag_api=this.$el.drag(e),this},o.resizable=function(){return this.resize_api=this.$el.drag({items:"."+this.options.resize.handle_class,offset_left:this.options.widget_margins[0],container_width:this.container_width,move_element:!1,resize:!0,limit:this.options.autogrow_cols?!1:!0,start:t.proxy(this.on_start_resize,this),stop:t.proxy(function(i,e){delay(t.proxy(function(){this.on_stop_resize(i,e)},this),120)},this),drag:throttle(t.proxy(this.on_resize,this),60)}),this},o.setup_resize=function(){this.resize_handle_class=this.options.resize.handle_class;var i=this.options.resize.axes,e='';return this.resize_handle_tpl=t.map(i,function(t){return e.replace("{type}",t)}).join(""),this},o.on_start_drag=function(i,e){this.$helper.add(this.$player).add(this.$wrapper).addClass("dragging"),this.highest_col=this.get_highest_occupied_cell().col,this.$player.addClass("player"),this.player_grid_data=this.$player.coords().grid,this.placeholder_grid_data=t.extend({},this.player_grid_data),this.set_dom_grid_height(this.$el.height()+this.player_grid_data.size_y*this.min_widget_height),this.set_dom_grid_width(this.cols);var s=this.player_grid_data.size_x,r=this.cols-this.highest_col;this.options.autogrow_cols&&s>=r&&this.add_faux_cols(Math.min(s-r,1));var o=this.faux_grid,a=this.$player.data("coords").coords;this.cells_occupied_by_player=this.get_cells_occupied(this.player_grid_data),this.cells_occupied_by_placeholder=this.get_cells_occupied(this.placeholder_grid_data),this.last_cols=[],this.last_rows=[],this.collision_api=this.$helper.collision(o,this.options.collision),this.$preview_holder=t("<"+this.$player.get(0).tagName+" />",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:a.width,height:a.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,i,e)},o.on_drag=function(t,i){if(null===this.$player)return!1;var e={left:i.position.left+this.baseX,top:i.position.top+this.baseY};if(this.options.autogrow_cols){var s=this.placeholder_grid_data.col+this.placeholder_grid_data.size_x-1;s>=this.cols-1&&this.options.max_cols>=this.cols+1&&(this.add_faux_cols(1),this.set_dom_grid_width(this.cols+1),this.drag_api.set_limits(this.container_width)),this.collision_api.set_colliders(this.faux_grid)}this.colliders_data=this.collision_api.get_closest_colliders(e),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:i.position.left,top:i.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,t,i)},o.on_stop_drag=function(t,i){this.$helper.add(this.$player).add(this.$wrapper).removeClass("dragging"),i.position.left=i.position.left+this.baseX,i.position.top=i.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(i.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player-revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.options.draggable.stop&&this.options.draggable.stop.call(this,t,i),this.$preview_holder.remove(),this.$player=null,this.$helper=null,this.placeholder_grid_data={},this.player_grid_data={},this.cells_occupied_by_placeholder={},this.cells_occupied_by_player={},this.set_dom_grid_height(),this.set_dom_grid_width(),this.options.autogrow_cols&&this.drag_api.set_limits(this.cols*this.min_widget_width)},o.on_start_resize=function(i,e){this.$resized_widget=e.$player.closest(".gs-w"),this.resize_coords=this.$resized_widget.coords(),this.resize_wgd=this.resize_coords.grid,this.resize_initial_width=this.resize_coords.coords.width,this.resize_initial_height=this.resize_coords.coords.height,this.resize_initial_sizex=this.resize_coords.grid.size_x,this.resize_initial_sizey=this.resize_coords.grid.size_y,this.resize_initial_col=this.resize_coords.grid.col,this.resize_last_sizex=this.resize_initial_sizex,this.resize_last_sizey=this.resize_initial_sizey,this.resize_max_size_x=Math.min(this.resize_wgd.max_size_x||this.options.resize.max_size[0],this.options.max_cols-this.resize_initial_col+1),this.resize_max_size_y=this.resize_wgd.max_size_y||this.options.resize.max_size[1],this.resize_min_size_x=this.resize_wgd.min_size_x||this.options.resize.min_size[0]||1,this.resize_min_size_y=this.resize_wgd.min_size_y||this.options.resize.min_size[1]||1,this.resize_initial_last_col=this.get_highest_occupied_cell().col,this.set_dom_grid_width(this.cols),this.resize_dir={right:e.$player.is("."+this.resize_handle_class+"-x"),bottom:e.$player.is("."+this.resize_handle_class+"-y")},this.$resized_widget.css({"min-width":this.options.widget_base_dimensions[0],"min-height":this.options.widget_base_dimensions[1]});var s=this.$resized_widget.get(0).tagName;this.$resize_preview_holder=t("<"+s+" />",{"class":"preview-holder resize-preview-holder","data-row":this.$resized_widget.attr("data-row"),"data-col":this.$resized_widget.attr("data-col"),css:{width:this.resize_initial_width,height:this.resize_initial_height}}).appendTo(this.$el),this.$resized_widget.addClass("resizing"),this.options.resize.start&&this.options.resize.start.call(this,i,e,this.$resized_widget),this.$el.trigger("gridster:resizestart")},o.on_stop_resize=function(i,e){this.$resized_widget.removeClass("resizing").css({width:"",height:""}),delay(t.proxy(function(){this.$resize_preview_holder.remove().css({"min-width":"","min-height":""}),this.options.resize.stop&&this.options.resize.stop.call(this,i,e,this.$resized_widget),this.$el.trigger("gridster:resizestop")},this),300),this.set_dom_grid_width(),this.options.autogrow_cols&&this.drag_api.set_limits(this.cols*this.min_widget_width)},o.on_resize=function(t,i){var e,s=i.pointer.diff_left,r=i.pointer.diff_top,o=this.options.widget_base_dimensions[0],a=this.options.widget_base_dimensions[1],h=this.options.widget_margins[0],n=this.options.widget_margins[1],_=this.resize_max_size_x,d=this.resize_min_size_x,l=this.resize_max_size_y,c=this.resize_min_size_y,p=this.options.autogrow_cols,g=1/0,u=1/0,f=Math.ceil(s/(o+2*h)-.2),w=Math.ceil(r/(a+2*n)-.2),m=Math.max(1,this.resize_initial_sizex+f),y=Math.max(1,this.resize_initial_sizey+w),v=this.container_width/this.min_widget_width-this.resize_initial_col+1,z=v*this.min_widget_width-2*h;if(m=Math.max(Math.min(m,_),d),m=Math.min(v,m),e=_*o+2*(m-1)*h,g=Math.min(e,z),min_width=d*o+2*(m-1)*h,y=Math.max(Math.min(y,l),c),u=l*a+2*(y-1)*n,min_height=c*a+2*(y-1)*n,this.resize_dir.right?y=this.resize_initial_sizey:this.resize_dir.bottom&&(m=this.resize_initial_sizex),p){var x=this.resize_initial_col+m-1;p&&x>=this.resize_initial_last_col&&(this.set_dom_grid_width(Math.max(x+1,this.cols)),x>this.cols&&this.add_faux_cols(x-this.cols))}var $={};!this.resize_dir.bottom&&($.width=Math.max(Math.min(this.resize_initial_width+s,g),min_width)),!this.resize_dir.right&&($.height=Math.max(Math.min(this.resize_initial_height+r,u),min_height)),this.$resized_widget.css($),(m!==this.resize_last_sizex||y!==this.resize_last_sizey)&&(this.resize_widget(this.$resized_widget,m,y),this.set_dom_grid_width(this.cols),this.$resize_preview_holder.css({width:"",height:""}).attr({"data-row":this.$resized_widget.attr("data-row"),"data-sizex":m,"data-sizey":y})),this.options.resize.resize&&this.options.resize.resize.call(this,t,i,this.$resized_widget),this.$el.trigger("gridster:resize"),this.resize_last_sizex=m,this.resize_last_sizey=y},o.on_overlapped_column_change=function(i,e){if(!this.colliders_data.length)return this;var s,r=this.get_targeted_columns(this.colliders_data[0].el.data.col),o=this.last_cols.length,a=r.length;for(s=0;a>s;s++)-1===t.inArray(r[s],this.last_cols)&&(i||t.noop).call(this,r[s]);for(s=0;o>s;s++)-1===t.inArray(this.last_cols[s],r)&&(e||t.noop).call(this,this.last_cols[s]);return this.last_cols=r,this},o.on_overlapped_row_change=function(i,e){if(!this.colliders_data.length)return this;var s,r=this.get_targeted_rows(this.colliders_data[0].el.data.row),o=this.last_rows.length,a=r.length;for(s=0;a>s;s++)-1===t.inArray(r[s],this.last_rows)&&(i||t.noop).call(this,r[s]);for(s=0;o>s;s++)-1===t.inArray(this.last_rows[s],r)&&(e||t.noop).call(this,this.last_rows[s]);this.last_rows=r},o.set_player=function(t,i,e){var s=this;e||this.empty_cells_player_occupies();var r=e?{col:t}:s.colliders_data[0].el.data,o=r.col,a=i||r.row;this.player_grid_data={col:o,row:a,size_y:this.player_grid_data.size_y,size_x:this.player_grid_data.size_x},this.cells_occupied_by_player=this.get_cells_occupied(this.player_grid_data);var h=this.get_widgets_overlapped(this.player_grid_data),n=this.widgets_constraints(h);if(this.manage_movements(n.can_go_up,o,a),this.manage_movements(n.can_not_go_up,o,a),!h.length){var _=this.can_go_player_up(this.player_grid_data);_!==!1&&(a=_),this.set_placeholder(o,a)}return{col:o,row:a}},o.widgets_constraints=function(i){var e,s=t([]),r=[],o=[];return i.each(t.proxy(function(i,e){var a=t(e),h=a.coords().grid;this.can_go_widget_up(h)?(s=s.add(a),r.push(h)):o.push(h)},this)),e=i.not(s),{can_go_up:this.sort_by_row_asc(r),can_not_go_up:this.sort_by_row_desc(o)}},o.sort_by_row_asc=function(i){return i=i.sort(function(i,e){return i.row||(i=t(i).coords().grid,e=t(e).coords().grid),i.row>e.row?1:-1})},o.sort_by_row_and_col_asc=function(t){return t=t.sort(function(t,i){return t.row>i.row||t.row===i.row&&t.col>i.col?1:-1})},o.sort_by_col_asc=function(t){return t=t.sort(function(t,i){return t.col>i.col?1:-1})},o.sort_by_row_desc=function(t){return t=t.sort(function(t,i){return t.row+t.size_y=0&&t.inArray(e,s.rows)>=0},o.is_placeholder_in=function(i,e){var s=this.cells_occupied_by_placeholder||{};return this.is_placeholder_in_col(i)&&t.inArray(e,s.rows)>=0},o.is_placeholder_in_col=function(i){var e=this.cells_occupied_by_placeholder||[];return t.inArray(i,e.cols)>=0},o.is_empty=function(t,i){return this.gridmap[t]!==undefined?this.gridmap[t][i]!==undefined&&this.gridmap[t][i]===!1?!0:!1:!0},o.is_occupied=function(t,i){return this.gridmap[t]?this.gridmap[t][i]?!0:!1:!1},o.is_widget=function(t,i){var e=this.gridmap[t];return e?(e=e[i],e?e:!1):!1},o.is_widget_under_player=function(t,i){return this.is_widget(t,i)?this.is_player_in(t,i):!1},o.get_widgets_under_player=function(i){i||(i=this.cells_occupied_by_player||{cols:[],rows:[]});var e=t([]);return t.each(i.cols,t.proxy(function(s,r){t.each(i.rows,t.proxy(function(t,i){this.is_widget(r,i)&&(e=e.add(this.gridmap[r][i]))},this))},this)),e},o.set_placeholder=function(i,e){var s=t.extend({},this.placeholder_grid_data),r=this.widgets_below({col:s.col,row:s.row,size_y:s.size_y,size_x:s.size_x}),o=i+s.size_x-1;o>this.cols&&(i-=o-i);var a=e>this.placeholder_grid_data.row,h=this.placeholder_grid_data.col!==i;this.placeholder_grid_data.col=i,this.placeholder_grid_data.row=e,this.cells_occupied_by_placeholder=this.get_cells_occupied(this.placeholder_grid_data),this.$preview_holder.attr({"data-row":e,"data-col":i}),(a||h)&&r.each(t.proxy(function(e,r){this.move_widget_up(t(r),this.placeholder_grid_data.col-i+s.size_y)},this));var n=this.get_widgets_under_player(this.cells_occupied_by_placeholder);n.length&&n.each(t.proxy(function(i,r){var o=t(r);this.move_widget_down(o,e+s.size_y-o.data("coords").grid.row)},this))},o.can_go_player_up=function(t){var i=t.row+t.size_y-1,e=!0,s=[],r=1e4,o=this.get_widgets_under_player();return this.for_each_column_occupied(t,function(t){var a=this.gridmap[t],h=i+1;for(s[t]=[];--h>0&&(this.is_empty(t,h)||this.is_player(t,h)||this.is_widget(t,h)&&a[h].is(o));)s[t].push(h),r=r>h?h:r;return 0===s[t].length?(e=!1,!0):(s[t].sort(function(t,i){return t-i}),undefined)}),e?this.get_valid_rows(t,s,r):!1},o.can_go_widget_up=function(t){var i=t.row+t.size_y-1,e=!0,s=[],r=1e4;return this.for_each_column_occupied(t,function(o){var a=this.gridmap[o];s[o]=[];for(var h=i+1;--h>0&&(!this.is_widget(o,h)||this.is_player_in(o,h)||a[h].is(t.el));)this.is_player(o,h)||this.is_placeholder_in(o,h)||this.is_player_in(o,h)||s[o].push(h),r>h&&(r=h);return 0===s[o].length?(e=!1,!0):(s[o].sort(function(t,i){return t-i}),undefined)}),e?this.get_valid_rows(t,s,r):!1},o.get_valid_rows=function(i,e,s){for(var r=i.row,o=i.row+i.size_y-1,a=i.size_y,h=s-1,n=[];o>=++h;){var _=!0;if(t.each(e,function(i,e){t.isArray(e)&&-1===t.inArray(h,e)&&(_=!1)}),_===!0&&(n.push(h),n.length===a))break}var d=!1;return 1===a?n[0]!==r&&(d=n[0]||!1):n[0]!==r&&(d=this.get_consecutive_numbers_index(n,a)),d},o.get_consecutive_numbers_index=function(t,i){for(var e=t.length,s=[],r=!0,o=-1,a=0;e>a;a++){if(r||t[a]===o+1){if(s.push(a),s.length===i)break;r=!1}else s=[],r=!0;o=t[a]}return s.length>=i?t[s[0]]:!1},o.get_widgets_overlapped=function(){var i=t([]),e=[],s=this.cells_occupied_by_player.rows.slice(0);return s.reverse(),t.each(this.cells_occupied_by_player.cols,t.proxy(function(r,o){t.each(s,t.proxy(function(s,r){if(!this.gridmap[o])return!0;var a=this.gridmap[o][r];this.is_occupied(o,r)&&!this.is_player(a)&&-1===t.inArray(a,e)&&(i=i.add(a),e.push(a))
+},this))},this)),i},o.on_start_overlapping_column=function(t){this.set_player(t,!1)},o.on_start_overlapping_row=function(t){this.set_player(!1,t)},o.on_stop_overlapping_column=function(t){this.set_player(t,!1);var i=this;this.for_each_widget_below(t,this.cells_occupied_by_player.rows[0],function(){i.move_widget_up(this,i.player_grid_data.size_y)})},o.on_stop_overlapping_row=function(t){this.set_player(!1,t);for(var i=this,e=this.cells_occupied_by_player.cols,s=0,r=e.length;r>s;s++)this.for_each_widget_below(e[s],t,function(){i.move_widget_up(this,i.player_grid_data.size_y)})},o.move_widget_to=function(i,e){var s=this,r=i.coords().grid;e-r.row;var o=this.widgets_below(i),a=this.can_move_to(r,r.col,e,i);return a===!1?!1:(this.remove_from_gridmap(r),r.row=e,this.add_to_gridmap(r),i.attr("data-row",e),this.$changed=this.$changed.add(i),o.each(function(i,e){var r=t(e),o=r.coords().grid,a=s.can_go_widget_up(o);a&&a!==o.row&&s.move_widget_to(r,a)}),this)},o.move_widget_up=function(i,e){var s=i.coords().grid,r=s.row,o=[];return e||(e=1),this.can_go_up(i)?(this.for_each_column_occupied(s,function(s){if(-1===t.inArray(i,o)){var a=i.coords().grid,h=r-e;if(h=this.can_go_up_to_row(a,s,h),!h)return!0;var n=this.widgets_below(i);this.remove_from_gridmap(a),a.row=h,this.add_to_gridmap(a),i.attr("data-row",a.row),this.$changed=this.$changed.add(i),o.push(i),n.each(t.proxy(function(i,s){this.move_widget_up(t(s),e)},this))}}),undefined):!1},o.move_widget_down=function(i,e){var s,r,o,a;if(0>=e)return!1;if(s=i.coords().grid,r=s.row,o=[],a=e,!i)return!1;if(-1===t.inArray(i,o)){var h=i.coords().grid,n=r+e,_=this.widgets_below(i);this.remove_from_gridmap(h),_.each(t.proxy(function(i,e){var s=t(e),r=s.coords().grid,o=this.displacement_diff(r,h,a);o>0&&this.move_widget_down(s,o)},this)),h.row=n,this.update_widget_position(h,i),i.attr("data-row",h.row),this.$changed=this.$changed.add(i),o.push(i)}},o.can_go_up_to_row=function(i,e,s){var r,o=this.gridmap,a=!0,h=[],n=i.row;if(this.for_each_column_occupied(i,function(t){for(o[t],h[t]=[],r=n;r--&&this.is_empty(t,r)&&!this.is_placeholder_in(t,r);)h[t].push(r);return h[t].length?undefined:(a=!1,!0)}),!a)return!1;for(r=s,r=1;n>r;r++){for(var _=!0,d=0,l=h.length;l>d;d++)h[d]&&-1===t.inArray(r,h[d])&&(_=!1);if(_===!0){a=r;break}}return a},o.displacement_diff=function(t,i,e){var s=t.row,r=[],o=i.row+i.size_y;this.for_each_column_occupied(t,function(t){for(var i=0,e=o;s>e;e++)this.is_empty(t,e)&&(i+=1);r.push(i)});var a=Math.max.apply(Math,r);return e-=a,e>0?e:0},o.widgets_below=function(i){var e=t.isPlainObject(i)?i:i.coords().grid,s=this;this.gridmap;var r=e.row+e.size_y-1,o=t([]);return this.for_each_column_occupied(e,function(i){s.for_each_widget_below(i,r,function(){return s.is_player(this)||-1!==t.inArray(this,o)?undefined:(o=o.add(this),!0)})}),this.sort_by_row_asc(o)},o.set_cells_player_occupies=function(t,i){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=t,this.placeholder_grid_data.row=i,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},o.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},o.can_go_up=function(t){var i=t.coords().grid,e=i.row,s=e-1;this.gridmap;var r=!0;return 1===e?!1:(this.for_each_column_occupied(i,function(t){return this.is_widget(t,s),this.is_occupied(t,s)||this.is_player(t,s)||this.is_placeholder_in(t,s)||this.is_player_in(t,s)?(r=!1,!0):undefined}),r)},o.can_move_to=function(t,i,e,s){this.gridmap;var r=t.el,o={size_y:t.size_y,size_x:t.size_x,col:i,row:e},a=!0,h=i+t.size_x-1;return h>this.cols?!1:s&&e+t.size_y-1>s?!1:(this.for_each_cell_occupied(o,function(i,e){var s=this.is_widget(i,e);!s||t.el&&!s.is(r)||(a=!1)}),a)},o.get_targeted_columns=function(t){for(var i=(t||this.player_grid_data.col)+(this.player_grid_data.size_x-1),e=[],s=t;i>=s;s++)e.push(s);return e},o.get_targeted_rows=function(t){for(var i=(t||this.player_grid_data.row)+(this.player_grid_data.size_y-1),e=[],s=t;i>=s;s++)e.push(s);return e},o.get_cells_occupied=function(i){var e,s={cols:[],rows:[]};for(arguments[1]instanceof t&&(i=arguments[1].coords().grid),e=0;i.size_x>e;e++){var r=i.col+e;s.cols.push(r)}for(e=0;i.size_y>e;e++){var o=i.row+e;s.rows.push(o)}return s},o.for_each_cell_occupied=function(t,i){return this.for_each_column_occupied(t,function(e){this.for_each_row_occupied(t,function(t){i.call(this,e,t)})}),this},o.for_each_column_occupied=function(t,i){for(var e=0;t.size_x>e;e++){var s=t.col+e;i.call(this,s,t)}},o.for_each_row_occupied=function(t,i){for(var e=0;t.size_y>e;e++){var s=t.row+e;i.call(this,s,t)}},o._traversing_widgets=function(i,e,s,r,o){var a=this.gridmap;if(a[s]){var h,n,_=i+"/"+e;if(arguments[2]instanceof t){var d=arguments[2].coords().grid;s=d.col,r=d.row,o=arguments[3]}var l=[],c=r,p={"for_each/above":function(){for(;c--&&!(c>0&&this.is_widget(s,c)&&-1===t.inArray(a[s][c],l)&&(h=o.call(a[s][c],s,c),l.push(a[s][c]),h)););},"for_each/below":function(){for(c=r+1,n=a[s].length;n>c&&(!this.is_widget(s,c)||-1!==t.inArray(a[s][c],l)||(h=o.call(a[s][c],s,c),l.push(a[s][c]),!h));c++);}};p[_]&&p[_].call(this)}},o.for_each_widget_above=function(t,i,e){return this._traversing_widgets("for_each","above",t,i,e),this},o.for_each_widget_below=function(t,i,e){return this._traversing_widgets("for_each","below",t,i,e),this},o.get_highest_occupied_cell=function(){for(var t,i=this.gridmap,e=i[1].length,s=[],r=[],o=i.length-1;o>=1;o--)for(t=e-1;t>=1;t--)if(this.is_widget(o,t)){s.push(t),r.push(o);break}return{col:Math.max.apply(Math,r),row:Math.max.apply(Math,s)}},o.get_widgets_from=function(i,e){this.gridmap;var s=t();return i&&(s=s.add(this.$widgets.filter(function(){var e=t(this).attr("data-col");return e===i||e>i}))),e&&(s=s.add(this.$widgets.filter(function(){var i=t(this).attr("data-row");return i===e||i>e}))),s},o.set_dom_grid_height=function(t){if(t===undefined){var i=this.get_highest_occupied_cell().row;t=i*this.min_widget_height}return this.container_height=t,this.$el.css("height",this.container_height),this},o.set_dom_grid_width=function(t){t===undefined&&(t=this.get_highest_occupied_cell().col);var i=this.options.autogrow_cols?this.options.max_cols:this.cols;return t=Math.min(i,Math.max(t,this.options.min_cols)),this.container_width=t*this.min_widget_width,this.$el.css("width",this.container_width),this},o.generate_stylesheet=function(i){var e,r="",o=this.options.max_size_x||this.cols;i||(i={}),i.cols||(i.cols=this.cols),i.rows||(i.rows=this.rows),i.namespace||(i.namespace=this.options.namespace),i.widget_base_dimensions||(i.widget_base_dimensions=this.options.widget_base_dimensions),i.widget_margins||(i.widget_margins=this.options.widget_margins),i.min_widget_width=2*i.widget_margins[0]+i.widget_base_dimensions[0],i.min_widget_height=2*i.widget_margins[1]+i.widget_base_dimensions[1];var a=t.param(i);if(t.inArray(a,s.generated_stylesheets)>=0)return!1;for(this.generated_stylesheets.push(a),s.generated_stylesheets.push(a),e=i.cols;e>=0;e--)r+=i.namespace+' [data-col="'+(e+1)+'"] { left:'+(e*i.widget_base_dimensions[0]+e*i.widget_margins[0]+(e+1)*i.widget_margins[0])+"px; }\n";for(e=i.rows;e>=0;e--)r+=i.namespace+' [data-row="'+(e+1)+'"] { top:'+(e*i.widget_base_dimensions[1]+e*i.widget_margins[1]+(e+1)*i.widget_margins[1])+"px; }\n";for(var h=1;i.rows>=h;h++)r+=i.namespace+' [data-sizey="'+h+'"] { height:'+(h*i.widget_base_dimensions[1]+(h-1)*2*i.widget_margins[1])+"px; }\n";for(var n=1;o>=n;n++)r+=i.namespace+' [data-sizex="'+n+'"] { width:'+(n*i.widget_base_dimensions[0]+(n-1)*2*i.widget_margins[0])+"px; }\n";return this.add_style_tag(r)},o.add_style_tag=function(t){var i=e,s=i.createElement("style");return i.getElementsByTagName("head")[0].appendChild(s),s.setAttribute("type","text/css"),s.styleSheet?s.styleSheet.cssText=t:s.appendChild(e.createTextNode(t)),this.$style_tags=this.$style_tags.add(s),this},o.remove_style_tags=function(){var i=s.generated_stylesheets,e=this.generated_stylesheets;this.$style_tags.remove(),s.generated_stylesheets=t.map(i,function(i){return-1===t.inArray(i,e)?i:undefined})},o.generate_faux_grid=function(t,i){this.faux_grid=[],this.gridmap=[];var e,s;for(e=i;e>0;e--)for(this.gridmap[e]=[],s=t;s>0;s--)this.add_faux_cell(s,e);return this},o.add_faux_cell=function(i,e){var s=t({left:this.baseX+(e-1)*this.min_widget_width,top:this.baseY+(i-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:e,row:i,original_col:e,original_row:i}).coords();return t.isArray(this.gridmap[e])||(this.gridmap[e]=[]),this.gridmap[e][i]=!1,this.faux_grid.push(s),this},o.add_faux_rows=function(t){for(var i=this.rows,e=i+(t||1),s=e;s>i;s--)for(var r=this.cols;r>=1;r--)this.add_faux_cell(s,r);return this.rows=e,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this},o.add_faux_cols=function(t){var i=this.cols,e=i+(t||1);e=Math.min(e,this.options.max_cols);for(var s=i+1;e>=s;s++)for(var r=this.rows;r>=1;r--)this.add_faux_cell(r,s);return this.cols=e,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this},o.recalculate_faux_grid=function(){var e=this.$wrapper.width();return this.baseX=(t(i).width()-e)/2,this.baseY=this.$wrapper.offset().top,t.each(this.faux_grid,t.proxy(function(t,i){this.faux_grid[t]=i.update({left:this.baseX+(i.data.col-1)*this.min_widget_width,top:this.baseY+(i.data.row-1)*this.min_widget_height})},this)),this},o.get_widgets_from_DOM=function(){return this.$widgets.each(t.proxy(function(i,e){this.register_widget(t(e))},this)),this},o.generate_grid_and_stylesheet=function(){var e=this.$wrapper.width(),s=this.options.max_cols,r=Math.floor(e/this.min_widget_width)+this.options.extra_cols,o=this.$widgets.map(function(){return t(this).attr("data-col")}).get();o.length||(o=[0]);var a=Math.max.apply(Math,o);this.cols=Math.max(a,r,this.options.min_cols),1/0!==s&&s>=a&&this.cols>s&&(this.cols=s);var h=this.options.extra_rows;return this.$widgets.each(function(i,e){h+=+t(e).attr("data-sizey")}),this.rows=Math.max(h,this.options.min_rows),this.baseX=(t(i).width()-e)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},o.destroy=function(e){return this.$el.removeData("gridster"),t(i).unbind(".gridster"),this.drag_api&&this.drag_api.destroy(),this.remove_style_tags(),e&&this.$el.remove(),this},t.fn.gridster=function(i){return this.each(function(){t(this).data("gridster")||t(this).data("gridster",new s(this,i))})},t.Gridster=o}(jQuery,window,document);
diff --git a/templates/project/assets/stylesheets/application.scss b/templates/project/assets/stylesheets/application.scss
index 091ac69b..451f03e3 100644
--- a/templates/project/assets/stylesheets/application.scss
+++ b/templates/project/assets/stylesheets/application.scss
@@ -144,9 +144,9 @@ h3 {
}
.widget {
- padding: 25px 12px;
text-align: center;
- width: 100%;
+ width: inherit;
+ height: inherit;
display: table-cell;
vertical-align: middle;
}
diff --git a/templates/project/assets/stylesheets/font-awesome.css b/templates/project/assets/stylesheets/font-awesome.css
index 69ae8434..cf6fe783 100644
--- a/templates/project/assets/stylesheets/font-awesome.css
+++ b/templates/project/assets/stylesheets/font-awesome.css
@@ -1,1479 +1,2086 @@
/*!
- * Font Awesome 3.2.1
- * the iconic font designed for Bootstrap
- * ------------------------------------------------------------------------------
- * The full suite of pictographic icons, examples, and documentation can be
- * found at http://fontawesome.io. Stay up to date on Twitter at
- * http://twitter.com/fontawesome.
- *
- * License
- * ------------------------------------------------------------------------------
- * - The Font Awesome font is licensed under SIL OFL 1.1 -
- * http://scripts.sil.org/OFL
- * - Font Awesome CSS, LESS, and SASS files are licensed under MIT License -
- * http://opensource.org/licenses/mit-license.html
- * - Font Awesome documentation licensed under CC BY 3.0 -
- * http://creativecommons.org/licenses/by/3.0/
- * - Attribution is no longer required in Font Awesome 3.0, but much appreciated:
- * "Font Awesome by Dave Gandy - http://fontawesome.io"
- *
- * Author - Dave Gandy
- * ------------------------------------------------------------------------------
- * Email: dave@fontawesome.io
- * Twitter: http://twitter.com/davegandy
- * Work: Lead Product Designer @ Kyruus - http://kyruus.com
+ * Font Awesome 4.5.0 by @davegandy - http://fontawesome.io - @fontawesome
+ * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
*/
/* FONT PATH
* -------------------------- */
@font-face {
font-family: 'FontAwesome';
- src: url('../assets/fontawesome-webfont.eot?v=3.2.1');
- src: url('../assets/fontawesome-webfont.eot?#iefix&v=3.2.1') format('embedded-opentype'), url('../assets/fontawesome-webfont.woff?v=3.2.1') format('woff'), url('../assets/fontawesome-webfont.ttf?v=3.2.1') format('truetype'), url('../assets/fontawesome-webfont.svg#fontawesomeregular?v=3.2.1') format('svg');
+ src: url('../assets/fontawesome-webfont.eot?v=4.5.0');
+ src: url('../assets/fontawesome-webfont.eot?#iefix&v=4.5.0') format('embedded-opentype'), url('../assets/fontawesome-webfont.woff2?v=4.5.0') format('woff2'), url('../assets/fontawesome-webfont.woff?v=4.5.0') format('woff'), url('../assets/fontawesome-webfont.ttf?v=4.5.0') format('truetype'), url('../assets/fontawesome-webfont.svg?v=4.5.0#fontawesomeregular') format('svg');
font-weight: normal;
font-style: normal;
}
-/* FONT AWESOME CORE
- * -------------------------- */
-[class^="icon-"],
-[class*=" icon-"] {
- font-family: FontAwesome;
- font-weight: normal;
- font-style: normal;
- text-decoration: inherit;
- -webkit-font-smoothing: antialiased;
- *margin-right: .3em;
-}
-[class^="icon-"]:before,
-[class*=" icon-"]:before {
- text-decoration: inherit;
+.fa {
display: inline-block;
- speak: none;
+ font: normal normal normal 14px/1 FontAwesome;
+ font-size: inherit;
+ text-rendering: auto;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
}
/* makes the font 33% larger relative to the icon container */
-.icon-large:before {
- vertical-align: -10%;
- font-size: 1.3333333333333333em;
-}
-/* makes sure icons active on rollover in links */
-a [class^="icon-"],
-a [class*=" icon-"] {
- display: inline;
-}
-/* increased font size for icon-large */
-[class^="icon-"].icon-fixed-width,
-[class*=" icon-"].icon-fixed-width {
- display: inline-block;
- width: 1.1428571428571428em;
- text-align: right;
- padding-right: 0.2857142857142857em;
+.fa-lg {
+ font-size: 1.33333333em;
+ line-height: 0.75em;
+ vertical-align: -15%;
}
-[class^="icon-"].icon-fixed-width.icon-large,
-[class*=" icon-"].icon-fixed-width.icon-large {
- width: 1.4285714285714286em;
+.fa-2x {
+ font-size: 2em;
}
-.icons-ul {
- margin-left: 2.142857142857143em;
- list-style-type: none;
+.fa-3x {
+ font-size: 3em;
}
-.icons-ul > li {
- position: relative;
+.fa-4x {
+ font-size: 4em;
}
-.icons-ul .icon-li {
- position: absolute;
- left: -2.142857142857143em;
- width: 2.142857142857143em;
+.fa-5x {
+ font-size: 5em;
+}
+.fa-fw {
+ width: 1.28571429em;
text-align: center;
- line-height: inherit;
}
-[class^="icon-"].hide,
-[class*=" icon-"].hide {
- display: none;
+.fa-ul {
+ padding-left: 0;
+ margin-left: 2.14285714em;
+ list-style-type: none;
}
-.icon-muted {
- color: #eeeeee;
+.fa-ul > li {
+ position: relative;
}
-.icon-light {
- color: #ffffff;
+.fa-li {
+ position: absolute;
+ left: -2.14285714em;
+ width: 2.14285714em;
+ top: 0.14285714em;
+ text-align: center;
}
-.icon-dark {
- color: #333333;
+.fa-li.fa-lg {
+ left: -1.85714286em;
}
-.icon-border {
- border: solid 1px #eeeeee;
+.fa-border {
padding: .2em .25em .15em;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- border-radius: 3px;
-}
-.icon-2x {
- font-size: 2em;
-}
-.icon-2x.icon-border {
- border-width: 2px;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
-}
-.icon-3x {
- font-size: 3em;
-}
-.icon-3x.icon-border {
- border-width: 3px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
+ border: solid 0.08em #eeeeee;
+ border-radius: .1em;
}
-.icon-4x {
- font-size: 4em;
+.fa-pull-left {
+ float: left;
}
-.icon-4x.icon-border {
- border-width: 4px;
- -webkit-border-radius: 6px;
- -moz-border-radius: 6px;
- border-radius: 6px;
+.fa-pull-right {
+ float: right;
}
-.icon-5x {
- font-size: 5em;
+.fa.fa-pull-left {
+ margin-right: .3em;
}
-.icon-5x.icon-border {
- border-width: 5px;
- -webkit-border-radius: 7px;
- -moz-border-radius: 7px;
- border-radius: 7px;
+.fa.fa-pull-right {
+ margin-left: .3em;
}
+/* Deprecated as of 4.4.0 */
.pull-right {
float: right;
}
.pull-left {
float: left;
}
-[class^="icon-"].pull-left,
-[class*=" icon-"].pull-left {
+.fa.pull-left {
margin-right: .3em;
}
-[class^="icon-"].pull-right,
-[class*=" icon-"].pull-right {
+.fa.pull-right {
margin-left: .3em;
}
-/* BOOTSTRAP SPECIFIC CLASSES
- * -------------------------- */
-/* Bootstrap 2.0 sprites.less reset */
-[class^="icon-"],
-[class*=" icon-"] {
- display: inline;
- width: auto;
- height: auto;
- line-height: normal;
- vertical-align: baseline;
- background-image: none;
- background-position: 0% 0%;
- background-repeat: repeat;
- margin-top: 0;
-}
-/* more sprites.less reset */
-.icon-white,
-.nav-pills > .active > a > [class^="icon-"],
-.nav-pills > .active > a > [class*=" icon-"],
-.nav-list > .active > a > [class^="icon-"],
-.nav-list > .active > a > [class*=" icon-"],
-.navbar-inverse .nav > .active > a > [class^="icon-"],
-.navbar-inverse .nav > .active > a > [class*=" icon-"],
-.dropdown-menu > li > a:hover > [class^="icon-"],
-.dropdown-menu > li > a:hover > [class*=" icon-"],
-.dropdown-menu > .active > a > [class^="icon-"],
-.dropdown-menu > .active > a > [class*=" icon-"],
-.dropdown-submenu:hover > a > [class^="icon-"],
-.dropdown-submenu:hover > a > [class*=" icon-"] {
- background-image: none;
-}
-/* keeps Bootstrap styles with and without icons the same */
-.btn [class^="icon-"].icon-large,
-.nav [class^="icon-"].icon-large,
-.btn [class*=" icon-"].icon-large,
-.nav [class*=" icon-"].icon-large {
- line-height: .9em;
-}
-.btn [class^="icon-"].icon-spin,
-.nav [class^="icon-"].icon-spin,
-.btn [class*=" icon-"].icon-spin,
-.nav [class*=" icon-"].icon-spin {
- display: inline-block;
+.fa-spin {
+ -webkit-animation: fa-spin 2s infinite linear;
+ animation: fa-spin 2s infinite linear;
}
-.nav-tabs [class^="icon-"],
-.nav-pills [class^="icon-"],
-.nav-tabs [class*=" icon-"],
-.nav-pills [class*=" icon-"],
-.nav-tabs [class^="icon-"].icon-large,
-.nav-pills [class^="icon-"].icon-large,
-.nav-tabs [class*=" icon-"].icon-large,
-.nav-pills [class*=" icon-"].icon-large {
- line-height: .9em;
-}
-.btn [class^="icon-"].pull-left.icon-2x,
-.btn [class*=" icon-"].pull-left.icon-2x,
-.btn [class^="icon-"].pull-right.icon-2x,
-.btn [class*=" icon-"].pull-right.icon-2x {
- margin-top: .18em;
-}
-.btn [class^="icon-"].icon-spin.icon-large,
-.btn [class*=" icon-"].icon-spin.icon-large {
- line-height: .8em;
-}
-.btn.btn-small [class^="icon-"].pull-left.icon-2x,
-.btn.btn-small [class*=" icon-"].pull-left.icon-2x,
-.btn.btn-small [class^="icon-"].pull-right.icon-2x,
-.btn.btn-small [class*=" icon-"].pull-right.icon-2x {
- margin-top: .25em;
-}
-.btn.btn-large [class^="icon-"],
-.btn.btn-large [class*=" icon-"] {
- margin-top: 0;
-}
-.btn.btn-large [class^="icon-"].pull-left.icon-2x,
-.btn.btn-large [class*=" icon-"].pull-left.icon-2x,
-.btn.btn-large [class^="icon-"].pull-right.icon-2x,
-.btn.btn-large [class*=" icon-"].pull-right.icon-2x {
- margin-top: .05em;
-}
-.btn.btn-large [class^="icon-"].pull-left.icon-2x,
-.btn.btn-large [class*=" icon-"].pull-left.icon-2x {
- margin-right: .2em;
-}
-.btn.btn-large [class^="icon-"].pull-right.icon-2x,
-.btn.btn-large [class*=" icon-"].pull-right.icon-2x {
- margin-left: .2em;
-}
-/* Fixes alignment in nav lists */
-.nav-list [class^="icon-"],
-.nav-list [class*=" icon-"] {
- line-height: inherit;
+.fa-pulse {
+ -webkit-animation: fa-spin 1s infinite steps(8);
+ animation: fa-spin 1s infinite steps(8);
}
-/* EXTRAS
- * -------------------------- */
-/* Stacked and layered icon */
-.icon-stack {
- position: relative;
- display: inline-block;
- width: 2em;
- height: 2em;
- line-height: 2em;
- vertical-align: -35%;
-}
-.icon-stack [class^="icon-"],
-.icon-stack [class*=" icon-"] {
- display: block;
- text-align: center;
- position: absolute;
- width: 100%;
- height: 100%;
- font-size: 1em;
- line-height: inherit;
- *line-height: 2em;
-}
-.icon-stack .icon-stack-base {
- font-size: 2em;
- *line-height: 1em;
-}
-/* Animated rotating icon */
-.icon-spin {
- display: inline-block;
- -moz-animation: spin 2s infinite linear;
- -o-animation: spin 2s infinite linear;
- -webkit-animation: spin 2s infinite linear;
- animation: spin 2s infinite linear;
-}
-/* Prevent stack and spinners from being taken inline when inside a link */
-a .icon-stack,
-a .icon-spin {
- display: inline-block;
- text-decoration: none;
-}
-@-moz-keyframes spin {
- 0% {
- -moz-transform: rotate(0deg);
- }
- 100% {
- -moz-transform: rotate(359deg);
- }
-}
-@-webkit-keyframes spin {
+@-webkit-keyframes fa-spin {
0% {
-webkit-transform: rotate(0deg);
+ transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(359deg);
+ transform: rotate(359deg);
}
}
-@-o-keyframes spin {
- 0% {
- -o-transform: rotate(0deg);
- }
- 100% {
- -o-transform: rotate(359deg);
- }
-}
-@-ms-keyframes spin {
- 0% {
- -ms-transform: rotate(0deg);
- }
- 100% {
- -ms-transform: rotate(359deg);
- }
-}
-@keyframes spin {
+@keyframes fa-spin {
0% {
+ -webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
+ -webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
-/* Icon rotations and mirroring */
-.icon-rotate-90:before {
+.fa-rotate-90 {
+ filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
-webkit-transform: rotate(90deg);
- -moz-transform: rotate(90deg);
-ms-transform: rotate(90deg);
- -o-transform: rotate(90deg);
transform: rotate(90deg);
- filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
}
-.icon-rotate-180:before {
+.fa-rotate-180 {
+ filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2);
-webkit-transform: rotate(180deg);
- -moz-transform: rotate(180deg);
-ms-transform: rotate(180deg);
- -o-transform: rotate(180deg);
transform: rotate(180deg);
- filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2);
}
-.icon-rotate-270:before {
+.fa-rotate-270 {
+ filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
-webkit-transform: rotate(270deg);
- -moz-transform: rotate(270deg);
-ms-transform: rotate(270deg);
- -o-transform: rotate(270deg);
transform: rotate(270deg);
- filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}
-.icon-flip-horizontal:before {
+.fa-flip-horizontal {
+ filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);
-webkit-transform: scale(-1, 1);
- -moz-transform: scale(-1, 1);
-ms-transform: scale(-1, 1);
- -o-transform: scale(-1, 1);
transform: scale(-1, 1);
}
-.icon-flip-vertical:before {
+.fa-flip-vertical {
+ filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);
-webkit-transform: scale(1, -1);
- -moz-transform: scale(1, -1);
-ms-transform: scale(1, -1);
- -o-transform: scale(1, -1);
transform: scale(1, -1);
}
-/* ensure rotation occurs inside anchor tags */
-a .icon-rotate-90:before,
-a .icon-rotate-180:before,
-a .icon-rotate-270:before,
-a .icon-flip-horizontal:before,
-a .icon-flip-vertical:before {
+:root .fa-rotate-90,
+:root .fa-rotate-180,
+:root .fa-rotate-270,
+:root .fa-flip-horizontal,
+:root .fa-flip-vertical {
+ filter: none;
+}
+.fa-stack {
+ position: relative;
display: inline-block;
+ width: 2em;
+ height: 2em;
+ line-height: 2em;
+ vertical-align: middle;
+}
+.fa-stack-1x,
+.fa-stack-2x {
+ position: absolute;
+ left: 0;
+ width: 100%;
+ text-align: center;
+}
+.fa-stack-1x {
+ line-height: inherit;
+}
+.fa-stack-2x {
+ font-size: 2em;
+}
+.fa-inverse {
+ color: #ffffff;
}
/* Font Awesome uses the Unicode Private Use Area (PUA) to ensure screen
readers do not read off random characters that represent icons */
-.icon-glass:before {
+.fa-glass:before {
content: "\f000";
}
-.icon-music:before {
+.fa-music:before {
content: "\f001";
}
-.icon-search:before {
+.fa-search:before {
content: "\f002";
}
-.icon-envelope-alt:before {
+.fa-envelope-o:before {
content: "\f003";
}
-.icon-heart:before {
+.fa-heart:before {
content: "\f004";
}
-.icon-star:before {
+.fa-star:before {
content: "\f005";
}
-.icon-star-empty:before {
+.fa-star-o:before {
content: "\f006";
}
-.icon-user:before {
+.fa-user:before {
content: "\f007";
}
-.icon-film:before {
+.fa-film:before {
content: "\f008";
}
-.icon-th-large:before {
+.fa-th-large:before {
content: "\f009";
}
-.icon-th:before {
+.fa-th:before {
content: "\f00a";
}
-.icon-th-list:before {
+.fa-th-list:before {
content: "\f00b";
}
-.icon-ok:before {
+.fa-check:before {
content: "\f00c";
}
-.icon-remove:before {
+.fa-remove:before,
+.fa-close:before,
+.fa-times:before {
content: "\f00d";
}
-.icon-zoom-in:before {
+.fa-search-plus:before {
content: "\f00e";
}
-.icon-zoom-out:before {
+.fa-search-minus:before {
content: "\f010";
}
-.icon-power-off:before,
-.icon-off:before {
+.fa-power-off:before {
content: "\f011";
}
-.icon-signal:before {
+.fa-signal:before {
content: "\f012";
}
-.icon-gear:before,
-.icon-cog:before {
+.fa-gear:before,
+.fa-cog:before {
content: "\f013";
}
-.icon-trash:before {
+.fa-trash-o:before {
content: "\f014";
}
-.icon-home:before {
+.fa-home:before {
content: "\f015";
}
-.icon-file-alt:before {
+.fa-file-o:before {
content: "\f016";
}
-.icon-time:before {
+.fa-clock-o:before {
content: "\f017";
}
-.icon-road:before {
+.fa-road:before {
content: "\f018";
}
-.icon-download-alt:before {
+.fa-download:before {
content: "\f019";
}
-.icon-download:before {
+.fa-arrow-circle-o-down:before {
content: "\f01a";
}
-.icon-upload:before {
+.fa-arrow-circle-o-up:before {
content: "\f01b";
}
-.icon-inbox:before {
+.fa-inbox:before {
content: "\f01c";
}
-.icon-play-circle:before {
+.fa-play-circle-o:before {
content: "\f01d";
}
-.icon-rotate-right:before,
-.icon-repeat:before {
+.fa-rotate-right:before,
+.fa-repeat:before {
content: "\f01e";
}
-.icon-refresh:before {
+.fa-refresh:before {
content: "\f021";
}
-.icon-list-alt:before {
+.fa-list-alt:before {
content: "\f022";
}
-.icon-lock:before {
+.fa-lock:before {
content: "\f023";
}
-.icon-flag:before {
+.fa-flag:before {
content: "\f024";
}
-.icon-headphones:before {
+.fa-headphones:before {
content: "\f025";
}
-.icon-volume-off:before {
+.fa-volume-off:before {
content: "\f026";
}
-.icon-volume-down:before {
+.fa-volume-down:before {
content: "\f027";
}
-.icon-volume-up:before {
+.fa-volume-up:before {
content: "\f028";
}
-.icon-qrcode:before {
+.fa-qrcode:before {
content: "\f029";
}
-.icon-barcode:before {
+.fa-barcode:before {
content: "\f02a";
}
-.icon-tag:before {
+.fa-tag:before {
content: "\f02b";
}
-.icon-tags:before {
+.fa-tags:before {
content: "\f02c";
}
-.icon-book:before {
+.fa-book:before {
content: "\f02d";
}
-.icon-bookmark:before {
+.fa-bookmark:before {
content: "\f02e";
}
-.icon-print:before {
+.fa-print:before {
content: "\f02f";
}
-.icon-camera:before {
+.fa-camera:before {
content: "\f030";
}
-.icon-font:before {
+.fa-font:before {
content: "\f031";
}
-.icon-bold:before {
+.fa-bold:before {
content: "\f032";
}
-.icon-italic:before {
+.fa-italic:before {
content: "\f033";
}
-.icon-text-height:before {
+.fa-text-height:before {
content: "\f034";
}
-.icon-text-width:before {
+.fa-text-width:before {
content: "\f035";
}
-.icon-align-left:before {
+.fa-align-left:before {
content: "\f036";
}
-.icon-align-center:before {
+.fa-align-center:before {
content: "\f037";
}
-.icon-align-right:before {
+.fa-align-right:before {
content: "\f038";
}
-.icon-align-justify:before {
+.fa-align-justify:before {
content: "\f039";
}
-.icon-list:before {
+.fa-list:before {
content: "\f03a";
}
-.icon-indent-left:before {
+.fa-dedent:before,
+.fa-outdent:before {
content: "\f03b";
}
-.icon-indent-right:before {
+.fa-indent:before {
content: "\f03c";
}
-.icon-facetime-video:before {
+.fa-video-camera:before {
content: "\f03d";
}
-.icon-picture:before {
+.fa-photo:before,
+.fa-image:before,
+.fa-picture-o:before {
content: "\f03e";
}
-.icon-pencil:before {
+.fa-pencil:before {
content: "\f040";
}
-.icon-map-marker:before {
+.fa-map-marker:before {
content: "\f041";
}
-.icon-adjust:before {
+.fa-adjust:before {
content: "\f042";
}
-.icon-tint:before {
+.fa-tint:before {
content: "\f043";
}
-.icon-edit:before {
+.fa-edit:before,
+.fa-pencil-square-o:before {
content: "\f044";
}
-.icon-share:before {
+.fa-share-square-o:before {
content: "\f045";
}
-.icon-check:before {
+.fa-check-square-o:before {
content: "\f046";
}
-.icon-move:before {
+.fa-arrows:before {
content: "\f047";
}
-.icon-step-backward:before {
+.fa-step-backward:before {
content: "\f048";
}
-.icon-fast-backward:before {
+.fa-fast-backward:before {
content: "\f049";
}
-.icon-backward:before {
+.fa-backward:before {
content: "\f04a";
}
-.icon-play:before {
+.fa-play:before {
content: "\f04b";
}
-.icon-pause:before {
+.fa-pause:before {
content: "\f04c";
}
-.icon-stop:before {
+.fa-stop:before {
content: "\f04d";
}
-.icon-forward:before {
+.fa-forward:before {
content: "\f04e";
}
-.icon-fast-forward:before {
+.fa-fast-forward:before {
content: "\f050";
}
-.icon-step-forward:before {
+.fa-step-forward:before {
content: "\f051";
}
-.icon-eject:before {
+.fa-eject:before {
content: "\f052";
}
-.icon-chevron-left:before {
+.fa-chevron-left:before {
content: "\f053";
}
-.icon-chevron-right:before {
+.fa-chevron-right:before {
content: "\f054";
}
-.icon-plus-sign:before {
+.fa-plus-circle:before {
content: "\f055";
}
-.icon-minus-sign:before {
+.fa-minus-circle:before {
content: "\f056";
}
-.icon-remove-sign:before {
+.fa-times-circle:before {
content: "\f057";
}
-.icon-ok-sign:before {
+.fa-check-circle:before {
content: "\f058";
}
-.icon-question-sign:before {
+.fa-question-circle:before {
content: "\f059";
}
-.icon-info-sign:before {
+.fa-info-circle:before {
content: "\f05a";
}
-.icon-screenshot:before {
+.fa-crosshairs:before {
content: "\f05b";
}
-.icon-remove-circle:before {
+.fa-times-circle-o:before {
content: "\f05c";
}
-.icon-ok-circle:before {
+.fa-check-circle-o:before {
content: "\f05d";
}
-.icon-ban-circle:before {
+.fa-ban:before {
content: "\f05e";
}
-.icon-arrow-left:before {
+.fa-arrow-left:before {
content: "\f060";
}
-.icon-arrow-right:before {
+.fa-arrow-right:before {
content: "\f061";
}
-.icon-arrow-up:before {
+.fa-arrow-up:before {
content: "\f062";
}
-.icon-arrow-down:before {
+.fa-arrow-down:before {
content: "\f063";
}
-.icon-mail-forward:before,
-.icon-share-alt:before {
+.fa-mail-forward:before,
+.fa-share:before {
content: "\f064";
}
-.icon-resize-full:before {
+.fa-expand:before {
content: "\f065";
}
-.icon-resize-small:before {
+.fa-compress:before {
content: "\f066";
}
-.icon-plus:before {
+.fa-plus:before {
content: "\f067";
}
-.icon-minus:before {
+.fa-minus:before {
content: "\f068";
}
-.icon-asterisk:before {
+.fa-asterisk:before {
content: "\f069";
}
-.icon-exclamation-sign:before {
+.fa-exclamation-circle:before {
content: "\f06a";
}
-.icon-gift:before {
+.fa-gift:before {
content: "\f06b";
}
-.icon-leaf:before {
+.fa-leaf:before {
content: "\f06c";
}
-.icon-fire:before {
+.fa-fire:before {
content: "\f06d";
}
-.icon-eye-open:before {
+.fa-eye:before {
content: "\f06e";
}
-.icon-eye-close:before {
+.fa-eye-slash:before {
content: "\f070";
}
-.icon-warning-sign:before {
+.fa-warning:before,
+.fa-exclamation-triangle:before {
content: "\f071";
}
-.icon-plane:before {
+.fa-plane:before {
content: "\f072";
}
-.icon-calendar:before {
+.fa-calendar:before {
content: "\f073";
}
-.icon-random:before {
+.fa-random:before {
content: "\f074";
}
-.icon-comment:before {
+.fa-comment:before {
content: "\f075";
}
-.icon-magnet:before {
+.fa-magnet:before {
content: "\f076";
}
-.icon-chevron-up:before {
+.fa-chevron-up:before {
content: "\f077";
}
-.icon-chevron-down:before {
+.fa-chevron-down:before {
content: "\f078";
}
-.icon-retweet:before {
+.fa-retweet:before {
content: "\f079";
}
-.icon-shopping-cart:before {
+.fa-shopping-cart:before {
content: "\f07a";
}
-.icon-folder-close:before {
+.fa-folder:before {
content: "\f07b";
}
-.icon-folder-open:before {
+.fa-folder-open:before {
content: "\f07c";
}
-.icon-resize-vertical:before {
+.fa-arrows-v:before {
content: "\f07d";
}
-.icon-resize-horizontal:before {
+.fa-arrows-h:before {
content: "\f07e";
}
-.icon-bar-chart:before {
+.fa-bar-chart-o:before,
+.fa-bar-chart:before {
content: "\f080";
}
-.icon-twitter-sign:before {
+.fa-twitter-square:before {
content: "\f081";
}
-.icon-facebook-sign:before {
+.fa-facebook-square:before {
content: "\f082";
}
-.icon-camera-retro:before {
+.fa-camera-retro:before {
content: "\f083";
}
-.icon-key:before {
+.fa-key:before {
content: "\f084";
}
-.icon-gears:before,
-.icon-cogs:before {
+.fa-gears:before,
+.fa-cogs:before {
content: "\f085";
}
-.icon-comments:before {
+.fa-comments:before {
content: "\f086";
}
-.icon-thumbs-up-alt:before {
+.fa-thumbs-o-up:before {
content: "\f087";
}
-.icon-thumbs-down-alt:before {
+.fa-thumbs-o-down:before {
content: "\f088";
}
-.icon-star-half:before {
+.fa-star-half:before {
content: "\f089";
}
-.icon-heart-empty:before {
+.fa-heart-o:before {
content: "\f08a";
}
-.icon-signout:before {
+.fa-sign-out:before {
content: "\f08b";
}
-.icon-linkedin-sign:before {
+.fa-linkedin-square:before {
content: "\f08c";
}
-.icon-pushpin:before {
+.fa-thumb-tack:before {
content: "\f08d";
}
-.icon-external-link:before {
+.fa-external-link:before {
content: "\f08e";
}
-.icon-signin:before {
+.fa-sign-in:before {
content: "\f090";
}
-.icon-trophy:before {
+.fa-trophy:before {
content: "\f091";
}
-.icon-github-sign:before {
+.fa-github-square:before {
content: "\f092";
}
-.icon-upload-alt:before {
+.fa-upload:before {
content: "\f093";
}
-.icon-lemon:before {
+.fa-lemon-o:before {
content: "\f094";
}
-.icon-phone:before {
+.fa-phone:before {
content: "\f095";
}
-.icon-unchecked:before,
-.icon-check-empty:before {
+.fa-square-o:before {
content: "\f096";
}
-.icon-bookmark-empty:before {
+.fa-bookmark-o:before {
content: "\f097";
}
-.icon-phone-sign:before {
+.fa-phone-square:before {
content: "\f098";
}
-.icon-twitter:before {
+.fa-twitter:before {
content: "\f099";
}
-.icon-facebook:before {
+.fa-facebook-f:before,
+.fa-facebook:before {
content: "\f09a";
}
-.icon-github:before {
+.fa-github:before {
content: "\f09b";
}
-.icon-unlock:before {
+.fa-unlock:before {
content: "\f09c";
}
-.icon-credit-card:before {
+.fa-credit-card:before {
content: "\f09d";
}
-.icon-rss:before {
+.fa-feed:before,
+.fa-rss:before {
content: "\f09e";
}
-.icon-hdd:before {
+.fa-hdd-o:before {
content: "\f0a0";
}
-.icon-bullhorn:before {
+.fa-bullhorn:before {
content: "\f0a1";
}
-.icon-bell:before {
- content: "\f0a2";
+.fa-bell:before {
+ content: "\f0f3";
}
-.icon-certificate:before {
+.fa-certificate:before {
content: "\f0a3";
}
-.icon-hand-right:before {
+.fa-hand-o-right:before {
content: "\f0a4";
}
-.icon-hand-left:before {
+.fa-hand-o-left:before {
content: "\f0a5";
}
-.icon-hand-up:before {
+.fa-hand-o-up:before {
content: "\f0a6";
}
-.icon-hand-down:before {
+.fa-hand-o-down:before {
content: "\f0a7";
}
-.icon-circle-arrow-left:before {
+.fa-arrow-circle-left:before {
content: "\f0a8";
}
-.icon-circle-arrow-right:before {
+.fa-arrow-circle-right:before {
content: "\f0a9";
}
-.icon-circle-arrow-up:before {
+.fa-arrow-circle-up:before {
content: "\f0aa";
}
-.icon-circle-arrow-down:before {
+.fa-arrow-circle-down:before {
content: "\f0ab";
}
-.icon-globe:before {
+.fa-globe:before {
content: "\f0ac";
}
-.icon-wrench:before {
+.fa-wrench:before {
content: "\f0ad";
}
-.icon-tasks:before {
+.fa-tasks:before {
content: "\f0ae";
}
-.icon-filter:before {
+.fa-filter:before {
content: "\f0b0";
}
-.icon-briefcase:before {
+.fa-briefcase:before {
content: "\f0b1";
}
-.icon-fullscreen:before {
+.fa-arrows-alt:before {
content: "\f0b2";
}
-.icon-group:before {
+.fa-group:before,
+.fa-users:before {
content: "\f0c0";
}
-.icon-link:before {
+.fa-chain:before,
+.fa-link:before {
content: "\f0c1";
}
-.icon-cloud:before {
+.fa-cloud:before {
content: "\f0c2";
}
-.icon-beaker:before {
+.fa-flask:before {
content: "\f0c3";
}
-.icon-cut:before {
+.fa-cut:before,
+.fa-scissors:before {
content: "\f0c4";
}
-.icon-copy:before {
+.fa-copy:before,
+.fa-files-o:before {
content: "\f0c5";
}
-.icon-paperclip:before,
-.icon-paper-clip:before {
+.fa-paperclip:before {
content: "\f0c6";
}
-.icon-save:before {
+.fa-save:before,
+.fa-floppy-o:before {
content: "\f0c7";
}
-.icon-sign-blank:before {
+.fa-square:before {
content: "\f0c8";
}
-.icon-reorder:before {
+.fa-navicon:before,
+.fa-reorder:before,
+.fa-bars:before {
content: "\f0c9";
}
-.icon-list-ul:before {
+.fa-list-ul:before {
content: "\f0ca";
}
-.icon-list-ol:before {
+.fa-list-ol:before {
content: "\f0cb";
}
-.icon-strikethrough:before {
+.fa-strikethrough:before {
content: "\f0cc";
}
-.icon-underline:before {
+.fa-underline:before {
content: "\f0cd";
}
-.icon-table:before {
+.fa-table:before {
content: "\f0ce";
}
-.icon-magic:before {
+.fa-magic:before {
content: "\f0d0";
}
-.icon-truck:before {
+.fa-truck:before {
content: "\f0d1";
}
-.icon-pinterest:before {
+.fa-pinterest:before {
content: "\f0d2";
}
-.icon-pinterest-sign:before {
+.fa-pinterest-square:before {
content: "\f0d3";
}
-.icon-google-plus-sign:before {
+.fa-google-plus-square:before {
content: "\f0d4";
}
-.icon-google-plus:before {
+.fa-google-plus:before {
content: "\f0d5";
}
-.icon-money:before {
+.fa-money:before {
content: "\f0d6";
}
-.icon-caret-down:before {
+.fa-caret-down:before {
content: "\f0d7";
}
-.icon-caret-up:before {
+.fa-caret-up:before {
content: "\f0d8";
}
-.icon-caret-left:before {
+.fa-caret-left:before {
content: "\f0d9";
}
-.icon-caret-right:before {
+.fa-caret-right:before {
content: "\f0da";
}
-.icon-columns:before {
+.fa-columns:before {
content: "\f0db";
}
-.icon-sort:before {
+.fa-unsorted:before,
+.fa-sort:before {
content: "\f0dc";
}
-.icon-sort-down:before {
+.fa-sort-down:before,
+.fa-sort-desc:before {
content: "\f0dd";
}
-.icon-sort-up:before {
+.fa-sort-up:before,
+.fa-sort-asc:before {
content: "\f0de";
}
-.icon-envelope:before {
+.fa-envelope:before {
content: "\f0e0";
}
-.icon-linkedin:before {
+.fa-linkedin:before {
content: "\f0e1";
}
-.icon-rotate-left:before,
-.icon-undo:before {
+.fa-rotate-left:before,
+.fa-undo:before {
content: "\f0e2";
}
-.icon-legal:before {
+.fa-legal:before,
+.fa-gavel:before {
content: "\f0e3";
}
-.icon-dashboard:before {
+.fa-dashboard:before,
+.fa-tachometer:before {
content: "\f0e4";
}
-.icon-comment-alt:before {
+.fa-comment-o:before {
content: "\f0e5";
}
-.icon-comments-alt:before {
+.fa-comments-o:before {
content: "\f0e6";
}
-.icon-bolt:before {
+.fa-flash:before,
+.fa-bolt:before {
content: "\f0e7";
}
-.icon-sitemap:before {
+.fa-sitemap:before {
content: "\f0e8";
}
-.icon-umbrella:before {
+.fa-umbrella:before {
content: "\f0e9";
}
-.icon-paste:before {
+.fa-paste:before,
+.fa-clipboard:before {
content: "\f0ea";
}
-.icon-lightbulb:before {
+.fa-lightbulb-o:before {
content: "\f0eb";
}
-.icon-exchange:before {
+.fa-exchange:before {
content: "\f0ec";
}
-.icon-cloud-download:before {
+.fa-cloud-download:before {
content: "\f0ed";
}
-.icon-cloud-upload:before {
+.fa-cloud-upload:before {
content: "\f0ee";
}
-.icon-user-md:before {
+.fa-user-md:before {
content: "\f0f0";
}
-.icon-stethoscope:before {
+.fa-stethoscope:before {
content: "\f0f1";
}
-.icon-suitcase:before {
+.fa-suitcase:before {
content: "\f0f2";
}
-.icon-bell-alt:before {
- content: "\f0f3";
+.fa-bell-o:before {
+ content: "\f0a2";
}
-.icon-coffee:before {
+.fa-coffee:before {
content: "\f0f4";
}
-.icon-food:before {
+.fa-cutlery:before {
content: "\f0f5";
}
-.icon-file-text-alt:before {
+.fa-file-text-o:before {
content: "\f0f6";
}
-.icon-building:before {
+.fa-building-o:before {
content: "\f0f7";
}
-.icon-hospital:before {
+.fa-hospital-o:before {
content: "\f0f8";
}
-.icon-ambulance:before {
+.fa-ambulance:before {
content: "\f0f9";
}
-.icon-medkit:before {
+.fa-medkit:before {
content: "\f0fa";
}
-.icon-fighter-jet:before {
+.fa-fighter-jet:before {
content: "\f0fb";
}
-.icon-beer:before {
+.fa-beer:before {
content: "\f0fc";
}
-.icon-h-sign:before {
+.fa-h-square:before {
content: "\f0fd";
}
-.icon-plus-sign-alt:before {
+.fa-plus-square:before {
content: "\f0fe";
}
-.icon-double-angle-left:before {
+.fa-angle-double-left:before {
content: "\f100";
}
-.icon-double-angle-right:before {
+.fa-angle-double-right:before {
content: "\f101";
}
-.icon-double-angle-up:before {
+.fa-angle-double-up:before {
content: "\f102";
}
-.icon-double-angle-down:before {
+.fa-angle-double-down:before {
content: "\f103";
}
-.icon-angle-left:before {
+.fa-angle-left:before {
content: "\f104";
}
-.icon-angle-right:before {
+.fa-angle-right:before {
content: "\f105";
}
-.icon-angle-up:before {
+.fa-angle-up:before {
content: "\f106";
}
-.icon-angle-down:before {
+.fa-angle-down:before {
content: "\f107";
}
-.icon-desktop:before {
+.fa-desktop:before {
content: "\f108";
}
-.icon-laptop:before {
+.fa-laptop:before {
content: "\f109";
}
-.icon-tablet:before {
+.fa-tablet:before {
content: "\f10a";
}
-.icon-mobile-phone:before {
+.fa-mobile-phone:before,
+.fa-mobile:before {
content: "\f10b";
}
-.icon-circle-blank:before {
+.fa-circle-o:before {
content: "\f10c";
}
-.icon-quote-left:before {
+.fa-quote-left:before {
content: "\f10d";
}
-.icon-quote-right:before {
+.fa-quote-right:before {
content: "\f10e";
}
-.icon-spinner:before {
+.fa-spinner:before {
content: "\f110";
}
-.icon-circle:before {
+.fa-circle:before {
content: "\f111";
}
-.icon-mail-reply:before,
-.icon-reply:before {
+.fa-mail-reply:before,
+.fa-reply:before {
content: "\f112";
}
-.icon-github-alt:before {
+.fa-github-alt:before {
content: "\f113";
}
-.icon-folder-close-alt:before {
+.fa-folder-o:before {
content: "\f114";
}
-.icon-folder-open-alt:before {
+.fa-folder-open-o:before {
content: "\f115";
}
-.icon-expand-alt:before {
- content: "\f116";
-}
-.icon-collapse-alt:before {
- content: "\f117";
-}
-.icon-smile:before {
+.fa-smile-o:before {
content: "\f118";
}
-.icon-frown:before {
+.fa-frown-o:before {
content: "\f119";
}
-.icon-meh:before {
+.fa-meh-o:before {
content: "\f11a";
}
-.icon-gamepad:before {
+.fa-gamepad:before {
content: "\f11b";
}
-.icon-keyboard:before {
+.fa-keyboard-o:before {
content: "\f11c";
}
-.icon-flag-alt:before {
+.fa-flag-o:before {
content: "\f11d";
}
-.icon-flag-checkered:before {
+.fa-flag-checkered:before {
content: "\f11e";
}
-.icon-terminal:before {
+.fa-terminal:before {
content: "\f120";
}
-.icon-code:before {
+.fa-code:before {
content: "\f121";
}
-.icon-reply-all:before {
- content: "\f122";
-}
-.icon-mail-reply-all:before {
+.fa-mail-reply-all:before,
+.fa-reply-all:before {
content: "\f122";
}
-.icon-star-half-full:before,
-.icon-star-half-empty:before {
+.fa-star-half-empty:before,
+.fa-star-half-full:before,
+.fa-star-half-o:before {
content: "\f123";
}
-.icon-location-arrow:before {
+.fa-location-arrow:before {
content: "\f124";
}
-.icon-crop:before {
+.fa-crop:before {
content: "\f125";
}
-.icon-code-fork:before {
+.fa-code-fork:before {
content: "\f126";
}
-.icon-unlink:before {
+.fa-unlink:before,
+.fa-chain-broken:before {
content: "\f127";
}
-.icon-question:before {
+.fa-question:before {
content: "\f128";
}
-.icon-info:before {
+.fa-info:before {
content: "\f129";
}
-.icon-exclamation:before {
+.fa-exclamation:before {
content: "\f12a";
}
-.icon-superscript:before {
+.fa-superscript:before {
content: "\f12b";
}
-.icon-subscript:before {
+.fa-subscript:before {
content: "\f12c";
}
-.icon-eraser:before {
+.fa-eraser:before {
content: "\f12d";
}
-.icon-puzzle-piece:before {
+.fa-puzzle-piece:before {
content: "\f12e";
}
-.icon-microphone:before {
+.fa-microphone:before {
content: "\f130";
}
-.icon-microphone-off:before {
+.fa-microphone-slash:before {
content: "\f131";
}
-.icon-shield:before {
+.fa-shield:before {
content: "\f132";
}
-.icon-calendar-empty:before {
+.fa-calendar-o:before {
content: "\f133";
}
-.icon-fire-extinguisher:before {
+.fa-fire-extinguisher:before {
content: "\f134";
}
-.icon-rocket:before {
+.fa-rocket:before {
content: "\f135";
}
-.icon-maxcdn:before {
+.fa-maxcdn:before {
content: "\f136";
}
-.icon-chevron-sign-left:before {
+.fa-chevron-circle-left:before {
content: "\f137";
}
-.icon-chevron-sign-right:before {
+.fa-chevron-circle-right:before {
content: "\f138";
}
-.icon-chevron-sign-up:before {
+.fa-chevron-circle-up:before {
content: "\f139";
}
-.icon-chevron-sign-down:before {
+.fa-chevron-circle-down:before {
content: "\f13a";
}
-.icon-html5:before {
+.fa-html5:before {
content: "\f13b";
}
-.icon-css3:before {
+.fa-css3:before {
content: "\f13c";
}
-.icon-anchor:before {
+.fa-anchor:before {
content: "\f13d";
}
-.icon-unlock-alt:before {
+.fa-unlock-alt:before {
content: "\f13e";
}
-.icon-bullseye:before {
+.fa-bullseye:before {
content: "\f140";
}
-.icon-ellipsis-horizontal:before {
+.fa-ellipsis-h:before {
content: "\f141";
}
-.icon-ellipsis-vertical:before {
+.fa-ellipsis-v:before {
content: "\f142";
}
-.icon-rss-sign:before {
+.fa-rss-square:before {
content: "\f143";
}
-.icon-play-sign:before {
+.fa-play-circle:before {
content: "\f144";
}
-.icon-ticket:before {
+.fa-ticket:before {
content: "\f145";
}
-.icon-minus-sign-alt:before {
+.fa-minus-square:before {
content: "\f146";
}
-.icon-check-minus:before {
+.fa-minus-square-o:before {
content: "\f147";
}
-.icon-level-up:before {
+.fa-level-up:before {
content: "\f148";
}
-.icon-level-down:before {
+.fa-level-down:before {
content: "\f149";
}
-.icon-check-sign:before {
+.fa-check-square:before {
content: "\f14a";
}
-.icon-edit-sign:before {
+.fa-pencil-square:before {
content: "\f14b";
}
-.icon-external-link-sign:before {
+.fa-external-link-square:before {
content: "\f14c";
}
-.icon-share-sign:before {
+.fa-share-square:before {
content: "\f14d";
}
-.icon-compass:before {
+.fa-compass:before {
content: "\f14e";
}
-.icon-collapse:before {
+.fa-toggle-down:before,
+.fa-caret-square-o-down:before {
content: "\f150";
}
-.icon-collapse-top:before {
+.fa-toggle-up:before,
+.fa-caret-square-o-up:before {
content: "\f151";
}
-.icon-expand:before {
+.fa-toggle-right:before,
+.fa-caret-square-o-right:before {
content: "\f152";
}
-.icon-euro:before,
-.icon-eur:before {
+.fa-euro:before,
+.fa-eur:before {
content: "\f153";
}
-.icon-gbp:before {
+.fa-gbp:before {
content: "\f154";
}
-.icon-dollar:before,
-.icon-usd:before {
+.fa-dollar:before,
+.fa-usd:before {
content: "\f155";
}
-.icon-rupee:before,
-.icon-inr:before {
+.fa-rupee:before,
+.fa-inr:before {
content: "\f156";
}
-.icon-yen:before,
-.icon-jpy:before {
+.fa-cny:before,
+.fa-rmb:before,
+.fa-yen:before,
+.fa-jpy:before {
content: "\f157";
}
-.icon-renminbi:before,
-.icon-cny:before {
+.fa-ruble:before,
+.fa-rouble:before,
+.fa-rub:before {
content: "\f158";
}
-.icon-won:before,
-.icon-krw:before {
+.fa-won:before,
+.fa-krw:before {
content: "\f159";
}
-.icon-bitcoin:before,
-.icon-btc:before {
+.fa-bitcoin:before,
+.fa-btc:before {
content: "\f15a";
}
-.icon-file:before {
+.fa-file:before {
content: "\f15b";
}
-.icon-file-text:before {
+.fa-file-text:before {
content: "\f15c";
}
-.icon-sort-by-alphabet:before {
+.fa-sort-alpha-asc:before {
content: "\f15d";
}
-.icon-sort-by-alphabet-alt:before {
+.fa-sort-alpha-desc:before {
content: "\f15e";
}
-.icon-sort-by-attributes:before {
+.fa-sort-amount-asc:before {
content: "\f160";
}
-.icon-sort-by-attributes-alt:before {
+.fa-sort-amount-desc:before {
content: "\f161";
}
-.icon-sort-by-order:before {
+.fa-sort-numeric-asc:before {
content: "\f162";
}
-.icon-sort-by-order-alt:before {
+.fa-sort-numeric-desc:before {
content: "\f163";
}
-.icon-thumbs-up:before {
+.fa-thumbs-up:before {
content: "\f164";
}
-.icon-thumbs-down:before {
+.fa-thumbs-down:before {
content: "\f165";
}
-.icon-youtube-sign:before {
+.fa-youtube-square:before {
content: "\f166";
}
-.icon-youtube:before {
+.fa-youtube:before {
content: "\f167";
}
-.icon-xing:before {
+.fa-xing:before {
content: "\f168";
}
-.icon-xing-sign:before {
+.fa-xing-square:before {
content: "\f169";
}
-.icon-youtube-play:before {
+.fa-youtube-play:before {
content: "\f16a";
}
-.icon-dropbox:before {
+.fa-dropbox:before {
content: "\f16b";
}
-.icon-stackexchange:before {
+.fa-stack-overflow:before {
content: "\f16c";
}
-.icon-instagram:before {
+.fa-instagram:before {
content: "\f16d";
}
-.icon-flickr:before {
+.fa-flickr:before {
content: "\f16e";
}
-.icon-adn:before {
+.fa-adn:before {
content: "\f170";
}
-.icon-bitbucket:before {
+.fa-bitbucket:before {
content: "\f171";
}
-.icon-bitbucket-sign:before {
+.fa-bitbucket-square:before {
content: "\f172";
}
-.icon-tumblr:before {
+.fa-tumblr:before {
content: "\f173";
}
-.icon-tumblr-sign:before {
+.fa-tumblr-square:before {
content: "\f174";
}
-.icon-long-arrow-down:before {
+.fa-long-arrow-down:before {
content: "\f175";
}
-.icon-long-arrow-up:before {
+.fa-long-arrow-up:before {
content: "\f176";
}
-.icon-long-arrow-left:before {
+.fa-long-arrow-left:before {
content: "\f177";
}
-.icon-long-arrow-right:before {
+.fa-long-arrow-right:before {
content: "\f178";
}
-.icon-apple:before {
+.fa-apple:before {
content: "\f179";
}
-.icon-windows:before {
+.fa-windows:before {
content: "\f17a";
}
-.icon-android:before {
+.fa-android:before {
content: "\f17b";
}
-.icon-linux:before {
+.fa-linux:before {
content: "\f17c";
}
-.icon-dribbble:before {
+.fa-dribbble:before {
content: "\f17d";
}
-.icon-skype:before {
+.fa-skype:before {
content: "\f17e";
}
-.icon-foursquare:before {
+.fa-foursquare:before {
content: "\f180";
}
-.icon-trello:before {
+.fa-trello:before {
content: "\f181";
}
-.icon-female:before {
+.fa-female:before {
content: "\f182";
}
-.icon-male:before {
+.fa-male:before {
content: "\f183";
}
-.icon-gittip:before {
+.fa-gittip:before,
+.fa-gratipay:before {
content: "\f184";
}
-.icon-sun:before {
+.fa-sun-o:before {
content: "\f185";
}
-.icon-moon:before {
+.fa-moon-o:before {
content: "\f186";
}
-.icon-archive:before {
+.fa-archive:before {
content: "\f187";
}
-.icon-bug:before {
+.fa-bug:before {
content: "\f188";
}
-.icon-vk:before {
+.fa-vk:before {
content: "\f189";
}
-.icon-weibo:before {
+.fa-weibo:before {
content: "\f18a";
}
-.icon-renren:before {
+.fa-renren:before {
content: "\f18b";
}
+.fa-pagelines:before {
+ content: "\f18c";
+}
+.fa-stack-exchange:before {
+ content: "\f18d";
+}
+.fa-arrow-circle-o-right:before {
+ content: "\f18e";
+}
+.fa-arrow-circle-o-left:before {
+ content: "\f190";
+}
+.fa-toggle-left:before,
+.fa-caret-square-o-left:before {
+ content: "\f191";
+}
+.fa-dot-circle-o:before {
+ content: "\f192";
+}
+.fa-wheelchair:before {
+ content: "\f193";
+}
+.fa-vimeo-square:before {
+ content: "\f194";
+}
+.fa-turkish-lira:before,
+.fa-try:before {
+ content: "\f195";
+}
+.fa-plus-square-o:before {
+ content: "\f196";
+}
+.fa-space-shuttle:before {
+ content: "\f197";
+}
+.fa-slack:before {
+ content: "\f198";
+}
+.fa-envelope-square:before {
+ content: "\f199";
+}
+.fa-wordpress:before {
+ content: "\f19a";
+}
+.fa-openid:before {
+ content: "\f19b";
+}
+.fa-institution:before,
+.fa-bank:before,
+.fa-university:before {
+ content: "\f19c";
+}
+.fa-mortar-board:before,
+.fa-graduation-cap:before {
+ content: "\f19d";
+}
+.fa-yahoo:before {
+ content: "\f19e";
+}
+.fa-google:before {
+ content: "\f1a0";
+}
+.fa-reddit:before {
+ content: "\f1a1";
+}
+.fa-reddit-square:before {
+ content: "\f1a2";
+}
+.fa-stumbleupon-circle:before {
+ content: "\f1a3";
+}
+.fa-stumbleupon:before {
+ content: "\f1a4";
+}
+.fa-delicious:before {
+ content: "\f1a5";
+}
+.fa-digg:before {
+ content: "\f1a6";
+}
+.fa-pied-piper:before {
+ content: "\f1a7";
+}
+.fa-pied-piper-alt:before {
+ content: "\f1a8";
+}
+.fa-drupal:before {
+ content: "\f1a9";
+}
+.fa-joomla:before {
+ content: "\f1aa";
+}
+.fa-language:before {
+ content: "\f1ab";
+}
+.fa-fax:before {
+ content: "\f1ac";
+}
+.fa-building:before {
+ content: "\f1ad";
+}
+.fa-child:before {
+ content: "\f1ae";
+}
+.fa-paw:before {
+ content: "\f1b0";
+}
+.fa-spoon:before {
+ content: "\f1b1";
+}
+.fa-cube:before {
+ content: "\f1b2";
+}
+.fa-cubes:before {
+ content: "\f1b3";
+}
+.fa-behance:before {
+ content: "\f1b4";
+}
+.fa-behance-square:before {
+ content: "\f1b5";
+}
+.fa-steam:before {
+ content: "\f1b6";
+}
+.fa-steam-square:before {
+ content: "\f1b7";
+}
+.fa-recycle:before {
+ content: "\f1b8";
+}
+.fa-automobile:before,
+.fa-car:before {
+ content: "\f1b9";
+}
+.fa-cab:before,
+.fa-taxi:before {
+ content: "\f1ba";
+}
+.fa-tree:before {
+ content: "\f1bb";
+}
+.fa-spotify:before {
+ content: "\f1bc";
+}
+.fa-deviantart:before {
+ content: "\f1bd";
+}
+.fa-soundcloud:before {
+ content: "\f1be";
+}
+.fa-database:before {
+ content: "\f1c0";
+}
+.fa-file-pdf-o:before {
+ content: "\f1c1";
+}
+.fa-file-word-o:before {
+ content: "\f1c2";
+}
+.fa-file-excel-o:before {
+ content: "\f1c3";
+}
+.fa-file-powerpoint-o:before {
+ content: "\f1c4";
+}
+.fa-file-photo-o:before,
+.fa-file-picture-o:before,
+.fa-file-image-o:before {
+ content: "\f1c5";
+}
+.fa-file-zip-o:before,
+.fa-file-archive-o:before {
+ content: "\f1c6";
+}
+.fa-file-sound-o:before,
+.fa-file-audio-o:before {
+ content: "\f1c7";
+}
+.fa-file-movie-o:before,
+.fa-file-video-o:before {
+ content: "\f1c8";
+}
+.fa-file-code-o:before {
+ content: "\f1c9";
+}
+.fa-vine:before {
+ content: "\f1ca";
+}
+.fa-codepen:before {
+ content: "\f1cb";
+}
+.fa-jsfiddle:before {
+ content: "\f1cc";
+}
+.fa-life-bouy:before,
+.fa-life-buoy:before,
+.fa-life-saver:before,
+.fa-support:before,
+.fa-life-ring:before {
+ content: "\f1cd";
+}
+.fa-circle-o-notch:before {
+ content: "\f1ce";
+}
+.fa-ra:before,
+.fa-rebel:before {
+ content: "\f1d0";
+}
+.fa-ge:before,
+.fa-empire:before {
+ content: "\f1d1";
+}
+.fa-git-square:before {
+ content: "\f1d2";
+}
+.fa-git:before {
+ content: "\f1d3";
+}
+.fa-y-combinator-square:before,
+.fa-yc-square:before,
+.fa-hacker-news:before {
+ content: "\f1d4";
+}
+.fa-tencent-weibo:before {
+ content: "\f1d5";
+}
+.fa-qq:before {
+ content: "\f1d6";
+}
+.fa-wechat:before,
+.fa-weixin:before {
+ content: "\f1d7";
+}
+.fa-send:before,
+.fa-paper-plane:before {
+ content: "\f1d8";
+}
+.fa-send-o:before,
+.fa-paper-plane-o:before {
+ content: "\f1d9";
+}
+.fa-history:before {
+ content: "\f1da";
+}
+.fa-circle-thin:before {
+ content: "\f1db";
+}
+.fa-header:before {
+ content: "\f1dc";
+}
+.fa-paragraph:before {
+ content: "\f1dd";
+}
+.fa-sliders:before {
+ content: "\f1de";
+}
+.fa-share-alt:before {
+ content: "\f1e0";
+}
+.fa-share-alt-square:before {
+ content: "\f1e1";
+}
+.fa-bomb:before {
+ content: "\f1e2";
+}
+.fa-soccer-ball-o:before,
+.fa-futbol-o:before {
+ content: "\f1e3";
+}
+.fa-tty:before {
+ content: "\f1e4";
+}
+.fa-binoculars:before {
+ content: "\f1e5";
+}
+.fa-plug:before {
+ content: "\f1e6";
+}
+.fa-slideshare:before {
+ content: "\f1e7";
+}
+.fa-twitch:before {
+ content: "\f1e8";
+}
+.fa-yelp:before {
+ content: "\f1e9";
+}
+.fa-newspaper-o:before {
+ content: "\f1ea";
+}
+.fa-wifi:before {
+ content: "\f1eb";
+}
+.fa-calculator:before {
+ content: "\f1ec";
+}
+.fa-paypal:before {
+ content: "\f1ed";
+}
+.fa-google-wallet:before {
+ content: "\f1ee";
+}
+.fa-cc-visa:before {
+ content: "\f1f0";
+}
+.fa-cc-mastercard:before {
+ content: "\f1f1";
+}
+.fa-cc-discover:before {
+ content: "\f1f2";
+}
+.fa-cc-amex:before {
+ content: "\f1f3";
+}
+.fa-cc-paypal:before {
+ content: "\f1f4";
+}
+.fa-cc-stripe:before {
+ content: "\f1f5";
+}
+.fa-bell-slash:before {
+ content: "\f1f6";
+}
+.fa-bell-slash-o:before {
+ content: "\f1f7";
+}
+.fa-trash:before {
+ content: "\f1f8";
+}
+.fa-copyright:before {
+ content: "\f1f9";
+}
+.fa-at:before {
+ content: "\f1fa";
+}
+.fa-eyedropper:before {
+ content: "\f1fb";
+}
+.fa-paint-brush:before {
+ content: "\f1fc";
+}
+.fa-birthday-cake:before {
+ content: "\f1fd";
+}
+.fa-area-chart:before {
+ content: "\f1fe";
+}
+.fa-pie-chart:before {
+ content: "\f200";
+}
+.fa-line-chart:before {
+ content: "\f201";
+}
+.fa-lastfm:before {
+ content: "\f202";
+}
+.fa-lastfm-square:before {
+ content: "\f203";
+}
+.fa-toggle-off:before {
+ content: "\f204";
+}
+.fa-toggle-on:before {
+ content: "\f205";
+}
+.fa-bicycle:before {
+ content: "\f206";
+}
+.fa-bus:before {
+ content: "\f207";
+}
+.fa-ioxhost:before {
+ content: "\f208";
+}
+.fa-angellist:before {
+ content: "\f209";
+}
+.fa-cc:before {
+ content: "\f20a";
+}
+.fa-shekel:before,
+.fa-sheqel:before,
+.fa-ils:before {
+ content: "\f20b";
+}
+.fa-meanpath:before {
+ content: "\f20c";
+}
+.fa-buysellads:before {
+ content: "\f20d";
+}
+.fa-connectdevelop:before {
+ content: "\f20e";
+}
+.fa-dashcube:before {
+ content: "\f210";
+}
+.fa-forumbee:before {
+ content: "\f211";
+}
+.fa-leanpub:before {
+ content: "\f212";
+}
+.fa-sellsy:before {
+ content: "\f213";
+}
+.fa-shirtsinbulk:before {
+ content: "\f214";
+}
+.fa-simplybuilt:before {
+ content: "\f215";
+}
+.fa-skyatlas:before {
+ content: "\f216";
+}
+.fa-cart-plus:before {
+ content: "\f217";
+}
+.fa-cart-arrow-down:before {
+ content: "\f218";
+}
+.fa-diamond:before {
+ content: "\f219";
+}
+.fa-ship:before {
+ content: "\f21a";
+}
+.fa-user-secret:before {
+ content: "\f21b";
+}
+.fa-motorcycle:before {
+ content: "\f21c";
+}
+.fa-street-view:before {
+ content: "\f21d";
+}
+.fa-heartbeat:before {
+ content: "\f21e";
+}
+.fa-venus:before {
+ content: "\f221";
+}
+.fa-mars:before {
+ content: "\f222";
+}
+.fa-mercury:before {
+ content: "\f223";
+}
+.fa-intersex:before,
+.fa-transgender:before {
+ content: "\f224";
+}
+.fa-transgender-alt:before {
+ content: "\f225";
+}
+.fa-venus-double:before {
+ content: "\f226";
+}
+.fa-mars-double:before {
+ content: "\f227";
+}
+.fa-venus-mars:before {
+ content: "\f228";
+}
+.fa-mars-stroke:before {
+ content: "\f229";
+}
+.fa-mars-stroke-v:before {
+ content: "\f22a";
+}
+.fa-mars-stroke-h:before {
+ content: "\f22b";
+}
+.fa-neuter:before {
+ content: "\f22c";
+}
+.fa-genderless:before {
+ content: "\f22d";
+}
+.fa-facebook-official:before {
+ content: "\f230";
+}
+.fa-pinterest-p:before {
+ content: "\f231";
+}
+.fa-whatsapp:before {
+ content: "\f232";
+}
+.fa-server:before {
+ content: "\f233";
+}
+.fa-user-plus:before {
+ content: "\f234";
+}
+.fa-user-times:before {
+ content: "\f235";
+}
+.fa-hotel:before,
+.fa-bed:before {
+ content: "\f236";
+}
+.fa-viacoin:before {
+ content: "\f237";
+}
+.fa-train:before {
+ content: "\f238";
+}
+.fa-subway:before {
+ content: "\f239";
+}
+.fa-medium:before {
+ content: "\f23a";
+}
+.fa-yc:before,
+.fa-y-combinator:before {
+ content: "\f23b";
+}
+.fa-optin-monster:before {
+ content: "\f23c";
+}
+.fa-opencart:before {
+ content: "\f23d";
+}
+.fa-expeditedssl:before {
+ content: "\f23e";
+}
+.fa-battery-4:before,
+.fa-battery-full:before {
+ content: "\f240";
+}
+.fa-battery-3:before,
+.fa-battery-three-quarters:before {
+ content: "\f241";
+}
+.fa-battery-2:before,
+.fa-battery-half:before {
+ content: "\f242";
+}
+.fa-battery-1:before,
+.fa-battery-quarter:before {
+ content: "\f243";
+}
+.fa-battery-0:before,
+.fa-battery-empty:before {
+ content: "\f244";
+}
+.fa-mouse-pointer:before {
+ content: "\f245";
+}
+.fa-i-cursor:before {
+ content: "\f246";
+}
+.fa-object-group:before {
+ content: "\f247";
+}
+.fa-object-ungroup:before {
+ content: "\f248";
+}
+.fa-sticky-note:before {
+ content: "\f249";
+}
+.fa-sticky-note-o:before {
+ content: "\f24a";
+}
+.fa-cc-jcb:before {
+ content: "\f24b";
+}
+.fa-cc-diners-club:before {
+ content: "\f24c";
+}
+.fa-clone:before {
+ content: "\f24d";
+}
+.fa-balance-scale:before {
+ content: "\f24e";
+}
+.fa-hourglass-o:before {
+ content: "\f250";
+}
+.fa-hourglass-1:before,
+.fa-hourglass-start:before {
+ content: "\f251";
+}
+.fa-hourglass-2:before,
+.fa-hourglass-half:before {
+ content: "\f252";
+}
+.fa-hourglass-3:before,
+.fa-hourglass-end:before {
+ content: "\f253";
+}
+.fa-hourglass:before {
+ content: "\f254";
+}
+.fa-hand-grab-o:before,
+.fa-hand-rock-o:before {
+ content: "\f255";
+}
+.fa-hand-stop-o:before,
+.fa-hand-paper-o:before {
+ content: "\f256";
+}
+.fa-hand-scissors-o:before {
+ content: "\f257";
+}
+.fa-hand-lizard-o:before {
+ content: "\f258";
+}
+.fa-hand-spock-o:before {
+ content: "\f259";
+}
+.fa-hand-pointer-o:before {
+ content: "\f25a";
+}
+.fa-hand-peace-o:before {
+ content: "\f25b";
+}
+.fa-trademark:before {
+ content: "\f25c";
+}
+.fa-registered:before {
+ content: "\f25d";
+}
+.fa-creative-commons:before {
+ content: "\f25e";
+}
+.fa-gg:before {
+ content: "\f260";
+}
+.fa-gg-circle:before {
+ content: "\f261";
+}
+.fa-tripadvisor:before {
+ content: "\f262";
+}
+.fa-odnoklassniki:before {
+ content: "\f263";
+}
+.fa-odnoklassniki-square:before {
+ content: "\f264";
+}
+.fa-get-pocket:before {
+ content: "\f265";
+}
+.fa-wikipedia-w:before {
+ content: "\f266";
+}
+.fa-safari:before {
+ content: "\f267";
+}
+.fa-chrome:before {
+ content: "\f268";
+}
+.fa-firefox:before {
+ content: "\f269";
+}
+.fa-opera:before {
+ content: "\f26a";
+}
+.fa-internet-explorer:before {
+ content: "\f26b";
+}
+.fa-tv:before,
+.fa-television:before {
+ content: "\f26c";
+}
+.fa-contao:before {
+ content: "\f26d";
+}
+.fa-500px:before {
+ content: "\f26e";
+}
+.fa-amazon:before {
+ content: "\f270";
+}
+.fa-calendar-plus-o:before {
+ content: "\f271";
+}
+.fa-calendar-minus-o:before {
+ content: "\f272";
+}
+.fa-calendar-times-o:before {
+ content: "\f273";
+}
+.fa-calendar-check-o:before {
+ content: "\f274";
+}
+.fa-industry:before {
+ content: "\f275";
+}
+.fa-map-pin:before {
+ content: "\f276";
+}
+.fa-map-signs:before {
+ content: "\f277";
+}
+.fa-map-o:before {
+ content: "\f278";
+}
+.fa-map:before {
+ content: "\f279";
+}
+.fa-commenting:before {
+ content: "\f27a";
+}
+.fa-commenting-o:before {
+ content: "\f27b";
+}
+.fa-houzz:before {
+ content: "\f27c";
+}
+.fa-vimeo:before {
+ content: "\f27d";
+}
+.fa-black-tie:before {
+ content: "\f27e";
+}
+.fa-fonticons:before {
+ content: "\f280";
+}
+.fa-reddit-alien:before {
+ content: "\f281";
+}
+.fa-edge:before {
+ content: "\f282";
+}
+.fa-credit-card-alt:before {
+ content: "\f283";
+}
+.fa-codiepie:before {
+ content: "\f284";
+}
+.fa-modx:before {
+ content: "\f285";
+}
+.fa-fort-awesome:before {
+ content: "\f286";
+}
+.fa-usb:before {
+ content: "\f287";
+}
+.fa-product-hunt:before {
+ content: "\f288";
+}
+.fa-mixcloud:before {
+ content: "\f289";
+}
+.fa-scribd:before {
+ content: "\f28a";
+}
+.fa-pause-circle:before {
+ content: "\f28b";
+}
+.fa-pause-circle-o:before {
+ content: "\f28c";
+}
+.fa-stop-circle:before {
+ content: "\f28d";
+}
+.fa-stop-circle-o:before {
+ content: "\f28e";
+}
+.fa-shopping-bag:before {
+ content: "\f290";
+}
+.fa-shopping-basket:before {
+ content: "\f291";
+}
+.fa-hashtag:before {
+ content: "\f292";
+}
+.fa-bluetooth:before {
+ content: "\f293";
+}
+.fa-bluetooth-b:before {
+ content: "\f294";
+}
+.fa-percent:before {
+ content: "\f295";
+}
diff --git a/templates/project/assets/stylesheets/jquery.gridster.css b/templates/project/assets/stylesheets/jquery.gridster.css
deleted file mode 100644
index d5124848..00000000
--- a/templates/project/assets/stylesheets/jquery.gridster.css
+++ /dev/null
@@ -1,57 +0,0 @@
-/*! gridster.js - v0.1.0 - 2012-08-14
-* http://gridster.net/
-* Copyright (c) 2012 ducksboard; Licensed MIT */
-
-.gridster {
- position:relative;
-}
-
-.gridster > * {
- margin: 0 auto;
- -webkit-transition: height .4s;
- -moz-transition: height .4s;
- -o-transition: height .4s;
- -ms-transition: height .4s;
- transition: height .4s;
-}
-
-.gridster .gs_w{
- z-index: 2;
- position: absolute;
-}
-
-.ready .gs_w:not(.preview-holder) {
- -webkit-transition: opacity .3s, left .3s, top .3s;
- -moz-transition: opacity .3s, left .3s, top .3s;
- -o-transition: opacity .3s, left .3s, top .3s;
- transition: opacity .3s, left .3s, top .3s;
-}
-
-.gridster .preview-holder {
- z-index: 1;
- position: absolute;
- background-color: #fff;
- border-color: #fff;
- opacity: 0.3;
-}
-
-.gridster .player-revert {
- z-index: 10!important;
- -webkit-transition: left .3s, top .3s!important;
- -moz-transition: left .3s, top .3s!important;
- -o-transition: left .3s, top .3s!important;
- transition: left .3s, top .3s!important;
-}
-
-.gridster .dragging {
- z-index: 10!important;
- -webkit-transition: all 0s !important;
- -moz-transition: all 0s !important;
- -o-transition: all 0s !important;
- transition: all 0s !important;
-}
-
-/* Uncomment this if you set helper : "clone" in draggable options */
-/*.gridster .player {
- opacity:0;
-}*/
\ No newline at end of file
diff --git a/templates/project/assets/stylesheets/jquery.gridster.min.css b/templates/project/assets/stylesheets/jquery.gridster.min.css
new file mode 100644
index 00000000..4639de9d
--- /dev/null
+++ b/templates/project/assets/stylesheets/jquery.gridster.min.css
@@ -0,0 +1,2 @@
+/*! gridster.js - v0.5.1 - 2014-03-26 - * http://gridster.net/ - Copyright (c) 2014 ducksboard; Licensed MIT */
+.gridster{position:relative}.gridster>*{margin:0 auto;-webkit-transition:height .4s,width .4s;-moz-transition:height .4s,width .4s;-o-transition:height .4s,width .4s;-ms-transition:height .4s,width .4s;transition:height .4s,width .4s}.gridster .gs-w{z-index:2;position:absolute}.ready .gs-w:not(.preview-holder){-webkit-transition:opacity .3s,left .3s,top .3s;-moz-transition:opacity .3s,left .3s,top .3s;-o-transition:opacity .3s,left .3s,top .3s;transition:opacity .3s,left .3s,top .3s}.ready .gs-w:not(.preview-holder),.ready .resize-preview-holder{-webkit-transition:opacity .3s,left .3s,top .3s,width .3s,height .3s;-moz-transition:opacity .3s,left .3s,top .3s,width .3s,height .3s;-o-transition:opacity .3s,left .3s,top .3s,width .3s,height .3s;transition:opacity .3s,left .3s,top .3s,width .3s,height .3s}.gridster .preview-holder{z-index:1;position:absolute;background-color:#fff;border-color:#fff;opacity:.3}.gridster .player-revert{z-index:10!important;-webkit-transition:left .3s,top .3s!important;-moz-transition:left .3s,top .3s!important;-o-transition:left .3s,top .3s!important;transition:left .3s,top .3s!important}.gridster .dragging,.gridster .resizing{z-index:10!important;-webkit-transition:all 0s!important;-moz-transition:all 0s!important;-o-transition:all 0s!important;transition:all 0s!important}.gs-resize-handle{position:absolute;z-index:1}.gs-resize-handle-both{width:20px;height:20px;bottom:-8px;right:-8px;background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pg08IS0tIEdlbmVyYXRvcjogQWRvYmUgRmlyZXdvcmtzIENTNiwgRXhwb3J0IFNWRyBFeHRlbnNpb24gYnkgQWFyb24gQmVhbGwgKGh0dHA6Ly9maXJld29ya3MuYWJlYWxsLmNvbSkgLiBWZXJzaW9uOiAwLjYuMSAgLS0+DTwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DTxzdmcgaWQ9IlVudGl0bGVkLVBhZ2UlMjAxIiB2aWV3Qm94PSIwIDAgNiA2IiBzdHlsZT0iYmFja2dyb3VuZC1jb2xvcjojZmZmZmZmMDAiIHZlcnNpb249IjEuMSINCXhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbDpzcGFjZT0icHJlc2VydmUiDQl4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjZweCIgaGVpZ2h0PSI2cHgiDT4NCTxnIG9wYWNpdHk9IjAuMzAyIj4NCQk8cGF0aCBkPSJNIDYgNiBMIDAgNiBMIDAgNC4yIEwgNCA0LjIgTCA0LjIgNC4yIEwgNC4yIDAgTCA2IDAgTCA2IDYgTCA2IDYgWiIgZmlsbD0iIzAwMDAwMCIvPg0JPC9nPg08L3N2Zz4=);background-position:top left;background-repeat:no-repeat;cursor:se-resize;z-index:20}.gs-resize-handle-x{top:0;bottom:13px;right:-5px;width:10px;cursor:e-resize}.gs-resize-handle-y{left:0;right:13px;bottom:-5px;height:10px;cursor:s-resize}.gs-w:hover .gs-resize-handle,.resizing .gs-resize-handle{opacity:1}.gs-resize-handle,.gs-w.dragging .gs-resize-handle{opacity:0}.gs-resize-disabled .gs-resize-handle{display:none!important}[data-max-sizex="1"] .gs-resize-handle-x,[data-max-sizey="1"] .gs-resize-handle-y,[data-max-sizey="1"][data-max-sizex="1"] .gs-resize-handle{display:none!important}
diff --git a/templates/project/config.ru b/templates/project/config.ru
index 6e1076a0..624244ea 100644
--- a/templates/project/config.ru
+++ b/templates/project/config.ru
@@ -5,8 +5,8 @@ configure do
helpers do
def protected!
- # Put any authentication code you want in here.
- # This method is run before accessing any resource.
+ # Put any authentication code you want in here.
+ # This method is run before accessing any resource.
end
end
end
@@ -15,4 +15,4 @@ map Sinatra::Application.assets_prefix do
run Sinatra::Application.sprockets
end
-run Sinatra::Application
\ No newline at end of file
+run Sinatra::Application
diff --git a/templates/project/dashboards/sample.erb b/templates/project/dashboards/sample.erb
index d41d5383..08c3b512 100644
--- a/templates/project/dashboards/sample.erb
+++ b/templates/project/dashboards/sample.erb
@@ -6,7 +6,7 @@
-
+
@@ -22,4 +22,4 @@
Try this: curl -d '{ "auth_token": "YOUR_AUTH_TOKEN", "text": "Hey, Look what I can do!" }' \http://<%=request.host%>:<%=request.port%>/widgets/welcome
-
\ No newline at end of file
+
diff --git a/templates/project/dashboards/sampletv.erb b/templates/project/dashboards/sampletv.erb
index cf4b39c2..6f3cb607 100644
--- a/templates/project/dashboards/sampletv.erb
+++ b/templates/project/dashboards/sampletv.erb
@@ -14,7 +14,7 @@ $(function() {
-
-
+
-
@@ -39,7 +39,7 @@ $(function() {
-
-
+
-
@@ -48,9 +48,9 @@ $(function() {
-
-
+
Try this: curl -d '{ "auth_token": "YOUR_AUTH_TOKEN", "text": "Hey, Look what I can do!" }' \http://<%=request.host%>:<%=request.port%>/widgets/welcome
-
\ No newline at end of file
+
diff --git a/templates/project/widgets/graph/graph.html b/templates/project/widgets/graph/graph.html
index 456dd0fa..786bbb73 100644
--- a/templates/project/widgets/graph/graph.html
+++ b/templates/project/widgets/graph/graph.html
@@ -1,5 +1,5 @@
-
+
diff --git a/templates/project/widgets/meter/meter.html b/templates/project/widgets/meter/meter.html
index 16f1f06a..72592fb1 100644
--- a/templates/project/widgets/meter/meter.html
+++ b/templates/project/widgets/meter/meter.html
@@ -1,6 +1,6 @@
-
+
diff --git a/templates/project/widgets/number/number.coffee b/templates/project/widgets/number/number.coffee
index 645ee7f3..0e5950c0 100644
--- a/templates/project/widgets/number/number.coffee
+++ b/templates/project/widgets/number/number.coffee
@@ -13,7 +13,7 @@ class Dashing.Number extends Dashing.Widget
@accessor 'arrow', ->
if @get('last')
- if parseInt(@get('current')) > parseInt(@get('last')) then 'icon-arrow-up' else 'icon-arrow-down'
+ if parseInt(@get('current')) > parseInt(@get('last')) then 'fa fa-arrow-up' else 'fa fa-arrow-down'
onData: (data) ->
if data.status
diff --git a/test/cli_test.rb b/test/cli_test.rb
index 567827eb..4d822969 100644
--- a/test/cli_test.rb
+++ b/test/cli_test.rb
@@ -68,10 +68,10 @@ def test_install_task_calls_create_file_for_each_valid_file_in_gist
Dir.stubs(:pwd).returns('')
Dashing::Downloader.stubs(:get_gist).returns(JSON.parse(json_response))
- @cli.stubs(:create_file).with('/jobs/ruby_job.rb', 'some job content').once
- @cli.stubs(:create_file).with('/widgets/num/num.html', 'some html content').once
- @cli.stubs(:create_file).with('/widgets/num/num.scss', 'some sass content').once
- @cli.stubs(:create_file).with('/widgets/num/num.coffee', 'some coffee content').once
+ @cli.stubs(:create_file).with('/jobs/ruby_job.rb', 'some job content', {:skip => false}).once
+ @cli.stubs(:create_file).with('/widgets/num/num.html', 'some html content', {:skip => false}).once
+ @cli.stubs(:create_file).with('/widgets/num/num.scss', 'some sass content', {:skip => false}).once
+ @cli.stubs(:create_file).with('/widgets/num/num.coffee', 'some coffee content', {:skip => false}).once
capture_io { @cli.install(123) }
end