Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Full Stack harjoitustyö
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
Container 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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AA2875
Full Stack harjoitustyö
Commits
34a185b5
Commit
34a185b5
authored
2 years ago
by
AA2875
Browse files
Options
Downloads
Patches
Plain Diff
ul li testausta
parent
03280588
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
V2/index.js
+4
-4
4 additions, 4 deletions
V2/index.js
V2/page/code.js
+46
-22
46 additions, 22 deletions
V2/page/code.js
V2/page/styles.css
+6
-1
6 additions, 1 deletion
V2/page/styles.css
with
56 additions
and
27 deletions
V2/index.js
+
4
−
4
View file @
34a185b5
...
...
@@ -67,12 +67,12 @@ app.put('/jumps/:id', async (request, response) => {
const
{
text
}
=
request
.
body
const
{
id
}
=
request
.
params
const
jump
=
await
Jump
.
findByIdAndUpdate
(
id
,
{
'
text
'
:
text
},
{
'
new
'
:
true
}
id
,
{
'
text
'
:
text
},
{
'
new
'
:
true
}
)
response
.
json
(
jump
)
})
})
// app listen port 3000
...
...
This diff is collapsed.
Click to expand it.
V2/page/code.js
+
46
−
22
View file @
34a185b5
...
...
@@ -11,35 +11,59 @@ async function loadJumps() {
showJumps
(
jumps
)
}
function
createJumpListItem
(
jump
)
{
// Tähän sisennys hommat
function
createJumpListItem
(
jump
)
{
let
li
=
document
.
createElement
(
'
li
'
)
let
ul
=
document
.
createElement
(
'
ul
'
)
let
li_attr
=
document
.
createAttribute
(
'
id
'
)
li_attr
.
value
=
jump
.
_id
li
.
setAttributeNode
(
li_attr
)
let
jumpSpecs
=
document
.
createTextNode
(
jump
.
number
+
"
"
+
jump
.
date
)
li
.
appendChild
(
jumpSpecs
)
// spanit
let
edit_span
=
document
.
createElement
(
'
span
'
)
let
edit_span_attr
=
document
.
createAttribute
(
'
class
'
)
let
del_span
=
document
.
createElement
(
'
span
'
)
let
del_span_attr
=
document
.
createAttribute
(
'
class
'
)
// edit
edit_span_attr
.
value
=
"
edit
"
edit_span
.
setAttributeNode
(
edit_span_attr
)
let
edit
=
document
.
createTextNode
(
"
edit
"
)
edit_span
.
appendChild
(
edit
)
edit_span
.
onclick
=
function
()
{
editJump
(
jump
.
_id
)
}
li
.
appendChild
(
edit_span
)
// delete
del_span_attr
.
value
=
'
delete
'
del_span
.
setAttributeNode
(
del_span_attr
)
let
x
=
document
.
createTextNode
(
'
x
'
)
del_span
.
appendChild
(
x
)
del_span
.
onclick
=
function
()
{
removeJump
(
jump
.
_id
)
}
li
.
appendChild
(
del_span
)
let
jumpNumber
=
document
.
createTextNode
(
"
#
"
+
jump
.
number
)
li
.
appendChild
(
jumpNumber
)
li
.
appendChild
(
ul
)
ul
.
appendChild
(
addJumpInfo
(
jump
))
// SEKASIN
return
li
}
function
addJumpInfo
(
jump
)
{
let
ul
=
document
.
createElement
(
'
ul
'
)
let
li
=
document
.
createElement
(
'
li
'
)
ul
.
appendChild
(
li
)
let
jumpDate
=
document
.
createTextNode
(
jump
.
date
)
console
.
log
(
jump
.
date
)
li
.
appendChild
(
jumpDate
)
return
ul
}
// function createJumpListItem(jump) { // Tähän sisennys hommat
// let li = document.createElement('li')
// let li_attr = document.createAttribute('id')
// li_attr.value = jump._id
// li.setAttributeNode(li_attr)
// let jumpSpecs = document.createTextNode(jump.number + " " + jump.date)
// li.appendChild(jumpSpecs)
// // spanit
// let edit_span = document.createElement('span')
// let edit_span_attr = document.createAttribute('class')
// let del_span = document.createElement('span')
// let del_span_attr = document.createAttribute('class')
// // edit
// edit_span_attr.value = "edit"
// edit_span.setAttributeNode(edit_span_attr)
// let edit = document.createTextNode(" edit ")
// edit_span.appendChild(edit)
// edit_span.onclick = function() { editJump(jump._id) }
// li.appendChild(edit_span)
// // delete
// del_span_attr.value = 'delete'
// del_span.setAttributeNode(del_span_attr)
// let x = document.createTextNode(' x ')
// del_span.appendChild(x)
// del_span.onclick = function() { removeJump(jump._id) }
// li.appendChild(del_span)
// return li
// }
function
showJumps
(
jumps
)
{
let
jumpsList
=
document
.
getElementById
(
'
jumpsList
'
)
let
infoText
=
document
.
getElementById
(
'
infoText
'
)
...
...
This diff is collapsed.
Click to expand it.
V2/page/styles.css
+
6
−
1
View file @
34a185b5
...
...
@@ -20,8 +20,13 @@ h1 {
}
ul
{
list-style-type
:
squar
e
;
list-style-type
:
non
e
;
margin
:
20px
0
20px
0
;
padding
:
0
;
}
li
{
padding
:
10px
0
;
}
input
[
type
=
text
]
{
...
...
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