-
Notifications
You must be signed in to change notification settings - Fork 84
Development #12
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
base: master
Are you sure you want to change the base?
Development #12
Conversation
flash42
left a comment
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.
I left a couple of comments inline. The only structure problem I could see (was not checking user facing things) is the one regarding the way you put half-baked elements in the dom and later make lookups to add event listeners to them.
| SELECT id, board_id, title, status_id, card_order FROM card; | ||
| """) | ||
|
|
||
| cards = cursor.fetchall() |
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.
Useless variable definition
|
|
||
| def get_boards(force=False): | ||
| return _get_data('boards', BOARDS_FILE, force) | ||
| cards = cursor.fetchall() |
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.
Useless variable definition
| """) | ||
|
|
||
| cards = cursor.fetchall() | ||
| print(cards) |
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.
printing in production code?
| getCardsByBoardId: function (boardId, callback) { | ||
| // the cards are retrieved and then the callback function is called with the cards | ||
|
|
||
| this._api_get(`/get-cards/${boardId}`, (response) => { |
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.
(response) => {} => response => {} // No need for () for a single parameter lambda.
| boardContainer.textContent = ''; | ||
| for (const board of boards) { | ||
| const template = document.querySelector('#board-template'); | ||
| const clone = document.importNode(template.content, true); |
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.
What is clone - doesn't tell me what it is. Maybe newBoard, or something it really is.
static/js/dom.js
Outdated
| ${boardList} | ||
| </ul> | ||
| `; | ||
| for (let card of cards) { |
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.
Sometimes there is const, here it is let in the for-each loop. Please use it consistently. Const is preferred over let, if you don't want (here you don't) to overwrite it.
| } | ||
| }, | ||
| addNewBoard: function () { | ||
| let addBoardButton = document.querySelector("#add-new-board-btn"); |
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.
You can use const
| }) | ||
| }, | ||
| showNewBoard: function (response) { | ||
| let boardContainer = document.querySelector('.board-container'); |
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.
You can use const
| loadCards: function (boardId) { | ||
| // retrieves cards and makes showCards called | ||
| addNewCard: function (boardId) { | ||
| let addNewCardButtons = document.querySelectorAll(".board-add"); |
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.
o_O This is hard to follow form the code. Why we need to look up these addNewCardButtons? More interesting question is why do we have board-add class on them? Can we not create the button with the proper event listener before we add it to the dom?
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.
Ask if something is not clear :)
|
|
||
| if (parseInt(response.board_id) === parseInt(column.dataset.boardId) && | ||
| parseInt(response.status_id) === parseInt(column.id)) { | ||
| const template = document.querySelector('#cards-template'); |
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.
There is a lot of string literals scattered across the code. Can you please extract them to methods?
e.g.:
const template = document.querySelector('#cards-template') =>
getCardsTemplate(): function() {
return document.querySelector('#cards-template').content;
}
const newCard = document.importNode(getCardsTemplate(), true);
…ing to input field with original title is ok
…. but with DOM manip., it works perfectly
…board, it gets displayed immediately at the end of the bpards instead of staying where it is. however, renamed board's new name appears also immediately.
No description provided.