-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 31-homework-student-feature-pretify-the-prep…
…aration-feed
- Loading branch information
Showing
17 changed files
with
557 additions
and
33 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
server/moodle/blocks/homework/amd/build/map_link_injector.min.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
server/moodle/blocks/homework/amd/build/map_link_injector.min.js.map
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import $ from 'jquery'; | ||
import Ajax from 'core/ajax'; | ||
/** | ||
* Homework/amd/src/filter.js | ||
* | ||
* @package | ||
* @copyright 2024, cs-24-sw-5-13 <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
* | ||
*/ | ||
|
||
export const init = async() => { | ||
let courses; | ||
Ajax.call([{ | ||
methodname: 'block_homework_get_courses', | ||
args: {}, | ||
done: async function(response) { | ||
courses = JSON.parse(response.courses); | ||
for (const course in courses) { | ||
$('#filter').append('<option value="' + courses[course].fullname + '">' + courses[course].fullname + '</option>'); | ||
} | ||
}, | ||
fail: (error) => { | ||
throw new Error(`Failed to find courses: ${error}`); | ||
} | ||
}]); | ||
$('#filter').on('change', () => { | ||
Ajax.call([{ | ||
methodname: 'block_homework_filter_homework', | ||
args: {filter: $('#filter').val()}, | ||
done: async function(response) { | ||
let homeworks = JSON.parse(response.homework); | ||
document.getElementById("outer-box").innerHTML = ""; | ||
homeworks.forEach((homework) => { | ||
console.log(homework); | ||
let box = document.createElement("div"); | ||
box.classList.add("infobox"); | ||
|
||
let h22 = document.createElement("h2"); | ||
h22.innerHTML = `${homework.course}`; | ||
box.appendChild(h22); | ||
|
||
let h2 = document.createElement("h2"); | ||
h2.innerHTML = `${homework.name}`; | ||
box.appendChild(h2); | ||
|
||
let h3 = document.createElement("h3"); | ||
h3.innerHTML = homework.duedate; | ||
box.appendChild(h3); | ||
|
||
let p = document.createElement("p"); | ||
p.innerHTML = `${homework.intro}`; | ||
box.appendChild(p); | ||
|
||
let button = document.createElement("button"); | ||
button.classList.add("Timebutton"); | ||
button.innerHTML = "Time"; | ||
box.appendChild(button); | ||
|
||
document.getElementById("outer-box").appendChild(box); | ||
}); | ||
}, | ||
fail: (error) => { | ||
console.log(error); | ||
throw new Error(`Failed to find filtered homework: ${error}`); | ||
} | ||
}]); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.