-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do 19 - list should be displayed based on object array #15
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,12 +25,65 @@ let upcoming = [{ | |
title: "Lorem3", | ||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit." | ||
}] | ||
|
||
let project1 = [{ | ||
id: 10, | ||
title: "Lorem1", | ||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit." | ||
}, { | ||
id: 12, | ||
title: "Lorem2", | ||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit." | ||
}, { | ||
id: 11, | ||
title: "Lorem3", | ||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit." | ||
}] | ||
|
||
let project2 = [{ | ||
id: 13, | ||
title: "Lorem1", | ||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit." | ||
}, { | ||
id: 15, | ||
title: "Lorem2", | ||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit." | ||
}, { | ||
id: 14, | ||
title: "Lorem3", | ||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit." | ||
}] | ||
|
||
let project3 = [{ | ||
id: 16, | ||
title: "Lorem1", | ||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit." | ||
}, { | ||
id: 18, | ||
title: "Lorem2", | ||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit." | ||
}, { | ||
id: 17, | ||
title: "Lorem3", | ||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit." | ||
}] | ||
|
||
|
||
let projectList = { | ||
"today": today, | ||
"upcoming": upcoming | ||
"upcoming": upcoming, | ||
"project1": project1, | ||
"project2": project2, | ||
"project3": project3 | ||
} | ||
|
||
let currentView; | ||
let projectList1 = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are there 2 lists projectList and projectList1? |
||
"project1": project1, | ||
"project2": project2, | ||
"project3": project3 | ||
} | ||
|
||
let currentView; | ||
|
||
|
||
function removeTask(id) { | ||
|
@@ -84,6 +137,25 @@ function showProject(listId) { | |
} | ||
|
||
|
||
function showProjectList() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Projects list that need to be displayed should be passed in the function argument. |
||
projectListArray = Object.keys(projectList1); | ||
let projects = ""; | ||
for (let i = 0; i < projectListArray.length; i++) { | ||
projects +="<li class='list-unstyled px-3'>" + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Variable projects should better be named projectsHtml. |
||
"<div class='d-flex justify-content-center align-items-center'>" + | ||
"<a href='#' class='list-group-item list-group-item-action' id='"+projectListArray[i]+"'onclick=''>"+ projectListArray[i]+"</a>" + | ||
"<div class='dropdown'>" + | ||
"<button class='btn dropdown-toggle' type='button' id='dropdownMenuButton1' data-bs-toggle='dropdown' aria-expanded='false'></button>"+ | ||
"</div>" + | ||
"</div>" + | ||
"</li>"; | ||
} | ||
document.getElementById("projects").innerHTML = projects; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,7 +100,7 @@ | |
<!-- Navigation Bar --> | ||
<div class="row"> | ||
<div class="col-3 collapse collapse-horizontal show" id="side-bar"> | ||
<nav> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why it has been changed from nav to div? |
||
<div> | ||
<ul class="list-group pt-4"> | ||
<a href="#" class="list-group-item list-group-item-action"> | ||
<li class="d-flex justify-content-between align-items-center"> | ||
|
@@ -118,7 +118,8 @@ | |
</li> | ||
</a> | ||
|
||
<a href="#" class="list-group-item list-group-item-action" onclick="showProject('today')"> | ||
<a href="#" class="list-group-item list-group-item-action" | ||
onclick="showProject('today')"> | ||
<li class="d-flex justify-content-between align-items-center"> | ||
<div> | ||
<span> | ||
|
@@ -137,7 +138,8 @@ | |
</li> | ||
</a> | ||
|
||
<a href="#" class="list-group-item list-group-item-action" onclick="showProject('upcoming')"> | ||
<a href="#" class="list-group-item list-group-item-action" | ||
onclick="showProject('upcoming')"> | ||
<li class="d-flex justify-content-between align-items-center"> | ||
<div> | ||
<span> | ||
|
@@ -171,9 +173,27 @@ | |
</li> | ||
</a> | ||
</ul> | ||
</nav> | ||
</div> | ||
</div> | ||
|
||
<!-- starting of project list --> | ||
<div class="pt-4"> | ||
<div class="d-flex"> | ||
<button class="btn btn-light flex-grow-1 d-flex justify-content-between align-items-center" onclick="showProjectList()">Projects <span> | ||
<svg data-bs-toggle="modal" data-bs-target="#addProjectModal" xmlns="http://www.w3.org/2000/svg" width="20" height="20" | ||
fill="currentColor" class="bi bi-plus-lg" viewBox="0 0 16 16"> | ||
<path fill-rule="evenodd" | ||
d="M8 2a.5.5 0 0 1 .5.5v5h5a.5.5 0 0 1 0 1h-5v5a.5.5 0 0 1-1 0v-5h-5a.5.5 0 0 1 0-1h5v-5A.5.5 0 0 1 8 2Z" /> | ||
</svg> | ||
</span></button> | ||
</div> | ||
|
||
<div id="projects"> | ||
|
||
</div> | ||
|
||
</div> | ||
<!-- ending of project list --> | ||
</div> | ||
|
||
<div class="col align-center px-5 py-4"> | ||
<h4>Today</h4> | ||
|
@@ -265,8 +285,10 @@ <h5 class="modal-title" id="exampleModalLabel">Add Task</h5> | |
</div> | ||
|
||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-light" data-bs-dismiss="modal" | ||
aria-label="Close">Cancel</button> | ||
<button type="submit" class="btn btn-primary"> | ||
Add | ||
Add task | ||
</button> | ||
</div> | ||
</div> | ||
|
@@ -299,6 +321,37 @@ <h5 class="modal-title" id="exampleModalLabel">Add Task</h5> | |
</div> | ||
</div> | ||
|
||
<!-- Add New Project Modal --> | ||
<section> | ||
<div class="modal fade" id="addProjectModal" tabindex="-1" aria-labelledby="addProjectModal" | ||
aria-hidden="true"> | ||
<div class="modal-dialog"> | ||
<div class="modal-content"> | ||
|
||
<div class="modal-header"> | ||
<h5 class="modal-title" id="exampleModalLabel">Add Project</h5> | ||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> | ||
</div> | ||
|
||
<div class="modal-body"> | ||
<div class="mb-3"> | ||
<label for="project-name" class="col-form-label">Name</label> | ||
<input id="name" type="text" class="form-control" name="project-name"> | ||
</div> | ||
</div> | ||
|
||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-light" data-bs-dismiss="modal" | ||
aria-label="Close">Cancel</button> | ||
<button type="submit" class="btn btn-primary"> | ||
Add | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
|
||
</main> | ||
|
||
<!-- Custom Js --> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doest project1 contain tasks? What this list depicts?