Permalink
Browse files

Merge pull request #93 from edchat/removeglobals

update ViewAllItemsByDate to use mvc/WidgetList instead of mvc/Replace, ...
  • Loading branch information...
2 parents 88ecbd6 + 516d0ee commit b358d8160982276914bec6c902691c0531b1f970 @edchat committed Jul 2, 2012
View
@@ -32,6 +32,7 @@
"dojox/app/utils/mvcModel",
"dojox/mvc/EditStoreRefListController",
"dojox/mvc/Repeat",
+ "dojox/mvc/WidgetList",
"dojox/mvc/Group",
"dojox/mvc/Output",
"dojox/mvc/at"
View
@@ -32,6 +32,7 @@
"dojox/app/utils/mvcModel",
"dojox/mvc/EditStoreRefListController",
"dojox/mvc/Repeat",
+ "dojox/mvc/WidgetList",
"dojox/mvc/Group",
"dojox/mvc/Output",
"dojox/mvc/at"
@@ -26,7 +26,7 @@
"due": null,
"completionDate": "",
"reminderOnAday": "on",
- "reminderDate": "2012-05-20",
+ "reminderDate": "2012-06-20",
"reminderOnAlocation": "off",
"reminderLocation": null,
"repeat": 0,
@@ -43,7 +43,7 @@
"due": null,
"completionDate": "",
"reminderOnAday": "on",
- "reminderDate": "2012-06-01",
+ "reminderDate": "2013-08-01",
"reminderOnAlocation": "off",
"reminderLocation": null,
"repeat": 0,
@@ -60,7 +60,7 @@
"due": null,
"completionDate": "",
"reminderOnAday": "on",
- "reminderDate": "2012-07-01",
+ "reminderDate": "2012-08-27",
"reminderOnAlocation": "off",
"reminderLocation": null,
"repeat": 0,
@@ -26,7 +26,7 @@
"due": null,
"completionDate": "",
"reminderOnAday": "on",
- "reminderDate": "2012-05-20",
+ "reminderDate": "2012-06-20",
"reminderOnAlocation": "off",
"reminderLocation": null,
"repeat": 0,
@@ -43,7 +43,7 @@
"due": null,
"completionDate": "",
"reminderOnAday": "on",
- "reminderDate": "2012-06-01",
+ "reminderDate": "2013-08-01",
"reminderOnAlocation": "off",
"reminderLocation": null,
"repeat": 0,
@@ -60,7 +60,7 @@
"due": null,
"completionDate": "",
"reminderOnAday": "on",
- "reminderDate": "2012-07-01",
+ "reminderDate": "2012-08-27",
"reminderOnAlocation": "off",
"reminderLocation": null,
"repeat": 0,
@@ -3,23 +3,28 @@
<div id="datewrapper">
<div data-dojo-type="dojox/app/widgets/Container" region="center" data-dojo-props="scrollable: true">
<h2 data-dojo-type="dojox/mobile/RoundRectCategory" region="top">All items by date</h2>
- <ul data-dojo-type="dojox/mobile/RoundRectList" id="itemsDate_list"
- data-dojo-mixins="dojox/mvc/Repeat"
- data-dojo-props="exprchar:'#'">
- <li data-dojo-type="dojox/mobile/ListItem" class="mblVariableHeight"
- data-dojo-props="clickable: true, onClick: function(){showItemDetails('#{this.index}');},
- transitionOptions: {title:'Detail', target:'details,EditTodoItem',url: '#details,EditTodoItem'}">
+ <ul id="itemsDate_list"
+ data-dojo-type="dojox/mobile/RoundRectList"
+ data-dojo-mixins="dojox/mvc/WidgetList,dojox/mvc/_InlineTemplateMixin"
+ data-mvc-child-type="dojox/mvc/Templated"
+ data-mvc-child-mixins="dojox/mobile/ListItem"
+ data-mvc-child-props="clickable: true,
+ transitionOptions: {title:'Detail', target:'details,EditTodoItem',url: '#details,EditTodoItem'},
+ onClick: function(){showItemDetails(this.indexAtStartup);}">
+ <script type="dojox/mvc/InlineTemplate">
+ <li class="mblVariableHeight">
<div preventTouch="true" class="lineItemPreventTouch"></div>
<input type="checkbox"
data-dojo-type="dojox/mobile/CheckBox"
- data-dojo-props="preventTouch: true, checked: at('rel:#{this.index}','completed')"/>
- <div data-dojo-type="dojox/mvc/Output" style="display: inline"
- data-dojo-props="value: at('rel:#{this.index}','title')"></div>
- <div data-dojo-type="dojox/mvc/Output" class="dateLabel"
- data-dojo-props="value: at('rel:#{this.index}','reminderDate'),
- class: at('rel:#{this.index}','reminderDate').direction(at.from).transform(dateListClassTransform)"></div>
+ data-dojo-props="preventTouch: true, checked: at('rel:', 'completed')"/>
+ <div data-dojo-type="dojox/mvc/Output" style="display: inline"
+ data-dojo-props="value: at('rel:','title')"></div>
+ <div data-dojo-type="dojox/mvc/Output" class="dateLabel"
+ data-dojo-props="value: at('rel:','reminderDate'),
+ class: at('rel:','reminderDate').direction(at.from).transform(dateListClassTransform)"></div>
</li>
- </ul>
+ </script>
+ </ul>
</div>
</div>
</div>
@@ -1,7 +1,8 @@
define(["dojo/dom","dojo/_base/lang", "dojo/dom-style", "dojo/when", "dijit/registry", "dojox/mvc/at",
"dojox/mvc/EditStoreRefListController", "dojox/mvc/getStateful",
+ "dojox/mvc/WidgetList", "dojox/mvc/Templated", "dojox/mvc/_InlineTemplateMixin",
"dojo/data/ItemFileWriteStore", "dojo/store/DataStore", "dojo/date/stamp"],
-function(dom, lang, domStyle, when, registry, at, EditStoreRefListController, getStateful, ItemFileWriteStore, DataStore, stamp){
+function(dom, lang, domStyle, when, registry, at, EditStoreRefListController, getStateful, WidgetList, Templated, _InlineTemplateMixin, ItemFileWriteStore, DataStore, stamp){
showItemDetails = function(index){
// summary:
@@ -82,7 +83,7 @@ function(dom, lang, domStyle, when, registry, at, EditStoreRefListController, ge
beforeDeactivate: function(){
// summary:
// view life cycle beforeDeactivate()
- if(!this.app._addNewItemCommit){
+ if(!this.app._addNewItemCommit && this.app.currentItemListModel){
this.app.currentItemListModel.commit(); //commit mark item as Complete change
}
this.app._addNewItemCommit = false;
@@ -131,8 +132,11 @@ function(dom, lang, domStyle, when, registry, at, EditStoreRefListController, ge
}
}
}
- var writestore = this.app.stores.allitemlistStore.store
- var listCtl = new EditStoreRefListController({store: new DataStore({store: writestore}), cursorIndex: 0});
+ var listCtl = this.app.currentItemListModel;
+ if(!listCtl){
+ var writestore = this.app.stores.allitemlistStore.store
+ listCtl = new EditStoreRefListController({store: new DataStore({store: writestore}), cursorIndex: 0});
+ }
when(listCtl.queryStore(query,options), lang.hitch(this, function(datamodel){
this.app.currentItemListModel = listCtl;
showListData(listCtl);
@@ -71,7 +71,7 @@ function(dom, lang, domStyle, when, registry, at, EditStoreRefListController, ge
beforeDeactivate: function(){
// summary:
// view life cycle beforeDeactivate()
- if(!this.app._addNewItemCommit){
+ if(!this.app._addNewItemCommit && this.app.currentItemListModel){
this.app.currentItemListModel.commit(); //commit mark item as Complete change
}
this.app._addNewItemCommit = false;
@@ -128,8 +128,11 @@ function(dom, lang, domStyle, when, registry, at, EditStoreRefListController, ge
}
this.loadedModels.listsmodel.model[this.app.selected_configuration_item].set("Checked", true);
}
- var writestore = this.app.stores.allitemlistStore.store;
- var listCtl = new EditStoreRefListController({store: new DataStore({store: writestore}), cursorIndex: 0});
+ var listCtl = this.app.currentItemListModel;
+ if(!listCtl){
+ var writestore = this.app.stores.allitemlistStore.store;
+ listCtl = new EditStoreRefListController({store: new DataStore({store: writestore}), cursorIndex: 0});
+ }
when(listCtl.queryStore(query,options), lang.hitch(this, function(datamodel){
this.app.currentItemListModel = listCtl;
showListData(listCtl);

0 comments on commit b358d81

Please sign in to comment.