diff options
Diffstat (limited to 'templates/project/assets/javascripts/dashing.gridster.coffee')
-rw-r--r-- | templates/project/assets/javascripts/dashing.gridster.coffee | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/templates/project/assets/javascripts/dashing.gridster.coffee b/templates/project/assets/javascripts/dashing.gridster.coffee new file mode 100644 index 0000000..0f6f9a1 --- /dev/null +++ b/templates/project/assets/javascripts/dashing.gridster.coffee @@ -0,0 +1,32 @@ +#= require_directory ./gridster + +# This file enables gridster integration (http://gridster.net/) +# Delete it if you'd rather handle the layout yourself. +# You'll miss out on a lot if you do, but we won't hold it against you. + +Dashing.gridsterLayout = (positions) -> + Dashing.customGridsterLayout = true + positions = positions.replace(/^"|"$/g, '') + positions = $.parseJSON(positions) + widgets = $("[data-row^=]") + for widget, index in widgets + $(widget).attr('data-row', positions[index].row) + $(widget).attr('data-col', positions[index].col) + +Dashing.showGridsterInstructions = -> + data = $(".gridster ul:first").gridster().data('gridster').serialize() + $('#save-gridster').slideDown() + $('#gridster-code').text(" + <script type='text/javascript'>\n + $(function() {\n + \ \ Dashing.gridsterLayout('#{JSON.stringify(data)}')\n + });\n + </script> + ") + + +$ -> + $('#save-gridster').leanModal() + + $('#save-gridster').click -> + $('#save-gridster').slideUp()
\ No newline at end of file |