Commit Graph
49 Commits
Author SHA1 Message Date
Davide Callegari 36bec0bb14 Fixed a couple of errors in the methods definition
Added my own IDE filed in the .gitignore file
2013-02-15 14:29:54 +01:00
vieron 55edd11ef8 gridster: new method remove_all_widgets
Remove multiple widgets without chaining callbacks was not possible so I've added a new argument to remove_widget method named `silent` which if it's value is true, widgets below the removed will not move up.

Also added the method remove_all_widgets.

Fixes #63
2012-10-20 01:37:41 +02:00
vieron 68f1d6279c Avoid dynamic column generation.
Using add_faux_col each time a new widget is added to the grid caused the widget was always positioned in the first row on the right. Related to #60.
2012-10-15 15:47:31 +02:00
vieron 5a3c382c8b Immediate children selection for widgets. Fixes #52. 2012-10-07 21:12:38 +02:00
vieron 7dbbc105c1 add_faux_cell: create parent array if doesn't exists 2012-10-07 21:12:38 +02:00
vieron 82b8778762 if not passed, use default namespace for generating stylessheets 2012-10-07 21:12:38 +02:00
vieron 7fc97d0f79 Allow to extend gridster out of the scope 2012-10-07 21:12:38 +02:00
vieron 0b1c9899d0 some code style corrections/improvements 2012-10-07 21:12:38 +02:00
vieron c4fee63b96 ability to specify a max row as limit in can_move_to method 2012-10-03 15:40:16 +02:00
vieron 3d5077dd7b add_faux_cols method 2012-10-03 15:33:46 +02:00
vieron 3bc9ea3527 Possibility to namespace first-time styles generated by gridster.
Useful if you have multiple grid instances in the same document.
2012-09-12 17:50:48 +02:00
vieron b71b8727df gridster: moving down widgets under placeholder. Related to #4.
This solves the overlapping-blocks seen in the screencast provided by @daniel-nelson. I've captured another one trying to reproduce the same movements with this commit applied: http://www.screenr.com/g7J8
2012-09-09 14:21:31 +02:00
vieron 9402f202b8 update coords for the new widget size.
Reported by @bmla in https://github.com/ducksboard/gridster.js/commit/dbf98cc9bdc#commitcomment-1735360
2012-08-20 21:06:21 +02:00
vieron dbf98cc9bd Resize widgets feature. Closes #15.
By popular demand, now gridster allows to change the size of widgets dynamically.

Usage.
- gridster_api.resize_wiget($widget, [size_x], [size_y]);

E.g. (try in gridster.net):
    - gridster.resize_widget($('.gs_w:eq(3)'), 6);
    - gridster.resize_widget($('.gs_w:eq(3)'), 1, 4);

To do this, two new methods were added to gridster:

    - empty_cells(col, row, size_x, size_y, $exclude)
      Move down widgets in cells represented by the arguments col, row, size_x,
      size_y.

    - remove_empty_cells(col, row, size_x, size_y, $exclude)
      Move up widgets below cells represented by the arguments col, row, size_x,
      size_y.

Also, add_widget method supports specifying a row and column. This was easy
through empty_cells method. Related to #24. Thanks to @parkerd for the help!

