forked from edrys-org/module-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
56 lines (47 loc) · 2.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!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="description" content="An example module to create your own" />
<meta name="show-in" content="*" />
<title>Example Module</title>
<script src="https://edrys-labs.github.io/module/edrys.js"></script>
<script defer src="https://edrys-labs.github.io/module/vendor/alpine.min.js"></script>
<link rel="stylesheet" href="https://edrys-labs.github.io/module/vendor/water.min.css" />
<link rel="stylesheet" href="https://edrys-labs.github.io/module/vendor/open-iconic/css/open-iconic.min.css" />
</head>
<body>
<template x-if="!!edrys" x-data="{ edrys: undefined }" x-init="Edrys.onUpdate((e) => { edrys = {...e} })">
<div>
<h1>Example Module</h1>
<hr />
<h2>Room Data</h2>
<div x-text="JSON.stringify(edrys)"></div>
<h2>Send Message</h2>
<form x-data="{ subject: '', message: '' }" x-on:submit.prevent="Edrys.sendMessage(subject, message)">
<input type="text" required minlength="1" placeholder="Subject" x-model="subject" />
<input type="text" required minlength="1" placeholder="Body" x-model="message" />
<button type="submit">
<span class="oi" data-glyph="arrow-thick-right" aria-hidden="true"></span>
Send message
</button>
</form>
<h2>Received messages</h2>
<div x-data="{ messages: [] }" x-init="Edrys.onMessage((m) => { messages.push(m) })">
<em x-show="!messages.length">No messages received yet...</em>
<ul>
<template x-for="message in messages">
<li>
<code x-text="message.from"></code>:
<code x-text="message.subject"></code> -
<code x-text="message.body"></code>
</li>
</template>
</ul>
</div>
</div>
</template>
</body>
</html>