Sha256: 2a59b619c8617532089d4c97145fa37fd86ef43a2d29ec86d729bee0b58b6a86

Contents?: true

Size: 1.19 KB

Versions: 14

Compression:

Stored size: 1.19 KB

Contents

# 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.getWidgetPositions = ->
  $(".gridster ul:first").gridster().data('gridster').serialize()

Dashing.showGridsterInstructions = ->
  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(Dashing.currentWidgetPositions)}')\n
      });\n
      </script>
    ")

$ ->
  $('#save-gridster').leanModal()

  $('#save-gridster').click ->
    $('#save-gridster').slideUp()

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
dashing-rails-2.4.0 lib/assets/javascripts/dashing.gridster.coffee
dashing-rails-2.3.2 lib/assets/javascripts/dashing.gridster.coffee
dashing-rails-2.3.1 lib/assets/javascripts/dashing.gridster.coffee
dashing-rails-2.3.0 lib/assets/javascripts/dashing.gridster.coffee
dashing-rails-2.2.0 lib/assets/javascripts/dashing.gridster.coffee
dashing-rails-2.1.1 lib/assets/javascripts/dashing.gridster.coffee
dashing-rails-2.1.0 lib/assets/javascripts/dashing.gridster.coffee
dashing-rails-2.0.2 lib/assets/javascripts/dashing.gridster.coffee
dashing-rails-2.0.1 lib/assets/javascripts/dashing.gridster.coffee
dashing-rails-2.0.0 lib/assets/javascripts/dashing.gridster.coffee
dashing-rails-1.0.3 lib/assets/javascripts/dashing.gridster.coffee
dashing-rails-1.0.2 lib/assets/javascripts/dashing.gridster.coffee
dashing-rails-1.0.1 lib/assets/javascripts/dashing.gridster.coffee
dashing-rails-1.0.0 lib/assets/javascripts/dashing.gridster.coffee