my_dashboard 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/assets/javascripts/my_dashboard.gridster.coffee +51 -0
- data/lib/my_dashboard/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fb0eb750ecf6233c11d7cbd20edd9ef717d8137
|
4
|
+
data.tar.gz: bfa0ae3b997e3fb235b96d6930d78df43891dd7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b24bac8cb89ac355b2509fc02d3a69e38b20d4a1ead73c4c94aa8f25d2e12dd5ac8d6f55fb8e0dcd91246eda2f4a27ab286269b638f2826ea2107fe1b852a02f
|
7
|
+
data.tar.gz: fce9b5dca37dcc78ea9103e032eae39751fd44f208416a93d7700cbe4c0a201ad431135bb4ff111ab27307a111ec9b3f07ed71c292dabc244a08747009ed9a00
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
# This file enables gridster integration (http://gridster.net/)
|
2
|
+
# Delete it if you'd rather handle the layout yourself.
|
3
|
+
# You'll miss out on a lot if you do, but we won't hold it against you.
|
4
|
+
|
5
|
+
MyDashboard.gridsterLayout = (positions) ->
|
6
|
+
MyDashboard.customGridsterLayout = true
|
7
|
+
positions = positions.replace(/^"|"$/g, '')
|
8
|
+
positions = $.parseJSON(positions)
|
9
|
+
widgets = $("[data-row]")
|
10
|
+
maxRow = 1
|
11
|
+
maxCol = 1
|
12
|
+
numColumns = MyDashboard.numColumns || 1
|
13
|
+
for widget, index in widgets
|
14
|
+
if positions? and index < positions.length
|
15
|
+
$(widget).attr('data-row', positions[index].row)
|
16
|
+
$(widget).attr('data-col', positions[index].col)
|
17
|
+
if positions[index].row > maxRow
|
18
|
+
maxRow = positions[index].row
|
19
|
+
maxCol = positions[index].col + 1
|
20
|
+
else if positions[index].row == maxRow and positions[index].col >= maxCol
|
21
|
+
maxCol = positions[index].col + 1
|
22
|
+
else
|
23
|
+
if maxCol > numColumns
|
24
|
+
maxRow += 1
|
25
|
+
maxCol = 1
|
26
|
+
$(widget).attr('data-row', maxRow)
|
27
|
+
$(widget).attr('data-col', maxCol)
|
28
|
+
maxCol += 1
|
29
|
+
|
30
|
+
MyDashboard.getWidgetPositions = ->
|
31
|
+
$(".gridster ul:first").gridster().data('gridster').serialize()
|
32
|
+
|
33
|
+
MyDashboard.showGridsterInstructions = ->
|
34
|
+
newWidgetPositions = MyDashboard.getWidgetPositions()
|
35
|
+
|
36
|
+
unless JSON.stringify(newWidgetPositions) == JSON.stringify(MyDashboard.currentWidgetPositions)
|
37
|
+
MyDashboard.currentWidgetPositions = newWidgetPositions
|
38
|
+
$('#save-gridster').slideDown()
|
39
|
+
$('#gridster-code').text("
|
40
|
+
<script type='text/javascript'>\n
|
41
|
+
$(function() {\n
|
42
|
+
\ \ MyDashboard.gridsterLayout('#{JSON.stringify(MyDashboard.currentWidgetPositions)}')\n
|
43
|
+
});\n
|
44
|
+
</script>
|
45
|
+
")
|
46
|
+
|
47
|
+
$ ->
|
48
|
+
$('#save-gridster').leanModal()
|
49
|
+
|
50
|
+
$('#save-gridster').click ->
|
51
|
+
$('#save-gridster').slideUp()
|
data/lib/my_dashboard/version.rb
CHANGED