New electron app

This commit is contained in:
barwie2@st.amu.edu.pl 2020-01-13 17:39:09 +01:00
parent b13f83ba2a
commit 1e7438d07a
3 changed files with 1 additions and 92 deletions

View File

@ -1,42 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/css/materialize.min.css">
<meta charset="UTF-8">
<title>Add student</title>
</head>
<body>
<div class="container">
<form>
<div>
<h5 class="center">Enter student data</h3> <br />
Name: <input type="text" id="name" required autofocus/> <br />
Surname: <input type="text" id="surname" required autofocus/> <br />
Index: <input type="text" id="index" required autofocus/> <br />
</div>
<br />
<button class="btn waves-effect waves-light" type="submit">Add</button>
</form>
</div>
<script>
const electron = require('electron');
const {ipcRenderer} = electron;
const form = document.querySelector("form");
form.addEventListener("submit",submitForm);
function submitForm(e){
e.preventDefault();
var name = document.querySelector("#name").value;
var surname = document.querySelector("#surname").value;
var index = document.querySelector("#index").value;
const item = [name,surname,index];
ipcRenderer.send("item:add",item);
}
</script>
</body>
</html>

View File

@ -8,7 +8,7 @@
<body>
<nav>
<div class="nav-wrapper">
<a class="brand-logo center">Student counter</a>
<a class="brand-logo center">@CHECK</a>
</div>
</nav>

View File

@ -1,49 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/css/materialize.min.css">
<meta charset="UTF-8">
<title>Student counter</title>
</head>
<body>
<nav>
<div class="nav-wrapper">
<a class="brand-logo center">Select classes</a>
</div>
</nav>
<ul>
</ul>
<script>
const electron = require('electron');
const {ipcRenderer} = electron;
const ul = document.querySelector("ul");
ipcRenderer.send("item:start");
ipcRenderer.on("item:add_select_classes",function(e,item) {
ul.className = "collection";
const li = document.createElement('li');
li.className = "collection-item";
li.id = item[3];
li.style.cursor = "pointer";
const itemText = document.createTextNode(item[0] + " " + item[1] + " " + item[2]);
li.appendChild(itemText);
ul.appendChild(li);
});
ul.addEventListener('click',selectItem);
function selectItem(item) {
ipcRenderer.send("item:select",item.target.id);
}
</script>
</html>