Permalink
Browse files

Allow Popup to function without ST loaded. Fixed some requires.

  • Loading branch information...
1 parent 4fb4556 commit 0b3df1e28ff65e7aabdf56cec658f136df2f360c @tobico committed Apr 4, 2012
Showing with 8 additions and 5 deletions.
  1. +4 −4 lib/Popup.coffee
  2. +3 −0 lib/ST/FormView.coffee
  3. +1 −1 lib/ST/TextFieldView.coffee
View
@@ -14,7 +14,7 @@ window.Popup = {
_view: null
keyDown: (key) ->
- if key == ST.View.VK_ESCAPE
+ if key == (if window.ST && ST.View then ST.View.VK_ESCAPE else 27)
@close()
true
@@ -24,7 +24,7 @@ window.Popup = {
@_closeCallback = null
@_popupID = null
@_view.returnKeyboardFocus() if @_view
- ST.View.method('returnKeyboardFocus').call(this) if ST.View
+ ST.View.method('returnKeyboardFocus').call(this) if window.ST && ST.View
$('#popup').removeAttr('id').stop().fadeOut 100, ->
onClose() if onClose
if @_view
@@ -50,9 +50,9 @@ window.Popup = {
@_closeCallback = ->
options.close.call element, element if options.close
- ST.View.method('takeKeyboardFocus').call(this) if ST.View
+ ST.View.method('takeKeyboardFocus').call(this) if window.ST && ST.View
- if ST.View && (display instanceof ST.View)
+ if window.ST && ST.View && (display instanceof ST.View)
@_view = display
display.load()
display.takeKeyboardFocus()
@@ -1,6 +1,9 @@
#= require ST/View
#= require ST/TextFieldView
#= require ST/ModelFieldView
+#= require ST/EnumFieldView
+#= require ST/BoolFieldView
+#= require ST/DateTimeFieldView
ST.class 'FormView', 'View', ->
@initializer (options, definition) ->
@@ -1,4 +1,4 @@
-#= require ST/View
+#= require ST/FieldView
ST.class 'TextFieldView', 'FieldView', ->
@initializer ->

0 comments on commit 0b3df1e

Please sign in to comment.