Skip to content

Instantly share code, notes, and snippets.

@kerbyfc
Last active December 3, 2015 13:00
Show Gist options
  • Save kerbyfc/5f0b6bffe66e6e9b8042 to your computer and use it in GitHub Desktop.
Save kerbyfc/5f0b6bffe66e6e9b8042 to your computer and use it in GitHub Desktop.
Fix for views/controls/grid.coffee
initialize: (o) ->
{@checkbox, @static} = o
- o.config = @config = _.result @collection, 'config'
+ o.config = @config = @getGridOptions('config')
(@config.default ?= {}).checkbox = true if @checkbox
@@ -266,16 +266,18 @@ class App.Views.Controls.ContentGrid extends App.Views.Controls.Grid
className: ->
if @options.popup or @popup then 'popup__contentWrap' else 'content'
+ getGridOptions: (key) ->
+ _.result((@options?.collection or {}), key) or _.result(@, key)
behaviors: ->
behaviors = super
collection = @options.collection
proto = collection.model::
@type = proto.type
- @buttons = _.result collection, 'buttons'
+ @buttons = @getGridOptions("buttons")
o = container: "#{@ui().toolbar}[data-type=#{@type}]"
- behaviors.Toolbar = _.extend o, _.result(@options.collection, 'toolbar')
+ behaviors.Toolbar = _.extend o, @getGridOptions('toolbar')
if @options.collection.model::can 'move'
behaviors.Drag = behaviorClass: App.Behaviors.Grid.Drag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment