Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions app/controllers/vandal_ui/static_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class VandalUi::StaticController < ActionController::Base
layout false

def index
vandal_path = VandalUi::Engine.routes.find_script_name({})
@schema_path = "#{vandal_path}/schema.json"
end
end
29 changes: 29 additions & 0 deletions app/views/vandal_ui/static/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang=en>
<head>
<meta charset=utf-8>
<meta http-equiv=X-UA-Compatible content="IE=edge">
<meta name=viewport content="width=device-width,initial-scale=1">
<meta name=schema content=<%= @schema_path %>>
<link rel=stylesheet href=https://use.fontawesome.com/releases/v5.4.1/css/all.css integrity=sha384-5sAR7xN1Nv6T6+dT2mhtzEpVJvfS3NScPQTrOxhwjIuvcA67KV2R5Jz6kr4abQsz crossorigin=anonymous>
<title>vandal</title>
<link href=/css/app.59d17783.css rel=preload as=style>
<link href=/css/chunk-vendors.e6a6ca22.css rel=preload as=style>
<link href=/js/app.f85601e5.js rel=preload as=script>
<link href=/js/chunk-vendors.326f67bb.js rel=preload as=script>
<link href=/css/chunk-vendors.e6a6ca22.css rel=stylesheet>
<link href=/css/app.59d17783.css rel=stylesheet>
</head>
<body>
<noscript><strong>We're sorry but vandal doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript>

<div id=app></div>
<script>
if (window.location.href.indexOf('#') === -1) {
window.location.href = window.location.href + '/#/'
}
</script>
<script src=/js/chunk-vendors.326f67bb.js></script>
<script src=/js/app.f85601e5.js></script>
</body>
</html>
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
VandalUi::Engine.routes.draw do
root to: 'vandal_ui/static#index'
get '/schema', to: 'vandal_ui/schemas#show'
end
5 changes: 5 additions & 0 deletions lib/vandal_ui/engine.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
module VandalUi
class Engine < ::Rails::Engine
config.app_middleware.use(
Rack::Static,
urls: ['/js', '/css', '/assets/img'],
root: VandalUi::Engine.root.join('lib/vandal_ui/static')
)
end
end