Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
X
XYZ-Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sindre Eiklid
XYZ-Project
Commits
57864eb8
Commit
57864eb8
authored
Nov 29, 2020
by
Rickard Loland
Browse files
Options
Downloads
Plain Diff
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
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
client/js/login.js
+24
-26
24 additions, 26 deletions
client/js/login.js
client/js/profile.js
+26
-41
26 additions, 41 deletions
client/js/profile.js
with
50 additions
and
67 deletions
client/js/login.js
+
24
−
26
View file @
57864eb8
/* 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>
...
...
This diff is collapsed.
Click to expand it.
client/js/profile.js
+
26
−
41
View file @
57864eb8
/* 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
()}
\>×</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
"
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment