Skip to content
This repository was archived by the owner on Mar 7, 2018. It is now read-only.

Get the view path of a widget on IE #322

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions javascripts/dashing.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Dashing.params = Batman.URI.paramsFromQuery(window.location.search.slice(1));
class Dashing.Widget extends Batman.View
constructor: ->
# Set the view path
@constructor::source = Batman.Filters.underscore(@constructor.name)
@constructor::source = Batman.Filters.underscore(@getName())
super

@mixin($(@node).data())
Expand All @@ -54,7 +54,15 @@ class Dashing.Widget extends Batman.View

@::on 'ready', ->
Dashing.Widget.fire 'ready'


getName: () =>
if (@constructor.name?)
return @constructor.name
# get constructor name from Function.toString
funcNameRegex = /function ([^\(]{1,})\(/;
results = (funcNameRegex).exec(@constructor.toString())
if (results && results.length > 1) then results[1].trim() else ""

receiveData: (data) =>
@mixin(data)
@onData(data)
Expand Down