Skip to content

Commit

Permalink
Added some improvements in the display of the todo and trading pages (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ecourtial authored Sep 25, 2021
1 parent f15984b commit b34fa3d
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 4 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ todo list, watch list, ranking...

## Changelog

## 3.6.0

* In the todo and to watch screens: separate games with a position from the others.
* In the trading history: games are also separated by month, not only per year.

## 3.5.0

* Platform is now visible in the history screen.
Expand Down
3 changes: 2 additions & 1 deletion V4_FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Front app is no longer included.
* To watch serious and to watch background are merged.
* True REST APIs:
* endpoint are reflecting resources and no longer screens ;
* endpoint are reflecting ressources and no longer screens ;
* using HTTP verbs instead of different endpoints for each action.
* Games are no longer duplicated (one entry per platform). We link them to the platforms instead.
* We can now see if a game is completed or entirely watched. Two new filters: "Finished" and "Not finished".
23 changes: 23 additions & 0 deletions static/js/app/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,29 @@ define(
// Used to filter content from JS injection
filterContent: function(content) {
return $('#extraP').text(content).html()
},

getMonthName: function(monthId) {
var correspondence = {
1: "Janvier",
2: "Février",
3: "Mars",
4: "Avril",
5: "Mai",
6: "Juin",
7: "Juillet",
8: "Août",
9: "Septembre",
10: "Octobre",
11: "Novembre",
12: "Décembre",
};

if (!(monthId in correspondence)) {
return "Mois inconnu";
}

return correspondence[monthId];
}
};
}
Expand Down
23 changes: 23 additions & 0 deletions static/js/pages/games.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,34 @@ define(
$('#contentTitle').html(this.getTitle(data, context));
var that = this;
var content = this.getSubtitle(context);
var count = 0;
var flagged = 0;
var flagFilter = null;

if (context == "to_do") {
flagFilter = "to_do_position";
} else if(context == "to_watch_background" || context == "to_watch_serious") {
flagFilter = "to_watch_position";
}


if (context === "to_do") {
content += "<strong>Avec priorité</strong>";
}

content += '<ul>';

data.games = that.order(data.games, context);

$.each(data.games, function (index, value) {
if (flagFilter != null && (value.meta[flagFilter] == 0 || value.meta[flagFilter] == null) && flagged == 0) {
content += '</ul>';
content += "<strong>Sans priorité</strong>";
content += '<ul>';
flagged = 1;
}

count++;
var gameEntry = tools.filterContent(value.title);
gameEntry = that.getStartIcon(value) + gameEntry;

Expand Down
19 changes: 16 additions & 3 deletions static/js/pages/trading.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,32 @@
$('#contentTitle').html("Historique commercial");
var content = '<p id="subtitle">Jeux vendus ou achetés</p>';
var currentYear = 0;
var currentMonth = 0;
var that = this;

$.each(data.games, function (index, value) {
var gameYear = parseInt(value.year);
var yearString = '<strong>' + gameYear + '</strong>';
var gameMonth = parseInt(value.month);
var yearString = '<strong style="color: yellow;">' + gameYear + '</strong>';

if (currentYear === 0) {
content += yearString + '<ul>';
content += yearString + '<br/>';
currentYear = gameYear;
} else {
if (currentYear != gameYear) {
content += '</ul>' + yearString + '<ul>';
content += '</ul></ul>' + yearString + '<br/>';
currentYear = gameYear;
currentMonth = 0;
}
}

if (currentMonth === 0) {
currentMonth = gameMonth;
content += '<br/>' + tools.getMonthName(currentMonth) + '<ul>';
} else {
if (currentMonth != gameMonth) {
currentMonth = gameMonth;
content += '</ul><br/>' + tools.getMonthName(currentMonth) + '<ul>';
}
}

Expand Down

0 comments on commit b34fa3d

Please sign in to comment.