Fixes send to trash and delete permanently actions (#60)

This commit is contained in:
weryques 2018-06-22 12:27:04 -03:00
parent 9e3ea53a24
commit 535f40139a
4 changed files with 16 additions and 8 deletions

View File

@ -26,7 +26,7 @@
<b-dropdown-item
@click="deleteSelectedItems()"
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 disabled>{{ $i18n.get('label_edit_selected_items') + ' (Not ready)' }}
</b-dropdown-item>

View File

@ -202,7 +202,8 @@ return apply_filters('tainacan-admin-i18n',[
'label_bulk_actions' => __( 'Bulk actions', 'tainacan' ),
'label_delete_selected_collections' => __( 'Delete 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_edit_selected_items' => __( 'Edit selected items', 'tainacan' ),
'label_edit_selected_taxonomies' => __( 'Edit selected taxonomies', 'tainacan' ),

View File

@ -79,8 +79,12 @@ export const fetchItems = ({ rootGetters, dispatch, commit }, { collectionId, is
export const deleteItem = ({ commit }, { itemId, isPermanently }) => {
return new Promise((resolve, reject) => {
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)
.then( res => {
@ -147,8 +151,11 @@ export const fetchCollectionName = ({ commit }, id) => {
export const deleteCollection = ({ commit }, { collectionId, isPermanently }) => {
return new Promise((resolve, reject) => {
let endpoint = '/collections/' + collectionId;
if (isPermanently)
endpoint = endpoint + '?permanently=true'
if (isPermanently){
endpoint = endpoint +'?permanently=1';
} else {
endpoint = endpoint +'?permanently=0';
}
axios.tainacan.delete(endpoint)
.then(res => {

View File

@ -25,7 +25,7 @@ export const createTaxonomy = ({commit}, taxonomy) => {
export const deleteTaxonomy = ({ commit }, taxonomyId) => {
return new Promise(( resolve, reject ) => {
axios.tainacan.delete(`/taxonomies/${taxonomyId}?permanently=${true}`)
axios.tainacan.delete(`/taxonomies/${taxonomyId}?permanently=1`)
.then(res => {
commit('deleteTaxonomy', res.data);
@ -139,7 +139,7 @@ export const sendTerm = ({commit}, { taxonomyId, name, description, parent, head
export const deleteTerm = ({ commit }, { taxonomyId, termId }) => {
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 => {
let term = res.data;
commit('deleteTerm', termId);