Unified · Split
| @@ -27,7 +27,8 @@ · 26 unmodified lines | ||
| 27 | 27 | @document = new app.views.Document |
| 28 | 28 | @mobile = new app.views.Mobile if @isMobile() |
| 29 | 29 | |
| 30 | − if @DOC | |
| 30 | + if document.body.hasAttribute('data-doc') | |
| 31 | + @DOC = JSON.parse(document.body.getAttribute('data-doc')) | |
| 31 | 32 | @bootOne() |
| 32 | 33 | else if @DOCS |
| 33 | 34 | @bootAll() |
| @@ -185,13 +185,13 @@ class AppTest < MiniTest::Spec · 184 unmodified lines | ||
| 185 | 185 | it "works when the doc exists" do |
| 186 | 186 | get '/html~4-foo-bar_42/' |
| 187 | 187 | assert last_response.ok? |
| 188 | − assert_includes last_response.body, 'app.DOC = {"name":"HTML","slug":"html~4"' | |
| 188 | + assert_includes last_response.body, 'data-doc="{"name":"HTML","slug":"html~4"' | |
| 189 | 189 | end |
| 190 | 190 | |
| 191 | 191 | it "works when the doc has no version in the path and a version exists" do |
| 192 | 192 | get '/html-foo-bar_42/' |
| 193 | 193 | assert last_response.ok? |
| 194 | − assert_includes last_response.body, 'app.DOC = {"name":"HTML","slug":"html~5"' | |
| 194 | + assert_includes last_response.body, 'data-doc="{"name":"HTML","slug":"html~5"' | |
| 195 | 195 | end |
| 196 | 196 | |
| 197 | 197 | it "returns 404 when the type is blank" do |
| @@ -13,9 +13,8 @@ · 12 unmodified lines | ||
| 13 | 13 | <link rel="stylesheet" href="<%= main_stylesheet_path %>" data-alt="<%= alternate_stylesheet_path %>"> |
| 14 | 14 | <%= javascript_tag 'application', asset_host: false %><% unless App.production? %> |
| 15 | 15 | <%= javascript_tag 'debug' %><% end %> |
| 16 | − <script>app.DOC = <%= @doc.to_json %>;</script> | |
| 17 | 16 | </head> |
| 18 | −<body class="_booting _noscript"> | |
| 17 | +<body class="_booting _noscript" data-doc="<%= CGI::escape_html @doc.to_json %>"> | |
| 19 | 18 | <noscript class="_fail">DevDocs requires JavaScript to run.</noscript> |
| 20 | 19 | <%= erb :app %></body> |
| 21 | 20 | </html> |