add make test and Remove vue-cli serve
This commit is contained in:
@@ -3,19 +3,15 @@ defmodule MobilizonWeb.PageController do
|
||||
Controller to load our webapp
|
||||
"""
|
||||
use MobilizonWeb, :controller
|
||||
alias Mobilizon.Service.Metadata
|
||||
alias Mobilizon.Actors
|
||||
alias Mobilizon.Actors.Actor
|
||||
alias Mobilizon.Events
|
||||
alias Mobilizon.Events.{Event, Comment}
|
||||
|
||||
plug(:put_layout, false)
|
||||
action_fallback(MobilizonWeb.FallbackController)
|
||||
|
||||
def index(conn, _params) do
|
||||
conn
|
||||
|> put_resp_content_type("text/html")
|
||||
|> send_file(200, "priv/static/index.html")
|
||||
render conn, "app.html"
|
||||
end
|
||||
|
||||
def actor(conn, %{"name" => name}) do
|
||||
@@ -77,16 +73,6 @@ defmodule MobilizonWeb.PageController do
|
||||
|
||||
# Inject OpenGraph information
|
||||
defp render_with_meta(conn, object) do
|
||||
{:ok, index_content} = File.read(index_file_path())
|
||||
tags = Metadata.build_tags(object)
|
||||
response = String.replace(index_content, "<!--server-generated-meta-->", tags)
|
||||
|
||||
conn
|
||||
|> put_resp_content_type("text/html")
|
||||
|> send_resp(200, response)
|
||||
end
|
||||
|
||||
defp index_file_path() do
|
||||
Path.join(Application.app_dir(:mobilizon, "priv/static/"), "index.html")
|
||||
render conn, "app.html", object: object
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,7 +21,7 @@ defmodule MobilizonWeb.Endpoint do
|
||||
at: "/",
|
||||
from: :mobilizon,
|
||||
gzip: false,
|
||||
only: ~w(css fonts images js favicon.ico robots.txt index.html)
|
||||
only: ~w(css fonts images js favicon.ico robots.txt)
|
||||
)
|
||||
|
||||
# Code reloading can be explicitly enabled under the
|
||||
|
||||
23
lib/mobilizon_web/templates/layout/app.html.eex
Normal file
23
lib/mobilizon_web/templates/layout/app.html.eex
Normal file
@@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="has-navbar-fixed-top">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="<%= static_path(@conn, "/js/favicon.ico") %>">
|
||||
<link rel="stylesheet" href="//cdn.materialdesignicons.com/3.5.95/css/materialdesignicons.min.css">
|
||||
<title>mobilizon</title>
|
||||
<%= if assigns[:object], do: Metadata.build_tags(@object) %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but mobilizon doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
<script src="<%= static_path(@conn, "/js/app.js") %>"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
5
lib/mobilizon_web/views/layout_view.ex
Normal file
5
lib/mobilizon_web/views/layout_view.ex
Normal file
@@ -0,0 +1,5 @@
|
||||
defmodule MobilizonWeb.LayoutView do
|
||||
use MobilizonWeb, :view
|
||||
alias Mobilizon.Service.Metadata
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user