QA for browser check.
This commit is contained in:
parent
27f5202097
commit
64230737da
4 changed files with 65 additions and 50 deletions
|
@ -400,6 +400,20 @@ class App.ControllerModal extends App.Controller
|
|||
# @callback.error = options.error
|
||||
|
||||
super(options)
|
||||
if options.show
|
||||
@render()
|
||||
|
||||
render: ->
|
||||
@html App.view('modal')(
|
||||
title: @title,
|
||||
message: @message
|
||||
detail: @detail
|
||||
close: @close
|
||||
)
|
||||
@modalShow(
|
||||
backdrop: @backdrop,
|
||||
keyboard: @keyboard,
|
||||
)
|
||||
|
||||
modalShow: (params) ->
|
||||
defaults = {
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
class App.BrowsercheckWidget extends App.Controller
|
||||
constructor: ->
|
||||
super
|
||||
|
||||
# bind on event to show message
|
||||
App.Event.bind 'session:browscheckfailed', (data) =>
|
||||
console.log('hannes was here')
|
||||
new Message(data)
|
||||
|
||||
|
||||
class Message extends App.ControllerModal
|
||||
constructor: ->
|
||||
super
|
||||
@render()
|
||||
|
||||
render: ->
|
||||
@html App.view('modal')(
|
||||
title: @title,
|
||||
message: @message
|
||||
detail: @detail
|
||||
close: @close
|
||||
)
|
||||
@modalShow(
|
||||
backdrop: false,
|
||||
keyboard: false,
|
||||
)
|
||||
|
||||
App.Config.set( 'browscheckfailed', App.BrowsercheckWidget, 'Widgets' )
|
|
@ -1,13 +1,48 @@
|
|||
class App.Browser extends App.Controller
|
||||
constructor: ->
|
||||
super
|
||||
class App.Browser
|
||||
@detection: ->
|
||||
data =
|
||||
browser: @searchString(@dataBrowser) or "An unknown browser"
|
||||
version: @searchVersion(navigator.userAgent) or @searchVersion(navigator.appVersion) or "an unknown version"
|
||||
OS: @searchString(@dataOS) or "an unknown OS"
|
||||
|
||||
@init: ->
|
||||
@browser = @searchString(@dataBrowser) or "An unknown browser"
|
||||
@version = @searchVersion(navigator.userAgent) or @searchVersion(navigator.appVersion) or "an unknown version"
|
||||
@OS = @searchString(@dataOS) or "an unknown OS"
|
||||
return @check()
|
||||
@check: ->
|
||||
data = @detection()
|
||||
|
||||
# disable Crome 13 and older
|
||||
if data.browser == 'Chrome' && data.version <= 13
|
||||
@message(data)
|
||||
return false
|
||||
|
||||
# disable Firefox 6 and older
|
||||
else if data.browser == 'Firefox' && data.version <= 6
|
||||
@message(data)
|
||||
return false
|
||||
|
||||
# disable IE 8 and older
|
||||
else if data.browser == 'Explorer' && data.version <= 8
|
||||
@message(data)
|
||||
return false
|
||||
|
||||
# disable Safari 3 and older
|
||||
else if data.browser == 'Firefox' && data.version <= 3
|
||||
@message(data)
|
||||
return false
|
||||
|
||||
# disable Opera 10 and older
|
||||
else if data.browser == 'Firefox' && data.version <= 10
|
||||
@message(data)
|
||||
return false
|
||||
|
||||
return true
|
||||
|
||||
@message: (data) ->
|
||||
new App.ControllerModal(
|
||||
title: 'Browser too old!'
|
||||
message: "Your Browser is not supported. Please use a newer one (#{data.browser} #{data.version} #{data.OS})"
|
||||
show: true
|
||||
backdrop: false
|
||||
keyboard: false
|
||||
)
|
||||
|
||||
@searchString: (data) ->
|
||||
i = 0
|
||||
|
@ -100,13 +135,4 @@ class App.Browser extends App.Controller
|
|||
identity: "Linux"
|
||||
]
|
||||
|
||||
@check: ->
|
||||
if @browser == 'Chrome' && @version <= 27
|
||||
App.Event.trigger('session:browscheckfailed', {title: 'Error', message: 'Your Browser is not supported!'})
|
||||
return false
|
||||
else
|
||||
return true
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -6,7 +6,8 @@ class App.Run extends App.Controller
|
|||
App.Event.trigger('app:init')
|
||||
|
||||
# browser check
|
||||
# App.Browser.check()
|
||||
if !App.Browser.check()
|
||||
return
|
||||
|
||||
# init collections
|
||||
App.Collection.init()
|
||||
|
@ -21,9 +22,13 @@ class App.Run extends App.Controller
|
|||
App.Event.trigger('widget:init')
|
||||
widgets = App.Config.get( 'Widgets' )
|
||||
if widgets
|
||||
for key, widget of widgets
|
||||
sortedKeys = []
|
||||
for key, value of widgets
|
||||
sortedKeys.push key
|
||||
sortedKeys = sortedKeys.sort()
|
||||
for key in sortedKeys
|
||||
@el.append('<div id="' + key + '"></div>')
|
||||
new widget( el: @el.find("##{key}") )
|
||||
new widgets[key]( el: @el.find("##{key}") )
|
||||
App.Event.trigger('widget:ready')
|
||||
|
||||
# bind to fill selected text into
|
||||
|
@ -44,8 +49,6 @@ class App.Content extends App.Controller
|
|||
|
||||
@log 'Content', 'notice', 'execute page controller', route, params
|
||||
|
||||
if !App.Browser.init()
|
||||
return
|
||||
# remove observers for page
|
||||
App.Collection.observeUnbindLevel('page')
|
||||
|
||||
|
|
Loading…
Reference in a new issue