Skip to content
Snippets Groups Projects
Commit 57864eb8 authored by Rickard Loland's avatar Rickard Loland
Browse files

Merge branch 'master' of https://git.gvk.idi.ntnu.no/sindre0830/xyz-project into master

parents 0a733aa1 271a82cb
No related branches found
No related tags found
No related merge requests found
/* library */
import { LitElement, html, css } from '../node_modules/lit-element/lit-element';
/**
* @brief Class Login.
*
*/
export class Login extends LitElement {
/**
* @brief Local styles.
*
*/
static get styles() {
return [
css `
......@@ -14,15 +21,24 @@ export class Login extends LitElement {
}`
];
}
/**
* @brief Define all global variables (None in this case).
*
*/
static get properties() {
return {};
}
/**
* @brief Constructor.
*
*/
constructor() {
super();
}
/**
* @brief Render this HTML code to the webpage.
*
*/
render() {
return html`
<div id="postContainer">
......@@ -30,11 +46,6 @@ export class Login extends LitElement {
<th>
<h1>Register</h1>
<form action="http://localhost:8081/createUser" method="POST" class="form-group">
<p></p>
<!-- <div class="form-group">
<label for="name">Enter your name: </label>
<input type="text" name="userName" id="name" required>
</div>-->
<div class="form-group">
<label for="email">Enter your email: </label>
<input type="email" name="email" id="email" required>
......@@ -43,10 +54,6 @@ export class Login extends LitElement {
<label for="password">Enter your password: </label>
<input type="password" name="password" id="password" required>
</div>
<!-- <div class="form-group">
<label for="userType">Enter your user type: </label>
<input type="userType" name="userType" id="userType" required>
</div> -->
<div class="form-group">
<label for="picture">Upload profile picture: </label>
<input type="file" name="picture" id="picture" accept="image/x-png,image/gif,image/jpeg">
......@@ -59,11 +66,6 @@ export class Login extends LitElement {
<th>
<h1>Login</h1>
<form action="http://localhost:8081/login" method="POST" class="form-group">
<p></p>
<!-- <div class="form-group">
<label for="name">Enter your name: </label>
<input type="text" name="userName" id="name" required>
</div>-->
<div class="form-group">
<label for="email">Email: </label>
<input type="email" name="email" id="email" required>
......@@ -72,10 +74,6 @@ export class Login extends LitElement {
<label for="password">Password: </label>
<input type="password" name="password" id="password" required>
</div>
<!-- <div class="form-group">
<label for="userType">Enter your user type: </label>
<input type="userType" name="userType" id="userType" required>
</div> -->
<input type="submit" value="Log Inn">
</form>
</th>
......
/* library */
import { LitElement, html, css } from '../node_modules/lit-element/lit-element';
/**
* @brief Class profile
* @brief Class profile.
*
*/
export class Profile extends LitElement {
/**
* @brief Local styles
* @brief Local styles.
*
*/
static get styles() {
return [css `
......@@ -125,7 +127,8 @@ export class Profile extends LitElement {
];
}
/**
* @brief Properties
* @brief Define all global variables.
*
*/
static get properties() {
return {
......@@ -138,7 +141,8 @@ export class Profile extends LitElement {
};
}
/**
* @brief Constructor
* @brief Get all posts on construction.
*
*/
constructor() {
super();
......@@ -170,10 +174,13 @@ export class Profile extends LitElement {
);
}
/**
* @brief Render this HTML code to the webpage
* @brief Render this HTML code to the webpage.
*
*/
render() {
//if render is run without any posts, return empty html code
if(this.postKey === undefined) return html``;
//fill in array of indexes so it can be used in the map loop
for(var i = 0; i < this.postKey.length; i++) {
this.arrIndex[i] = i;
}
......@@ -207,9 +214,8 @@ export class Profile extends LitElement {
<div id="stealthContainer">
<div id="stealthContent">
<span class="close" @click=${e => this.closeStealth()}\>&times;</span>
<div class="title" id="pageTitle">TITLE!</div>
<div class="description" id="pageDescription">DESCRIPTION...</div>
<div class="title" id="pageTitle"></div>
<div class="description" id="pageDescription"></div>
<form id="formComment" action="http://localhost:8081/createComment/" method="GET" class="form">
<div class="form-col">
<textarea id="comment" name="comment" rows="2" col="10"></textarea>
......@@ -218,25 +224,7 @@ export class Profile extends LitElement {
<input type="submit" value="Post comment">
</button>
</form>
<div id="commentContainer">
<div class="comment">
<div class="commentPoster">
Author: 1
</div>
<div class="commentContent">
Lorum ipsum...
</div>
</div>
<div class="comment">
<div class="commentPoster">
Author: 1
</div>
<div class="commentContent">
Lorum ipsum...
</div>
</div>
</div>
<div id="commentContainer"></div>
</div>
</div>
</div>
......@@ -244,20 +232,9 @@ export class Profile extends LitElement {
`;
}
/**
* @brief Run this function after render().
* @brief Display a post as a pop-up.
*
*/
updated() {
//get current user
/*fetch(
`${window.MyAppGlobals.serverURL}getUser`
).then(
res => res.json()
).then(
data => {
console.log(data);
}
);*/
}
displayPost(id) {
for(var i = 0; i < this.postKey.length; i++) {
if(this.postKey[i] == id) {
......@@ -281,6 +258,10 @@ export class Profile extends LitElement {
}
);
}
/**
* @brief Display all the comments to a specific post.
*
*/
displayComment(arrComment) {
console.log(arrComment);
this.shadowRoot.getElementById('commentContainer').innerHTML = ``;
......@@ -297,6 +278,10 @@ export class Profile extends LitElement {
`;
}
}
/**
* @brief Close post pop-up.
*
*/
closeStealth() {
this.shadowRoot.getElementById('stealthContainer').style.display = "none";
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment