From e72bb62410f2171eabce86872e6ae907368b90a3 Mon Sep 17 00:00:00 2001 From: xiweicheng Date: Sun, 1 Apr 2018 10:58:20 +0800 Subject: [PATCH] todo desc --- index.html | 2 +- src/environment.js | 4 +-- .../elements/em-chat-content-item.less | 31 +++++++++++++---- .../elements/em-chat-sidebar-right.js | 2 +- src/resources/elements/em-chat-todo.html | 12 +++++++ src/resources/elements/em-chat-todo.js | 33 +++++++++++++++++-- src/resources/elements/em-chat-todo.less | 28 ++++++++++++++-- src/resources/elements/em-chat-top-menu.html | 4 +-- 8 files changed, 99 insertions(+), 17 deletions(-) diff --git a/index.html b/index.html index 0f074f4..1dd3448 100644 --- a/index.html +++ b/index.html @@ -17,7 +17,7 @@ - + diff --git a/src/environment.js b/src/environment.js index da32a4b..3495e9a 100644 --- a/src/environment.js +++ b/src/environment.js @@ -1,4 +1,4 @@ export default { - debug: false, - testing: false + debug: true, + testing: true }; diff --git a/src/resources/elements/em-chat-content-item.less b/src/resources/elements/em-chat-content-item.less index 8b057d7..c806adb 100644 --- a/src/resources/elements/em-chat-content-item.less +++ b/src/resources/elements/em-chat-content-item.less @@ -13,11 +13,11 @@ margin-left: 3em; } .actions { - > a { + >a { margin-right: 5px; } .dropdown { - > a .ellipsis.icon { + >a .ellipsis.icon { margin-right: 0; } .item.tms-red { @@ -87,13 +87,30 @@ transition-timing-function: ease-out; } } - > .content { - > .metadata > .rating { + >.content { + textarea.tms-edit-textarea { + box-sizing: border-box; + // background-color: transparent; + padding: 8px; // margin: 0; + // -webkit-appearance: none; + // tap-highlight-color: rgba(255, 255, 255, 0); + // padding: .78571429em 1em; + // background: #fff; + border: 1px solid rgba(34, 36, 38, .15); + outline: 0; // color: rgba(0, 0, 0, .87); + border-radius: .28571429rem; + box-shadow: 0 0 0 0 transparent inset; // -webkit-transition: color .1s ease, border-color .1s ease; + // transition: color .1s ease, border-color .1s ease; + // font-size: 1em; + // line-height: 1.2857; + // resize: vertical; + } + >.metadata>.rating { @media only screen and (max-width: 767px) { display: none!important; } } - > .markdown-body { + >.markdown-body { span.at-user { cursor: pointer; } @@ -104,12 +121,12 @@ } } } - > .tools { + >.tools { position: absolute; right: 0; bottom: 0; display: none; - > .ui.button { + >.ui.button { margin: 0; background-color: rgba(224, 225, 226, 0.5); &:hover { diff --git a/src/resources/elements/em-chat-sidebar-right.js b/src/resources/elements/em-chat-sidebar-right.js index ff5df86..35022f5 100644 --- a/src/resources/elements/em-chat-sidebar-right.js +++ b/src/resources/elements/em-chat-sidebar-right.js @@ -16,7 +16,7 @@ export class EmChatSidebarRight { [nsCons.ACTION_TYPE_SEARCH]: { nodata: '无符合检索结果', show: 'msg', icon: 'search', title: '检索结果' }, [nsCons.ACTION_TYPE_PIN]: { nodata: '暂无频道固定消息', show: 'msg', icon: 'pin', title: '频道固定消息' }, [nsCons.ACTION_TYPE_TOPIC]: { nodata: '', show: 'topic', icon: 'talk outline', title: '话题讨论' }, - [nsCons.ACTION_TYPE_TODO]: { handler: this.todoHandler, nodata: '暂无待办事项', show: 'todo', icon: 'ordered list', title: '待办事项' }, + [nsCons.ACTION_TYPE_TODO]: { handler: this.todoHandler, nodata: '暂无待办事项', show: 'todo', icon: 'list', title: '待办事项' }, } /** diff --git a/src/resources/elements/em-chat-todo.html b/src/resources/elements/em-chat-todo.html index c82a093..4611fac 100644 --- a/src/resources/elements/em-chat-todo.html +++ b/src/resources/elements/em-chat-todo.html @@ -23,6 +23,7 @@ +
${item.title}
@@ -30,6 +31,11 @@ +
+
+ +
+
@@ -49,6 +55,7 @@ +
${item.title}
@@ -56,6 +63,11 @@ +
+
+ +
+
diff --git a/src/resources/elements/em-chat-todo.js b/src/resources/elements/em-chat-todo.js index 9f11005..fdfde77 100644 --- a/src/resources/elements/em-chat-todo.js +++ b/src/resources/elements/em-chat-todo.js @@ -99,18 +99,47 @@ export class EmChatTodo { _.defer(() => $(inputRef).focus()); } + editContentHandler(item, textareaRef) { + item.isOpen = !item.isOpen; + if (item.isOpen) { + item.oldContent = item.content; + _.defer(() => { + $(textareaRef).focus() + if (item.content) { + autosize.update(textareaRef); + } + }); + } + } + updateHandler(item) { item.isEditing = false; if (!_.trim(item.title) || item.title == item.oldTitle) { - item.title = item.oldTitle + item.title = item.oldTitle return; } $.post('/admin/todo/update', { id: item.id, title: item.title }, (data, textStatus, xhr) => { - if (data.success) {} else { + if (data.success) { + toastr.success('更新待办事项内容成功!'); + } else { item.title = item.oldTitle; toastr.error(data.data, '更新待办事项失败!'); } }); } + updateDescHandler(item) { + if (item.content == item.oldContent) { + return; + } + $.post('/admin/todo/update', { id: item.id, content: item.content }, (data, textStatus, xhr) => { + if (data.success) { + toastr.success('更新待办事项描述成功!'); + } else { + item.content = item.oldContent; + toastr.error(data.data, '更新待办事项失败!'); + } + }); + } + } diff --git a/src/resources/elements/em-chat-todo.less b/src/resources/elements/em-chat-todo.less index e9e1c50..a3eab51 100644 --- a/src/resources/elements/em-chat-todo.less +++ b/src/resources/elements/em-chat-todo.less @@ -5,8 +5,7 @@ text-overflow: ellipsis; overflow: hidden; max-width: 300px; - min-width: 300px; - // width: 300px; + min-width: 300px; // width: 300px; white-space: nowrap; &.red { color: red; @@ -26,6 +25,31 @@ display: inline-block; } } + >.ui.form { + // transition: all 0.15s ease-out 0s; + textarea { + box-sizing: border-box; + background-color: transparent; + } + } + i.icon { + &.square { + padding-right: 6px; + } + &.checkmark { + padding-right: 3px; + } + } + i.angle.icon { + // padding-left: .28571429em; + padding-left: 4px; + padding-right: 4px; + padding-top: 3px; + &.down { + padding-left: 2px; + padding-right: 2px; + } + } } } } diff --git a/src/resources/elements/em-chat-top-menu.html b/src/resources/elements/em-chat-top-menu.html index 2228f5b..24d8ce7 100644 --- a/src/resources/elements/em-chat-top-menu.html +++ b/src/resources/elements/em-chat-top-menu.html @@ -109,7 +109,7 @@
@@ -151,7 +151,7 @@
-- Gitee