Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

97 righe
2.8 KiB

  1. // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
  2. // MIT License. See license.txt
  3. wn.ui.form.Footer = Class.extend({
  4. init: function(opts) {
  5. var me = this;
  6. $.extend(this, opts);
  7. this.make();
  8. this.make_assignments();
  9. this.make_attachments();
  10. this.make_tags();
  11. this.make_comments();
  12. // render-complete
  13. $(this.frm.wrapper).on("render_complete", function() {
  14. me.refresh();
  15. })
  16. },
  17. make: function() {
  18. var me = this;
  19. $("<div>").css({"border-top":"1px solid #c7c7c7"}).appendTo(this.parent)
  20. this.wrapper = $('<div class="form-footer container">\
  21. <!--i class="icon-cut" style="margin-top: -23px; margin-bottom: 23px; \
  22. display: block; margin-left: 15px; color: #888;"></i-->\
  23. <div>\
  24. <div class="help-area"></div>\
  25. </div>\
  26. <div class="after-save row">\
  27. <div class="col-md-8">\
  28. <div class="form-comments">\
  29. <h5><i class="icon-comments"></i> '+wn._("Comments")+'</h5>\
  30. </div>\
  31. </div>\
  32. <div class="col-md-4">\
  33. <div class="form-tags">\
  34. <h5 style="display: inline-block"><i class="icon-tag"></i> '+wn._("Tags")+'</h5>\
  35. <span class="tag-area"></span><br>\
  36. </div><hr>\
  37. <div class="form-assignments" style="margin-bottom: 7px;">\
  38. <h5>\
  39. <i class="icon-flag"></i> '+wn._("Assigned To")+': \
  40. <button class="btn small btn-default pull-right"\
  41. style="margin-top:-7px;">'+wn._("Add")+'</button>\
  42. </h5>\
  43. </div><hr>\
  44. <div class="form-attachments">\
  45. <h5>\
  46. <i class="icon-paper-clip"></i> '+wn._("Attachments")+':\
  47. <button class="btn small btn-default pull-right"\
  48. style="margin-top:-7px;">'+wn._("Add")+'</button>\
  49. </h5>\
  50. </div>\
  51. </div>\
  52. </div>\
  53. </div>')
  54. .appendTo(this.parent);
  55. this.wrapper.find(".btn-save").click(function() {
  56. me.frm.save('Save', null, this);
  57. })
  58. this.help_area = this.wrapper.find(".help-area").get(0);
  59. },
  60. make_tags: function() {
  61. this.frm.tags = new wn.ui.TagEditor({
  62. parent: this.wrapper.find(".tag-area"),
  63. frm: this.frm,
  64. })
  65. },
  66. make_attachments: function() {
  67. this.frm.attachments = new wn.ui.form.Attachments({
  68. parent: this.wrapper.find(".form-attachments"),
  69. frm: this.frm
  70. });
  71. },
  72. make_assignments: function() {
  73. this.frm.assign_to = new wn.ui.form.AssignTo({
  74. parent: this.wrapper.find(".form-assignments"),
  75. frm: this.frm
  76. });
  77. },
  78. make_comments: function() {
  79. this.frm.comments = new wn.ui.form.Comments({
  80. parent: this.wrapper.find(".form-comments"),
  81. frm: this.frm
  82. })
  83. },
  84. refresh: function() {
  85. if(this.frm.doc.__islocal) {
  86. this.parent.addClass("hide");
  87. } else {
  88. this.parent.removeClass("hide");
  89. this.frm.attachments.refresh();
  90. this.frm.comments.refresh();
  91. this.frm.assign_to.refresh();
  92. this.frm.tags.refresh();
  93. }
  94. },
  95. });