Skip to content

Commit

Permalink
feat(package/calendar): view lists in the To-Do List module
Browse files Browse the repository at this point in the history
  • Loading branch information
louistiti committed May 19, 2019
1 parent 2041be1 commit 12e8f5c
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 21 deletions.
14 changes: 13 additions & 1 deletion packages/calendar/data/answers/en.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"todolist": {
"list_created": [
"I created the \"%list%\" list."
"Alright, I've created the \"%list%\" list.",
"Done, I created your \"%list%\" list."
],
"list_name_not_provided": [
"Please provide me a list name.",
Expand All @@ -11,6 +12,10 @@
"Please make sure you provide the list name to rename and its new list name.",
"Please provide the list name to rename and its new list name."
],
"no_list": [
"You do not have any list.",
"There is no list to show."
],
"list_does_not_exists": [
"Sorry I can't because the \"%list%\" does not exist.",
"I cannot do that because the \"%list%\" does not exist."
Expand All @@ -24,6 +29,13 @@
"list_deleted": [
"I deleted the \"%list%\" list and all the todos it contained."
],
"list_list": [
"You have %lists_nb% lists. Please let me list them below for you:<br><br><ul>%result%</ul>"
],
"list_list_element": [
"<li>\"%list%\", with %todos_nb% elements in it.</li>",
"<li>\"%list%\", that contains %todos_nb% items.</li>"
],
"todo_added": [
"I added \"%todo%\" to your \"%list%\" list."
],
Expand Down
14 changes: 13 additions & 1 deletion packages/calendar/data/answers/fr.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"todolist": {
"list_created": [
"J'ai créé la liste \"%list%\"."
"Entendu, j'ai créé la liste \"%list%\".",
"C'est fait, j'ai créé votre liste \"%list%\"."
],
"list_name_not_provided": [
"Merci de me fournir un nom de liste.",
Expand All @@ -11,6 +12,10 @@
"Merci de vous assurer d'avoir fourni le nom de la liste à renommer et son nouveau nom.",
"Merci de fournir le nom de la liste à renommer ainsi que son nouveau nom."
],
"no_list": [
"Je n'ai trouvé aucune liste.",
"Il n'y a pas de liste à montrer."
],
"list_does_not_exists": [
"Désolé je ne peux pas car la liste \"%list%\" n'éxiste pas.",
"Je ne peux pas parce que la liste \"%list%\" n'éxiste pas."
Expand All @@ -24,6 +29,13 @@
"list_deleted": [
"J'ai supprimé la liste \"%list%\" et toutes les tâches qu'elle contenait."
],
"list_list": [
"Vous avez %lists_nb% listes. Permettez-moi de vous les lister :<br><br><ul>%result%</ul>"
],
"list_list_element": [
"<li>\"%list%\", avec %todos_nb% éléments.</li>",
"<li>\"%list%\", contenant %todos_nb% éléments.</li>"
],
"todo_added": [
"J'ai ajouté la tâche \"%todo%\" à votre liste \"%list%\"."
],
Expand Down
18 changes: 10 additions & 8 deletions packages/calendar/data/expressions/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@
}
]
},
"view_lists": {
"expressions": [
"Show the lists",
"Show my lists",
"What are the lists?",
"What are my lists?"
]
},
"rename_list": {
"expressions": [
"Rename the list to list",
Expand Down Expand Up @@ -84,23 +92,17 @@
"Delete my list"
]
},
"add_todo": {
"add_todos": {
"expressions": [
"Add to the list",
"Add to my list"
]
},
"complete_todo": {
"complete_todos": {
"expressions": [
"Complete from the list",
"Complete from my list"
]
},
"archive_todo": {
"expressions": [
"Archive from the list",
"Archive from my list"
]
}
}
}
18 changes: 10 additions & 8 deletions packages/calendar/data/expressions/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
"Crée une liste"
]
},
"view_lists": {
"expressions": [
"Montre les listes",
"Montre mes listes",
"Quelles sont les listes ?",
"Quelles sont mes listes ?"
]
},
"rename_list": {
"expressions": [
"Renomme la liste en liste",
Expand All @@ -18,23 +26,17 @@
"Supprime ma liste"
]
},
"add_todo": {
"add_todos": {
"expressions": [
"Ajoute à la liste",
"Ajoute à ma liste"
]
},
"complete_todo": {
"complete_todos": {
"expressions": [
"Complète de la liste",
"Complete de ma liste"
]
},
"archive_todo": {
"expressions": [
"Archive de la liste",
"Archive de ma liste"
]
}
}
}
26 changes: 23 additions & 3 deletions packages/calendar/todolist.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,27 @@ def create_list(string, entities):
def view_lists(string, entities):
"""View to-do lists"""

# TODO
# Lists number
lists_nb = len(lists)

# Verify if a list exists
if lists_nb == 0:
return utils.output('end', 'no_list', utils.translate('no_list'))

result = ''
# Fill end result
for listelement in lists:
result += utils.translate('list_list_element', {
'list': listelement['name'],
'todos_nb': len(listelement['todos'])
})

return utils.output('end', 'list_list', utils.translate('list_list', {
'lists_nb': lists_nb,
'result': result
}
)
)

def rename_list(string, entities):
"""Rename a to-do list"""
Expand Down Expand Up @@ -93,7 +113,7 @@ def delete_list(string, entities):

return utils.output('end', 'list_deleted', utils.translate('list_deleted', { 'list': 'fake' }))

def add_todo(string, entities):
def add_todos(string, entities):
"""WIP"""

return utils.output('end', 'todo_added', utils.translate('todo_added', {
Expand All @@ -106,7 +126,7 @@ def view_todos(string, entities):

# TODO

def complete_todo(string, entities):
def complete_todos(string, entities):
"""WIP"""

# Complete potatoes from my list
Expand Down

0 comments on commit 12e8f5c

Please sign in to comment.