Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A simpler gridster directive that thinly wraps it, needs to inline it…
…'s css though rather than sticking it in the <head></head>, also some commented out usage in the broker page
- Loading branch information
Showing
4 changed files
with
214 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
module UI { | ||
|
||
export class GridsterDirective { | ||
|
||
public restrict = 'A'; | ||
public replace = true; | ||
|
||
public controller = ($scope, $element, $attrs) => { | ||
|
||
}; | ||
|
||
public link = ($scope, $element, $attrs) => { | ||
|
||
var widgetMargins = [6, 6]; | ||
var widgetBaseDimensions = [150, 150]; | ||
var gridSize = [150, 150]; | ||
var extraRows = 10; | ||
var extraCols = 6; | ||
|
||
/* | ||
if (angular.isDefined($attrs['dimensions'])) { | ||
var dimension = $attrs['dimensions'].toNumber(); | ||
widgetBaseDimensions = [dimension, dimension]; | ||
} | ||
if (angular.isDefined($attrs['margins'])) { | ||
var margins = $attrs['margins'].toNumber(); | ||
widgetMargins = [margins, margins]; | ||
} | ||
if (angular.isDefined($attrs['gridSize'])) { | ||
var size = $attrs['gridSize'].toNumber(); | ||
gridSize = [size, size]; | ||
} | ||
*/ | ||
|
||
if (angular.isDefined($attrs['extraRows'])) { | ||
extraRows = $attrs['extraRows'].toNumber(); | ||
} | ||
|
||
if (angular.isDefined($attrs['extraCols'])) { | ||
extraCols = $attrs['extraCols'].toNumber(); | ||
} | ||
|
||
var grid =$('<ul style="margin: 0"></ul>'); | ||
|
||
var styleStr = '<style type="text/css">'; | ||
|
||
var styleStr = styleStr + '</style>'; | ||
|
||
$element.append($(styleStr)); | ||
$element.append(grid); | ||
|
||
$scope.gridster = grid.gridster({ | ||
widget_margins: widgetMargins, | ||
grid_size: gridSize, | ||
extra_rows: extraRows, | ||
extra_cols: extraCols | ||
}).data('gridster'); | ||
|
||
}; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters