Skip to content

Commit

Permalink
Updates to track with statamic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmitchell committed Feb 26, 2021
1 parent e5ac9a1 commit 5ee343e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
8 changes: 1 addition & 7 deletions resources/dist/cplisting.js
Original file line number Diff line number Diff line change
Expand Up @@ -767,9 +767,6 @@ __webpack_require__.r(__webpack_exports__);
};
},
computed: {
deletingModalTitle: function deletingModalTitle() {
return this.deletingModalTitleFromRowKey("source");
}
},
methods: {
confirmDeleteRow: function confirmDeleteRow(id, index) {
Expand All @@ -778,16 +775,13 @@ __webpack_require__.r(__webpack_exports__);
index: index
};
},
deletingModalTitleFromRowKey: function deletingModalTitleFromRowKey(key) {
return __("Delete") + " " + this.rows[this.deletingRow.index][key];
},
deleteRow: function deleteRow(resourceRoute, message) {
var _this = this;

var id = this.deletingRow.id;
message = message || __("Deleted");
this.$axios["delete"](cp_url("".concat(resourceRoute, "/").concat(id))).then(function () {
var i = _.indexOf(_this.rows, _.findWhere(_this.rows, {
var i = _.indexOf(_this.items, _.findWhere(_this.items, {
id: id
}));

Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/CPListing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

<confirmation-modal
v-if="deletingRow !== false"
:title="deletingModalTitle"
:title="__('Delete')"
:bodyText="__('Are you sure you want to delete this item?')"
:buttonText="__('Delete')"
:danger="true"
Expand Down
11 changes: 2 additions & 9 deletions resources/js/components/DeletesListingRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,22 @@ export default {
},

computed: {
deletingModalTitle() {
return this.deletingModalTitleFromRowKey("source");
},
},

methods: {
confirmDeleteRow(id, index) {
this.deletingRow = { id, index };
},

deletingModalTitleFromRowKey(key) {
return __("Delete") + " " + this.rows[this.deletingRow.index][key];
},

deleteRow(resourceRoute, message) {
const id = this.deletingRow.id;
message = message || __("Deleted");

this.$axios
.delete(cp_url(`${resourceRoute}/${id}`))
.then(() => {
let i = _.indexOf(this.rows, _.findWhere(this.rows, { id }));
this.rows.splice(i, 1);
let i = _.indexOf(this.items, _.findWhere(this.rows, { id }));
this.items.splice(i, 1);
this.deletingRow = false;
this.$toast.success(message);

Expand Down

0 comments on commit 5ee343e

Please sign in to comment.