You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
976 B

  1. import Vue from 'vue';
  2. Vue.use(require('vue-shortkey'), { prevent: ['input', 'textarea'] });
  3. import annotationMixin from './mixin.js';
  4. import HTTP from './http.js';
  5. var vm = new Vue({
  6. el: '#mail-app',
  7. delimiters: ['[[', ']]'],
  8. mixins: [annotationMixin],
  9. methods: {
  10. addLabel: async function (label_id) {
  11. for (var i = 0; i < this.items[this.cur]['labels'].length; i++) {
  12. var item = this.items[this.cur]['labels'][i];
  13. if (label_id == item.label.id) {
  14. this.deleteLabel(i);
  15. return;
  16. }
  17. }
  18. var payload = {
  19. 'label_id': label_id
  20. };
  21. var doc_id = this.items[this.cur].id;
  22. await HTTP.post(`docs/${doc_id}/annotations/`, payload).then(response => {
  23. this.items[this.cur]['labels'].push(response.data);
  24. });
  25. this.updateProgress();
  26. }
  27. }
  28. });