Please read this section at least one day prior to the seminar. This section outlines what you are expected to know, be able to do, or prepare in advance. Following these instructions will help you get the most out of the seminar and ensure smooth participation.
Before the start of the practical, you should be able to:
This slide applies to you only if you plan to use your own computer for the practical.
Before the start of the practical, make sure that:
The basics are simple ...
class Model {
constructor(name) {
// We use `this` to set properties.
this.name = name;
}
method() {
// We use `this` to access this class instance.
console.log(">", this.name);
}
}
const m = new Model("Joe");
m.method();
All member properties must be assigned in the constructor. All methods and properties are public by default. We do not need anything else - KISS (keep it simple, stupid).
The objective is to take the application from the last practical and apply MVP design pattern. We also add support for "clear filters" and "list ordering" to make it interesting.
If you do not have the solution from last exercise, you can use this partial solution. The solution is missing the synchronization with URL using location and history API.
Continue to the next slide once you are done.
There are many flavors to Model-View-Presenter. For this exercise, we use Model-View-Presenter with passive view.
Model expose all data related methods.
View expose methods to update the user interface and to bind to user events.
Presenter has to be able to take View and a Model and connect them together.
Continue to the next slide once you are done.
Continue to the next slide once you are done.
Add a button that will clear all filters.
Continue to the next slide once you are done.
Add a combobox which user can use to select item ordering. Following orderings has to be available:
Default value is Label descending.
The sort direction has to be stored in the URL and its changes has to be recorded in history. When the default ordering is selected, the URL should not contain any information about the ordering.
Continue to the next slide once you are done.
In order to get the bonus point, you need to finish the application. Once the application is ready, upload the file content to the file ~/public_html/product-list-mvp.html at webik.ms.mff.cuni.cz. Yes, you are expected to put all into a single file.
While the bonus assignment is optional, we strongly recommend to implement it as we will use the result in the next practical.
Congratulations, if you have followed the instructions, you have just reached the end of this exercise.