Group.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. MWF.xApplication.TeamWork = MWF.xApplication.TeamWork || {};
  2. MWF.xApplication.TeamWork.Group = new Class({
  3. Extends: MWF.xApplication.TeamWork.Common.ToolTips,
  4. options : {
  5. // displayDelay : 300,
  6. hasArrow:false,
  7. event:"click"
  8. },
  9. _loadCustom : function( callback ){
  10. this.topBar = new Element("div.topBar",{styles:this.css.tooltip.group.topBar}).inject(this.contentNode);
  11. var tt = this.lp.group.topText;
  12. if(this.data.do == "edit"){
  13. tt = this.lp.group.topTextEdit;
  14. }
  15. this.topBarText = new Element("div.topBarText",{styles:this.css.tooltip.group.topBarText,text:tt}).inject(this.topBar);
  16. this.topBarClose = new Element("div.topBarClose",{styles:this.css.tooltip.group.topBarClose}).inject(this.topBar);
  17. this.topBarClose.addEvents({
  18. click:function(){this.hide()}.bind(this)
  19. });
  20. this.groupInContainer = new Element("div.groupInContainer",{styles:this.css.tooltip.group.groupInContainer}).inject(this.contentNode);
  21. this.groupIn = new Element("input.groupIn",{styles:this.css.tooltip.group.groupIn,type:"text",placeholder:this.lp.group.groupIn}).inject(this.groupInContainer);
  22. if(this.data.do == "edit"){
  23. if(this.data.name) this.groupIn.set("value",this.data.name)
  24. }
  25. this.groupIn.addEvents({
  26. keyup:function(){
  27. var v = this.groupIn.get("value");
  28. if(v.trim()==""){
  29. this.groupAdd.setStyles({
  30. "cursor":"",
  31. "background-color":"#F0F0F0",
  32. "color":"#666666"
  33. })
  34. }else{
  35. this.groupAdd.setStyles({
  36. "cursor":"pointer",
  37. "background-color":"#4A90E2",
  38. "color":"#FFFFFF"
  39. })
  40. }
  41. }.bind(this)
  42. });
  43. this.groupAdd = new Element("div.groupAdd",{styles:this.css.tooltip.group.groupAdd,text:this.lp.group.groupAdd}).inject(this.contentNode);
  44. if(this.data.do == "edit"){
  45. this.groupAdd.setStyles({
  46. "cursor":"pointer",
  47. "background-color":"#4A90E2",
  48. "color":"#FFFFFF"
  49. })
  50. }
  51. this.groupAdd.addEvents({
  52. click:function(){
  53. if(this.groupIn.get("value").trim()=="") return;
  54. //var json = {
  55. // "do":this.data.do,
  56. // "title": this.groupIn.get("value").trim()
  57. //};
  58. var data = {
  59. "name":this.groupIn.get("value").trim()
  60. };
  61. if(this.data.do == "edit"){
  62. if(this.data.id){
  63. data.id = this.data.id;
  64. }
  65. }
  66. this.rootActions.ProjectGroupAction.save(data,function(json){
  67. this.close(json.data);
  68. }.bind(this),function(){
  69. //alert("err")
  70. }.bind(this));
  71. //this.hide();
  72. }.bind(this)
  73. });
  74. if(callback)callback();
  75. }
  76. });