| 78 | } |
| 79 | |
| 80 | onClickSaveButton (e) { |
| 81 | this.treema.endExistingEdits() |
| 82 | for (const key in this.treema.data) { |
| 83 | const value = this.treema.data[key] |
| 84 | this.resource.set(key, value) |
| 85 | } |
| 86 | this.resource.updateI18NCoverage() |
| 87 | const res = this.resource.save() |
| 88 | |
| 89 | res.error((collection, response, options) => { |
| 90 | return console.error(response) |
| 91 | }) |
| 92 | |
| 93 | return res.success(() => { |
| 94 | const url = `${this.redirectPathOnSuccess}/${this.resource.get('slug') || this.resource.id}` |
| 95 | document.location.href = url |
| 96 | }) |
| 97 | } |
| 98 | } |
| 99 | EditView.initClass() |
| 100 | return EditView |