Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 
 

116 Zeilen
3.3 KiB

  1. // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
  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. this.wrapper = $('<div class="form-footer row">\
  20. <!--i class="icon-cut" style="margin-top: -23px; margin-bottom: 23px; \
  21. display: block; margin-left: 15px; color: #888;"></i-->\
  22. <div class="col-md-12">\
  23. <div class="save-area">\
  24. <button class="btn btn-save btn-primary">\
  25. <i class="icon-save"></i> '+wn._("Save")+'</button>\
  26. </div>\
  27. <div class="help-area"></div>\
  28. </div>\
  29. <div class="after-save">\
  30. <div class="col-md-8">\
  31. <div class="form-tags">\
  32. <h4 style="display: inline-block"><i class="icon-tag"></i> '+wn._("Tags")+'</h4>\
  33. <span class="tag-area"></span><br>\
  34. </div><hr>\
  35. <div class="form-comments">\
  36. <h4><i class="icon-comments"></i> '+wn._("Comments")+'</h4>\
  37. </div>\
  38. </div>\
  39. <div class="col-md-4">\
  40. <div class="form-assignments" style="margin-bottom: 7px;">\
  41. <h4>\
  42. <i class="icon-ok-sign"></i> '+wn._("Assigned To")+': \
  43. <button class="btn btn-small btn-default pull-right"\
  44. style="margin-top:-7px;">'+wn._("Add")+'</button>\
  45. </h4>\
  46. </div><hr>\
  47. <div class="form-attachments">\
  48. <h4>\
  49. <i class="icon-paper-clip"></i> '+wn._("Attachments")+':\
  50. <button class="btn btn-small btn-default pull-right"\
  51. style="margin-top:-7px;">'+wn._("Add")+'</button>\
  52. </h4>\
  53. </div>\
  54. </div>\
  55. </div>\
  56. </div>')
  57. .appendTo(this.parent);
  58. this.wrapper.find(".btn-save").click(function() {
  59. me.frm.save('Save', null, this);
  60. })
  61. this.help_area = this.wrapper.find(".help-area").get(0);
  62. },
  63. make_tags: function() {
  64. this.frm.tags = new wn.ui.TagEditor({
  65. parent: this.wrapper.find(".tag-area"),
  66. frm: this.frm,
  67. })
  68. },
  69. make_attachments: function() {
  70. this.frm.attachments = new wn.ui.form.Attachments({
  71. parent: this.wrapper.find(".form-attachments"),
  72. frm: this.frm
  73. });
  74. },
  75. make_assignments: function() {
  76. this.frm.assign_to = new wn.ui.form.AssignTo({
  77. parent: this.wrapper.find(".form-assignments"),
  78. frm: this.frm
  79. });
  80. },
  81. make_comments: function() {
  82. this.frm.comments = new wn.ui.form.Comments({
  83. parent: this.wrapper.find(".form-comments"),
  84. frm: this.frm
  85. })
  86. },
  87. show_save: function() {
  88. this.wrapper.find(".save-area").toggle(true);
  89. },
  90. hide_save: function() {
  91. this.wrapper.find(".save-area").toggle(false);
  92. },
  93. refresh: function() {
  94. this.toggle_save();
  95. if(this.frm.doc.__islocal) {
  96. this.wrapper.find(".after-save").toggle(false);
  97. } else {
  98. this.wrapper.find(".after-save").toggle(true);
  99. this.frm.attachments.refresh();
  100. this.frm.comments.refresh();
  101. this.frm.assign_to.refresh();
  102. this.frm.tags.refresh();
  103. }
  104. },
  105. toggle_save: function() {
  106. if(this.frm_head && this.appframe.toolbar
  107. && this.appframe.buttons.Save && !this.save_disabled
  108. && (this.fields && this.fields.length > 7)) {
  109. this.show_save();
  110. } else {
  111. this.hide_save();
  112. }
  113. }
  114. });