From 27f520209772ef2701dd53e3829991cb27797c76 Mon Sep 17 00:00:00 2001 From: Johannes Nickel Date: Tue, 11 Jun 2013 16:11:34 +0200 Subject: [PATCH 1/3] first browser check version --- .../controllers/browsercheck_widget.js.coffee | 28 +++++ .../app/lib/app_post/browser.coffee | 112 ++++++++++++++++++ .../lib/app_post/interface_handle.js.coffee | 2 + 3 files changed, 142 insertions(+) create mode 100644 app/assets/javascripts/app/controllers/browsercheck_widget.js.coffee create mode 100644 app/assets/javascripts/app/lib/app_post/browser.coffee diff --git a/app/assets/javascripts/app/controllers/browsercheck_widget.js.coffee b/app/assets/javascripts/app/controllers/browsercheck_widget.js.coffee new file mode 100644 index 000000000..80eb0b057 --- /dev/null +++ b/app/assets/javascripts/app/controllers/browsercheck_widget.js.coffee @@ -0,0 +1,28 @@ +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' ) diff --git a/app/assets/javascripts/app/lib/app_post/browser.coffee b/app/assets/javascripts/app/lib/app_post/browser.coffee new file mode 100644 index 000000000..8edebe37e --- /dev/null +++ b/app/assets/javascripts/app/lib/app_post/browser.coffee @@ -0,0 +1,112 @@ +class App.Browser extends App.Controller + constructor: -> + super + + @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() + + + @searchString: (data) -> + i = 0 + + while i < data.length + dataString = data[i].string + dataProp = data[i].prop + @versionSearchString = data[i].versionSearch or data[i].identity + if dataString + return data[i].identity unless dataString.indexOf(data[i].subString) is -1 + else return data[i].identity if dataProp + i++ + + @searchVersion: (dataString) -> + index = dataString.indexOf(@versionSearchString) + return if index is -1 + parseFloat dataString.substring(index + @versionSearchString.length + 1) + + @dataBrowser: [ + string: navigator.userAgent + subString: "Chrome" + identity: "Chrome" + , + string: navigator.userAgent + subString: "OmniWeb" + versionSearch: "OmniWeb/" + identity: "OmniWeb" + , + string: navigator.vendor + subString: "Apple" + identity: "Safari" + versionSearch: "Version" + , + prop: window.opera + identity: "Opera" + versionSearch: "Version" + , + string: navigator.vendor + subString: "iCab" + identity: "iCab" + , + string: navigator.vendor + subString: "KDE" + identity: "Konqueror" + , + string: navigator.userAgent + subString: "Firefox" + identity: "Firefox" + , + string: navigator.vendor + subString: "Camino" + identity: "Camino" + , + # for newer Netscapes (6+) + string: navigator.userAgent + subString: "Netscape" + identity: "Netscape" + , + string: navigator.userAgent + subString: "MSIE" + identity: "Explorer" + versionSearch: "MSIE" + , + string: navigator.userAgent + subString: "Gecko" + identity: "Mozilla" + versionSearch: "rv" + , + # for older Netscapes (4-) + string: navigator.userAgent + subString: "Mozilla" + identity: "Netscape" + versionSearch: "Mozilla" + ] + @dataOS: [ + string: navigator.platform + subString: "Win" + identity: "Windows" + , + string: navigator.platform + subString: "Mac" + identity: "Mac" + , + string: navigator.userAgent + subString: "iPhone" + identity: "iPhone/iPod" + , + string: navigator.platform + subString: "Linux" + 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 + + + + diff --git a/app/assets/javascripts/app/lib/app_post/interface_handle.js.coffee b/app/assets/javascripts/app/lib/app_post/interface_handle.js.coffee index f33a6e352..82d704fd8 100644 --- a/app/assets/javascripts/app/lib/app_post/interface_handle.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/interface_handle.js.coffee @@ -44,6 +44,8 @@ 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') From 64230737da60d1a0cc6e557508aab4fec56303fd Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 11 Jun 2013 22:39:43 +0200 Subject: [PATCH 2/3] QA for browser check. --- .../_application_controller.js.coffee | 14 +++++ .../controllers/browsercheck_widget.js.coffee | 28 --------- .../app/lib/app_post/browser.coffee | 60 +++++++++++++------ .../lib/app_post/interface_handle.js.coffee | 13 ++-- 4 files changed, 65 insertions(+), 50 deletions(-) delete mode 100644 app/assets/javascripts/app/controllers/browsercheck_widget.js.coffee diff --git a/app/assets/javascripts/app/controllers/_application_controller.js.coffee b/app/assets/javascripts/app/controllers/_application_controller.js.coffee index 0c23d9902..6b99177e1 100644 --- a/app/assets/javascripts/app/controllers/_application_controller.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller.js.coffee @@ -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 = { diff --git a/app/assets/javascripts/app/controllers/browsercheck_widget.js.coffee b/app/assets/javascripts/app/controllers/browsercheck_widget.js.coffee deleted file mode 100644 index 80eb0b057..000000000 --- a/app/assets/javascripts/app/controllers/browsercheck_widget.js.coffee +++ /dev/null @@ -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' ) diff --git a/app/assets/javascripts/app/lib/app_post/browser.coffee b/app/assets/javascripts/app/lib/app_post/browser.coffee index 8edebe37e..178f8853e 100644 --- a/app/assets/javascripts/app/lib/app_post/browser.coffee +++ b/app/assets/javascripts/app/lib/app_post/browser.coffee @@ -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 - - - diff --git a/app/assets/javascripts/app/lib/app_post/interface_handle.js.coffee b/app/assets/javascripts/app/lib/app_post/interface_handle.js.coffee index 82d704fd8..c776a04f7 100644 --- a/app/assets/javascripts/app/lib/app_post/interface_handle.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/interface_handle.js.coffee @@ -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('
') - 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') From 67379f70406ef1a58a839953e87ae6fda8606032 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 11 Jun 2013 23:24:04 +0200 Subject: [PATCH 3/3] Moved footer to java script context. Added boot splash screen. --- .../content_permanent_widget.js.coffee | 7 ------- .../javascripts/app/controllers/footer.js.coffee | 15 +++++++++++++++ .../app/lib/app_post/interface_handle.js.coffee | 3 +++ .../app/lib/app_post/task_manager.js.coffee | 4 ++++ app/assets/javascripts/app/views/footer.jst.eco | 4 ++++ app/assets/stylesheets/zzz.css | 16 +++++++++++++++- app/views/init/index.html.erb | 13 ++----------- db/seeds.rb | 2 +- 8 files changed, 44 insertions(+), 20 deletions(-) delete mode 100644 app/assets/javascripts/app/controllers/content_permanent_widget.js.coffee create mode 100644 app/assets/javascripts/app/controllers/footer.js.coffee create mode 100644 app/assets/javascripts/app/views/footer.jst.eco diff --git a/app/assets/javascripts/app/controllers/content_permanent_widget.js.coffee b/app/assets/javascripts/app/controllers/content_permanent_widget.js.coffee deleted file mode 100644 index d7c30f0fe..000000000 --- a/app/assets/javascripts/app/controllers/content_permanent_widget.js.coffee +++ /dev/null @@ -1,7 +0,0 @@ -class App.ContentPermanentWidget extends App.ControllerPermanent - className: 'container aaa' - - constructor: -> - super - -App.Config.set( 'content_permanent', App.ContentPermanentWidget, 'Widgets' ) diff --git a/app/assets/javascripts/app/controllers/footer.js.coffee b/app/assets/javascripts/app/controllers/footer.js.coffee new file mode 100644 index 000000000..c0e146899 --- /dev/null +++ b/app/assets/javascripts/app/controllers/footer.js.coffee @@ -0,0 +1,15 @@ +class App.Footer extends App.Controller + className: 'container' + + constructor: -> + super + @render() + + # rebuild ticket overview data + App.Event.bind 'ui:rerender', => + @render() + + render: () -> + @html App.view('footer')() + +App.Config.set( 'zzzfooter', App.Footer, 'Widgets' ) diff --git a/app/assets/javascripts/app/lib/app_post/interface_handle.js.coffee b/app/assets/javascripts/app/lib/app_post/interface_handle.js.coffee index c776a04f7..1cfa88692 100644 --- a/app/assets/javascripts/app/lib/app_post/interface_handle.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/interface_handle.js.coffee @@ -9,6 +9,9 @@ class App.Run extends App.Controller if !App.Browser.check() return + # hide splash screen + $('#splash').hide() + # init collections App.Collection.init() diff --git a/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee b/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee index 9d0f53ada..68f3744e7 100644 --- a/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee @@ -105,6 +105,10 @@ class _Singleton extends App.Controller tasks = @all() + # create div for permanent content + if !$("#content_permanent")[0] + $('#app').append('
') + # empty static content if task is shown if active @activeTask = key diff --git a/app/assets/javascripts/app/views/footer.jst.eco b/app/assets/javascripts/app/views/footer.jst.eco new file mode 100644 index 000000000..dc72ac441 --- /dev/null +++ b/app/assets/javascripts/app/views/footer.jst.eco @@ -0,0 +1,4 @@ + diff --git a/app/assets/stylesheets/zzz.css b/app/assets/stylesheets/zzz.css index cd465171a..c0501e234 100644 --- a/app/assets/stylesheets/zzz.css +++ b/app/assets/stylesheets/zzz.css @@ -449,4 +449,18 @@ footer { } .sub_attribute .controls { margin-left: 80px; -} \ No newline at end of file +} + +#splash { + background-color: #eee; + position: absolute; + width: 100%; + top: 0px; + height: 100%; +} +#splash .logo { + margin-left: auto; + margin-right: auto; + margin-top: 200px; + width: 100px; +} diff --git a/app/views/init/index.html.erb b/app/views/init/index.html.erb index fe131c0e7..113f0a8de 100644 --- a/app/views/init/index.html.erb +++ b/app/views/init/index.html.erb @@ -1,16 +1,7 @@ -
- -
- -
- +
\ No newline at end of file + diff --git a/db/seeds.rb b/db/seeds.rb index 379a8aa5a..b4e4afaf3 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1807,7 +1807,7 @@ Translation.create_if_not_exists( :locale => 'de', :source => "First Response Ti Translation.create_if_not_exists( :locale => 'de', :source => "Update Time", :target => "Aktuallisierungszeit" ) Translation.create_if_not_exists( :locale => 'de', :source => "Solution Time", :target => "Lösungszeit" ) Translation.create_if_not_exists( :locale => 'de', :source => "Add Attribute", :target => "Attribut hinzufügen" ) -Translation.create_if_not_exists( :locale => 'de', :source => "", :target => "" ) +Translation.create_if_not_exists( :locale => 'de', :source => "Back to top", :target => "Nach oben" ) #Translation.create_if_not_exists( :locale => 'de', :source => "", :target => "" )