History

Improve offline mode error page

Thibaut committed 11 years ago

Commit 1252b361 parent 74ea6814 files · +23 −8Browse files

Unified · Split

4 files
  1. assets/javascripts/app/db.coffee +7 −1
  2. assets/javascripts/templates/error_tmpl.coffee +13 −4
  3. assets/javascripts/views/content/offline_page.coffee +1 −1
  4. assets/stylesheets/components/_content.scss +2 −2
assets/javascripts/app/db.coffee+7−1
@@ -29,6 +29,7 @@ class app.DB · 28 unmodified lines
29 @checkedBuggyIDB = true29 @checkedBuggyIDB = true
30 catch30 catch
31 try db.close()31 try db.close()
32 @reason = 'apple'
32 @onOpenError()33 @onOpenError()
33 return34 return
34 35
@@ -47,6 +48,7 @@ class app.DB · 12 unmodified lines
47 app.onQuotaExceeded()48 app.onQuotaExceeded()
48 else49 else
49 @useIndexedDB = false50 @useIndexedDB = false
51 @reason or= 'cant_open'
50 @runCallbacks()52 @runCallbacks()
51 return53 return
52 54
@@ -251,7 +253,11 @@ class app.DB · 198 unmodified lines
251 253
252 useIndexedDB: ->254 useIndexedDB: ->
253 try255 try
254 !app.isSingleDoc() and !!window.indexedDB256 if !app.isSingleDoc() and window.indexedDB
257 true
258 else
259 @reason = 'not_supported'
260 false
255 catch261 catch
256 false262 false
257 263
assets/javascripts/templates/error_tmpl.coffee+13−4
@@ -22,10 +22,19 @@ app.templates.bootError = -> · 21 unmodified lines
22 """ Check your Internet connection and try <a href="javascript:location.reload()">reloading</a>.<br>22 """ Check your Internet connection and try <a href="javascript:location.reload()">reloading</a>.<br>
23 If you keep seeing this, you're likely behind a proxy or firewall that blocks cross-domain requests. """23 If you keep seeing this, you're likely behind a proxy or firewall that blocks cross-domain requests. """
24 24
25app.templates.offlineError = ->25app.templates.offlineError = (reason) ->
26 error """ Oops, the database failed to load. """,26 reason = switch reason
27 """ DevDocs requires IndexedDB to cache documentations for offline access.<br>27 when 'not_supported'
28 Unfortunately IndexedDB is either not supported in your browser, disabled, or buggy. """28 """ Unfortunately your browser either doesn't support it or does not make it available. """
29 when 'cant_open'
30 """ Although your browser appears to support it, DevDocs couldn't open the database.<br>
31 This could be because you're browsing in private mode and have disallowed offline storage on the domain. """
32 when 'apple'
33 """ Unfortunately Safari's implementation of IndexedDB is <a href="https://bugs.webkit.org/show_bug.cgi?id=136937">badly broken</a>.<br>
34 This message will automatically go away when Apple fix their code. """
35
36 error """ Oops, offline mode is unavailable. """,
37 """ DevDocs requires IndexedDB to cache documentations for offline access.<br>#{reason} """
29 38
30app.templates.unsupportedBrowser = """39app.templates.unsupportedBrowser = """
31 <div class="_fail">40 <div class="_fail">
assets/javascripts/views/content/offline_page.coffee+1−1
@@ -14,7 +14,7 @@ class app.views.OfflinePage extends app.View · 13 unmodified lines
14 app.docs.getInstallStatuses (statuses) =>14 app.docs.getInstallStatuses (statuses) =>
15 return unless @activated15 return unless @activated
16 if statuses is false16 if statuses is false
17 @html @tmpl('offlineError')17 @html @tmpl('offlineError', app.db.reason)
18 else18 else
19 html = ''19 html = ''
20 html += @renderDoc(doc, statuses[doc.slug]) for doc in app.docs.all()20 html += @renderDoc(doc, statuses[doc.slug]) for doc in app.docs.all()
assets/stylesheets/components/_content.scss+2−2
@@ -163,8 +163,8 @@ · 162 unmodified lines
163}163}
164 164
165._error-title {165._error-title {
166 margin: -5.5rem 0 .5rem;166 margin: -5.5rem 0 1rem;
167 line-height: 2;167 line-height: 2rem;
168 font-size: 1.5rem;168 font-size: 1.5rem;
169}169}
170 170