summaryrefslogtreecommitdiff
path: root/templates/project/assets/javascripts/dashing.gridster.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'templates/project/assets/javascripts/dashing.gridster.coffee')
-rw-r--r--templates/project/assets/javascripts/dashing.gridster.coffee13
1 files changed, 9 insertions, 4 deletions
diff --git a/templates/project/assets/javascripts/dashing.gridster.coffee b/templates/project/assets/javascripts/dashing.gridster.coffee
index 0f6f9a1..e25c561 100644
--- a/templates/project/assets/javascripts/dashing.gridster.coffee
+++ b/templates/project/assets/javascripts/dashing.gridster.coffee
@@ -13,20 +13,25 @@ Dashing.gridsterLayout = (positions) ->
$(widget).attr('data-row', positions[index].row)
$(widget).attr('data-col', positions[index].col)
+Dashing.getWidgetPositions = ->
+ $(".gridster ul:first").gridster().data('gridster').serialize()
+
Dashing.showGridsterInstructions = ->
- data = $(".gridster ul:first").gridster().data('gridster').serialize()
+ newWidgetPositions = Dashing.getWidgetPositions()
+
+ unless JSON.stringify(newWidgetPositions) == JSON.stringify(Dashing.currentWidgetPositions)
+ Dashing.currentWidgetPositions = newWidgetPositions
$('#save-gridster').slideDown()
$('#gridster-code').text("
<script type='text/javascript'>\n
$(function() {\n
- \ \ Dashing.gridsterLayout('#{JSON.stringify(data)}')\n
+ \ \ Dashing.gridsterLayout('#{JSON.stringify(Dashing.currentWidgetPositions)}')\n
});\n
</script>
")
-
$ ->
$('#save-gridster').leanModal()
$('#save-gridster').click ->
- $('#save-gridster').slideUp() \ No newline at end of file
+ $('#save-gridster').slideUp()