Fixes send to trash and delete permanently actions (#60)
This commit is contained in:
parent
9e3ea53a24
commit
535f40139a
|
@ -26,7 +26,7 @@
|
||||||
<b-dropdown-item
|
<b-dropdown-item
|
||||||
@click="deleteSelectedItems()"
|
@click="deleteSelectedItems()"
|
||||||
id="item-delete-selected-items">
|
id="item-delete-selected-items">
|
||||||
{{ $i18n.get('label_delete_selected_items') }}
|
{{ isOnTrash ? $i18n.get('label_delete_permanently') : $i18n.get('label_send_to_trash') }}
|
||||||
</b-dropdown-item>
|
</b-dropdown-item>
|
||||||
<b-dropdown-item disabled>{{ $i18n.get('label_edit_selected_items') + ' (Not ready)' }}
|
<b-dropdown-item disabled>{{ $i18n.get('label_edit_selected_items') + ' (Not ready)' }}
|
||||||
</b-dropdown-item>
|
</b-dropdown-item>
|
||||||
|
|
|
@ -202,7 +202,8 @@ return apply_filters('tainacan-admin-i18n',[
|
||||||
'label_bulk_actions' => __( 'Bulk actions', 'tainacan' ),
|
'label_bulk_actions' => __( 'Bulk actions', 'tainacan' ),
|
||||||
'label_delete_selected_collections' => __( 'Delete selected collections', 'tainacan' ),
|
'label_delete_selected_collections' => __( 'Delete selected collections', 'tainacan' ),
|
||||||
'label_edit_selected_collections' => __( 'Edit selected collections', 'tainacan' ),
|
'label_edit_selected_collections' => __( 'Edit selected collections', 'tainacan' ),
|
||||||
'label_delete_selected_items' => __( 'Delete selected items', 'tainacan' ),
|
'label_delete_permanently' => __( 'Delete permanently', 'tainacan' ),
|
||||||
|
'label_send_to_trash' => __( 'Send to trash', 'tainacan' ),
|
||||||
'label_delete_selected_taxonomies' => __( 'Delete selected taxonomies', 'tainacan' ),
|
'label_delete_selected_taxonomies' => __( 'Delete selected taxonomies', 'tainacan' ),
|
||||||
'label_edit_selected_items' => __( 'Edit selected items', 'tainacan' ),
|
'label_edit_selected_items' => __( 'Edit selected items', 'tainacan' ),
|
||||||
'label_edit_selected_taxonomies' => __( 'Edit selected taxonomies', 'tainacan' ),
|
'label_edit_selected_taxonomies' => __( 'Edit selected taxonomies', 'tainacan' ),
|
||||||
|
|
|
@ -79,8 +79,12 @@ export const fetchItems = ({ rootGetters, dispatch, commit }, { collectionId, is
|
||||||
export const deleteItem = ({ commit }, { itemId, isPermanently }) => {
|
export const deleteItem = ({ commit }, { itemId, isPermanently }) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let endpoint = '/items/' + itemId;
|
let endpoint = '/items/' + itemId;
|
||||||
if (isPermanently)
|
|
||||||
endpoint = endpoint + '?permanently=1'
|
if (isPermanently){
|
||||||
|
endpoint = endpoint + '?permanently=1';
|
||||||
|
} else {
|
||||||
|
endpoint = endpoint + '?permanently=0';
|
||||||
|
}
|
||||||
|
|
||||||
axios.tainacan.delete(endpoint)
|
axios.tainacan.delete(endpoint)
|
||||||
.then( res => {
|
.then( res => {
|
||||||
|
@ -147,8 +151,11 @@ export const fetchCollectionName = ({ commit }, id) => {
|
||||||
export const deleteCollection = ({ commit }, { collectionId, isPermanently }) => {
|
export const deleteCollection = ({ commit }, { collectionId, isPermanently }) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let endpoint = '/collections/' + collectionId;
|
let endpoint = '/collections/' + collectionId;
|
||||||
if (isPermanently)
|
if (isPermanently){
|
||||||
endpoint = endpoint + '?permanently=true'
|
endpoint = endpoint +'?permanently=1';
|
||||||
|
} else {
|
||||||
|
endpoint = endpoint +'?permanently=0';
|
||||||
|
}
|
||||||
|
|
||||||
axios.tainacan.delete(endpoint)
|
axios.tainacan.delete(endpoint)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
|
|
|
@ -25,7 +25,7 @@ export const createTaxonomy = ({commit}, taxonomy) => {
|
||||||
|
|
||||||
export const deleteTaxonomy = ({ commit }, taxonomyId) => {
|
export const deleteTaxonomy = ({ commit }, taxonomyId) => {
|
||||||
return new Promise(( resolve, reject ) => {
|
return new Promise(( resolve, reject ) => {
|
||||||
axios.tainacan.delete(`/taxonomies/${taxonomyId}?permanently=${true}`)
|
axios.tainacan.delete(`/taxonomies/${taxonomyId}?permanently=1`)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
commit('deleteTaxonomy', res.data);
|
commit('deleteTaxonomy', res.data);
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ export const sendTerm = ({commit}, { taxonomyId, name, description, parent, head
|
||||||
|
|
||||||
export const deleteTerm = ({ commit }, { taxonomyId, termId }) => {
|
export const deleteTerm = ({ commit }, { taxonomyId, termId }) => {
|
||||||
return new Promise(( resolve, reject ) => {
|
return new Promise(( resolve, reject ) => {
|
||||||
axios.tainacan.delete(`/taxonomy/${taxonomyId}/terms/${termId}?permanently=${true}`)
|
axios.tainacan.delete(`/taxonomy/${taxonomyId}/terms/${termId}?permanently=1`)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
let term = res.data;
|
let term = res.data;
|
||||||
commit('deleteTerm', termId);
|
commit('deleteTerm', termId);
|
||||||
|
|
Loading…
Reference in New Issue