Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

It has to be written jQuery Mobile not jQueryMobile in comments

  • Loading branch information...
commit 60cab247cffc9486de85f4e3f1263b8363d81d26 1 parent c586370
@tekool authored
Showing with 133 additions and 134 deletions.
  1. +1 −1  README.textile
  2. +22 −22 bin/puremvc_employeeadmin_jquerymobile-min.js
  3. +66 −64 bin/puremvc_employeeadmin_jquerymobile.js
  4. +1 −1  build/build.xml
  5. +5 −5 debug.html
  6. +5 −5 index.html
  7. +1 −1  license.txt
  8. +1 −1  src/org/puremvc/js/demos/objs/employeeadmin/ApplicationFacade.js
  9. +1 −1  src/org/puremvc/js/demos/objs/employeeadmin/abc/MediatorNames.js
  10. +1 −1  src/org/puremvc/js/demos/objs/employeeadmin/abc/NotificationNames.js
  11. +1 −1  src/org/puremvc/js/demos/objs/employeeadmin/abc/ProxyNames.js
  12. +1 −1  src/org/puremvc/js/demos/objs/employeeadmin/controller/DeleteUserCommand.js
  13. +1 −1  src/org/puremvc/js/demos/objs/employeeadmin/controller/PrepModelCommand.js
  14. +1 −1  src/org/puremvc/js/demos/objs/employeeadmin/controller/PrepViewCommand.js
  15. +1 −1  src/org/puremvc/js/demos/objs/employeeadmin/controller/StartupCommand.js
  16. +1 −1  src/org/puremvc/js/demos/objs/employeeadmin/model/RoleProxy.js
  17. +1 −1  src/org/puremvc/js/demos/objs/employeeadmin/model/UserProxy.js
  18. +1 −1  src/org/puremvc/js/demos/objs/employeeadmin/model/enum/DeptEnum.js
  19. +1 −1  src/org/puremvc/js/demos/objs/employeeadmin/model/enum/RoleEnum.js
  20. +1 −1  src/org/puremvc/js/demos/objs/employeeadmin/model/vo/RoleVO.js
  21. +1 −1  src/org/puremvc/js/demos/objs/employeeadmin/model/vo/UserVO.js
  22. +2 −2 src/org/puremvc/js/demos/objs/employeeadmin/view/UserFormMediator.js
  23. +1 −1  src/org/puremvc/js/demos/objs/employeeadmin/view/UserListMediator.js
  24. +1 −1  src/org/puremvc/js/demos/objs/employeeadmin/view/components/UiComponent.js
  25. +12 −15 src/org/puremvc/js/demos/objs/employeeadmin/view/components/UserForm.js
  26. +2 −2 src/org/puremvc/js/demos/objs/employeeadmin/view/components/UserList.js
