From d3a7381f396ab71cef2ff4210ef4409e58654727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sat, 11 Aug 2018 22:44:14 +0200 Subject: [PATCH] Edit All button in row editor --- resources/assets/js/components/RowsEditor.vue | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/resources/assets/js/components/RowsEditor.vue b/resources/assets/js/components/RowsEditor.vue index 7ceb3ad..e4eee85 100644 --- a/resources/assets/js/components/RowsEditor.vue +++ b/resources/assets/js/components/RowsEditor.vue @@ -26,14 +26,14 @@ Rows are identified by row._id, columns by col.id
- +
CSV + -->From CSV
@@ -43,8 +43,13 @@ Rows are identified by row._id, columns by col.id
- + + @@ -316,9 +321,15 @@ Rows are identified by row._id, columns by col.id /** Save all changed rows */ saveAllChanges () { let toChange = _.filter(this.rows, (r) => { - return this.isRowChanged(r) + let changed = this.isRowChanged(r) + if (!changed && r._editing) { + this.rows[r._id]._editing = false + } + return changed; }) + if (toChange.length === 0) return; + this.query({ action: 'row.update-many', data: toChange @@ -349,7 +360,13 @@ Rows are identified by row._id, columns by col.id this.$set(this.rows, row._id, row) if (wasDirty) this.dirtyRows-- + }, + + editAll() { + _.each(this.rows, (row, id) => { + this.$set(this.rows[id], '_editing', true) + }) } - } + }, }