Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Lok committed Oct 17, 2020
1 parent da43dad commit 125153e
Show file tree
Hide file tree
Showing 15 changed files with 872 additions and 24 deletions.
726 changes: 726 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@
"@vue/cli-plugin-eslint": "3.10.0",
"@vue/cli-plugin-unit-mocha": "3.10.0",
"@vue/cli-service": "3.10.0",
"@vue/devtools": "^5.3.3",
"@vue/test-utils": "1.0.0-beta.29",
"babel-eslint": "^10.0.1",
"chai": "^4.2.0",
"electron": "6.0.2",
"electron-devtools-installer": "^3.1.1",
"electron-icon-builder": "1.0.1",
"eslint": "6.1.0",
"eslint-plugin-vue": "5.2.3",
Expand Down
40 changes: 40 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
<template>
<div id="app">
<top-bar></top-bar>
<div v-if="authenticated === true">
<MainPage></MainPage>
<global-keybindings></global-keybindings>
</div>
<div v-else>
<div class = "parent">
<form class="login">
<Input on-enter="submit" type="password" v-model="Password" placeholder="Please Enter Your Password" style="width: 300px"/><br><br>
<Button type="primary" v-on:click="submit">Login</Button>
</form>
</div>
</div>
</div>
</template>

Expand All @@ -17,6 +27,23 @@
name: "backlog",
components: {GlobalKeybindings, TopBar, MainPage},
mixins: [cloudMixin],
data(){
return {
Password: "",
authenticated: false,
}
},
methods:{
submit(){
if(this.Password=="0000"){
this.authenticated = true
}
else{
alert("Wrong!")
location.reload()
}
}
},
created() {
this.$store.dispatch("setupKeyBindings");
this.$store.dispatch("fetchRawBoards");
Expand Down Expand Up @@ -79,4 +106,17 @@
.uppercase {
text-transform: uppercase;
}
.parent{
text-align: center
}
.login{
width: 200px;
height: 100px;
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
margin: auto;
}
</style>
25 changes: 15 additions & 10 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@
import {app, BrowserWindow, Menu, protocol} from 'electron';
import {createProtocol, installVueDevtools} from 'vue-cli-plugin-electron-builder/lib';
import windowRepository from './windowRepository';
import installExtension from 'electron-devtools-installer';
import devtools from '@vue/devtools'



const path = require('path');


require('electron-context-menu')();

const isDevelopment = process.env.NODE_ENV !== 'production';
const isDevelopment = process.env.NODE_ENV !== 'development';

const windowSettings = windowRepository(path.join(app.getPath('userData'), 'window.json'));

Expand All @@ -34,6 +39,8 @@ function createWindow() {
win = new BrowserWindow(windowConfig);
win.userDataPath = path.join(app.getPath('userData'), 'backlog.json');



if (process.platform === 'darwin') {
Menu.setApplicationMenu(createMenuOnMac());
} else {
Expand Down Expand Up @@ -81,23 +88,21 @@ app.on('activate', () => {
}
});


// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', async() => {
if (isDevelopment && !process.env.IS_TEST) {
// Install Vue Devtools
try {
await installVueDevtools();
} catch (e) {
console.error('Vue Devtools failed to install:', e.toString());
}
}
app.on('ready', () => {
installExtension('nhdogjmejiglipccpnnnanhbledajbpd')
.then((name) => console.log(`Added Extension: ${name}`))
.catch((err) => console.log('An error occurred: ', err));
createWindow();

});

// Exit cleanly on request from parent process in development mode.
if (isDevelopment) {
devtools.connect(/* host, port */)
if (process.platform === 'win32') {
process.on('message', data => {
if (data === 'graceful-exit') {
Expand Down
1 change: 1 addition & 0 deletions src/components/board/BoardContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
:key="item.id"
:itemId="item.id"
:isDone="item.isDone"
:isImportant="item.isImportant"
:text="item.text"
:created="item.created"
:ref="item.id"
Expand Down
36 changes: 32 additions & 4 deletions src/components/board/item/ActionButtons.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<template>
<span class="icon-more">
<span class="icon-more" >
<Dropdown @on-click="handleClick" :transfer="true">
<Icon type="ios-more-outline" size="24"/>

<DropdownMenu slot="list" class="dropdown-menu">
<DropdownItem name="moveToTop">
<Icon type="ios-arrow-dropup"/>
Expand All @@ -12,6 +11,14 @@
<Icon type="ios-arrow-dropdown"/>
{{$t("item.move_to_bottom")}}
</DropdownItem>
<DropdownItem name="markImportant">
<Icon type="ios-add" />
{{$t("item.mark_important")}}
</DropdownItem>
<DropdownItem name="markUnimportant">
<Icon type="ios-close" />
{{$t("item.mark_unimportant")}}
</DropdownItem>
<DropdownItem class="delete-btn" name="remove">
<Icon type="ios-trash-outline"/>
{{$t("item.delete")}}
Expand All @@ -24,6 +31,12 @@
<script>
export default {
name: "ActionButtons",
props: ['isImportant'],
data(){
return{
localisImportant: this.isImportant
}
},
methods: {
handleClick(val) {
switch (val) {
Expand All @@ -36,8 +49,22 @@
case "moveToBottom":
this.moveToBottom();
break;
case "markUnimportant":
this.Important = true;
this.changeToFalse();
break;
case "markImportant":
this.Important = false;
this.changeToTure();
break;
}
},
changeToTure(){
this.$emit("changeImportant", true)
},
changeToFalse(){
this.$emit("changeImportant", false)
},
remove() {
this.$emit("remove");
},
Expand All @@ -46,9 +73,10 @@
},
moveToBottom() {
this.$emit("moveToBottom");
}
}
},
},
};
</script>

<style>
Expand Down
15 changes: 13 additions & 2 deletions src/components/board/item/BoardItem.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div :class="{'doneItem': isDone, 'isEditing': isEditing}"
<div :class="{'doneItem': isDone, 'isEditing': isEditing,}"
class="item list-complete-item"
:data-id="itemId"
:data-boardId="boardId"
Expand Down Expand Up @@ -78,6 +78,7 @@
<ActionButtons @remove="removeItem"
@moveToTop="moveItemToTop"
@moveToBottom="moveItemToBottom"
@changeImportant="changeIsImportant"
:boardId="boardId"
>
</ActionButtons>
Expand All @@ -104,7 +105,7 @@
name: 'board-item',
components: {BoardItemCalendar, ActionButtons, EmojiButton, EmojiPicker},
mixins: [keyShortcutMixin],
props: ['boardId', 'itemId', 'isDone', 'text', 'created'],
props: ['boardId', 'itemId', 'isDone', 'text', 'created', 'isImportant'],
data () {
return {
isEditing: false,
Expand Down Expand Up @@ -199,6 +200,16 @@
this.$bus.$emit('focusOnAddItem');
this.$Message.success(this.$t('board.item_removed'));
},
changeIsImportant (newVal) {
this.$store.dispatch('changeIsImportant', {
boardId: this.boardId,
itemId: this.itemId,
newVal
});
this.$store.dispatch('fetchBoardItems', this.boardId);
this.$store.dispatch('fetchBoards');
this.$bus.$emit('focusOnAddItem');
},
moveItemToTop () {
this.$store.dispatch('moveItemToTop', {
boardId: this.boardId,
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
"delete": "Delete",
"enter_something": "Enter something...",
"move_to_bottom": "Move to bottom",
"move_to_top": "Move to top"
"move_to_top": "Move to top",
"mark_important": "Mark important",
"mark_unimportant": "Mark unimportant"
},
"menu": {
"add_new_board": "Add New Board ",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/hr.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
"delete": "Obriši",
"enter_something": "Unesi nešto...",
"move_to_bottom": "Pomakni na dno",
"move_to_top": "Pomakni na vrh"
"move_to_top": "Pomakni na vrh",
"mark_important": "označi kot pomembno",
"mark_unimportant": "označi kot nepomembno"
},
"menu": {
"add_new_board": "Dodaj novu ploču ",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
"delete": "Usuń",
"enter_something": "Wpisz coś...",
"move_to_bottom": "Przesuń na dół",
"move_to_top": "Przesuń na górę"
"move_to_top": "Przesuń na górę",
"mark_important": "zaznacz ważne",
"mark_unimportant": "oznacz nieważne"
},
"menu": {
"add_new_board": "Dodaj Nową Tablicę",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
"delete": "Excluir",
"enter_something": "Digite algo...",
"move_to_bottom": "Mover para baixo",
"move_to_top": "Mover para o topo"
"move_to_top": "Mover para o topo",
"mark_important": "marca importante",
"mark_unimportant": "marca sem importância"
},
"menu": {
"add_new_board": "Adicionar novo board ",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
"delete": "移除",
"enter_something": "写一些东西吧······",
"move_to_bottom": "移至底层",
"move_to_top": "移至顶层"
"move_to_top": "移至顶层",
"mark_important": "标记为重要",
"mark_unimportant": "标记为不重要"
},
"menu": {
"add_new_board": "新建一个页面",
Expand Down
7 changes: 4 additions & 3 deletions src/repositories/boardsRepository.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default {
.find({id: boardId});
const newItem = {
id: shortid.generate(),
isImportant: false,
isDone: false,
created: new Date(),
updated: new Date(),
Expand All @@ -44,16 +45,16 @@ export default {
syncRepository.addToSyncQueue(oldBoardVal, newBoardVal);
return newItem;
},
addItemToEnd(boardId, text, created, isDone) {
addItemToEnd(boardId, text, created, isDone, isImportant) {
const board = db
.get("boards")
.find({id: boardId});
board.assign({"updated": new Date()}).write();

const oldBoardVal = board.cloneDeep().value();
const writeAction = board
.get("items")
.insert({
isImportant: isImportant || false,
isDone: isDone || false,
created: created || new Date(),
updated: new Date(),
Expand Down Expand Up @@ -228,7 +229,7 @@ export default {
db.boards.forEach((board) => {
const newBoardObj = service.addNewBoard(board.label, {prependNewItems: board.prependNewItem});
board.items.forEach((item) => {
service.addItemToEnd(newBoardObj.id, item.text, item.created, item.isDone);
service.addItemToEnd(newBoardObj.id, item.text, item.created, item.isDone, item.isImportant);
});
});
resolve();
Expand Down
21 changes: 21 additions & 0 deletions src/repositories/itemsRepository.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,27 @@ export default {

return res;
},
switchIsImportant(boardId, itemId, value) {
const board = db
.get("boards")
.find({id: boardId});

board.assign({"updated": new Date()}).write();
const oldBoardVal = board.cloneDeep().value();

const res = board
.get("items")
.find({id: itemId})
.assign({
isImportant: value,
updated: new Date()
})
.write();
const newBoardVal = board.cloneDeep().value();
syncRepository.addToSyncQueue(oldBoardVal, newBoardVal);

return res;
},
switchPrependNewItem(boardId, value) {
const board = db
.get("boards")
Expand Down
3 changes: 3 additions & 0 deletions src/store/modules/boards.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ const actions = {
changeIsDone(context, {boardId, itemId, newVal}) {
itemsRepository.switchIsDone(boardId, itemId, newVal);
},
changeIsImportant(context, {boardId, itemId, newVal}) {
itemsRepository.switchIsImportant(boardId, itemId, newVal);
},
changeItemVal(context, {boardId, itemId, newVal}) {
itemsRepository.changeItemValue(boardId, itemId, newVal);
},
Expand Down

0 comments on commit 125153e

Please sign in to comment.