rewrite
This commit is contained in:
parent
ba8f072d23
commit
2c935df494
110 changed files with 1350 additions and 8011 deletions
4
eisrom_ui/.formatter.exs
Normal file
4
eisrom_ui/.formatter.exs
Normal file
|
@ -0,0 +1,4 @@
|
|||
[
|
||||
import_deps: [:phoenix],
|
||||
inputs: ["*.{ex,exs}", "{config,lib,test}/**/*.{ex,exs}"]
|
||||
]
|
35
eisrom_ui/.gitignore
vendored
Normal file
35
eisrom_ui/.gitignore
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
# The directory Mix will write compiled artifacts to.
|
||||
/_build/
|
||||
|
||||
# If you run "mix test --cover", coverage assets end up here.
|
||||
/cover/
|
||||
|
||||
# The directory Mix downloads your dependencies sources to.
|
||||
/deps/
|
||||
|
||||
# Where 3rd-party dependencies like ExDoc output generated docs.
|
||||
/doc/
|
||||
|
||||
# Ignore .fetch files in case you like to edit your project deps locally.
|
||||
/.fetch
|
||||
|
||||
# If the VM crashes, it generates a dump, let's ignore it too.
|
||||
erl_crash.dump
|
||||
|
||||
# Also ignore archive artifacts (built via "mix archive.build").
|
||||
*.ez
|
||||
|
||||
# Ignore package tarball (built via "mix hex.build").
|
||||
eisrom_ui-*.tar
|
||||
|
||||
# Ignore assets that are produced by build tools.
|
||||
/priv/static/assets/
|
||||
|
||||
# Ignore digested assets cache.
|
||||
/priv/static/cache_manifest.json
|
||||
|
||||
# In case you use Node.js/npm, you want to ignore these.
|
||||
npm-debug.log
|
||||
/assets/node_modules/
|
||||
|
||||
config/secrets.exs
|
18
eisrom_ui/README.md
Normal file
18
eisrom_ui/README.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
# EisromUi
|
||||
|
||||
To start your Phoenix server:
|
||||
|
||||
* Install dependencies with `mix deps.get`
|
||||
* Start Phoenix endpoint with `mix phx.server` or inside IEx with `iex -S mix phx.server`
|
||||
|
||||
Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.
|
||||
|
||||
Ready to run in production? Please [check our deployment guides](https://hexdocs.pm/phoenix/deployment.html).
|
||||
|
||||
## Learn more
|
||||
|
||||
* Official website: https://www.phoenixframework.org/
|
||||
* Guides: https://hexdocs.pm/phoenix/overview.html
|
||||
* Docs: https://hexdocs.pm/phoenix
|
||||
* Forum: https://elixirforum.com/c/phoenix-forum
|
||||
* Source: https://github.com/phoenixframework/phoenix
|
45
eisrom_ui/assets/css/app.css
Normal file
45
eisrom_ui/assets/css/app.css
Normal file
|
@ -0,0 +1,45 @@
|
|||
body {
|
||||
background-color: lightblue;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 30px;
|
||||
font-family: "Verdana", Verdana, sans-serif;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 25px;
|
||||
font-family: "Verdana", Verdana, sans-serif;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 20px;
|
||||
font-family: "Verdana", Verdana, sans-serif;
|
||||
}
|
||||
|
||||
#buttonwrap {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.button {
|
||||
background-color: #4CAF50; /* Green */
|
||||
border: none;
|
||||
color: white;
|
||||
padding: 15px 32px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 16px;
|
||||
width: 70%;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
.button.stop {
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
#hintbutton {
|
||||
background-color: white;
|
||||
font-size: 15px;
|
||||
}
|
45
eisrom_ui/assets/js/app.js
Normal file
45
eisrom_ui/assets/js/app.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
// We import the CSS which is extracted to its own file by esbuild.
|
||||
// Remove this line if you add a your own CSS build pipeline (e.g postcss).
|
||||
import "../css/app.css"
|
||||
|
||||
// If you want to use Phoenix channels, run `mix help phx.gen.channel`
|
||||
// to get started and then uncomment the line below.
|
||||
// import "./user_socket.js"
|
||||
|
||||
// You can include dependencies in two ways.
|
||||
//
|
||||
// The simplest option is to put them in assets/vendor and
|
||||
// import them using relative paths:
|
||||
//
|
||||
// import "../vendor/some-package.js"
|
||||
//
|
||||
// Alternatively, you can `npm install some-package --prefix assets` and import
|
||||
// them using a path starting with the package name:
|
||||
//
|
||||
// import "some-package"
|
||||
//
|
||||
|
||||
// Include phoenix_html to handle method=PUT/DELETE in forms and buttons.
|
||||
import "phoenix_html"
|
||||
// Establish Phoenix Socket and LiveView configuration.
|
||||
import {Socket} from "phoenix"
|
||||
import {LiveSocket} from "phoenix_live_view"
|
||||
import topbar from "../vendor/topbar"
|
||||
|
||||
let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content")
|
||||
let liveSocket = new LiveSocket("/live", Socket, {params: {_csrf_token: csrfToken}})
|
||||
|
||||
// Show progress bar on live navigation and form submits
|
||||
topbar.config({barColors: {0: "#29d"}, shadowColor: "rgba(0, 0, 0, .3)"})
|
||||
window.addEventListener("phx:page-loading-start", info => topbar.show())
|
||||
window.addEventListener("phx:page-loading-stop", info => topbar.hide())
|
||||
|
||||
// connect if there are any LiveViews on the page
|
||||
liveSocket.connect()
|
||||
|
||||
// expose liveSocket on window for web console debug logs and latency simulation:
|
||||
// >> liveSocket.enableDebug()
|
||||
// >> liveSocket.enableLatencySim(1000) // enabled for duration of browser session
|
||||
// >> liveSocket.disableLatencySim()
|
||||
window.liveSocket = liveSocket
|
||||
|
157
eisrom_ui/assets/vendor/topbar.js
vendored
Normal file
157
eisrom_ui/assets/vendor/topbar.js
vendored
Normal file
|
@ -0,0 +1,157 @@
|
|||
/**
|
||||
* @license MIT
|
||||
* topbar 1.0.0, 2021-01-06
|
||||
* https://buunguyen.github.io/topbar
|
||||
* Copyright (c) 2021 Buu Nguyen
|
||||
*/
|
||||
(function (window, document) {
|
||||
"use strict";
|
||||
|
||||
// https://gist.github.com/paulirish/1579671
|
||||
(function () {
|
||||
var lastTime = 0;
|
||||
var vendors = ["ms", "moz", "webkit", "o"];
|
||||
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
|
||||
window.requestAnimationFrame =
|
||||
window[vendors[x] + "RequestAnimationFrame"];
|
||||
window.cancelAnimationFrame =
|
||||
window[vendors[x] + "CancelAnimationFrame"] ||
|
||||
window[vendors[x] + "CancelRequestAnimationFrame"];
|
||||
}
|
||||
if (!window.requestAnimationFrame)
|
||||
window.requestAnimationFrame = function (callback, element) {
|
||||
var currTime = new Date().getTime();
|
||||
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
|
||||
var id = window.setTimeout(function () {
|
||||
callback(currTime + timeToCall);
|
||||
}, timeToCall);
|
||||
lastTime = currTime + timeToCall;
|
||||
return id;
|
||||
};
|
||||
if (!window.cancelAnimationFrame)
|
||||
window.cancelAnimationFrame = function (id) {
|
||||
clearTimeout(id);
|
||||
};
|
||||
})();
|
||||
|
||||
var canvas,
|
||||
progressTimerId,
|
||||
fadeTimerId,
|
||||
currentProgress,
|
||||
showing,
|
||||
addEvent = function (elem, type, handler) {
|
||||
if (elem.addEventListener) elem.addEventListener(type, handler, false);
|
||||
else if (elem.attachEvent) elem.attachEvent("on" + type, handler);
|
||||
else elem["on" + type] = handler;
|
||||
},
|
||||
options = {
|
||||
autoRun: true,
|
||||
barThickness: 3,
|
||||
barColors: {
|
||||
0: "rgba(26, 188, 156, .9)",
|
||||
".25": "rgba(52, 152, 219, .9)",
|
||||
".50": "rgba(241, 196, 15, .9)",
|
||||
".75": "rgba(230, 126, 34, .9)",
|
||||
"1.0": "rgba(211, 84, 0, .9)",
|
||||
},
|
||||
shadowBlur: 10,
|
||||
shadowColor: "rgba(0, 0, 0, .6)",
|
||||
className: null,
|
||||
},
|
||||
repaint = function () {
|
||||
canvas.width = window.innerWidth;
|
||||
canvas.height = options.barThickness * 5; // need space for shadow
|
||||
|
||||
var ctx = canvas.getContext("2d");
|
||||
ctx.shadowBlur = options.shadowBlur;
|
||||
ctx.shadowColor = options.shadowColor;
|
||||
|
||||
var lineGradient = ctx.createLinearGradient(0, 0, canvas.width, 0);
|
||||
for (var stop in options.barColors)
|
||||
lineGradient.addColorStop(stop, options.barColors[stop]);
|
||||
ctx.lineWidth = options.barThickness;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(0, options.barThickness / 2);
|
||||
ctx.lineTo(
|
||||
Math.ceil(currentProgress * canvas.width),
|
||||
options.barThickness / 2
|
||||
);
|
||||
ctx.strokeStyle = lineGradient;
|
||||
ctx.stroke();
|
||||
},
|
||||
createCanvas = function () {
|
||||
canvas = document.createElement("canvas");
|
||||
var style = canvas.style;
|
||||
style.position = "fixed";
|
||||
style.top = style.left = style.right = style.margin = style.padding = 0;
|
||||
style.zIndex = 100001;
|
||||
style.display = "none";
|
||||
if (options.className) canvas.classList.add(options.className);
|
||||
document.body.appendChild(canvas);
|
||||
addEvent(window, "resize", repaint);
|
||||
},
|
||||
topbar = {
|
||||
config: function (opts) {
|
||||
for (var key in opts)
|
||||
if (options.hasOwnProperty(key)) options[key] = opts[key];
|
||||
},
|
||||
show: function () {
|
||||
if (showing) return;
|
||||
showing = true;
|
||||
if (fadeTimerId !== null) window.cancelAnimationFrame(fadeTimerId);
|
||||
if (!canvas) createCanvas();
|
||||
canvas.style.opacity = 1;
|
||||
canvas.style.display = "block";
|
||||
topbar.progress(0);
|
||||
if (options.autoRun) {
|
||||
(function loop() {
|
||||
progressTimerId = window.requestAnimationFrame(loop);
|
||||
topbar.progress(
|
||||
"+" + 0.05 * Math.pow(1 - Math.sqrt(currentProgress), 2)
|
||||
);
|
||||
})();
|
||||
}
|
||||
},
|
||||
progress: function (to) {
|
||||
if (typeof to === "undefined") return currentProgress;
|
||||
if (typeof to === "string") {
|
||||
to =
|
||||
(to.indexOf("+") >= 0 || to.indexOf("-") >= 0
|
||||
? currentProgress
|
||||
: 0) + parseFloat(to);
|
||||
}
|
||||
currentProgress = to > 1 ? 1 : to;
|
||||
repaint();
|
||||
return currentProgress;
|
||||
},
|
||||
hide: function () {
|
||||
if (!showing) return;
|
||||
showing = false;
|
||||
if (progressTimerId != null) {
|
||||
window.cancelAnimationFrame(progressTimerId);
|
||||
progressTimerId = null;
|
||||
}
|
||||
(function loop() {
|
||||
if (topbar.progress("+.1") >= 1) {
|
||||
canvas.style.opacity -= 0.05;
|
||||
if (canvas.style.opacity <= 0.05) {
|
||||
canvas.style.display = "none";
|
||||
fadeTimerId = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
fadeTimerId = window.requestAnimationFrame(loop);
|
||||
})();
|
||||
},
|
||||
};
|
||||
|
||||
if (typeof module === "object" && typeof module.exports === "object") {
|
||||
module.exports = topbar;
|
||||
} else if (typeof define === "function" && define.amd) {
|
||||
define(function () {
|
||||
return topbar;
|
||||
});
|
||||
} else {
|
||||
this.topbar = topbar;
|
||||
}
|
||||
}.call(this, window, document));
|
38
eisrom_ui/config/config.exs
Normal file
38
eisrom_ui/config/config.exs
Normal file
|
@ -0,0 +1,38 @@
|
|||
# This file is responsible for configuring your application
|
||||
# and its dependencies with the aid of the Config module.
|
||||
#
|
||||
# This configuration file is loaded before any dependency and
|
||||
# is restricted to this project.
|
||||
|
||||
# General application configuration
|
||||
import Config
|
||||
|
||||
# Configures the endpoint
|
||||
config :eisrom_ui, EisromUiWeb.Endpoint,
|
||||
url: [host: "localhost"],
|
||||
render_errors: [view: EisromUiWeb.ErrorView, accepts: ~w(html json), layout: false],
|
||||
pubsub_server: EisromUi.PubSub,
|
||||
live_view: [signing_salt: "v9/5caL4"]
|
||||
|
||||
# Configure esbuild (the version is required)
|
||||
config :esbuild,
|
||||
version: "0.14.29",
|
||||
default: [
|
||||
args:
|
||||
~w(js/app.js --bundle --target=es2017 --outdir=../priv/static/assets --external:/fonts/* --external:/images/*),
|
||||
cd: Path.expand("../assets", __DIR__),
|
||||
env: %{"NODE_PATH" => Path.expand("../deps", __DIR__)}
|
||||
]
|
||||
|
||||
# Configures Elixir's Logger
|
||||
config :logger, :console,
|
||||
format: "$time $metadata[$level] $message\n",
|
||||
metadata: [:request_id]
|
||||
|
||||
# Use Jason for JSON parsing in Phoenix
|
||||
config :phoenix, :json_library, Jason
|
||||
|
||||
# Import environment specific config. This must remain at the bottom
|
||||
# of this file so it overrides the configuration defined above.
|
||||
import_config "#{config_env()}.exs"
|
||||
import_config "secrets.exs"
|
64
eisrom_ui/config/dev.exs
Normal file
64
eisrom_ui/config/dev.exs
Normal file
|
@ -0,0 +1,64 @@
|
|||
import Config
|
||||
|
||||
# For development, we disable any cache and enable
|
||||
# debugging and code reloading.
|
||||
#
|
||||
# The watchers configuration can be used to run external
|
||||
# watchers to your application. For example, we use it
|
||||
# with esbuild to bundle .js and .css sources.
|
||||
config :eisrom_ui, EisromUiWeb.Endpoint,
|
||||
# Binding to loopback ipv4 address prevents access from other machines.
|
||||
# Change to `ip: {0, 0, 0, 0}` to allow access from other machines.
|
||||
http: [ip: {127, 0, 0, 1}, port: 4000],
|
||||
check_origin: false,
|
||||
code_reloader: true,
|
||||
debug_errors: true,
|
||||
secret_key_base: "LD6C7sMtLQTWwvx6BkMEGME1K0xZvBSK7t3LQJzBPLLgma1URsBwK37I+gooshlu",
|
||||
watchers: [
|
||||
# Start the esbuild watcher by calling Esbuild.install_and_run(:default, args)
|
||||
esbuild: {Esbuild, :install_and_run, [:default, ~w(--sourcemap=inline --watch)]}
|
||||
]
|
||||
|
||||
# ## SSL Support
|
||||
#
|
||||
# In order to use HTTPS in development, a self-signed
|
||||
# certificate can be generated by running the following
|
||||
# Mix task:
|
||||
#
|
||||
# mix phx.gen.cert
|
||||
#
|
||||
# Note that this task requires Erlang/OTP 20 or later.
|
||||
# Run `mix help phx.gen.cert` for more information.
|
||||
#
|
||||
# The `http:` config above can be replaced with:
|
||||
#
|
||||
# https: [
|
||||
# port: 4001,
|
||||
# cipher_suite: :strong,
|
||||
# keyfile: "priv/cert/selfsigned_key.pem",
|
||||
# certfile: "priv/cert/selfsigned.pem"
|
||||
# ],
|
||||
#
|
||||
# If desired, both `http:` and `https:` keys can be
|
||||
# configured to run both http and https servers on
|
||||
# different ports.
|
||||
|
||||
# Watch static and templates for browser reloading.
|
||||
config :eisrom_ui, EisromUiWeb.Endpoint,
|
||||
live_reload: [
|
||||
patterns: [
|
||||
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
|
||||
~r"lib/eisrom_ui_web/(live|views)/.*(ex)$",
|
||||
~r"lib/eisrom_ui_web/templates/.*(eex)$"
|
||||
]
|
||||
]
|
||||
|
||||
# Do not include metadata nor timestamps in development logs
|
||||
config :logger, :console, format: "[$level] $message\n"
|
||||
|
||||
# Set a higher stacktrace during development. Avoid configuring such
|
||||
# in production as building large stacktraces may be expensive.
|
||||
config :phoenix, :stacktrace_depth, 20
|
||||
|
||||
# Initialize plugs at runtime for faster development compilation
|
||||
config :phoenix, :plug_init_mode, :runtime
|
62
eisrom_ui/config/prod.exs
Normal file
62
eisrom_ui/config/prod.exs
Normal file
|
@ -0,0 +1,62 @@
|
|||
import Config
|
||||
|
||||
# For production, don't forget to configure the url host
|
||||
# to something meaningful, Phoenix uses this information
|
||||
# when generating URLs.
|
||||
#
|
||||
# Note we also include the path to a cache manifest
|
||||
# containing the digested version of static files. This manifest is generated by the `mix phx.digest` task,
|
||||
# which you should run after static files are built and
|
||||
# before starting your production server.
|
||||
#config :eisrom_ui, EisromUiWeb.Endpoint, cache_static_manifest: "priv/static/cache_manifest.json"
|
||||
|
||||
# Do not print debug messages in production
|
||||
config :logger, level: :info
|
||||
|
||||
# ## SSL Support
|
||||
#
|
||||
# To get SSL working, you will need to add the `https` key
|
||||
# to the previous section and set your `:url` port to 443:
|
||||
#
|
||||
# config :eisrom_ui, EisromUiWeb.Endpoint,
|
||||
# ...,
|
||||
# url: [host: "example.com", port: 443],
|
||||
# https: [
|
||||
# ...,
|
||||
# port: 443,
|
||||
# cipher_suite: :strong,
|
||||
# keyfile: System.get_env("SOME_APP_SSL_KEY_PATH"),
|
||||
# certfile: System.get_env("SOME_APP_SSL_CERT_PATH")
|
||||
# ]
|
||||
#
|
||||
# The `cipher_suite` is set to `:strong` to support only the
|
||||
# latest and more secure SSL ciphers. This means old browsers
|
||||
# and clients may not be supported. You can set it to
|
||||
# `:compatible` for wider support.
|
||||
#
|
||||
# `:keyfile` and `:certfile` expect an absolute path to the key
|
||||
# and cert in disk or a relative path inside priv, for example
|
||||
# "priv/ssl/server.key". For all supported SSL configuration
|
||||
# options, see https://hexdocs.pm/plug/Plug.SSL.html#configure/1
|
||||
#
|
||||
# We also recommend setting `force_ssl` in your endpoint, ensuring
|
||||
# no data is ever sent via http, always redirecting to https:
|
||||
#
|
||||
# config :eisrom_ui, EisromUiWeb.Endpoint,
|
||||
# force_ssl: [hsts: true]
|
||||
#
|
||||
# Check `Plug.SSL` for all available options in `force_ssl`.
|
||||
|
||||
config :eisrom_ui, EisromUiWeb.Endpoint,
|
||||
url: [host: "geokunis2.nl"],
|
||||
http: [port: 80],
|
||||
cache_static_manifest: "priv/static/cache_manifest.json", # needed?
|
||||
secret_key_base: "ains9m4Gu88kI1PO13704I+MkKUNaiap/+ppJa80NotAs62bA62/9cQI/eeH2TNf",
|
||||
live_view: [signing_salt: "v9/5caL4"],
|
||||
check_origin: false,
|
||||
render_errors: [view: EisromUiWeb.ErrorView, accepts: ~w(html json), layout: false],
|
||||
pubsub_server: EisromUi.PubSub,
|
||||
server: true,
|
||||
code_reloader: false
|
||||
|
||||
config :phoenix, :json_library, Jason
|
50
eisrom_ui/config/runtime.exs
Normal file
50
eisrom_ui/config/runtime.exs
Normal file
|
@ -0,0 +1,50 @@
|
|||
import Config
|
||||
|
||||
# config/runtime.exs is executed for all environments, including
|
||||
# during releases. It is executed after compilation and before the
|
||||
# system starts, so it is typically used to load production configuration
|
||||
# and secrets from environment variables or elsewhere. Do not define
|
||||
# any compile-time configuration in here, as it won't be applied.
|
||||
# The block below contains prod specific runtime configuration.
|
||||
|
||||
# ## Using releases
|
||||
#
|
||||
# If you use `mix release`, you need to explicitly enable the server
|
||||
# by passing the PHX_SERVER=true when you start it:
|
||||
#
|
||||
# PHX_SERVER=true bin/eisrom_ui start
|
||||
#
|
||||
# Alternatively, you can use `mix phx.gen.release` to generate a `bin/server`
|
||||
# script that automatically sets the env var above.
|
||||
if System.get_env("PHX_SERVER") do
|
||||
config :eisrom_ui, EisromUiWeb.Endpoint, server: true
|
||||
end
|
||||
|
||||
if config_env() == :prod do
|
||||
# The secret key base is used to sign/encrypt cookies and other secrets.
|
||||
# A default value is used in config/dev.exs and config/test.exs but you
|
||||
# want to use a different value for prod and you most likely don't want
|
||||
# to check this value into version control, so we use an environment
|
||||
# variable instead.
|
||||
secret_key_base =
|
||||
System.get_env("SECRET_KEY_BASE") ||
|
||||
raise """
|
||||
environment variable SECRET_KEY_BASE is missing.
|
||||
You can generate one by calling: mix phx.gen.secret
|
||||
"""
|
||||
|
||||
host = System.get_env("PHX_HOST") || "example.com"
|
||||
port = String.to_integer(System.get_env("PORT") || "4000")
|
||||
|
||||
config :eisrom_ui, EisromUiWeb.Endpoint,
|
||||
url: [host: host, port: 443, scheme: "https"],
|
||||
http: [
|
||||
# Enable IPv6 and bind on all interfaces.
|
||||
# Set it to {0, 0, 0, 0, 0, 0, 0, 1} for local network only access.
|
||||
# See the documentation on https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html
|
||||
# for details about using IPv6 vs IPv4 and loopback vs public addresses.
|
||||
ip: {0, 0, 0, 0, 0, 0, 0, 0},
|
||||
port: port
|
||||
],
|
||||
secret_key_base: secret_key_base
|
||||
end
|
14
eisrom_ui/config/test.exs
Normal file
14
eisrom_ui/config/test.exs
Normal file
|
@ -0,0 +1,14 @@
|
|||
import Config
|
||||
|
||||
# We don't run a server during test. If one is required,
|
||||
# you can enable the server option below.
|
||||
config :eisrom_ui, EisromUiWeb.Endpoint,
|
||||
http: [ip: {127, 0, 0, 1}, port: 4002],
|
||||
secret_key_base: "dfppXvxP1vXJhlk0z7H3jC/wqrQw/SUXVXG9RmTPIHPHSqBh/L8KllPViDdiEfay",
|
||||
server: false
|
||||
|
||||
# Print only warnings and errors during test
|
||||
config :logger, level: :warn
|
||||
|
||||
# Initialize plugs at runtime for faster test compilation
|
||||
config :phoenix, :plug_init_mode, :runtime
|
9
eisrom_ui/lib/eisrom_ui.ex
Normal file
9
eisrom_ui/lib/eisrom_ui.ex
Normal file
|
@ -0,0 +1,9 @@
|
|||
defmodule EisromUi do
|
||||
@moduledoc """
|
||||
EisromUi keeps the contexts that define your domain
|
||||
and business logic.
|
||||
|
||||
Contexts are also responsible for managing your data, regardless
|
||||
if it comes from the database, an external API or others.
|
||||
"""
|
||||
end
|
33
eisrom_ui/lib/eisrom_ui/application.ex
Normal file
33
eisrom_ui/lib/eisrom_ui/application.ex
Normal file
|
@ -0,0 +1,33 @@
|
|||
defmodule EisromUi.Application do
|
||||
# See https://hexdocs.pm/elixir/Application.html
|
||||
# for more information on OTP Applications
|
||||
@moduledoc false
|
||||
|
||||
use Application
|
||||
|
||||
@impl true
|
||||
def start(_type, _args) do
|
||||
children = [
|
||||
# Start the Telemetry supervisor
|
||||
EisromUiWeb.Telemetry,
|
||||
# Start the PubSub system
|
||||
{Phoenix.PubSub, name: EisromUi.PubSub},
|
||||
# Start the Endpoint (http/https)
|
||||
EisromUiWeb.Endpoint,
|
||||
{Eisrom.Morse.Server, nil}
|
||||
]
|
||||
|
||||
# See https://hexdocs.pm/elixir/Supervisor.html
|
||||
# for other strategies and supported options
|
||||
opts = [strategy: :one_for_one, name: EisromUi.Supervisor]
|
||||
Supervisor.start_link(children, opts)
|
||||
end
|
||||
|
||||
# Tell Phoenix to update the endpoint configuration
|
||||
# whenever the application is updated.
|
||||
@impl true
|
||||
def config_change(changed, _new, removed) do
|
||||
EisromUiWeb.Endpoint.config_change(changed, removed)
|
||||
:ok
|
||||
end
|
||||
end
|
64
eisrom_ui/lib/eisrom_ui/morse/server.ex
Normal file
64
eisrom_ui/lib/eisrom_ui/morse/server.ex
Normal file
|
@ -0,0 +1,64 @@
|
|||
defmodule Eisrom.Morse.Server do
|
||||
use GenServer
|
||||
|
||||
def start_link(_) do
|
||||
GenServer.start_link(__MODULE__, {nil, 0}, name: __MODULE__)
|
||||
end
|
||||
|
||||
def toggle_morse do
|
||||
GenServer.call(__MODULE__, :toggle)
|
||||
end
|
||||
|
||||
def update_progress(progress) do
|
||||
GenServer.cast(__MODULE__, {:progress, progress})
|
||||
end
|
||||
|
||||
def progress do
|
||||
GenServer.call(__MODULE__, :progress)
|
||||
end
|
||||
|
||||
def in_progress? do
|
||||
GenServer.call(__MODULE__, :in_progress?)
|
||||
end
|
||||
|
||||
@impl true
|
||||
def init(state) do
|
||||
{:ok, state}
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_call(:toggle, _from, {pid, _progress}) do
|
||||
if worker_alive?(pid) do
|
||||
EisromUi.Morse.Worker.kill(pid)
|
||||
Phoenix.PubSub.broadcast(EisromUi.PubSub, "morse_progress", 0)
|
||||
# apply(pubsub(), :broadcast, [EisromUi.PubSub, "morse_progress", 0])
|
||||
{:reply, :ok, {nil, 0}}
|
||||
else
|
||||
pid = spawn(&Eisrom.Morse.Worker.signal/0)
|
||||
{:reply, :ok, {pid, 0}}
|
||||
end
|
||||
end
|
||||
|
||||
def handle_call(:progress, _from, {_pid, progress} = state) do
|
||||
{:reply, progress, state}
|
||||
end
|
||||
|
||||
def handle_call(:in_progress?, _from, {pid, _progress} = state) do
|
||||
{:reply, worker_alive?(pid), state}
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_cast({:progress, new_progress}, {pid, _progress}) do
|
||||
Phoenix.PubSub.broadcast(EiromUi.PubSub, "morse_progress", new_progress)
|
||||
# apply(pubsub(), :broadcast, [EisromUi.PubSub, "morse_progress", new_progress])
|
||||
{:noreply, {pid, new_progress}}
|
||||
end
|
||||
|
||||
defp pubsub do
|
||||
Application.fetch_env!(:eisrom_ui, :pubsub)
|
||||
end
|
||||
|
||||
defp worker_alive?(pid) do
|
||||
pid != nil and Process.alive?(pid)
|
||||
end
|
||||
end
|
90
eisrom_ui/lib/eisrom_ui/morse/worker.ex
Normal file
90
eisrom_ui/lib/eisrom_ui/morse/worker.ex
Normal file
|
@ -0,0 +1,90 @@
|
|||
defmodule Eisrom.Morse.Worker do
|
||||
@moduledoc """
|
||||
Functions to control the signal lamp connected with GPIO.
|
||||
"""
|
||||
|
||||
@sleep_short 200
|
||||
@sleep_delay 400
|
||||
@sleep_long 700
|
||||
@sleep_pause 1000
|
||||
@sleep_start 3000
|
||||
|
||||
@on 0
|
||||
@off 1
|
||||
|
||||
@doc """
|
||||
Signal the provided morse symbols using the GPIO.
|
||||
"""
|
||||
|
||||
def signal do
|
||||
code = secret_code()
|
||||
code_length = length(code)
|
||||
|
||||
update_progress(0, 100)
|
||||
|
||||
toggle_lamp(@off)
|
||||
Process.sleep(@sleep_start)
|
||||
|
||||
code
|
||||
|> Enum.with_index()
|
||||
|> Enum.each(&signal_symbol(&1, code_length))
|
||||
|
||||
update_progress(100, 100)
|
||||
end
|
||||
|
||||
def kill(pid) do
|
||||
Process.exit(pid, :kill)
|
||||
toggle_lamp(@off)
|
||||
end
|
||||
|
||||
defp signal_symbol({?., _index}, _length) do
|
||||
toggle_lamp(@on)
|
||||
Process.sleep(@sleep_short)
|
||||
toggle_lamp(@off)
|
||||
Process.sleep(@sleep_delay)
|
||||
end
|
||||
|
||||
defp signal_symbol({?-, _index}, _length) do
|
||||
toggle_lamp(@on)
|
||||
Process.sleep(@sleep_long)
|
||||
toggle_lamp(@off)
|
||||
Process.sleep(@sleep_delay)
|
||||
end
|
||||
|
||||
defp signal_symbol({?\s, index}, length) do
|
||||
update_progress(index, length)
|
||||
Process.sleep(@sleep_pause)
|
||||
end
|
||||
|
||||
defp update_progress(index, length) do
|
||||
Eisrom.Morse.Server.update_progress(index / length * 100)
|
||||
end
|
||||
|
||||
defp secret_code do
|
||||
Application.fetch_env!(:eisrom_ui, :morse_message)
|
||||
|> String.to_charlist()
|
||||
end
|
||||
|
||||
# Communicate with a deployed esrom node, if running on a host.
|
||||
case Application.get_env(:eisrom_ui, :target) do
|
||||
:host ->
|
||||
@esrom_node :"esrom@esrom.lan"
|
||||
|
||||
def toggle_lamp(state) do
|
||||
# Check if the deployed esrom node is online.
|
||||
if :pong == Node.ping(@esrom_node) do
|
||||
:rpc.call(@esrom_node, Eisrom.Morse.Worker, :toggle_lamp, [state])
|
||||
end
|
||||
end
|
||||
|
||||
_ ->
|
||||
def toggle_lamp(state) do
|
||||
{:ok, gpio} = Circuits.GPIO.open(relay_pin(), :output)
|
||||
Circuits.GPIO.write(gpio, state)
|
||||
end
|
||||
|
||||
defp relay_pin() do
|
||||
Application.fetch_env!(:eisrom_ui, :relay_pin)
|
||||
end
|
||||
end
|
||||
end
|
107
eisrom_ui/lib/eisrom_ui_web.ex
Normal file
107
eisrom_ui/lib/eisrom_ui_web.ex
Normal file
|
@ -0,0 +1,107 @@
|
|||
defmodule EisromUiWeb do
|
||||
@moduledoc """
|
||||
The entrypoint for defining your web interface, such
|
||||
as controllers, views, channels and so on.
|
||||
|
||||
This can be used in your application as:
|
||||
|
||||
use EisromUiWeb, :controller
|
||||
use EisromUiWeb, :view
|
||||
|
||||
The definitions below will be executed for every view,
|
||||
controller, etc, so keep them short and clean, focused
|
||||
on imports, uses and aliases.
|
||||
|
||||
Do NOT define functions inside the quoted expressions
|
||||
below. Instead, define any helper function in modules
|
||||
and import those modules here.
|
||||
"""
|
||||
|
||||
def controller do
|
||||
quote do
|
||||
use Phoenix.Controller, namespace: EisromUiWeb
|
||||
|
||||
import Plug.Conn
|
||||
alias EisromUiWeb.Router.Helpers, as: Routes
|
||||
end
|
||||
end
|
||||
|
||||
def view do
|
||||
quote do
|
||||
use Phoenix.View,
|
||||
root: "lib/eisrom_ui_web/templates",
|
||||
namespace: EisromUiWeb
|
||||
|
||||
# Import convenience functions from controllers
|
||||
import Phoenix.Controller,
|
||||
only: [get_flash: 1, get_flash: 2, view_module: 1, view_template: 1]
|
||||
|
||||
# Include shared imports and aliases for views
|
||||
unquote(view_helpers())
|
||||
end
|
||||
end
|
||||
|
||||
def live_view do
|
||||
quote do
|
||||
use Phoenix.LiveView,
|
||||
layout: {EisromUiWeb.LayoutView, "live.html"}
|
||||
|
||||
unquote(view_helpers())
|
||||
end
|
||||
end
|
||||
|
||||
def live_component do
|
||||
quote do
|
||||
use Phoenix.LiveComponent
|
||||
|
||||
unquote(view_helpers())
|
||||
end
|
||||
end
|
||||
|
||||
def component do
|
||||
quote do
|
||||
use Phoenix.Component
|
||||
|
||||
unquote(view_helpers())
|
||||
end
|
||||
end
|
||||
|
||||
def router do
|
||||
quote do
|
||||
use Phoenix.Router
|
||||
|
||||
import Plug.Conn
|
||||
import Phoenix.Controller
|
||||
import Phoenix.LiveView.Router
|
||||
end
|
||||
end
|
||||
|
||||
def channel do
|
||||
quote do
|
||||
use Phoenix.Channel
|
||||
end
|
||||
end
|
||||
|
||||
defp view_helpers do
|
||||
quote do
|
||||
# Use all HTML functionality (forms, tags, etc)
|
||||
use Phoenix.HTML
|
||||
|
||||
# Import LiveView and .heex helpers (live_render, live_patch, <.form>, etc)
|
||||
import Phoenix.LiveView.Helpers
|
||||
|
||||
# Import basic rendering functionality (render, render_layout, etc)
|
||||
import Phoenix.View
|
||||
|
||||
import EisromUiWeb.ErrorHelpers
|
||||
alias EisromUiWeb.Router.Helpers, as: Routes
|
||||
end
|
||||
end
|
||||
|
||||
@doc """
|
||||
When used, dispatch to the appropriate controller/view/etc.
|
||||
"""
|
||||
defmacro __using__(which) when is_atom(which) do
|
||||
apply(__MODULE__, which, [])
|
||||
end
|
||||
end
|
15
eisrom_ui/lib/eisrom_ui_web/controllers/page_controller.ex
Normal file
15
eisrom_ui/lib/eisrom_ui_web/controllers/page_controller.ex
Normal file
|
@ -0,0 +1,15 @@
|
|||
defmodule EisromUiWeb.PageController do
|
||||
use EisromUiWeb, :controller
|
||||
|
||||
def index(conn, _params) do
|
||||
send_resp(conn, 204, "")
|
||||
end
|
||||
|
||||
def instructions(conn, _params) do
|
||||
render(conn, :instructions)
|
||||
end
|
||||
|
||||
def morse(conn, _params) do
|
||||
Phoenix.LiveView.Controller.live_render(conn, EisromUiWeb.MorseLive)
|
||||
end
|
||||
end
|
49
eisrom_ui/lib/eisrom_ui_web/endpoint.ex
Normal file
49
eisrom_ui/lib/eisrom_ui_web/endpoint.ex
Normal file
|
@ -0,0 +1,49 @@
|
|||
defmodule EisromUiWeb.Endpoint do
|
||||
use Phoenix.Endpoint, otp_app: :eisrom_ui
|
||||
|
||||
# The session will be stored in the cookie and signed,
|
||||
# this means its contents can be read but not tampered with.
|
||||
# Set :encryption_salt if you would also like to encrypt it.
|
||||
@session_options [
|
||||
store: :cookie,
|
||||
key: "_eisrom_ui_key",
|
||||
signing_salt: "lolEkmxx"
|
||||
]
|
||||
|
||||
socket "/live", Phoenix.LiveView.Socket, websocket: [connect_info: [session: @session_options]]
|
||||
|
||||
# Serve at "/" the static files from "priv/static" directory.
|
||||
#
|
||||
# You should set gzip to true if you are running phx.digest
|
||||
# when deploying your static files in production.
|
||||
plug Plug.Static,
|
||||
at: "/",
|
||||
from: :eisrom_ui,
|
||||
gzip: false,
|
||||
only: ~w(assets fonts images favicon.ico robots.txt)
|
||||
|
||||
# Code reloading can be explicitly enabled under the
|
||||
# :code_reloader configuration of your endpoint.
|
||||
if code_reloading? do
|
||||
socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
|
||||
plug Phoenix.LiveReloader
|
||||
plug Phoenix.CodeReloader
|
||||
end
|
||||
|
||||
plug Phoenix.LiveDashboard.RequestLogger,
|
||||
param_key: "request_logger",
|
||||
cookie_key: "request_logger"
|
||||
|
||||
plug Plug.RequestId
|
||||
plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint]
|
||||
|
||||
plug Plug.Parsers,
|
||||
parsers: [:urlencoded, :multipart, :json],
|
||||
pass: ["*/*"],
|
||||
json_decoder: Phoenix.json_library()
|
||||
|
||||
plug Plug.MethodOverride
|
||||
plug Plug.Head
|
||||
plug Plug.Session, @session_options
|
||||
plug EisromUiWeb.Router
|
||||
end
|
39
eisrom_ui/lib/eisrom_ui_web/live/morse_live.ex
Normal file
39
eisrom_ui/lib/eisrom_ui_web/live/morse_live.ex
Normal file
|
@ -0,0 +1,39 @@
|
|||
defmodule EisromUiWeb.MorseLive do
|
||||
use Phoenix.LiveView
|
||||
require Logger
|
||||
|
||||
@topic "morse_progress"
|
||||
|
||||
def render(assigns) do
|
||||
EisromUiWeb.PageView.render("morse.html", assigns)
|
||||
end
|
||||
|
||||
def mount(_params, _session, socket) do
|
||||
EisromUiWeb.Endpoint.subscribe(@topic)
|
||||
{:ok, assign(socket, default_assigns())}
|
||||
end
|
||||
|
||||
def handle_event("toggle_morse", _value, socket) do
|
||||
Logger.info("Button pressed!")
|
||||
|
||||
Eisrom.Morse.Server.toggle_morse()
|
||||
|
||||
{:noreply, socket}
|
||||
end
|
||||
|
||||
def handle_event("toggle_hint", _value, socket) do
|
||||
{:noreply, update(socket, :hints_visible, &(not &1))}
|
||||
end
|
||||
|
||||
def handle_info(progress, socket) do
|
||||
{:noreply, assign(socket, progress: progress, in_progress?: Eisrom.Morse.Server.in_progress?())}
|
||||
end
|
||||
|
||||
defp default_assigns do
|
||||
[
|
||||
progress: Eisrom.Morse.Server.progress(),
|
||||
in_progress?: Eisrom.Morse.Server.in_progress?(),
|
||||
hints_visible: false
|
||||
]
|
||||
end
|
||||
end
|
52
eisrom_ui/lib/eisrom_ui_web/router.ex
Normal file
52
eisrom_ui/lib/eisrom_ui_web/router.ex
Normal file
|
@ -0,0 +1,52 @@
|
|||
defmodule EisromUiWeb.Router do
|
||||
use EisromUiWeb, :router
|
||||
|
||||
pipeline :browser do
|
||||
plug :accepts, ["html"]
|
||||
plug :fetch_session
|
||||
plug :fetch_live_flash
|
||||
plug :put_root_layout, {EisromUiWeb.LayoutView, :root}
|
||||
plug :protect_from_forgery
|
||||
plug :put_secure_browser_headers
|
||||
end
|
||||
|
||||
pipeline :api do
|
||||
plug :accepts, ["json"]
|
||||
end
|
||||
|
||||
scope "/", EisromUiWeb do
|
||||
pipe_through :browser
|
||||
|
||||
get "/", PageController, :index
|
||||
|
||||
get "/ZZZZ", PageController, :instructions
|
||||
get "/morse", PageController, :instructions
|
||||
get "/esrom", PageController, :instructions
|
||||
|
||||
get "/0B13", PageController, :morse
|
||||
get "/OB13", PageController, :morse
|
||||
get "/seinlamp", PageController, :morse
|
||||
end
|
||||
|
||||
# Other scopes may use custom stacks.
|
||||
# scope "/api", EisromUiWeb do
|
||||
# pipe_through :api
|
||||
# end
|
||||
|
||||
# Enables LiveDashboard only for development
|
||||
#
|
||||
# If you want to use the LiveDashboard in production, you should put
|
||||
# it behind authentication and allow only admins to access it.
|
||||
# If your application does not have an admins-only section yet,
|
||||
# you can use Plug.BasicAuth to set up some basic authentication
|
||||
# as long as you are also using SSL (which you should anyway).
|
||||
if Mix.env() in [:dev, :test] do
|
||||
import Phoenix.LiveDashboard.Router
|
||||
|
||||
scope "/" do
|
||||
pipe_through :browser
|
||||
|
||||
live_dashboard "/dashboard", metrics: EisromUiWeb.Telemetry
|
||||
end
|
||||
end
|
||||
end
|
48
eisrom_ui/lib/eisrom_ui_web/telemetry.ex
Normal file
48
eisrom_ui/lib/eisrom_ui_web/telemetry.ex
Normal file
|
@ -0,0 +1,48 @@
|
|||
defmodule EisromUiWeb.Telemetry do
|
||||
use Supervisor
|
||||
import Telemetry.Metrics
|
||||
|
||||
def start_link(arg) do
|
||||
Supervisor.start_link(__MODULE__, arg, name: __MODULE__)
|
||||
end
|
||||
|
||||
@impl true
|
||||
def init(_arg) do
|
||||
children = [
|
||||
# Telemetry poller will execute the given period measurements
|
||||
# every 10_000ms. Learn more here: https://hexdocs.pm/telemetry_metrics
|
||||
{:telemetry_poller, measurements: periodic_measurements(), period: 10_000}
|
||||
# Add reporters as children of your supervision tree.
|
||||
# {Telemetry.Metrics.ConsoleReporter, metrics: metrics()}
|
||||
]
|
||||
|
||||
Supervisor.init(children, strategy: :one_for_one)
|
||||
end
|
||||
|
||||
def metrics do
|
||||
[
|
||||
# Phoenix Metrics
|
||||
summary("phoenix.endpoint.stop.duration",
|
||||
unit: {:native, :millisecond}
|
||||
),
|
||||
summary("phoenix.router_dispatch.stop.duration",
|
||||
tags: [:route],
|
||||
unit: {:native, :millisecond}
|
||||
),
|
||||
|
||||
# VM Metrics
|
||||
summary("vm.memory.total", unit: {:byte, :kilobyte}),
|
||||
summary("vm.total_run_queue_lengths.total"),
|
||||
summary("vm.total_run_queue_lengths.cpu"),
|
||||
summary("vm.total_run_queue_lengths.io")
|
||||
]
|
||||
end
|
||||
|
||||
defp periodic_measurements do
|
||||
[
|
||||
# A module, function and arguments to be invoked periodically.
|
||||
# This function must call :telemetry.execute/3 and a metric must be added above.
|
||||
# {EisromUiWeb, :count_users, []}
|
||||
]
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
<main role="main" class="container">
|
||||
<p class="alert alert-info" role="alert"><%= get_flash(@conn, :info) %></p>
|
||||
<p class="alert alert-danger" role="alert"><%= get_flash(@conn, :error) %></p>
|
||||
<%= @inner_content %>
|
||||
</main>
|
11
eisrom_ui/lib/eisrom_ui_web/templates/layout/live.html.heex
Normal file
11
eisrom_ui/lib/eisrom_ui_web/templates/layout/live.html.heex
Normal file
|
@ -0,0 +1,11 @@
|
|||
<main role="main" class="container">
|
||||
<p class="alert alert-info" role="alert"
|
||||
phx-click="lv:clear-flash"
|
||||
phx-value-key="info"><%= live_flash(@flash, :info) %></p>
|
||||
|
||||
<p class="alert alert-danger" role="alert"
|
||||
phx-click="lv:clear-flash"
|
||||
phx-value-key="error"><%= live_flash(@flash, :error) %></p>
|
||||
|
||||
<%= @inner_content %>
|
||||
</main>
|
15
eisrom_ui/lib/eisrom_ui_web/templates/layout/root.html.heex
Normal file
15
eisrom_ui/lib/eisrom_ui_web/templates/layout/root.html.heex
Normal file
|
@ -0,0 +1,15 @@
|
|||
<!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.0"/>
|
||||
<meta name="csrf-token" content={csrf_token_value()}>
|
||||
<title>Esrom Geocache</title>
|
||||
<link phx-track-static rel="stylesheet" href={Routes.static_path(@conn, "/assets/app.css")}/>
|
||||
<script defer phx-track-static type="text/javascript" src={Routes.static_path(@conn, "/assets/app.js")}></script>
|
||||
</head>
|
||||
<body>
|
||||
<%= @inner_content %>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,2 @@
|
|||
<p>Welcome geocacher, you will need to go to the first coordinate and start from there.</p>
|
||||
<p>Good luck!</p>
|
28
eisrom_ui/lib/eisrom_ui_web/templates/page/morse.html.heex
Normal file
28
eisrom_ui/lib/eisrom_ui_web/templates/page/morse.html.heex
Normal file
|
@ -0,0 +1,28 @@
|
|||
<h1>Welcome to <a href="https://www.geocaching.com/geocache/GC7C642_esrom">Esrom</a>!</h1>
|
||||
<h2>en:<br>Push the Start button below to get <span style="color:red">UVW</span><span style="color:blue">XYZ</span>. You can find the geocache at N 52° 40.<span style="color:red">UVW</span>' E 004° 53.<span style="color:blue">XYZ</span>'</h2>
|
||||
<h2>nl:<br>Druk op de Start knop hieronder om <span style="color:red">UVW</span><span style="color:blue">XYZ</span> te vinden. Je kunt dan de geocache vinden op N 52° 40.<span style="color:red">UVW</span>' E 004° 53.<span style="color:blue">XYZ</span>'</h2>
|
||||
|
||||
<div id="buttonwrap">
|
||||
<%= if @in_progress? do %>
|
||||
<button phx-click="toggle_morse" class="button stop">Stop</button>
|
||||
<% else %>
|
||||
<button phx-click="toggle_morse" class="button">Start</button>
|
||||
<% end %>
|
||||
<div id="response-block">
|
||||
<h2>Progress:</h2>
|
||||
<progress max="100" value={@progress}>
|
||||
<%= @progress %>%
|
||||
</progress>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a href="http://www.geochecker.com/index.php?code=de602fd6ce063e4acdfd69dacd1f081e&action=check&wp=47433743363432&name=4573726f6d">en: check your coordinate on GeoChecker.com nl: controleer je coördinaat op GeoChecker.</a>
|
||||
<br>
|
||||
<br>
|
||||
<button phx-click="toggle_hint" id="hintButton">Click here for a hint!</button>
|
||||
<div id="givehint" style={"visibility:" <> (if @hints_visible, do: "visible", else: "hidden")}>
|
||||
<p>en: Position yourself on the bridge. Watch carefully around to windows of houses, remember this is a nightly geocache. During daytime it is quite hard to see, but not impossible. After pushing the button, it takes 3
|
||||
seconds to start. The whole process takes about 35 sec. You can start it all over again as much as you like. In case you are really stuck, you could try to contact me via WhatsApp on number +31 6 41633689. Best of luck to you!</p>
|
||||
<p>nl: Ga op de brug staan. Kijk goed om je heen naar ramen van woningen en realiseer je dat dit een een nachtcache is. Overdag is het slecht te zien, maar niet onmogelijk. Na het indrukken van de knop duurt het 3 seconden
|
||||
voordat het begint. Het hele proces duurt ongeveer 35 sec. Je kunt het zo vaak starten als je wilt. Als het helemaal niet lukt zou je me kunnen proberen te bereiken via WhatsApp nummer 06-41633689. Veel plezier!</p>
|
||||
</div>
|
30
eisrom_ui/lib/eisrom_ui_web/views/error_helpers.ex
Normal file
30
eisrom_ui/lib/eisrom_ui_web/views/error_helpers.ex
Normal file
|
@ -0,0 +1,30 @@
|
|||
defmodule EisromUiWeb.ErrorHelpers do
|
||||
@moduledoc """
|
||||
Conveniences for translating and building error messages.
|
||||
"""
|
||||
|
||||
use Phoenix.HTML
|
||||
|
||||
@doc """
|
||||
Generates tag for inlined form input errors.
|
||||
"""
|
||||
def error_tag(form, field) do
|
||||
Enum.map(Keyword.get_values(form.errors, field), fn error ->
|
||||
content_tag(:span, translate_error(error),
|
||||
class: "invalid-feedback",
|
||||
phx_feedback_for: input_name(form, field)
|
||||
)
|
||||
end)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Translates an error message.
|
||||
"""
|
||||
def translate_error({msg, opts}) do
|
||||
# Because the error messages we show in our forms and APIs
|
||||
# are defined inside Ecto, we need to translate them dynamically.
|
||||
Enum.reduce(opts, msg, fn {key, value}, acc ->
|
||||
String.replace(acc, "%{#{key}}", fn _ -> to_string(value) end)
|
||||
end)
|
||||
end
|
||||
end
|
16
eisrom_ui/lib/eisrom_ui_web/views/error_view.ex
Normal file
16
eisrom_ui/lib/eisrom_ui_web/views/error_view.ex
Normal file
|
@ -0,0 +1,16 @@
|
|||
defmodule EisromUiWeb.ErrorView do
|
||||
use EisromUiWeb, :view
|
||||
|
||||
# If you want to customize a particular status code
|
||||
# for a certain format, you may uncomment below.
|
||||
# def render("500.html", _assigns) do
|
||||
# "Internal Server Error"
|
||||
# end
|
||||
|
||||
# By default, Phoenix returns the status message from
|
||||
# the template name. For example, "404.html" becomes
|
||||
# "Not Found".
|
||||
def template_not_found(template, _assigns) do
|
||||
Phoenix.Controller.status_message_from_template(template)
|
||||
end
|
||||
end
|
7
eisrom_ui/lib/eisrom_ui_web/views/layout_view.ex
Normal file
7
eisrom_ui/lib/eisrom_ui_web/views/layout_view.ex
Normal file
|
@ -0,0 +1,7 @@
|
|||
defmodule EisromUiWeb.LayoutView do
|
||||
use EisromUiWeb, :view
|
||||
|
||||
# Phoenix LiveDashboard is available only in development by default,
|
||||
# so we instruct Elixir to not warn if the dashboard route is missing.
|
||||
@compile {:no_warn_undefined, {Routes, :live_dashboard_path, 2}}
|
||||
end
|
3
eisrom_ui/lib/eisrom_ui_web/views/page_view.ex
Normal file
3
eisrom_ui/lib/eisrom_ui_web/views/page_view.ex
Normal file
|
@ -0,0 +1,3 @@
|
|||
defmodule EisromUiWeb.PageView do
|
||||
use EisromUiWeb, :view
|
||||
end
|
64
eisrom_ui/mix.exs
Normal file
64
eisrom_ui/mix.exs
Normal file
|
@ -0,0 +1,64 @@
|
|||
defmodule EisromUi.MixProject do
|
||||
use Mix.Project
|
||||
|
||||
def project do
|
||||
[
|
||||
app: :eisrom_ui,
|
||||
version: "0.1.0",
|
||||
elixir: "~> 1.12",
|
||||
elixirc_paths: elixirc_paths(Mix.env()),
|
||||
compilers: Mix.compilers(),
|
||||
start_permanent: Mix.env() == :prod,
|
||||
aliases: aliases(),
|
||||
deps: deps()
|
||||
]
|
||||
end
|
||||
|
||||
# Configuration for the OTP application.
|
||||
#
|
||||
# Type `mix help compile.app` for more information.
|
||||
def application do
|
||||
[
|
||||
env: [morse_message: "... --- ...", relay_pin: 17],
|
||||
mod: {EisromUi.Application, []},
|
||||
extra_applications: [:logger, :runtime_tools]
|
||||
]
|
||||
end
|
||||
|
||||
# Specifies which paths to compile per environment.
|
||||
defp elixirc_paths(:test), do: ["lib", "test/support"]
|
||||
defp elixirc_paths(_), do: ["lib"]
|
||||
|
||||
# Specifies your project dependencies.
|
||||
#
|
||||
# Type `mix help deps` for examples and options.
|
||||
defp deps do
|
||||
[
|
||||
{:phoenix, "~> 1.6.13"},
|
||||
{:phoenix_html, "~> 3.0"},
|
||||
{:phoenix_live_reload, "~> 1.2", only: :dev},
|
||||
{:phoenix_live_view, "~> 0.17.5"},
|
||||
{:floki, ">= 0.30.0", only: :test},
|
||||
{:phoenix_live_dashboard, "~> 0.6"},
|
||||
{:esbuild, "~> 0.4", runtime: Mix.env() == :dev && Mix.target() == :host},
|
||||
{:telemetry_metrics, "~> 0.6"},
|
||||
{:telemetry_poller, "~> 1.0"},
|
||||
{:jason, "~> 1.2"},
|
||||
{:plug_cowboy, "~> 2.5"},
|
||||
{:circuits_gpio, "~> 1.0"}
|
||||
]
|
||||
end
|
||||
|
||||
# Aliases are shortcuts or tasks specific to the current project.
|
||||
# For example, to install project dependencies and perform other setup tasks, run:
|
||||
#
|
||||
# $ mix setup
|
||||
#
|
||||
# See the documentation for `Mix` for more info on aliases.
|
||||
defp aliases do
|
||||
[
|
||||
setup: ["deps.get"],
|
||||
"assets.deploy": ["esbuild default --minify", "phx.digest"]
|
||||
]
|
||||
end
|
||||
end
|
28
eisrom_ui/mix.lock
Normal file
28
eisrom_ui/mix.lock
Normal file
|
@ -0,0 +1,28 @@
|
|||
%{
|
||||
"castore": {:hex, :castore, "0.1.18", "deb5b9ab02400561b6f5708f3e7660fc35ca2d51bfc6a940d2f513f89c2975fc", [:mix], [], "hexpm", "61bbaf6452b782ef80b33cdb45701afbcf0a918a45ebe7e73f1130d661e66a06"},
|
||||
"circuits_gpio": {:hex, :circuits_gpio, "1.0.1", "53e0aefebc0eedc1326f7f28cc53831bed84654767eb3c613934c6ec8ca77caa", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "d8e918fdfada785b24a071edc7e4dbd334b3b42c6a0298fc0d13e7f1fc5b3e0a"},
|
||||
"cowboy": {:hex, :cowboy, "2.9.0", "865dd8b6607e14cf03282e10e934023a1bd8be6f6bacf921a7e2a96d800cd452", [:make, :rebar3], [{:cowlib, "2.11.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "2c729f934b4e1aa149aff882f57c6372c15399a20d54f65c8d67bef583021bde"},
|
||||
"cowboy_telemetry": {:hex, :cowboy_telemetry, "0.4.0", "f239f68b588efa7707abce16a84d0d2acf3a0f50571f8bb7f56a15865aae820c", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7d98bac1ee4565d31b62d59f8823dfd8356a169e7fcbb83831b8a5397404c9de"},
|
||||
"cowlib": {:hex, :cowlib, "2.11.0", "0b9ff9c346629256c42ebe1eeb769a83c6cb771a6ee5960bd110ab0b9b872063", [:make, :rebar3], [], "hexpm", "2b3e9da0b21c4565751a6d4901c20d1b4cc25cbb7fd50d91d2ab6dd287bc86a9"},
|
||||
"elixir_make": {:hex, :elixir_make, "0.6.3", "bc07d53221216838d79e03a8019d0839786703129599e9619f4ab74c8c096eac", [:mix], [], "hexpm", "f5cbd651c5678bcaabdbb7857658ee106b12509cd976c2c2fca99688e1daf716"},
|
||||
"esbuild": {:hex, :esbuild, "0.5.0", "d5bb08ff049d7880ee3609ed5c4b864bd2f46445ea40b16b4acead724fb4c4a3", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}], "hexpm", "f183a0b332d963c4cfaf585477695ea59eef9a6f2204fdd0efa00e099694ffe5"},
|
||||
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
|
||||
"floki": {:hex, :floki, "0.33.1", "f20f1eb471e726342b45ccb68edb9486729e7df94da403936ea94a794f072781", [:mix], [{:html_entities, "~> 0.5.0", [hex: :html_entities, repo: "hexpm", optional: false]}], "hexpm", "461035fd125f13fdf30f243c85a0b1e50afbec876cbf1ceefe6fddd2e6d712c6"},
|
||||
"html_entities": {:hex, :html_entities, "0.5.2", "9e47e70598da7de2a9ff6af8758399251db6dbb7eebe2b013f2bbd2515895c3c", [:mix], [], "hexpm", "c53ba390403485615623b9531e97696f076ed415e8d8058b1dbaa28181f4fdcc"},
|
||||
"jason": {:hex, :jason, "1.4.0", "e855647bc964a44e2f67df589ccf49105ae039d4179db7f6271dfd3843dc27e6", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "79a3791085b2a0f743ca04cec0f7be26443738779d09302e01318f97bdb82121"},
|
||||
"mime": {:hex, :mime, "2.0.3", "3676436d3d1f7b81b5a2d2bd8405f412c677558c81b1c92be58c00562bb59095", [:mix], [], "hexpm", "27a30bf0db44d25eecba73755acf4068cbfe26a4372f9eb3e4ea3a45956bff6b"},
|
||||
"phoenix": {:hex, :phoenix, "1.6.13", "5b3152907afdb8d3a6cdafb4b149e8aa7aabbf1422fd9f7ef4c2a67ead57d24a", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 1.0", [hex: :phoenix_view, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "13d8806c31176e2066da4df2d7443c144211305c506ed110ad4044335b90171d"},
|
||||
"phoenix_html": {:hex, :phoenix_html, "3.2.0", "1c1219d4b6cb22ac72f12f73dc5fad6c7563104d083f711c3fcd8551a1f4ae11", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "36ec97ba56d25c0136ef1992c37957e4246b649d620958a1f9fa86165f8bc54f"},
|
||||
"phoenix_live_dashboard": {:hex, :phoenix_live_dashboard, "0.6.5", "1495bb014be12c9a9252eca04b9af54246f6b5c1e4cd1f30210cd00ec540cf8e", [:mix], [{:ecto, "~> 3.6.2 or ~> 3.7", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_mysql_extras, "~> 0.3", [hex: :ecto_mysql_extras, repo: "hexpm", optional: true]}, {:ecto_psql_extras, "~> 0.7", [hex: :ecto_psql_extras, repo: "hexpm", optional: true]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.17.7", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "ef4fa50dd78364409039c99cf6f98ab5209b4c5f8796c17f4db118324f0db852"},
|
||||
"phoenix_live_reload": {:hex, :phoenix_live_reload, "1.3.3", "3a53772a6118d5679bf50fc1670505a290e32a1d195df9e069d8c53ab040c054", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "766796676e5f558dbae5d1bdb066849673e956005e3730dfd5affd7a6da4abac"},
|
||||
"phoenix_live_view": {:hex, :phoenix_live_view, "0.17.12", "74f4c0ad02d7deac2d04f50b52827a5efdc5c6e7fac5cede145f5f0e4183aedc", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6.0 or ~> 1.7.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.1", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "af6dd5e0aac16ff43571f527a8e0616d62cb80b10eb87aac82170243e50d99c8"},
|
||||
"phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.1", "ba04e489ef03763bf28a17eb2eaddc2c20c6d217e2150a61e3298b0f4c2012b5", [:mix], [], "hexpm", "81367c6d1eea5878ad726be80808eb5a787a23dee699f96e72b1109c57cdd8d9"},
|
||||
"phoenix_view": {:hex, :phoenix_view, "1.1.2", "1b82764a065fb41051637872c7bd07ed2fdb6f5c3bd89684d4dca6e10115c95a", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "7ae90ad27b09091266f6adbb61e1d2516a7c3d7062c6789d46a7554ec40f3a56"},
|
||||
"plug": {:hex, :plug, "1.13.6", "187beb6b67c6cec50503e940f0434ea4692b19384d47e5fdfd701e93cadb4cc2", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "02b9c6b9955bce92c829f31d6284bf53c591ca63c4fb9ff81dfd0418667a34ff"},
|
||||
"plug_cowboy": {:hex, :plug_cowboy, "2.5.2", "62894ccd601cf9597e2c23911ff12798a8a18d237e9739f58a6b04e4988899fe", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "ea6e87f774c8608d60c8d34022a7d073bd7680a0a013f049fc62bf35efea1044"},
|
||||
"plug_crypto": {:hex, :plug_crypto, "1.2.3", "8f77d13aeb32bfd9e654cb68f0af517b371fb34c56c9f2b58fe3df1235c1251a", [:mix], [], "hexpm", "b5672099c6ad5c202c45f5a403f21a3411247f164e4a8fab056e5cd8a290f4a2"},
|
||||
"ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"},
|
||||
"telemetry": {:hex, :telemetry, "1.1.0", "a589817034a27eab11144ad24d5c0f9fab1f58173274b1e9bae7074af9cbee51", [:rebar3], [], "hexpm", "b727b2a1f75614774cff2d7565b64d0dfa5bd52ba517f16543e6fc7efcc0df48"},
|
||||
"telemetry_metrics": {:hex, :telemetry_metrics, "0.6.1", "315d9163a1d4660aedc3fee73f33f1d355dcc76c5c3ab3d59e76e3edf80eef1f", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7be9e0871c41732c233be71e4be11b96e56177bf15dde64a8ac9ce72ac9834c6"},
|
||||
"telemetry_poller": {:hex, :telemetry_poller, "1.0.0", "db91bb424e07f2bb6e73926fcafbfcbcb295f0193e0a00e825e589a0a47e8453", [:rebar3], [{:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "b3a24eafd66c3f42da30fc3ca7dda1e9d546c12250a2d60d7b81d264fbec4f6e"},
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
eisrom_ui/priv/static/favicon.ico
Normal file
BIN
eisrom_ui/priv/static/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
eisrom_ui/priv/static/images/phoenix.png
Normal file
BIN
eisrom_ui/priv/static/images/phoenix.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
|
@ -0,0 +1,5 @@
|
|||
# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
|
||||
#
|
||||
# To ban all spiders from the entire site uncomment the next two lines:
|
||||
# User-agent: *
|
||||
# Disallow: /
|
Binary file not shown.
5
eisrom_ui/priv/static/robots.txt
Normal file
5
eisrom_ui/priv/static/robots.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
|
||||
#
|
||||
# To ban all spiders from the entire site uncomment the next two lines:
|
||||
# User-agent: *
|
||||
# Disallow: /
|
BIN
eisrom_ui/priv/static/robots.txt.gz
Normal file
BIN
eisrom_ui/priv/static/robots.txt.gz
Normal file
Binary file not shown.
|
@ -0,0 +1,8 @@
|
|||
defmodule EisromUiWeb.PageControllerTest do
|
||||
use EisromUiWeb.ConnCase
|
||||
|
||||
test "GET /", %{conn: conn} do
|
||||
conn = get(conn, "/")
|
||||
assert html_response(conn, 200) =~ "Welcome to Phoenix!"
|
||||
end
|
||||
end
|
14
eisrom_ui/test/eisrom_ui_web/views/error_view_test.exs
Normal file
14
eisrom_ui/test/eisrom_ui_web/views/error_view_test.exs
Normal file
|
@ -0,0 +1,14 @@
|
|||
defmodule EisromUiWeb.ErrorViewTest do
|
||||
use EisromUiWeb.ConnCase, async: true
|
||||
|
||||
# Bring render/3 and render_to_string/3 for testing custom views
|
||||
import Phoenix.View
|
||||
|
||||
test "renders 404.html" do
|
||||
assert render_to_string(EisromUiWeb.ErrorView, "404.html", []) == "Not Found"
|
||||
end
|
||||
|
||||
test "renders 500.html" do
|
||||
assert render_to_string(EisromUiWeb.ErrorView, "500.html", []) == "Internal Server Error"
|
||||
end
|
||||
end
|
8
eisrom_ui/test/eisrom_ui_web/views/layout_view_test.exs
Normal file
8
eisrom_ui/test/eisrom_ui_web/views/layout_view_test.exs
Normal file
|
@ -0,0 +1,8 @@
|
|||
defmodule EisromUiWeb.LayoutViewTest do
|
||||
use EisromUiWeb.ConnCase, async: true
|
||||
|
||||
# When testing helpers, you may want to import Phoenix.HTML and
|
||||
# use functions such as safe_to_string() to convert the helper
|
||||
# result into an HTML string.
|
||||
# import Phoenix.HTML
|
||||
end
|
3
eisrom_ui/test/eisrom_ui_web/views/page_view_test.exs
Normal file
3
eisrom_ui/test/eisrom_ui_web/views/page_view_test.exs
Normal file
|
@ -0,0 +1,3 @@
|
|||
defmodule EisromUiWeb.PageViewTest do
|
||||
use EisromUiWeb.ConnCase, async: true
|
||||
end
|
37
eisrom_ui/test/support/conn_case.ex
Normal file
37
eisrom_ui/test/support/conn_case.ex
Normal file
|
@ -0,0 +1,37 @@
|
|||
defmodule EisromUiWeb.ConnCase do
|
||||
@moduledoc """
|
||||
This module defines the test case to be used by
|
||||
tests that require setting up a connection.
|
||||
|
||||
Such tests rely on `Phoenix.ConnTest` and also
|
||||
import other functionality to make it easier
|
||||
to build common data structures and query the data layer.
|
||||
|
||||
Finally, if the test case interacts with the database,
|
||||
we enable the SQL sandbox, so changes done to the database
|
||||
are reverted at the end of every test. If you are using
|
||||
PostgreSQL, you can even run database tests asynchronously
|
||||
by setting `use EisromUiWeb.ConnCase, async: true`, although
|
||||
this option is not recommended for other databases.
|
||||
"""
|
||||
|
||||
use ExUnit.CaseTemplate
|
||||
|
||||
using do
|
||||
quote do
|
||||
# Import conveniences for testing with connections
|
||||
import Plug.Conn
|
||||
import Phoenix.ConnTest
|
||||
import EisromUiWeb.ConnCase
|
||||
|
||||
alias EisromUiWeb.Router.Helpers, as: Routes
|
||||
|
||||
# The default endpoint for testing
|
||||
@endpoint EisromUiWeb.Endpoint
|
||||
end
|
||||
end
|
||||
|
||||
setup _tags do
|
||||
{:ok, conn: Phoenix.ConnTest.build_conn()}
|
||||
end
|
||||
end
|
1
eisrom_ui/test/test_helper.exs
Normal file
1
eisrom_ui/test/test_helper.exs
Normal file
|
@ -0,0 +1 @@
|
|||
ExUnit.start()
|
Loading…
Add table
Add a link
Reference in a new issue