View
2  README.textile
@@ -1,4 +1,4 @@
-h2. PureMVC Port to Javascript / Objs / jQueryMobile EmployeeAdmin Demo
+h2. PureMVC Port to Javascript / Objs / jQuery Mobile EmployeeAdmin Demo
PureMVC Port to Javascript / Objs by Frederic Saunier
PureMVC - Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
View
44 bin/puremvc_employeeadmin_jquerymobile-min.js
@@ -16,25 +16,25 @@ b++){if(c[b].uname==a){return c[b]}}return null},updateItem:function(a){var c=th
}else{b=this.listenerMap[UiComponent.QUEUE_PATTERN+g]}var a=b.length;for(var e=0;e<a;e++){var c=b[e];if(c.equals(d)){return}}b.push(d)},removeEventListener:function(f,g,e){if(typeof f=="undefined"){return}if(typeof g=="undefined"){return}if(typeof this.listenerMap[UiComponent.QUEUE_PATTERN+f]=="undefined"){return}var b=this.listenerMap[UiComponent.QUEUE_PATTERN+f];var a=b.length;for(var d=0;d<a;d++){var c=b[d];if(c.equals(new UiComponent.ListenerDescriptor(g,e))){b.splice(d,1);return}}}});UiComponent.Event=Objs("org.puremvc.js.demos.objs.employeeadmin.view.components.UiComponent.Event",{type:null,properties:null});
UiComponent.ListenerDescriptor=Objs("org.puremvc.js.demos.objs.employeeadmin.view.components.UiComponent.Event",{initialize:function(b,a){this.listener=b;this.context=a},equals:function(a){if(a.listener==this.listener){if(typeof a.context!="undefined"){if(a.context==null&&this.context==null){return true}if(a.context==this.context){return true}}}return false}});UiComponent.QUEUE_PATTERN="@_@";var UserForm=Objs("org.puremvc.js.demos.objs.employeeadmin.view.components.UserForm",UiComponent,{userFormPanel:null,uname:null,fname:null,lname:null,email:null,password:null,confirm:null,department:null,submitButton:null,user:null,userRoles:null,mode:null,initialize:function(){UserForm.$super.initialize.call(this);
this.initializeChildren();this.bindListeners()},initializeChildren:function(){this.userFormPanel=jQuery("#user-form-panel");this.uname=this.userFormPanel.find("#uname");this.fname=this.userFormPanel.find("#fname");this.lname=this.userFormPanel.find("#lname");this.email=this.userFormPanel.find("#email");this.password=this.userFormPanel.find("#password");this.confirm=this.userFormPanel.find("#confirm");this.department=this.userFormPanel.find("#department").selectmenu();this.roles=this.userFormPanel.find("#roles").selectmenu();
-this.submitButton=this.userFormPanel.find("#submit-button").button();this.deleteButton=this.userFormPanel.find("#delete-button").button()},bindListeners:function(){var b=".UserForm";var a=jQuery.proxy(this,"field_focusHandler");this.uname.on("focus"+b,a);this.password.on("focus"+b,a);this.confirm.on("focus"+b,a);this.department.on("focus"+b,a);this.roles.on("focus"+b,a);this.submitButton.on("click"+b,jQuery.proxy(this,"submitButton_clickHandler"));this.deleteButton.on("click"+b,jQuery.proxy(this,"deleteButton_clickHandler"))
-},unbindListeners:function(){var a=".UserForm";this.uname.off("focus"+a);this.password.off("focus"+a);this.confirm.off("focus"+a);this.department.off("focus"+a);this.roles.off("focus"+a);this.submitButton.off("click"+a);this.deleteButton.off("click"+a)},fillDepartmentList:function(g){var e='<select id="department"><option></option></select>';var j="";for(var c=0;c<g.length;c++){var d=g[c];var b='value="'+d.ordinal+'"';var h=d.equals(this.user.department)?"selected":"";j+="<option "+b+" "+h+" >"+d.value+"</option>"
-}if(j){e=e.replace("<option></option>",j)}var a=this.department.closest(".ui-field-contain");var f=this.department.closest(".ui-select");f.detach();a.append(e);this.department=this.userFormPanel.find("#department").selectmenu();this.department.selectmenu("refresh")},fillRoleList:function(e){var f='<select id="roles" multiple="multiple"><option></option></select>';var j="";for(var c=0;c<e.length;c++){var d=e[c];var b="";if(!d.equals(RoleEnum.NONE_SELECTED)){b='value="'+d.ordinal+'"'}var h=this.isUserRole(d)?"selected":"";
-j+="<option "+b+" "+h+" >"+d.value+"</option>\n"}if(j){f=f.replace("<option></option>",j)}var a=this.roles.closest(".ui-field-contain");var g=this.roles.closest(".ui-select");g.detach();a.append(f);this.roles=this.userFormPanel.find("#roles").selectmenu();this.roles.selectmenu("refresh");this.roles.mousedown(function(){this.fillRoleList(RoleEnum.getComboList())})},setUser:function(a){this.user=a;this.uname.val(a.uname);this.fname.val(a.fname);this.lname.val(a.lname);this.email.val(a.email);this.password.val(a.password);
-this.confirm.val(a.password);this.fillDepartmentList(DeptEnum.getComboList())},getUser:function(){var a=new UserVO();a.uname=this.uname.val();a.fname=this.fname.val();a.lname=this.lname.val();a.email=this.email.val();a.password=this.password.val();a.department=this.getSelectedDepartment();return a},setUserRoles:function(a){this.userRoles=a;this.fillRoleList(RoleEnum.getComboList())},getUserRoles:function(){return this.getSelectedRoles()},clearForm:function(){this.uname.val("");this.fname.val("");
-this.lname.val("");this.email.val("");this.password.val("");this.confirm.val("");this.fillRoleList([]);this.fillDepartmentList([]);this.setFieldError("uname",false);this.setFieldError("password",false);this.setFieldError("confirm",false);this.setFieldError("department",false);this.fillDepartmentList([]);this.fillRoleList([])},setMode:function(a){this.mode=a;switch(a){case UserForm.MODE_ADD:this.uname.removeAttr("disabled");this.uname.removeAttr("data-theme");this.submitButton.parent().find(".ui-btn-text").text("Add");
-this.deleteButton.parent().hide();break;case UserForm.MODE_EDIT:this.uname.attr("disabled","disabled");this.uname.attr("data-theme","ui-disabled");this.submitButton.parent().find(".ui-btn-text").text("Save");this.deleteButton.parent().show();break}},submitButton_clickHandler:function(){if(this.getErrors()){return}var a=this.getUser();if(a.getIsValid()){if(this.mode==UserForm.MODE_ADD){this.dispatchEvent(UserForm.ADD_USER)}else{this.dispatchEvent(UserForm.UPDATE_USER)}jQuery.mobile.changePage("#UserList")
-}},deleteButton_clickHandler:function(){this.dispatchEvent(UserForm.DELETE_USER);jQuery.mobile.changePage("#UserList")},getErrors:function(){var c=false;if(this.uname.val()==""){this.setFieldError("uname",c=true)}else{this.setFieldError("uname",false)}if(this.password.val()==""){this.setFieldError("password",c=true)}else{this.setFieldError("password",false)}if(this.password.val()!=""&&this.confirm.val()!=this.password.val()){this.setFieldError("confirm",c=true)}else{this.setFieldError("confirm",false)
-}var b=this.getSelectedDepartment();if(!b||b.equals(DeptEnum.NONE_SELECTED)){this.setFieldError("department",c=true)}else{this.setFieldError("department",false)}var a=this.getUserRoles();if(!a||a.length==0){this.setFieldError("roles",c=true)}else{this.setFieldError("roles",false)}return c},setFieldError:function(d,b){var a=this.userFormPanel.find('label[for="'+d+'"]');var c=this.userFormPanel.find("#"+d);if(b){c.closest(".ui-field-contain").addClass("fieldError")}else{c.closest(".ui-field-contain").removeClass("fieldError")
-}},isUserRole:function(b){for(var a=0;a<this.userRoles.length;a++){if(b.equals(this.userRoles[a])){return true}}return false},getSelectedDepartment:function(){var d=parseInt(this.department.val());var c=DeptEnum.getList();for(var b=0;b<c.length;b++){var a=c[b];if(c[b].ordinal==d){return a}}return null},getSelectedRoles:function(){var a=[];var g=this.roles.val();if(!g){return a}var e=RoleEnum.getList();for(var d=0;d<e.length;d++){var f=e[d];for(var b=0;b<g.length;b++){var c=parseInt(g[b]);if(f.ordinal==c){a.push(f)
-}}}return a}});UserForm.ADD_USER="addUser";UserForm.UPDATE_USER="updateUser";UserForm.DELETE_USER="deleteUser";UserForm.CANCEL="cancel";UserForm.MODE_ADD="modeAdd";UserForm.MODE_EDIT="modeEdit";UserForm.ADD_ROLE="addRole";UserForm.REMOVE_ROLE="removeRole";var UserList=Objs("org.puremvc.js.demos.objs.employeeadmin.view.components.UserList",UiComponent,{userListPanel:null,userList:null,newButton:null,selectedUser:null,users:null,listItemClickProxy:null,initialize:function(){UserList.$super.initialize.call(this);
-this.listItemClickProxy=jQuery.proxy(this,"userList_clickHandler");this.initializeChildren();this.bindListeners()},initializeChildren:function(){this.userListPanel=jQuery("#user-list-panel");this.userList=this.userListPanel.find("#user-list");this.newButton=this.userListPanel.find("#new-button").button()},bindListeners:function(){var a=".UserList";this.newButton.on("click"+a,jQuery.proxy(this,"newButton_clickHandler"))},unbindListeners:function(){var a=".UserList";this.newButton.off("click"+a)},setUsers:function(a){this.users=a;
-var d="";for(var c=0;c<this.users.length;c++){var b=this.users[c];d+='<li id="'+c+'-user-list-item"><a href="#">'+b.getGivenName()+"</a></li>"}this.userList.html(d).listview("refresh",true);this.userList.find("li").on("click",this.listItemClickProxy)},userList_clickHandler:function(c){var a=jQuery(c.currentTarget);var b=parseInt(a.attr("id"));jQuery.mobile.changePage("#UserForm");this.dispatchEvent(UserList.SELECT,this.users[b])},newButton_clickHandler:function(){jQuery.mobile.changePage("#UserForm");
-this.dispatchEvent(UserList.NEW)}});UserList.NEW="new";UserList.DELETE="delete";UserList.SELECT="select";var UserFormMediator=Objs("org.puremvc.js.demos.objs.employeeadmin.view.UserFormMediator",Mediator,{roleProxy:null,userProxy:null,initialize:function(b,a){UserFormMediator.$super.initialize.call(this,b,a);this.registerListeners();this.userProxy=this.facade.retrieveProxy(ProxyNames.USER_PROXY);this.roleProxy=this.facade.retrieveProxy(ProxyNames.ROLE_PROXY)},getUserForm:function(){return this.viewComponent
-},registerListeners:function(){var a=this.getUserForm();a.addEventListener(UserForm.ADD_USER,this.onAdd,this);a.addEventListener(UserForm.UPDATE_USER,this.onUpdate,this);a.addEventListener(UserForm.DELETE_USER,this.onDelete,this)},unregisterListeners:function(){var a=this.getUserForm();a.removeEventListener(UserForm.ADD_USER,this.onAdd,this);a.removeEventListener(UserForm.UPDATE_USER,this.onUpdate,this);a.removeEventListener(UserForm.DELETE_USER,this.onDelete,this)},onAdd:function(b){var a=this.getUserForm().getUser();
-this.userProxy.addItem(a);this.updateUserRoles();this.sendNotification(NotificationNames.USER_ADDED,a)},onUpdate:function(){var a=this.getUserForm().getUser();this.userProxy.updateItem(a);this.updateUserRoles();this.sendNotification(NotificationNames.USER_UPDATED,a)},onDelete:function(){var a=this.getUserForm().getUser();if(a==null){return}this.sendNotification(NotificationNames.DELETE_USER,a)},updateUserRoles:function(){var a=this.getUserForm().getUser();var c=this.getUserForm().getUserRoles();var b=new RoleVO();
-b.uname=a.uname;b.roles=c;this.roleProxy.deleteItem(b);this.roleProxy.addItem(b)},listNotificationInterests:function(){return[NotificationNames.NEW_USER,NotificationNames.USER_SELECTED]},handleNotification:function(c){var d=this.getUserForm();var a;switch(c.getName()){case NotificationNames.NEW_USER:d.clearForm();d.setUser(c.getBody());d.setUserRoles([]);d.setMode(UserForm.MODE_ADD);break;case NotificationNames.USER_SELECTED:a=c.getBody();d.clearForm();d.setUser(a);var b=this.roleProxy.getUserRoles(a.uname);
-d.setUserRoles(b);d.setMode(UserForm.MODE_EDIT);break}},onRemove:function(){this.unregisterListeners();this.getUserForm().unbindListeners()}});UserFormMediator.ADD="add";UserFormMediator.UPDATE="update";UserFormMediator.CANCEL="cancel";UserFormMediator.MODE_ADD="modeAdd";UserFormMediator.MODE_EDIT="modeEdit";var UserListMediator=Objs("org.puremvc.js.demos.objs.employeeadmin.view.UserListMediator",Mediator,{userList:null,initialize:function(b,a){UserListMediator.$super.initialize.call(this,b,a);this.registerListeners();
-var c=this.facade.retrieveProxy(ProxyNames.USER_PROXY);a.setUsers(c.getUsers())},registerListeners:function(){var a=this.getUserList();a.addEventListener(UserList.NEW,this.onNew,this);a.addEventListener(UserList.SELECT,this.onSelect,this)},unregisterListeners:function(){var a=this.getUserList();a.removeEventListener(UserList.NEW,this.onNew,this);a.removeEventListener(UserList.SELECT,this.onSelect,this)},getUserList:function(){return this.viewComponent},listNotificationInterests:function(){return[NotificationNames.USER_UPDATED,NotificationNames.USER_ADDED,NotificationNames.USER_DELETED]
-},handleNotification:function(b){var a=this.getUserList();var c=this.facade.retrieveProxy(ProxyNames.USER_PROXY);switch(b.getName()){case NotificationNames.USER_UPDATED:a.setUsers(c.getUsers());break;case NotificationNames.USER_ADDED:a.setUsers(c.getUsers());break;case NotificationNames.USER_DELETED:a.setUsers(c.getUsers());break}},onNew:function(){var a=new UserVO();this.sendNotification(NotificationNames.NEW_USER,a)},onSelect:function(a){this.sendNotification(NotificationNames.USER_SELECTED,a)},onRemove:function(){this.unregisterListeners();
-this.getUserList().unbindListeners()}});var ApplicationFacade=Objs("org.puremvc.js.demos.objs.employeeadmin.ApplicationFacade",Facade,{startup:function(a){this.sendNotification(NotificationNames.STARTUP,a)},initializeController:function(){ApplicationFacade.$super.initializeController.call(this);this.registerCommand(NotificationNames.STARTUP,StartupCommand);this.registerCommand(NotificationNames.DELETE_USER,DeleteUserCommand)}});ApplicationFacade.getInstance=function(){if(!Facade.instance){Facade.instance=new ApplicationFacade()
-}return Facade.instance};
+this.submitButton=this.userFormPanel.find("#submit-button").button();this.deleteButton=this.userFormPanel.find("#delete-button").button()},bindListeners:function(){var a=jQuery.proxy(this,"field_focusHandler");this.uname.on("focus"+UserForm.EVENT_NS,a);this.password.on("focus"+UserForm.EVENT_NS,a);this.confirm.on("focus"+UserForm.EVENT_NS,a);this.submitButton.on("click"+UserForm.EVENT_NS,jQuery.proxy(this,"submitButton_clickHandler"));this.deleteButton.on("click"+UserForm.EVENT_NS,jQuery.proxy(this,"deleteButton_clickHandler"))
+},unbindListeners:function(){this.uname.off("focus"+UserForm.EVENT_NS);this.password.off("focus"+UserForm.EVENT_NS);this.confirm.off("focus"+UserForm.EVENT_NS);this.department.parent().off("click"+UserForm.EVENT_NS);this.roles.parent().off("click"+UserForm.EVENT_NS);this.submitButton.off("click"+UserForm.EVENT_NS);this.deleteButton.off("click"+UserForm.EVENT_NS)},fillDepartmentList:function(g){var e='<select id="department"><option></option></select>';var j="";for(var c=0;c<g.length;c++){var d=g[c];
+var b='value="'+d.ordinal+'"';var h=d.equals(this.user.department)?"selected":"";j+="<option "+b+" "+h+" >"+d.value+"</option>"}if(j){e=e.replace("<option></option>",j)}var a=this.department.closest(".ui-field-contain");var f=this.department.closest(".ui-select");f.detach();a.append(e);this.department=this.userFormPanel.find("#department").selectmenu();this.department.selectmenu("refresh");this.department.off("change"+UserForm.EVENT_NS);this.department.on("change"+UserForm.EVENT_NS,jQuery.proxy(this,"field_focusHandler"))
+},fillRoleList:function(e){var f='<select id="roles" multiple="multiple"><option></option></select>';var j="";for(var c=0;c<e.length;c++){var d=e[c];var b="";if(!d.equals(RoleEnum.NONE_SELECTED)){b='value="'+d.ordinal+'"'}var h=this.isUserRole(d)?"selected":"";j+="<option "+b+" "+h+" >"+d.value+"</option>\n"}if(j){f=f.replace("<option></option>",j)}var a=this.roles.closest(".ui-field-contain");var g=this.roles.closest(".ui-select");g.detach();a.append(f);this.roles=this.userFormPanel.find("#roles").selectmenu();
+this.roles.selectmenu("refresh");this.roles.off("change"+UserForm.EVENT_NS);this.roles.on("change"+UserForm.EVENT_NS,jQuery.proxy(this,"field_focusHandler"))},setUser:function(a){this.user=a;this.uname.val(a.uname);this.fname.val(a.fname);this.lname.val(a.lname);this.email.val(a.email);this.password.val(a.password);this.confirm.val(a.password);this.fillDepartmentList(DeptEnum.getComboList())},getUser:function(){var a=new UserVO();a.uname=this.uname.val();a.fname=this.fname.val();a.lname=this.lname.val();
+a.email=this.email.val();a.password=this.password.val();a.department=this.getSelectedDepartment();return a},setUserRoles:function(a){this.userRoles=a;this.fillRoleList(RoleEnum.getComboList())},getUserRoles:function(){return this.getSelectedRoles()},clearForm:function(){this.uname.val("");this.fname.val("");this.lname.val("");this.email.val("");this.password.val("");this.confirm.val("");this.fillRoleList([]);this.fillDepartmentList([]);this.setFieldError("uname",false);this.setFieldError("password",false);
+this.setFieldError("confirm",false);this.setFieldError("department",false);this.fillDepartmentList([]);this.fillRoleList([])},setMode:function(a){this.mode=a;switch(a){case UserForm.MODE_ADD:this.uname.removeAttr("disabled");this.submitButton.parent().find(".ui-btn-text").text("Add");this.deleteButton.parent().hide();break;case UserForm.MODE_EDIT:this.uname.attr("disabled","disabled");this.submitButton.parent().find(".ui-btn-text").text("Save");this.deleteButton.parent().show();break}},submitButton_clickHandler:function(){if(this.getErrors()){return
+}var a=this.getUser();if(a.getIsValid()){if(this.mode==UserForm.MODE_ADD){this.dispatchEvent(UserForm.ADD_USER)}else{this.dispatchEvent(UserForm.UPDATE_USER)}jQuery.mobile.changePage("#UserList")}},deleteButton_clickHandler:function(){this.dispatchEvent(UserForm.DELETE_USER);jQuery.mobile.changePage("#UserList")},field_focusHandler:function(a){this.setFieldError(a.target.id,false)},getErrors:function(){var c=false;if(this.uname.val()==""){this.setFieldError("uname",c=true)}else{this.setFieldError("uname",false)
+}if(this.password.val()==""){this.setFieldError("password",c=true)}else{this.setFieldError("password",false)}if(this.password.val()!=""&&this.confirm.val()!=this.password.val()){this.setFieldError("confirm",c=true)}else{this.setFieldError("confirm",false)}var b=this.getSelectedDepartment();if(!b||b.equals(DeptEnum.NONE_SELECTED)){this.setFieldError("department",c=true)}else{this.setFieldError("department",false)}var a=this.getUserRoles();if(!a||a.length==0){this.setFieldError("roles",c=true)}else{this.setFieldError("roles",false)
+}return c},setFieldError:function(d,b){var a=this.userFormPanel.find('label[for="'+d+'"]');var c=this.userFormPanel.find("#"+d);if(b){c.closest(".ui-field-contain").addClass("fieldError")}else{c.closest(".ui-field-contain").removeClass("fieldError")}},isUserRole:function(b){for(var a=0;a<this.userRoles.length;a++){if(b.equals(this.userRoles[a])){return true}}return false},getSelectedDepartment:function(){var d=parseInt(this.department.val());var c=DeptEnum.getList();for(var b=0;b<c.length;b++){var a=c[b];
+if(c[b].ordinal==d){return a}}return null},getSelectedRoles:function(){var a=[];var g=this.roles.val();if(!g){return a}var e=RoleEnum.getList();for(var d=0;d<e.length;d++){var f=e[d];for(var b=0;b<g.length;b++){var c=parseInt(g[b]);if(f.ordinal==c){a.push(f)}}}return a}});UserForm.EVENT_NS=".UserForm";UserForm.ADD_USER="addUser";UserForm.UPDATE_USER="updateUser";UserForm.DELETE_USER="deleteUser";UserForm.CANCEL="cancel";UserForm.MODE_ADD="modeAdd";UserForm.MODE_EDIT="modeEdit";UserForm.ADD_ROLE="addRole";
+UserForm.REMOVE_ROLE="removeRole";var UserList=Objs("org.puremvc.js.demos.objs.employeeadmin.view.components.UserList",UiComponent,{userListPanel:null,userList:null,newButton:null,selectedUser:null,users:null,listItemClickProxy:null,initialize:function(){UserList.$super.initialize.call(this);this.listItemClickProxy=jQuery.proxy(this,"userList_clickHandler");this.initializeChildren();this.bindListeners()},initializeChildren:function(){this.userListPanel=jQuery("#user-list-panel");this.userList=this.userListPanel.find("#user-list");
+this.newButton=this.userListPanel.find("#new-button").button()},bindListeners:function(){var a=".UserList";this.newButton.on("click"+a,jQuery.proxy(this,"newButton_clickHandler"))},unbindListeners:function(){var a=".UserList";this.newButton.off("click"+a)},setUsers:function(a){this.users=a;var d="";for(var c=0;c<this.users.length;c++){var b=this.users[c];d+='<li id="'+c+'-user-list-item"><a href="#">'+b.getGivenName()+"</a></li>"}this.userList.html(d).listview("refresh",true);this.userList.find("li").on("click",this.listItemClickProxy)
+},userList_clickHandler:function(c){var a=jQuery(c.currentTarget);var b=parseInt(a.attr("id"));jQuery.mobile.changePage("#UserForm");this.dispatchEvent(UserList.SELECT,this.users[b])},newButton_clickHandler:function(){jQuery.mobile.changePage("#UserForm");this.dispatchEvent(UserList.NEW)}});UserList.NEW="new";UserList.DELETE="delete";UserList.SELECT="select";var UserFormMediator=Objs("org.puremvc.js.demos.objs.employeeadmin.view.UserFormMediator",Mediator,{roleProxy:null,userProxy:null,initialize:function(b,a){UserFormMediator.$super.initialize.call(this,b,a);
+this.registerListeners();this.userProxy=this.facade.retrieveProxy(ProxyNames.USER_PROXY);this.roleProxy=this.facade.retrieveProxy(ProxyNames.ROLE_PROXY)},getUserForm:function(){return this.viewComponent},registerListeners:function(){var a=this.getUserForm();a.addEventListener(UserForm.ADD_USER,this.onAdd,this);a.addEventListener(UserForm.UPDATE_USER,this.onUpdate,this);a.addEventListener(UserForm.DELETE_USER,this.onDelete,this)},unregisterListeners:function(){var a=this.getUserForm();a.removeEventListener(UserForm.ADD_USER,this.onAdd,this);
+a.removeEventListener(UserForm.UPDATE_USER,this.onUpdate,this);a.removeEventListener(UserForm.DELETE_USER,this.onDelete,this)},onAdd:function(b){var a=this.getUserForm().getUser();this.userProxy.addItem(a);this.updateUserRoles();this.sendNotification(NotificationNames.USER_ADDED,a)},onUpdate:function(){var a=this.getUserForm().getUser();this.userProxy.updateItem(a);this.updateUserRoles();this.sendNotification(NotificationNames.USER_UPDATED,a)},onDelete:function(){var a=this.getUserForm().getUser();
+if(a==null){return}this.sendNotification(NotificationNames.DELETE_USER,a)},updateUserRoles:function(){var a=this.getUserForm().getUser();var c=this.getUserForm().getUserRoles();var b=new RoleVO();b.uname=a.uname;b.roles=c;this.roleProxy.deleteItem(b);this.roleProxy.addItem(b)},listNotificationInterests:function(){return[NotificationNames.NEW_USER,NotificationNames.USER_SELECTED]},handleNotification:function(c){var d=this.getUserForm();var a;switch(c.getName()){case NotificationNames.NEW_USER:d.clearForm();
+d.setUser(c.getBody());d.setUserRoles([]);d.setMode(UserForm.MODE_ADD);break;case NotificationNames.USER_SELECTED:a=c.getBody();d.clearForm();d.setUser(a);var b=this.roleProxy.getUserRoles(a.uname);d.setUserRoles(b);d.setMode(UserForm.MODE_EDIT);break}},onRemove:function(){this.unregisterListeners();this.getUserForm().unbindListeners()}});UserFormMediator.ADD="add";UserFormMediator.UPDATE="update";UserFormMediator.CANCEL="cancel";UserFormMediator.MODE_ADD="modeAdd";UserFormMediator.MODE_EDIT="modeEdit";
+var UserListMediator=Objs("org.puremvc.js.demos.objs.employeeadmin.view.UserListMediator",Mediator,{userList:null,initialize:function(b,a){UserListMediator.$super.initialize.call(this,b,a);this.registerListeners();var c=this.facade.retrieveProxy(ProxyNames.USER_PROXY);a.setUsers(c.getUsers())},registerListeners:function(){var a=this.getUserList();a.addEventListener(UserList.NEW,this.onNew,this);a.addEventListener(UserList.SELECT,this.onSelect,this)},unregisterListeners:function(){var a=this.getUserList();
+a.removeEventListener(UserList.NEW,this.onNew,this);a.removeEventListener(UserList.SELECT,this.onSelect,this)},getUserList:function(){return this.viewComponent},listNotificationInterests:function(){return[NotificationNames.USER_UPDATED,NotificationNames.USER_ADDED,NotificationNames.USER_DELETED]},handleNotification:function(b){var a=this.getUserList();var c=this.facade.retrieveProxy(ProxyNames.USER_PROXY);switch(b.getName()){case NotificationNames.USER_UPDATED:a.setUsers(c.getUsers());break;case NotificationNames.USER_ADDED:a.setUsers(c.getUsers());
+break;case NotificationNames.USER_DELETED:a.setUsers(c.getUsers());break}},onNew:function(){var a=new UserVO();this.sendNotification(NotificationNames.NEW_USER,a)},onSelect:function(a){this.sendNotification(NotificationNames.USER_SELECTED,a)},onRemove:function(){this.unregisterListeners();this.getUserList().unbindListeners()}});var ApplicationFacade=Objs("org.puremvc.js.demos.objs.employeeadmin.ApplicationFacade",Facade,{startup:function(a){this.sendNotification(NotificationNames.STARTUP,a)},initializeController:function(){ApplicationFacade.$super.initializeController.call(this);
+this.registerCommand(NotificationNames.STARTUP,StartupCommand);this.registerCommand(NotificationNames.DELETE_USER,DeleteUserCommand)}});ApplicationFacade.getInstance=function(){if(!Facade.instance){Facade.instance=new ApplicationFacade()}return Facade.instance};
View
130 bin/puremvc_employeeadmin_jquerymobile.js
@@ -1,5 +1,5 @@
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
@@ -14,7 +14,7 @@ var MediatorNames = Objs("org.puremvc.js.demos.objs.employeeadmin.abc.MediatorNa
MediatorNames.USER_FORM_MEDIATOR = "userFormMediator";
MediatorNames.USER_LIST_MEDIATOR = "userListMediator";
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
@@ -36,7 +36,7 @@ NotificationNames.USER_DELETED = "userDeleted";
NotificationNames.ADD_ROLE = "addRole";
NotificationNames.ADD_ROLE_RESULT = "addRoleResult";
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
@@ -51,7 +51,7 @@ var ProxyNames = Objs("org.puremvc.js.demos.objs.employeeadmin.abc.ProxyNames",{
ProxyNames.ROLE_PROXY = "roleProxy";
ProxyNames.USER_PROXY = "userProxy";
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
@@ -90,7 +90,7 @@ var DeleteUserCommand = Objs("org.puremvc.js.demos.objs.employeeadmin.controller
}
});
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
@@ -187,7 +187,7 @@ var PrepModelCommand = Objs("org.puremvc.js.demos.objs.employeeadmin.controller.
}
});
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
@@ -229,7 +229,7 @@ var PrepViewCommand = Objs("org.puremvc.js.demos.objs.employeeadmin.controller.P
}
});
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
@@ -266,7 +266,7 @@ var StartupCommand = Objs("org.puremvc.js.demos.objs.employeeadmin.controller.St
}
});
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
@@ -365,7 +365,7 @@ DeptEnum.getComboList = function()
return cList;
};
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
@@ -506,7 +506,7 @@ RoleEnum.getItem = function( ordinal )
return null;
};
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
@@ -536,7 +536,7 @@ var RoleVO = Objs("org.puremvc.js.demos.objs.employeeadmin.model.vo.RoleVO",
roles: []
});
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
@@ -623,7 +623,7 @@ var UserVO = Objs("org.puremvc.js.demos.objs.employeeadmin.model.vo.UserVO",
}
});
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
@@ -834,7 +834,7 @@ var RoleProxy = Objs("org.puremvc.js.demos.objs.employeeadmin.model.RoleProxy",
}
});
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
@@ -941,7 +941,7 @@ var UserProxy = Objs("org.puremvc.js.demos.objs.employeeadmin.model.UserProxy",
}
});
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
@@ -1197,7 +1197,7 @@ UiComponent.ListenerDescriptor = Objs("org.puremvc.js.demos.objs.employeeadmin.v
*/
UiComponent.QUEUE_PATTERN = '@_@';
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
@@ -1350,20 +1350,13 @@ var UserForm = Objs("org.puremvc.js.demos.objs.employeeadmin.view.components.Use
*/
bindListeners: function()
{
- //jQuery will be able to only remove events attached under this namespace
- var namespace/*String*/ = ".UserForm";
-
var focusEventProxy/*jQueryProxy*/ = jQuery.proxy( this, "field_focusHandler" );
- this.uname.on("focus" + namespace, focusEventProxy );
- this.password.on("focus" + namespace, focusEventProxy );
- this.confirm.on("focus" + namespace, focusEventProxy );
-
- //TODO focus event is not received by the selects
- this.department.on("focus" + namespace, focusEventProxy );
- this.roles.on("focus" + namespace, focusEventProxy );
+ this.uname.on("focus" + UserForm.EVENT_NS, focusEventProxy );
+ this.password.on("focus" + UserForm.EVENT_NS, focusEventProxy );
+ this.confirm.on("focus" + UserForm.EVENT_NS, focusEventProxy );
- this.submitButton.on( "click" + namespace, jQuery.proxy( this, "submitButton_clickHandler" ) );
- this.deleteButton.on( "click" + namespace, jQuery.proxy( this, "deleteButton_clickHandler" ) );
+ this.submitButton.on( "click" + UserForm.EVENT_NS, jQuery.proxy( this, "submitButton_clickHandler" ) );
+ this.deleteButton.on( "click" + UserForm.EVENT_NS, jQuery.proxy( this, "deleteButton_clickHandler" ) );
},
/**
@@ -1371,17 +1364,15 @@ var UserForm = Objs("org.puremvc.js.demos.objs.employeeadmin.view.components.Use
*/
unbindListeners: function()
{
- //jQuery will only remove events attached under this namespace
- var namespace/*String*/ = ".UserForm";
+ this.uname.off("focus" + UserForm.EVENT_NS );
+ this.password.off("focus" + UserForm.EVENT_NS );
+ this.confirm.off("focus" + UserForm.EVENT_NS );
- this.uname.off("focus" + namespace );
- this.password.off("focus" + namespace );
- this.confirm.off("focus" + namespace );
- this.department.off("focus" + namespace );
- this.roles.off("focus" + namespace );
+ this.department.parent().off("click" + UserForm.EVENT_NS );
+ this.roles.parent().off("click" + UserForm.EVENT_NS );
- this.submitButton.off( "click" + namespace );
- this.deleteButton.off( "click" + namespace );
+ this.submitButton.off( "click" + UserForm.EVENT_NS );
+ this.deleteButton.off( "click" + UserForm.EVENT_NS );
},
/**
@@ -1395,12 +1386,9 @@ var UserForm = Objs("org.puremvc.js.demos.objs.employeeadmin.view.components.Use
fillDepartmentList: function( deptEnumList )
{
/*
- * We need to hard reset the select component for jQueryMobile to
- * refresh its display and set which is its selected element.
- *
- * Whatever the documentation says, with jQueryMobile 1.0.1 if we don't
- * use native select menus (but we don't have placeholders), the pop-up
- * menu won't work.
+ * Whatever the documentation says, with jQuery Mobile 1.0.1 we need to
+ * hard reset the select component for jQuery Mobile to refresh its
+ * display and set which is its selected element.
*/
var select/*String*/ = '<select id="department"><option></option></select>';
var options/*String*/ = "";
@@ -1424,7 +1412,10 @@ var UserForm = Objs("org.puremvc.js.demos.objs.employeeadmin.view.components.Use
this.department = this.userFormPanel.find("#department").selectmenu();
this.department.selectmenu('refresh');
- },
+
+ this.department.off("change" + UserForm.EVENT_NS );
+ this.department.on("change" + UserForm.EVENT_NS, jQuery.proxy( this, "field_focusHandler" ) );
+},
/**
* Add items from <code>RoleEnum</code> to the corresponding list UI component.
@@ -1436,12 +1427,9 @@ var UserForm = Objs("org.puremvc.js.demos.objs.employeeadmin.view.components.Use
fillRoleList: function( roleEnumList )
{
/*
- * We need to hard reset the select component for jQueryMobile to
- * refresh its display and set which is its selected element.
- *
- * Whatever the documentation says, with jQueryMobile 1.0.1 if we don't
- * use native select menus (but we don't have placeholders), the pop-up
- * menu won't work.
+ * Whatever the documentation says, with jQuery Mobile 1.0.1 we need to
+ * hard reset the select component for jQuery Mobile to refresh its
+ * display and set which is its selected element.
*/
var select/*String*/ = '<select id="roles" multiple="multiple"><option></option></select>';
var options/*String*/ = "";
@@ -1468,7 +1456,9 @@ var UserForm = Objs("org.puremvc.js.demos.objs.employeeadmin.view.components.Use
this.roles = this.userFormPanel.find("#roles").selectmenu();
this.roles.selectmenu("refresh");
- this.roles.mousedown(function(){this.fillRoleList( RoleEnum.getComboList() );})
+
+ this.roles.off("change" + UserForm.EVENT_NS );
+ this.roles.on("change" + UserForm.EVENT_NS, jQuery.proxy( this, "field_focusHandler" ) );
},
/**
@@ -1562,20 +1552,17 @@ var UserForm = Objs("org.puremvc.js.demos.objs.employeeadmin.view.components.Use
switch(mode)
{
case UserForm.MODE_ADD:
- //We have to hack jQueryMobile a little here
- //TODO Make this works !!!
this.uname.removeAttr("disabled");
- this.uname.removeAttr( "data-theme");
+
+ //We have to hack jQuery Mobile a little here
this.submitButton.parent().find(".ui-btn-text").text("Add");
this.deleteButton.parent().hide();
break;
case UserForm.MODE_EDIT:
- //We have to hack jQueryMobile a little here
-
- //TODO Make this works !!!
this.uname.attr( "disabled", "disabled" );
- this.uname.attr( "data-theme", "ui-disabled" );
+
+ //We have to hack jQuery Mobile a little here
this.submitButton.parent().find(".ui-btn-text").text("Save");
this.deleteButton.parent().show();
break;
@@ -1613,6 +1600,15 @@ var UserForm = Objs("org.puremvc.js.demos.objs.employeeadmin.view.components.Use
},
/**
+ * Handle focus event on all the required form fields.
+ */
+ field_focusHandler: function( evt )
+ {
+ //Remove error on the selected field.
+ this.setFieldError( evt.target.id, false );
+ },
+
+ /**
* Display errors associated with form fields and return if at least one
* field is in error.
*
@@ -1749,7 +1745,13 @@ var UserForm = Objs("org.puremvc.js.demos.objs.employeeadmin.view.components.Use
return arr;
}
});
-
+
+/**
+ * @const
+ * @private
+ */
+UserForm.EVENT_NS = ".UserForm";
+
/*
* Event names
*/
@@ -1764,7 +1766,7 @@ UserForm.MODE_EDIT = "modeEdit";
UserForm.ADD_ROLE = "addRole";
UserForm.REMOVE_ROLE = "removeRole";
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
@@ -1909,7 +1911,7 @@ var UserList = Objs("org.puremvc.js.demos.objs.employeeadmin.view.components.Use
*
* <P>
* We are currently unable to listen for a <code>select</code> event on an
- * unumbered list in jQueryMobile so we have to listen for the click on the
+ * unumbered list in jQuery Mobile so we have to listen for the click on the
* whole list and identify the clicked <li /> element.
*
* @param {Event} event
@@ -1943,7 +1945,7 @@ UserList.NEW = "new";
UserList.DELETE = "delete";
UserList.SELECT = "select";
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
@@ -2092,7 +2094,7 @@ var UserFormMediator = Objs("org.puremvc.js.demos.objs.employeeadmin.view.UserFo
},
/*
- * In the jQueryMobile EmployeeAdmin demo we can't add/remove roles
+ * In the jQuery Mobile EmployeeAdmin demo we can't add/remove roles
* one by one, so we refresh the whole list on add/update operations.
*/
updateUserRoles: function()
@@ -2172,7 +2174,7 @@ UserFormMediator.CANCEL = "cancel";
UserFormMediator.MODE_ADD = "modeAdd";
UserFormMediator.MODE_EDIT = "modeEdit";
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
@@ -2336,7 +2338,7 @@ var UserListMediator = Objs("org.puremvc.js.demos.objs.employeeadmin.view.UserLi
});
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
View
2  build/build.xml
@@ -63,7 +63,7 @@
<yuicompress
charset="UTF-8"
linebreak="500"
- warn="true"
+ warn="false"
munge="yes"
preserveallsemicolons="false"
preservestringlitterals="false"
View
10 debug.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html class="ui-mobile-rendering">
<!--
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
@@ -9,9 +9,9 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
- <title> PureMVC Javascript Objs EmployeeAdmin demo for jQueryMobile </title>
+ <title> PureMVC Javascript Objs EmployeeAdmin demo for jQuery Mobile </title>
- <!-- jQuery and jQueryMobile library dependencies -->
+ <!-- jQuery and jQuery Mobile library dependencies -->
<link rel="stylesheet" href="lib/jquery.mobile-1.0.1/jquery.mobile-1.0.1.css" />
<link rel="stylesheet" href="css/application.css" />
@@ -74,7 +74,7 @@
function()
{
/*
- * jQueryMobile change the browser address bar to reflect the
+ * jQuery Mobile change the browser address bar to reflect the
* current displayed page as an anchor. If the user loads
* (or refreshes) the current page while being on the UserForm,
* we have to redirect him on the default home page.
@@ -87,7 +87,7 @@
document.location.hash = "";
/*
- * We have deferred jQueryMobile page initialization so that we
+ * We have deferred jQuery Mobile page initialization so that we
* ensure it happens before PureMVC startup.
*/
$.mobile.initializePage();
View
10 index.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html class="ui-mobile-rendering">
<!--
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
@@ -9,9 +9,9 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
- <title> PureMVC Javascript Objs EmployeeAdmin demo for jQueryMobile </title>
+ <title> PureMVC Javascript Objs EmployeeAdmin demo for jQuery Mobile </title>
- <!-- jQuery and jQueryMobile library dependencies -->
+ <!-- jQuery and jQuery Mobile library dependencies -->
<link rel="stylesheet" href="lib/jquery.mobile-1.0.1/jquery.mobile-1.0.1.min.css" />
<link rel="stylesheet" href="css/application.css" />
@@ -48,7 +48,7 @@
function()
{
/*
- * jQueryMobile change the browser address bar to reflect the
+ * jQuery Mobile change the browser address bar to reflect the
* current displayed page as an anchor. If the user loads
* (or refreshes) the current page while being on the UserForm,
* we have to redirect him on the default home page.
@@ -61,7 +61,7 @@
document.location.hash = "";
/*
- * We have deferred jQueryMobile page initialization so that we
+ * We have deferred jQuery Mobile page initialization so that we
* ensure it happens before PureMVC startup.
*/
$.mobile.initializePage();
View
2  license.txt
@@ -1,4 +1,4 @@
-PureMVC Javascript Employee Admin demo / Objs using jQueryMobile by Frederic Saunier
+PureMVC Javascript Employee Admin demo / Objs using jQuery Mobile by Frederic Saunier
PureMVC - Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
--------------------------------------------------------------------------
Reuse governed by Creative Commons Attribution 3.0 United States License
View
2  src/org/puremvc/js/demos/objs/employeeadmin/ApplicationFacade.js
@@ -1,5 +1,5 @@
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
View
2  src/org/puremvc/js/demos/objs/employeeadmin/abc/MediatorNames.js
@@ -1,5 +1,5 @@
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
View
2  src/org/puremvc/js/demos/objs/employeeadmin/abc/NotificationNames.js
@@ -1,5 +1,5 @@
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
View
2  src/org/puremvc/js/demos/objs/employeeadmin/abc/ProxyNames.js
@@ -1,5 +1,5 @@
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
View
2  src/org/puremvc/js/demos/objs/employeeadmin/controller/DeleteUserCommand.js
@@ -1,5 +1,5 @@
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
View
2  src/org/puremvc/js/demos/objs/employeeadmin/controller/PrepModelCommand.js
@@ -1,5 +1,5 @@
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
View
2  src/org/puremvc/js/demos/objs/employeeadmin/controller/PrepViewCommand.js
@@ -1,5 +1,5 @@
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
View
2  src/org/puremvc/js/demos/objs/employeeadmin/controller/StartupCommand.js
@@ -1,5 +1,5 @@
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
View
2  src/org/puremvc/js/demos/objs/employeeadmin/model/RoleProxy.js
@@ -1,5 +1,5 @@
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
View
2  src/org/puremvc/js/demos/objs/employeeadmin/model/UserProxy.js
@@ -1,5 +1,5 @@
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
View
2  src/org/puremvc/js/demos/objs/employeeadmin/model/enum/DeptEnum.js
@@ -1,5 +1,5 @@
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
View
2  src/org/puremvc/js/demos/objs/employeeadmin/model/enum/RoleEnum.js
@@ -1,5 +1,5 @@
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
View
2  src/org/puremvc/js/demos/objs/employeeadmin/model/vo/RoleVO.js
@@ -1,5 +1,5 @@
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
View
2  src/org/puremvc/js/demos/objs/employeeadmin/model/vo/UserVO.js
@@ -1,5 +1,5 @@
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
View
4 src/org/puremvc/js/demos/objs/employeeadmin/view/UserFormMediator.js
@@ -1,5 +1,5 @@
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
@@ -148,7 +148,7 @@ var UserFormMediator = Objs("org.puremvc.js.demos.objs.employeeadmin.view.UserFo
},
/*
- * In the jQueryMobile EmployeeAdmin demo we can't add/remove roles
+ * In the jQuery Mobile EmployeeAdmin demo we can't add/remove roles
* one by one, so we refresh the whole list on add/update operations.
*/
updateUserRoles: function()
View
2  src/org/puremvc/js/demos/objs/employeeadmin/view/UserListMediator.js
@@ -1,5 +1,5 @@
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
View
2  src/org/puremvc/js/demos/objs/employeeadmin/view/components/UiComponent.js
@@ -1,5 +1,5 @@
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
View
27 src/org/puremvc/js/demos/objs/employeeadmin/view/components/UserForm.js
@@ -1,5 +1,5 @@
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
@@ -188,12 +188,9 @@ var UserForm = Objs("org.puremvc.js.demos.objs.employeeadmin.view.components.Use
fillDepartmentList: function( deptEnumList )
{
/*
- * We need to hard reset the select component for jQueryMobile to
- * refresh its display and set which is its selected element.
- *
- * Whatever the documentation says, with jQueryMobile 1.0.1 if we don't
- * use native select menus (but we don't have placeholders), the pop-up
- * menu won't work.
+ * Whatever the documentation says, with jQuery Mobile 1.0.1 we need to
+ * hard reset the select component for jQuery Mobile to refresh its
+ * display and set which is its selected element.
*/
var select/*String*/ = '<select id="department"><option></option></select>';
var options/*String*/ = "";
@@ -218,6 +215,7 @@ var UserForm = Objs("org.puremvc.js.demos.objs.employeeadmin.view.components.Use
this.department = this.userFormPanel.find("#department").selectmenu();
this.department.selectmenu('refresh');
+ this.department.off("change" + UserForm.EVENT_NS );
this.department.on("change" + UserForm.EVENT_NS, jQuery.proxy( this, "field_focusHandler" ) );
},
@@ -231,12 +229,9 @@ var UserForm = Objs("org.puremvc.js.demos.objs.employeeadmin.view.components.Use
fillRoleList: function( roleEnumList )
{
/*
- * We need to hard reset the select component for jQueryMobile to
- * refresh its display and set which is its selected element.
- *
- * Whatever the documentation says, with jQueryMobile 1.0.1 if we don't
- * use native select menus (but we don't have placeholders), the pop-up
- * menu won't work.
+ * Whatever the documentation says, with jQuery Mobile 1.0.1 we need to
+ * hard reset the select component for jQuery Mobile to refresh its
+ * display and set which is its selected element.
*/
var select/*String*/ = '<select id="roles" multiple="multiple"><option></option></select>';
var options/*String*/ = "";
@@ -263,6 +258,8 @@ var UserForm = Objs("org.puremvc.js.demos.objs.employeeadmin.view.components.Use
this.roles = this.userFormPanel.find("#roles").selectmenu();
this.roles.selectmenu("refresh");
+
+ this.roles.off("change" + UserForm.EVENT_NS );
this.roles.on("change" + UserForm.EVENT_NS, jQuery.proxy( this, "field_focusHandler" ) );
},
@@ -359,7 +356,7 @@ var UserForm = Objs("org.puremvc.js.demos.objs.employeeadmin.view.components.Use
case UserForm.MODE_ADD:
this.uname.removeAttr("disabled");
- //We have to hack jQueryMobile a little here
+ //We have to hack jQuery Mobile a little here
this.submitButton.parent().find(".ui-btn-text").text("Add");
this.deleteButton.parent().hide();
break;
@@ -367,7 +364,7 @@ var UserForm = Objs("org.puremvc.js.demos.objs.employeeadmin.view.components.Use
case UserForm.MODE_EDIT:
this.uname.attr( "disabled", "disabled" );
- //We have to hack jQueryMobile a little here
+ //We have to hack jQuery Mobile a little here
this.submitButton.parent().find(".ui-btn-text").text("Save");
this.deleteButton.parent().show();
break;
View
4 src/org/puremvc/js/demos/objs/employeeadmin/view/components/UserList.js
@@ -1,5 +1,5 @@
/*
- PureMVC Javascript Objs Employee Admin Demo for jQueryMobile
+ PureMVC Javascript Objs Employee Admin Demo for jQuery Mobile
by Frederic Saunier <frederic.saunier@puremvc.org>
PureMVC - Copyright(c) 2006-12 Futurescale, Inc., Some rights reserved.
Your reuse is governed by the Creative Commons Attribution 3.0 License
@@ -144,7 +144,7 @@ var UserList = Objs("org.puremvc.js.demos.objs.employeeadmin.view.components.Use
*
* <P>
* We are currently unable to listen for a <code>select</code> event on an
- * unumbered list in jQueryMobile so we have to listen for the click on the
+ * unumbered list in jQuery Mobile so we have to listen for the click on the
* whole list and identify the clicked <li /> element.
*
* @param {Event} event
Please sign in to comment.
Something went wrong with that request. Please try again.