The code should be improved and make it more reusable when the feature of
"move widgets dynamically" is added (related to #20).
2012-08-20 01:31:34 +02:00
vieron 010444f57c Allow widgets to start in a specific col+row on the grid 2012-08-18 22:10:12 +02:00
vieron 32ea0da04b wip: resize widget feature 2012-08-18 22:10:12 +02:00
vieron 1d65da9260 Improving the way that rows are calculated. Related to #30.
Until now, the number of rows for the faux grid (this.cols) was calculated taking the highest
value among min_rows option, the highest widget, and the number of rows
that fits on the wrapper height (based on widget_base_dimensions, widget_margins
and extra_rows options).

In addition to this, styles for data-row attributes ara generated based on
this.cols (above) plus a constant value of 10. This was done to reduce
the number of cells by which iterate when dragging, but it's not very logical...

So, now the number of rows is calculated by adding the height of all widgets.
In this way we ensure that there is always available cells in the grid.
Also the same number of rows are generated for both the faux grid and
the DOM grid (css styles).
2012-08-18 19:34:47 +02:00
vieron 573ed66922 fixes in drag/stop callbacks. Related to #23.
- break ondrag callback execution if stop event already was fired.
- unset this.$player after the execution of draggable.stop callback.
2012-08-14 00:06:03 +02:00
vieron 81c96b92d5 fixed: drag api access from gridster and draggable.disable method.
Fixes #25. I broke this in the issue #17 and commit 8e7a5c.
2012-08-13 22:32:35 +02:00
vieron 6c9eaf067d Fixes related to overlapping problems. Solve part of #4.
Some fixes are about errors (seen in the link provided by @floflow in #16)
produced by drag large blocks.
2012-08-12 18:47:02 +02:00
vieron d78bd254bd renamed jQuery adapter for Draggable class to $.fn.drag. Fixes #17.
Prevents name collisions with jQuery UI draggable module.
2012-08-08 23:33:31 +02:00
vieron 5f4e6ded39 fixed index error in for loop. Fixes #16. 2012-08-08 20:37:02 +02:00
vieron 148963d12f added max_size_x and max_size_y as configurable options. Fixes #16.
The maximum number of columns/rows that a widget can span
was hardcoded to 6. Maybe it makes sense for dashboards but
not for other uses of gridster.
2012-08-08 01:21:30 +02:00
vieron dc0a548bd4 stupid typos 2012-08-07 00:59:58 +02:00
vieron f359a7eb76 fixed typo in docs 2012-08-06 23:55:30 +02:00
vieron 4048784eaf Forcing conversion to arrays before calling Math.max 2012-07-30 21:17:03 +02:00
vieron 6972f9fb33 recalculate grid height when a widget is removed 2012-07-27 17:55:04 +02:00
Jan Urbański f4e425ced2 switch to using the MIT license exclusively 2012-07-27 13:29:07 +02:00
vieron 341e1bbd4c prevent cols/rows from being empty arrays (needed to pass phantom tests) 2012-07-26 09:58:39 +02:00
vieron e4e06f4cde gridster: passing Math (not null) as first argument in Math.max.apply() 2012-07-25 17:58:18 +02:00
vieron 06b53fdc19 throttling to 60ms to prevent overlapping 2012-07-24 16:56:16 +02:00
vieron 3456aef408 trottling drag callback 2012-07-24 15:40:49 +02:00
vieron 443d0fbc29 jslinting 2012-07-24 10:34:12 +02:00
vieron 4eb679fb78 documentation fixes 2012-07-23 22:51:04 +02:00
vieron 33b8f206cf updated Gridster doc and code style corrections 2012-07-23 22:07:43 +02:00
vieron f0a50649d1 removing playing-revert class when gridster is disabled 2012-07-23 15:14:53 +02:00
vieron 5edfe0a488 new methods, fixes and improvements:
- new disable, enable methods

- don't generate duplicated stylesheets for the same origin config

- new configuration option called 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.

- Removed jquery ui dependencie.

- Fix to prevent widgets go out of the grid.

- New methods to get all widgets from a column or row.

- generate_stylesheets method now supports namespaces to generate multiple stylesheets based on a parent class.
2012-07-23 11:01:05 +02:00
vieron 18b620f6ce the remove_widget callback must be inside the fadeout callback 2012-07-20 15:47:39 +02:00
vieron fbeb2ac05c fixed add_widget method 2012-07-20 14:03:24 +02:00
vieron 9dbad2b29e remove_widget accepts a callback as second argument 2012-07-20 14:03:03 +02:00
vieron 7624182bf4 updated docs and diet 2012-07-20 11:06:26 +02:00
vieron 0e03a05435 namespaced gridster events: dragstart, dragstop, drag 2012-07-20 11:04:54 +02:00
vieron 79bec6897f using next_positions inside add_widget method 2012-07-19 16:44:49 +02:00
vieron 97074001bb fixed a bug that caused next_positions method redefinition 2012-07-19 16:10:31 +02:00
vieron 2bcd943fff new method to get the next position of a new widget 2012-07-19 15:56:01 +02:00
vieron b83d993d4b recalculate faux grid offsets when browser is resized 2012-07-19 11:08:10 +02:00
vieron 31028a3975 fixed compatibility issues with the helper:clone option of Draggable 2012-07-18 21:48:53 +02:00
vieron 6fe6f720da documentation typos 2012-07-18 19:08:36 +02:00
vieron 257914ee99 initial commit 2012-07-18 18:31:44 +02:00