Skip to content

Commit

Permalink
Updated styles. Rewrited js on classes and imorts
Browse files Browse the repository at this point in the history
  • Loading branch information
KikyTokamuro committed Jul 30, 2022
1 parent 312f988 commit 3f326dd
Show file tree
Hide file tree
Showing 8 changed files with 402 additions and 310 deletions.
2 changes: 1 addition & 1 deletion index.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@
(:div :class "separator")
(:div :class "send-task-button"
(:img :src "./static/images/send.svg"))))
(:script :src "./static/script.js")))))
(:script :type "module" :src "./static/app.js")))))
Binary file modified preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
92 changes: 92 additions & 0 deletions static/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/**
* API methods
*/
export class TodolistAPI {
constructor () {}

/**
* Get list of all groups
*
* @returns jqXHR
*/
getGroupsList () {
return $.get('/api/group/list', {}, 'json');
}

/**
* Delete group by name
*
* @param {string} group
* @returns jqXHR
*/
deleteGroup (group) {
return $.get('/api/group/delete', {
group: group
}, 'json');
}

/**
* Get all todos
*
* @returns jqXHR
*/
getAllTodos () {
return $.get('/api/todos/all', {}, 'json');
}

/**
* Get todos by group name
*
* @param {string} group
* @returns jqXHR
*/
getTodosByGroup (group) {
return $.get('/api/todos', {
group: group
}, 'json');
}

/**
* Change todo status
*
* @param {string} group
* @param {number} id
* @param {string} status
* @returns jqXHR
*/
changeTodoStatus (group, id, status) {
return $.get('/api/todos/status/change', {
group: group,
todoid: id,
status: status
}, 'json');
};

/**
* Create new todo in group
*
* @param {string} group
* @param {string} text
* @returns jqXHR
*/
createNewTodo (group, text) {
return $.get('/api/todos/add', {
group: group,
text: text,
}, 'json');
};

/**
* Delete todo item
*
* @param {string} group
* @param {number} todoid
* @returns jqXHR
*/
deleteTodo (group, todoid) {
return $.get('/api/todos/delete', {
group: group,
todoid: todoid,
}, 'json');
}
}
6 changes: 6 additions & 0 deletions static/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { TodolistAPI } from "./api.js";
import { TodolistUI } from "./ui.js";

const api = new TodolistAPI();
const ui = new TodolistUI(api);
ui.init();
278 changes: 0 additions & 278 deletions static/script.js

This file was deleted.

Loading

0 comments on commit 3f326dd

Please sign in to comment.