From 7316f8c67e036d476a4396a5bac4f14fe6254031 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Sun, 11 Mar 2012 15:04:46 -0400 Subject: [PATCH] Reverted input field back to richtext because of line wrapping issues Added priority, project, and context selection to the edit view Fixed replace flag when closing popups to avoid race conditions --- app/source/TodoEdit.js | 82 ++++++++++++++++++++++++++++++++++++++++-- app/source/TodoList.js | 42 ++++++++++++++++++++++ app/source/TodoTxt.js | 2 ++ 3 files changed, 123 insertions(+), 3 deletions(-) diff --git a/app/source/TodoEdit.js b/app/source/TodoEdit.js index 3a25ed6..fe09bde 100644 --- a/app/source/TodoEdit.js +++ b/app/source/TodoEdit.js @@ -22,9 +22,28 @@ enyo.kind({ "onSave": "" }, components: [ - + {name: "insertPopup", kind: "ModalDialog", dismissWithClick: true, + components: [ + {name: "projects", kind: "RowGroup", caption: "Projects"}, + {name: "contexts", kind: "RowGroup", caption: "Contexts"}, + {kind: "Button", caption: "Dismiss", onclick: "closePopup"} + ]}, + {name: "filterToolbar", kind: "Toolbar", pack: "justify", className: "enyo-toolbar-light", + components: [ + {kind: "RadioGroup", name: "priGroup", + onChange: "setPriority", components: [ + {caption: "-", value: "-"}, + {caption: "A", value: "A"}, + {caption: "B", value: "B"}, + {caption: "C", value: "C"}, + {caption: "D", value: "D"}, + {caption: "E", value: "E"} + ]}, + {kind: "Button", caption: "+", onclick: "showInsert"} + ] + }, {flex: 1, kind: "Scroller", components: [ - {kind: "Input", name: "tododetail"}, + {kind: "RichText", name: "tododetail", richContent: false}, ]}, {name: "editToolbar", kind: "Toolbar", pack: "justify", className: "enyo-toolbar-light", components: [ @@ -35,6 +54,63 @@ enyo.kind({ ] } - ] + ], + + setPriority: function(inSender) { + var pri = inSender.getValue(); + var val = this.$.tododetail.getValue(); + val = val.replace(/^\([A-E]\)\s/,"") + if (pri.match(/[A-E]/)) { + this.$.tododetail.setValue( + "(" + pri + ") " + val); + } else { + this.$.tododetail.setValue( val ); + } + }, + + showInsert: function() { + this.$.insertPopup.openAtCenter(); + this.projectList = this.owner.$.listView.getProjectList(); + for (i=0; i