From 430b57c135f830388d7873d5a871f686ee977303 Mon Sep 17 00:00:00 2001 From: weryques Date: Wed, 13 Jun 2018 09:29:54 -0300 Subject: [PATCH] Rename category to taxonomy and categories to taxonomies --- .../integration/repository/category_spec.js | 130 +++--- .../collection/field/field_category_spec.js | 80 ++-- docs/class-reference-fields.md | 10 +- docs/key-concepts.md | 4 +- docs/permissions.md | 2 +- .../edition/category-edition-form.vue | 370 ------------------ .../components/edition/term-edition-form.vue | 10 +- .../components/lists/categories-list.vue | 287 -------------- src/admin/components/lists/terms-list.vue | 28 +- .../components/navigation/primary-menu.vue | 2 +- .../navigation/tainacan-subheader.vue | 12 +- .../components/navigation/tainacan-title.vue | 12 +- src/admin/js/main.js | 20 +- src/admin/js/router.js | 14 +- src/admin/js/theme-main.js | 20 +- src/admin/js/utilities.js | 28 +- src/admin/pages/lists/categories-page.vue | 236 ----------- src/admin/pages/singles/category-page.vue | 62 --- src/admin/tainacan-admin-i18n.php | 52 +-- .../entities/class-tainacan-metadatum.php | 8 +- .../filter-types/category/Checkbox.vue | 129 ------ .../filter-types/category/Selectbox.vue | 131 ------- .../filter-types/category/Taginput.vue | 142 ------- .../class-tainacan-categorycheckbox.php | 27 -- .../class-tainacan-categoryselectbox.php | 27 -- .../class-tainacan-categorytaginput.php | 27 -- .../metadata-types/category/AddNewTerm.vue | 132 ------- .../metadata-types/category/Category.vue | 144 ------- .../category/CategoryCheckbox.vue | 55 --- .../metadata-types/category/CategoryRadio.vue | 51 --- .../category/CategorySelectbox.vue | 60 --- .../category/CategoryTaginput.vue | 83 ---- .../metadata-types/category/FormCategory.vue | 197 ---------- .../category/class-tainacan-category.php | 180 --------- .../metadata-types/tainacan-form-item.vue | 2 +- .../repositories/class-tainacan-metadata.php | 18 +- src/classes/tainacan-creator.php | 12 +- src/importer/class-tainacan-old-tainacan.php | 28 +- src/importer/class-tainacan-test-importer.php | 4 +- src/js/store/modules/category/actions.js | 184 --------- src/js/store/modules/category/getters.js | 15 - src/js/store/modules/category/index.js | 18 - src/js/store/modules/category/mutations.js | 44 --- src/js/store/store.js | 4 +- src/languages/tainacan-pt_BR.po | 64 +-- src/migrate-post-type.php | 100 +++-- tests/test-category-metadatum-types.php | 16 +- tests/test-compound-metadatum-types.php | 14 +- 48 files changed, 356 insertions(+), 2939 deletions(-) delete mode 100644 src/admin/components/edition/category-edition-form.vue delete mode 100644 src/admin/components/lists/categories-list.vue delete mode 100644 src/admin/pages/lists/categories-page.vue delete mode 100644 src/admin/pages/singles/category-page.vue delete mode 100644 src/classes/filter-types/category/Checkbox.vue delete mode 100644 src/classes/filter-types/category/Selectbox.vue delete mode 100644 src/classes/filter-types/category/Taginput.vue delete mode 100644 src/classes/filter-types/category/class-tainacan-categorycheckbox.php delete mode 100644 src/classes/filter-types/category/class-tainacan-categoryselectbox.php delete mode 100644 src/classes/filter-types/category/class-tainacan-categorytaginput.php delete mode 100644 src/classes/metadata-types/category/AddNewTerm.vue delete mode 100644 src/classes/metadata-types/category/Category.vue delete mode 100644 src/classes/metadata-types/category/CategoryCheckbox.vue delete mode 100644 src/classes/metadata-types/category/CategoryRadio.vue delete mode 100644 src/classes/metadata-types/category/CategorySelectbox.vue delete mode 100644 src/classes/metadata-types/category/CategoryTaginput.vue delete mode 100644 src/classes/metadata-types/category/FormCategory.vue delete mode 100644 src/classes/metadata-types/category/class-tainacan-category.php delete mode 100644 src/js/store/modules/category/actions.js delete mode 100644 src/js/store/modules/category/getters.js delete mode 100644 src/js/store/modules/category/index.js delete mode 100644 src/js/store/modules/category/mutations.js diff --git a/cypress/integration/repository/category_spec.js b/cypress/integration/repository/category_spec.js index 79a5835bc..f88db82ed 100644 --- a/cypress/integration/repository/category_spec.js +++ b/cypress/integration/repository/category_spec.js @@ -1,4 +1,4 @@ -describe('Category test', function () { +describe('Taxonomy test', function () { beforeEach(() => { cy.loginByUI() }) @@ -8,100 +8,100 @@ describe('Category test', function () { }) context('CRUD Taxonomies', function(){ - it('canceled create category', function(){ - cy.visit('/wp-admin/admin.php?page=tainacan_admin#/categories') - cy.location('hash').should('eq', '#/categories') - //cy.get('#button-category-creation').click() + it('canceled create taxonomy', function(){ + cy.visit('/wp-admin/admin.php?page=tainacan_admin#/taxonomies') + cy.location('hash').should('eq', '#/taxonomies') + //cy.get('#button-taxonomy-creation').click() cy.get('.button').click() - cy.location('hash').should('eq', '#/categories/new') - cy.get('#tainacan-text-name').type('Category canceled') - cy.get('#tainacan-text-description').type('description category canceled') + cy.location('hash').should('eq', '#/taxonomies/new') + cy.get('#tainacan-text-name').type('Taxonomy canceled') + cy.get('#tainacan-text-description').type('description taxonomy canceled') cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish') - cy.get('#button-cancel-category-creation').click() - cy.location('hash').should('eq', '#/categories/') + cy.get('#button-cancel-taxonomy-creation').click() + cy.location('hash').should('eq', '#/taxonomies/') cy.get('td').should('not.contain', 'Book canceled') }) - it('create category with status publish', function(){ - cy.visit('/wp-admin/admin.php?page=tainacan_admin#/categories') - cy.location('hash').should('eq', '#/categories') - //cy.get('#button-category-creation').click() + it('create taxonomy with status publish', function(){ + cy.visit('/wp-admin/admin.php?page=tainacan_admin#/taxonomies') + cy.location('hash').should('eq', '#/taxonomies') + //cy.get('#button-taxonomy-creation').click() cy.get('.button').click() - cy.location('hash').should('eq', '#/categories/new') - cy.get('#tainacan-text-name').type('Category publish') - cy.get('#tainacan-text-description').type('description category publish') + cy.location('hash').should('eq', '#/taxonomies/new') + cy.get('#tainacan-text-name').type('Taxonomy publish') + cy.get('#tainacan-text-description').type('description taxonomy publish') cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish') - cy.get('#button-submit-category-creation').click() - cy.location('hash').should('eq', '#/categories/') - cy.get('td').should('contain', 'Category publish') + cy.get('#button-submit-taxonomy-creation').click() + cy.location('hash').should('eq', '#/taxonomies/') + cy.get('td').should('contain', 'Taxonomy publish') }) - it('create category with status private', function(){ - cy.visit('/wp-admin/admin.php?page=tainacan_admin#/categories') - cy.location('hash').should('eq', '#/categories') - //cy.get('#button-category-creation').click() + it('create taxonomy with status private', function(){ + cy.visit('/wp-admin/admin.php?page=tainacan_admin#/taxonomies') + cy.location('hash').should('eq', '#/taxonomies') + //cy.get('#button-taxonomy-creation').click() cy.get('.button').click() - cy.location('hash').should('eq', '#/categories/new') - cy.get('#tainacan-text-name').type('Category private') - cy.get('#tainacan-text-description').type('description category private') + cy.location('hash').should('eq', '#/taxonomies/new') + cy.get('#tainacan-text-name').type('Taxonomy private') + cy.get('#tainacan-text-description').type('description taxonomy private') cy.get('#tainacan-select-status').select('Private').should('have.value', 'private') - cy.get('#button-submit-category-creation').click() - cy.location('hash').should('eq', '#/categories/') - cy.get('td').should('contain', 'Category private') + cy.get('#button-submit-taxonomy-creation').click() + cy.location('hash').should('eq', '#/taxonomies/') + cy.get('td').should('contain', 'Taxonomy private') }) - it('create category with status draft', function(){ - cy.visit('/wp-admin/admin.php?page=tainacan_admin#/categories') - cy.location('hash').should('eq', '#/categories') - //cy.get('#button-category-creation').click() + it('create taxonomy with status draft', function(){ + cy.visit('/wp-admin/admin.php?page=tainacan_admin#/taxonomies') + cy.location('hash').should('eq', '#/taxonomies') + //cy.get('#button-taxonomy-creation').click() cy.get('.button').click() - cy.location('hash').should('eq', '#/categories/new') - cy.get('#tainacan-text-name').type('Category draft') - cy.get('#tainacan-text-description').type('description category draft') + cy.location('hash').should('eq', '#/taxonomies/new') + cy.get('#tainacan-text-name').type('Taxonomy draft') + cy.get('#tainacan-text-description').type('description taxonomy draft') cy.get('#tainacan-select-status').select('Draft').should('have.value', 'draft') - cy.get('#button-submit-category-creation').click() - cy.location('hash').should('eq', '#/categories/') - cy.get('td').should('not.contain', 'Category draft') + cy.get('#button-submit-taxonomy-creation').click() + cy.location('hash').should('eq', '#/taxonomies/') + cy.get('td').should('not.contain', 'Taxonomy draft') }) - it('create category with status draft', function(){ - cy.visit('/wp-admin/admin.php?page=tainacan_admin#/categories') - cy.location('hash').should('eq', '#/categories') - //cy.get('#button-category-creation').click() + it('create taxonomy with status draft', function(){ + cy.visit('/wp-admin/admin.php?page=tainacan_admin#/taxonomies') + cy.location('hash').should('eq', '#/taxonomies') + //cy.get('#button-taxonomy-creation').click() cy.get('.button').click() - cy.location('hash').should('eq', '#/categories/new') - cy.get('#tainacan-text-name').type('Category trash') - cy.get('#tainacan-text-description').type('description category trash') + cy.location('hash').should('eq', '#/taxonomies/new') + cy.get('#tainacan-text-name').type('Taxonomy trash') + cy.get('#tainacan-text-description').type('description taxonomy trash') cy.get('#tainacan-select-status').select('Trash').should('have.value', 'trash') - cy.get('#button-submit-category-creation').click() - cy.location('hash').should('eq', '#/categories/') - cy.get('td').should('not.contain', 'Category trash') + cy.get('#button-submit-taxonomy-creation').click() + cy.location('hash').should('eq', '#/taxonomies/') + cy.get('td').should('not.contain', 'Taxonomy trash') }) - it('create category color', function(){ - cy.visit('/wp-admin/admin.php?page=tainacan_admin#/categories') - cy.location('hash').should('eq', '#/categories') - //cy.get('#button-category-creation').click() + it('create taxonomy color', function(){ + cy.visit('/wp-admin/admin.php?page=tainacan_admin#/taxonomies') + cy.location('hash').should('eq', '#/taxonomies') + //cy.get('#button-taxonomy-creation').click() cy.get('.button').click() - cy.location('hash').should('eq', '#/categories/new') - cy.get('#tainacan-text-name').type('Category color') - cy.get('#tainacan-text-description').type('description category color') + cy.location('hash').should('eq', '#/taxonomies/new') + cy.get('#tainacan-text-name').type('Taxonomy color') + cy.get('#tainacan-text-description').type('description taxonomy color') cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish') - cy.get('#button-submit-category-creation').click() - cy.location('hash').should('eq', '#/categories/') - cy.get('td').should('contain', 'Category color') + cy.get('#button-submit-taxonomy-creation').click() + cy.location('hash').should('eq', '#/taxonomies/') + cy.get('td').should('contain', 'Taxonomy color') }) - it('delete category color', function(){ - cy.visit('/wp-admin/admin.php?page=tainacan_admin#/categories') - cy.location('hash').should('eq', '#/categories') + it('delete taxonomy color', function(){ + cy.visit('/wp-admin/admin.php?page=tainacan_admin#/taxonomies') + cy.location('hash').should('eq', '#/taxonomies') cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click() - cy.get('.b-table').should('contain', 'Category trash') + cy.get('.b-table').should('contain', 'Taxonomy trash') cy.get(':nth-child(1) > [data-label="Actions"] > :nth-child(1) > #button-delete > .icon > .mdi').click() cy.get('.modal-card').should('have.class', 'animation-content') cy.get('.is-primary').click() cy.get('.breadcrumbs > :nth-child(3) > .router-link-active').click() - cy.get('.b-table').should('not.contain', 'Category trash') + cy.get('.b-table').should('not.contain', 'Taxonomy trash') }) }) }) diff --git a/cypress/integration/repository/collection/field/field_category_spec.js b/cypress/integration/repository/collection/field/field_category_spec.js index acc54edeb..bb3ab4343 100644 --- a/cypress/integration/repository/collection/field/field_category_spec.js +++ b/cypress/integration/repository/collection/field/field_category_spec.js @@ -1,4 +1,4 @@ -context('Category field test', function(){ +context('Taxonomy field test', function(){ beforeEach(() => { cy.loginByUI() }) @@ -27,40 +27,40 @@ context('Category field test', function(){ cy.get('#tainacan-text-name').type('Cat 1') cy.get('#tainacan-text-description').type('description cat 1') cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish') - cy.get('#button-submit-category-creation').click() + cy.get('#button-submit-taxonomy-creation').click() cy.get('.page-container').should('contain', 'Cat 1') cy.get('.button').click() cy.get('#tainacan-text-name').type('Cat 2') cy.get('#tainacan-text-description').type('description cat 2') cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish') - cy.get('#button-submit-category-creation').click() + cy.get('#button-submit-taxonomy-creation').click() cy.get('.page-container').should('contain', 'Cat 2') cy.get('.button').click() cy.get('#tainacan-text-name').type('Cat 3') cy.get('#tainacan-text-description').type('description cat 3') cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish') - cy.get('#button-submit-category-creation').click() + cy.get('#button-submit-taxonomy-creation').click() cy.get('.page-container').should('contain', 'Cat 3') cy.get('.button').click() cy.get('#tainacan-text-name').type('Cat 4') cy.get('#tainacan-text-description').type('description cat 4') cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish') - cy.get('#button-submit-category-creation').click() + cy.get('#button-submit-taxonomy-creation').click() cy.get('.page-container').should('contain', 'Cat 4') cy.get('.button').click() cy.get('#tainacan-text-name').type('Cat 5') cy.get('#tainacan-text-description').type('description cat 5') cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish') - cy.get('#button-submit-category-creation').click() + cy.get('#button-submit-taxonomy-creation').click() cy.get('.page-container').should('contain', 'Cat 5') cy.get('#tainacan-text-name').type('Cat 6') cy.get('#tainacan-text-description').type('description cat 6') cy.get('#tainacan-select-status').select('Publish').should('have.value', 'publish') - cy.get('#button-submit-category-creation').click() + cy.get('#button-submit-taxonomy-creation').click() cy.get('.page-container').should('contain', 'Cat 6') }) - it('canceled create category-type field public', function(){ + it('canceled create taxonomy-type field public', function(){ cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections') cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() @@ -69,14 +69,14 @@ context('Category field test', function(){ cy.get('h1').should('contain', 'Collection Fields Edition Page') cy.get('.field > :nth-child(2) > :nth-child(7)').click() cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear() - cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('category name canceled') + cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('taxonomy name canceled') cy.get('.textarea').type('name book canceled description') cy.get('#tainacan-select-status-publish > .check').click() cy.get(':nth-child(1) > .button').click() - cy.get('.active-fields-area >').should('not.contain', 'category name canceled') + cy.get('.active-fields-area >').should('not.contain', 'taxonomy name canceled') }) - it('create category-type field public - input type = radio', function(){ + it('create taxonomy-type field public - input type = radio', function(){ cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections') cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() @@ -85,16 +85,16 @@ context('Category field test', function(){ cy.get('h1').should('contain', 'Collection Fields Edition Page') cy.get('.field > :nth-child(2) > :nth-child(7)').click() cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear() - cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('category name public') + cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('taxonomy name public') cy.get('.textarea').type('name book description') cy.get('#tainacan-select-status-publish > .check').click() cy.get(':nth-child(1) > .control > .select > select').select('Cat 1') - cy.get(':nth-child(2) > .control > .select > select').select('Radio').should('have.value', 'tainacan-category-radio') + cy.get(':nth-child(2) > .control > .select > select').select('Radio').should('have.value', 'tainacan-taxonomy-radio') cy.get(':nth-child(2) > .button').click() - cy.get('.active-fields-area >').should('contain', 'category name public') + cy.get('.active-fields-area >').should('contain', 'taxonomy name public') }) - it('create category-type field public - input type = selectbox', function(){ + it('create taxonomy-type field public - input type = selectbox', function(){ cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections') cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() @@ -103,16 +103,16 @@ context('Category field test', function(){ cy.get('h1').should('contain', 'Collection Fields Edition Page') cy.get('.field > :nth-child(2) > :nth-child(7)').click() cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear() - cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('category name public') + cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('taxonomy name public') cy.get('.textarea').type('name book description') cy.get('#tainacan-select-status-publish > .check').click() cy.get(':nth-child(1) > .control > .select > select').select('Cat 1') - cy.get(':nth-child(2) > .control > .select > select').select('Selectbox').should('have.value', 'tainacan-category-selectbox') + cy.get(':nth-child(2) > .control > .select > select').select('Selectbox').should('have.value', 'tainacan-taxonomy-selectbox') cy.get(':nth-child(2) > .button').click() - cy.get('.active-fields-area >').should('contain', 'category name public') + cy.get('.active-fields-area >').should('contain', 'taxonomy name public') }) - it('create category-type field private', function(){ + it('create taxonomy-type field private', function(){ cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections') cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() @@ -121,16 +121,16 @@ context('Category field test', function(){ cy.get('h1').should('contain', 'Collection Fields Edition Page') cy.get('.field > :nth-child(2) > :nth-child(7)').click() cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear() - cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('category name private') + cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('taxonomy name private') cy.get('.textarea').type('name book description') cy.get('#tainacan-select-status-private > .check').click() cy.get(':nth-child(1) > .control > .select > select').select('Cat 2') - cy.get(':nth-child(2) > .control > .select > select').select('Radio').should('have.value', 'tainacan-category-radio') + cy.get(':nth-child(2) > .control > .select > select').select('Radio').should('have.value', 'tainacan-taxonomy-radio') cy.get(':nth-child(2) > .button').click() - cy.get('.active-fields-area >').should('contain', 'category name private') + cy.get('.active-fields-area >').should('contain', 'taxonomy name private') }) - it('create category-type field public required', function(){ + it('create taxonomy-type field public required', function(){ cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections') cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() @@ -139,16 +139,16 @@ context('Category field test', function(){ cy.get('h1').should('contain', 'Collection Fields Edition Page') cy.get('.field > :nth-child(2) > :nth-child(7)').click() cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear() - cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('category name public required') + cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('taxonomy name public required') cy.get('.textarea').type('name book description required') cy.get('#tainacan-select-status-publish > .check').click() cy.get(':nth-child(1) > .control > .select > select').select('Cat 3') - cy.get(':nth-child(2) > .control > .select > select').select('Radio').should('have.value', 'tainacan-category-radio') + cy.get(':nth-child(2) > .control > .select > select').select('Radio').should('have.value', 'tainacan-taxonomy-radio') cy.get(':nth-child(2) > .button').click() - cy.get('.active-fields-area >').should('contain', 'category name public required') + cy.get('.active-fields-area >').should('contain', 'taxonomy name public required') }) - it('create category-type field public multiple values', function(){ + it('create taxonomy-type field public multiple values', function(){ cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections') cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() @@ -157,16 +157,16 @@ context('Category field test', function(){ cy.get('h1').should('contain', 'Collection Fields Edition Page') cy.get('.field > :nth-child(2) > :nth-child(7)').click() cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear() - cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('category name public multiple values') + cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('taxonomy name public multiple values') cy.get('.textarea').type('name book description multiple values') cy.get('#tainacan-select-status-publish > .check').click() cy.get(':nth-child(1) > .control > .select > select').select('Cat 4') - cy.get(':nth-child(2) > .control > .select > select').select('Radio').should('have.value', 'tainacan-category-radio') + cy.get(':nth-child(2) > .control > .select > select').select('Radio').should('have.value', 'tainacan-taxonomy-radio') cy.get(':nth-child(2) > .button').click() - cy.get('.active-fields-area >').should('contain', 'category name public multiple values') + cy.get('.active-fields-area >').should('contain', 'taxonomy name public multiple values') }) - it('create category-type field public unique values', function(){ + it('create taxonomy-type field public unique values', function(){ cy.visit('/wp-admin/admin.php?page=tainacan_admin#/collections') cy.location('hash').should('eq', '#/collections') cy.get('[data-label="Name"] > :nth-child(1) > .clickable-row').click() @@ -175,13 +175,13 @@ context('Category field test', function(){ cy.get('h1').should('contain', 'Collection Fields Edition Page') cy.get('.field > :nth-child(2) > :nth-child(7)').click() cy.get('#fieldEditForm > :nth-child(1) > .control > .input').clear() - cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('category name public unique values') + cy.get('#fieldEditForm > :nth-child(1) > .control > .input').type('taxonomy name public unique values') cy.get('.textarea').type('name book description multiple values') cy.get('#tainacan-select-status-publish > .check').click() cy.get(':nth-child(1) > .control > .select > select').select('Cat 5') - cy.get(':nth-child(2) > .control > .select > select').select('Radio').should('have.value', 'tainacan-category-radio') + cy.get(':nth-child(2) > .control > .select > select').select('Radio').should('have.value', 'tainacan-taxonomy-radio') cy.get(':nth-child(2) > .button').click() - cy.get('.active-fields-area >').should('contain', 'category name public unique values') + cy.get('.active-fields-area >').should('contain', 'taxonomy name public unique values') }) it('check if fields are updated to page', function(){ @@ -191,11 +191,11 @@ context('Category field test', function(){ cy.get(':nth-child(4) > .router-link-active').should('contain', 'Items') cy.get('.menu > :nth-child(2) > :nth-child(7) > a').click() cy.get('h1').should('contain', 'Collection Fields Edition Page') - cy.get('.active-fields-area >').should('not.contain', 'category name canceled') - cy.get('.active-fields-area >').should('contain', 'category name public') - cy.get('.active-fields-area >').should('contain', 'category name private') - cy.get('.active-fields-area >').should('contain', 'category name public required') - cy.get('.active-fields-area >').should('contain', 'category name public multiple values') - cy.get('.active-fields-area >').should('contain', 'category name public unique values') + cy.get('.active-fields-area >').should('not.contain', 'taxonomy name canceled') + cy.get('.active-fields-area >').should('contain', 'taxonomy name public') + cy.get('.active-fields-area >').should('contain', 'taxonomy name private') + cy.get('.active-fields-area >').should('contain', 'taxonomy name public required') + cy.get('.active-fields-area >').should('contain', 'taxonomy name public multiple values') + cy.get('.active-fields-area >').should('contain', 'taxonomy name public unique values') }) }) diff --git a/docs/class-reference-fields.md b/docs/class-reference-fields.md index 32e3f3437..45beea315 100644 --- a/docs/class-reference-fields.md +++ b/docs/class-reference-fields.md @@ -175,18 +175,18 @@ Fetch all values of a metadatum from a collection in all it collection items **Returns:** array|null|object -### `private function pre_update_category_field($metadatum)` +### `private function pre_update_taxonomy_field($metadatum)` -Stores the value of the taxonomy_id option to use on update_category_field method. +Stores the value of the taxonomy_id option to use on update_taxonomy_field method. -### `private function update_category_field($metadatum)` +### `private function update_taxonomy_field($metadatum)` -Triggers hooks when saving a Category Metadatum, indicating wich taxonomy was added or removed from a collection. +Triggers hooks when saving a Taxonomy Metadatum, indicating wich taxonomy was added or removed from a collection. -This is used by Taxonomies repository to update the collections_ids property of the taxonomy as a metadatum type category is inserted or removed +This is used by Taxonomies repository to update the collections_ids property of the taxonomy as a metadatum type taxonomy is inserted or removed **Parameters:** diff --git a/docs/key-concepts.md b/docs/key-concepts.md index 287149ab4..3e038444f 100644 --- a/docs/key-concepts.md +++ b/docs/key-concepts.md @@ -11,7 +11,7 @@ The typical workflow when you create a Digital Repository with Tainacan is: A collection is a group of items, that share the same set of metadata. Every item uploaded to your digital repository will be part of a collection - and only one collection. For instance, you could have a "paintings" collections, with metadata such as Title, Author, Country, Tecnique, etc and another collection for "films", with Title, Director, Country and Genre. -For each collection you can set a different set of metadata and they can share common categories, which means you could browse for items in a specific Country, and get both paintings and films in your results. +For each collection you can set a different set of metadata and they can share common taxonomies, which means you could browse for items in a specific Country, and get both paintings and films in your results. Collections can also have child collections, which will inherit parent's collection metadata and can add their own set of additional information. @@ -69,7 +69,7 @@ Taxonomies can be created and used to classify items. Typical Taxonomies are Gen In WordPress language, they are Custom Taxonomies, and they can be shared among many collections. -Each Category has a set of terms. For example, the category Genre may have terms like "drama" and "comedy". +Each Taxonomy has a set of terms. For example, the taxonomy Genre may have terms like "drama" and "comedy". Terms can have hierarchy, which means that when you browse for items that have a parente term (for instance, "Rock"), the results will include items that have any of the child terms (for instance, "Progressive Rock" and "Classic Rock"). diff --git a/docs/permissions.md b/docs/permissions.md index f428a2fd3..64f8f5ec8 100644 --- a/docs/permissions.md +++ b/docs/permissions.md @@ -207,7 +207,7 @@ Who's got it: Administrators, Editors and Tainacan Editors Allows to view Items marked as private and its items. -### Categories +### Taxonomies ### Metadata diff --git a/src/admin/components/edition/category-edition-form.vue b/src/admin/components/edition/category-edition-form.vue deleted file mode 100644 index 316496563..000000000 --- a/src/admin/components/edition/category-edition-form.vue +++ /dev/null @@ -1,370 +0,0 @@ - - - - - diff --git a/src/admin/components/edition/term-edition-form.vue b/src/admin/components/edition/term-edition-form.vue index 593518966..85e321b49 100644 --- a/src/admin/components/edition/term-edition-form.vue +++ b/src/admin/components/edition/term-edition-form.vue @@ -121,21 +121,21 @@ }, props: { editForm: Object, - categoryId: '' + taxonomyId: '' }, methods: { - ...mapActions('category', [ + ...mapActions('taxonomy', [ 'sendTerm', 'updateTerm', ]), - ...mapGetters('category', [ + ...mapGetters('taxonomy', [ 'getTerms' ]), saveEdition(term) { if (term.id === 'new') { this.sendTerm({ - categoryId: this.categoryId, + taxonomyId: this.taxonomyId, name: this.editForm.name, description: this.editForm.description, parent: this.editForm.parent, @@ -157,7 +157,7 @@ } else { this.updateTerm({ - categoryId: this.categoryId, + taxonomyId: this.taxonomyId, termId: this.editForm.id, name: this.editForm.name, description: this.editForm.description, diff --git a/src/admin/components/lists/categories-list.vue b/src/admin/components/lists/categories-list.vue deleted file mode 100644 index 503cad1bf..000000000 --- a/src/admin/components/lists/categories-list.vue +++ /dev/null @@ -1,287 +0,0 @@ - - - - - - - diff --git a/src/admin/components/lists/terms-list.vue b/src/admin/components/lists/terms-list.vue index 770dd48ea..bbe6f837b 100644 --- a/src/admin/components/lists/terms-list.vue +++ b/src/admin/components/lists/terms-list.vue @@ -2,7 +2,7 @@
+ :label="$i18n.get('label_taxonomy_terms')"> --> @@ -69,7 +69,7 @@
{ }) @@ -250,7 +250,7 @@ export default { for (let orphanTerm of this.termsList) { if (orphanTerm.parent == term.id) { this.updateTerm({ - categoryId: this.categoryId, + taxonomyId: this.taxonomyId, termId: orphanTerm.id, name: orphanTerm.name, description: orphanTerm.description, @@ -314,7 +314,7 @@ export default { }, loadTerms() { this.isLoadingTerms = true; - this.fetchTerms(this.categoryId) + this.fetchTerms(this.taxonomyId) .then(() => { // Fill this.form data with current data. this.isLoadingTerms = false; @@ -326,7 +326,7 @@ export default { } }, created() { - if (this.categoryId !== String) { + if (this.taxonomyId !== String) { this.loadTerms(); } } diff --git a/src/admin/components/navigation/primary-menu.vue b/src/admin/components/navigation/primary-menu.vue index 3a55412cc..a10837a7e 100644 --- a/src/admin/components/navigation/primary-menu.vue +++ b/src/admin/components/navigation/primary-menu.vue @@ -61,7 +61,7 @@ - {{ $i18n.getFrom('categories', 'name') }} + {{ $i18n.getFrom('taxonomies', 'name') }}
  • diff --git a/src/admin/components/navigation/tainacan-subheader.vue b/src/admin/components/navigation/tainacan-subheader.vue index 87aa91ad5..2e11598e0 100644 --- a/src/admin/components/navigation/tainacan-subheader.vue +++ b/src/admin/components/navigation/tainacan-subheader.vue @@ -141,11 +141,11 @@ export default { ...mapGetters('item', [ 'getItemTitle' ]), - ...mapActions('category', [ - 'fetchCategoryName' + ...mapActions('taxonomy', [ + 'fetchTaxonomyName' ]), - ...mapGetters('category', [ - 'getCategoryName' + ...mapGetters('taxonomy', [ + 'getTaxonomyName' ]), ...mapActions('event', [ 'fetchEventTitle' @@ -171,8 +171,8 @@ export default { .catch((error) => this.$console.error(error)); break; case 'taxonomies': - this.fetchCategoryName(this.arrayRealPath[i]) - .then(categoryName => this.arrayViewPath.splice(i, 1, categoryName)) + this.fetchTaxonomyName(this.arrayRealPath[i]) + .then(taxonomyName => this.arrayViewPath.splice(i, 1, taxonomyName)) .catch((error) => this.$console.error(error)); break; case 'events': diff --git a/src/admin/components/navigation/tainacan-title.vue b/src/admin/components/navigation/tainacan-title.vue index fea7fd533..af5d3bc43 100644 --- a/src/admin/components/navigation/tainacan-title.vue +++ b/src/admin/components/navigation/tainacan-title.vue @@ -58,11 +58,11 @@ export default { ...mapGetters('item', [ 'getItemTitle' ]), - ...mapActions('category', [ - 'fetchCategoryName' + ...mapActions('taxonomy', [ + 'fetchTaxonomyName' ]), - ...mapGetters('category', [ - 'getCategoryName' + ...mapGetters('taxonomy', [ + 'getTaxonomyName' ]), ...mapActions('event', [ 'fetchEventTitle' @@ -87,8 +87,8 @@ export default { .catch((error) => this.$console.error(error)); break; case 'taxonomies': - this.fetchCategoryName(this.arrayRealPath[i]) - .then(categoryName => this.arrayViewPath.splice(i, 1, categoryName)) + this.fetchTaxonomyName(this.arrayRealPath[i]) + .then(taxonomyName => this.arrayViewPath.splice(i, 1, taxonomyName)) .catch((error) => this.$console.error(error)); break; case 'events': diff --git a/src/admin/js/main.js b/src/admin/js/main.js index e69727042..c38f94b65 100644 --- a/src/admin/js/main.js +++ b/src/admin/js/main.js @@ -14,10 +14,10 @@ import Selectbox from '../../classes/metadata-types/selectbox/Selectbox.vue'; import Numeric from '../../classes/metadata-types/numeric/Numeric.vue'; import Date from '../../classes/metadata-types/date/Date.vue'; import Relationship from '../../classes/metadata-types/relationship/Relationship.vue'; -import Category from '../../classes/metadata-types/category/Category.vue'; +import Taxonomy from '../../classes/metadata-types/taxonomy/Taxonomy.vue'; import FormRelationship from '../../classes/metadata-types/relationship/FormRelationship.vue'; -import FormCategory from '../../classes/metadata-types/category/FormCategory.vue'; +import FormTaxonomy from '../../classes/metadata-types/taxonomy/FormTaxonomy.vue'; import FormSelectbox from '../../classes/metadata-types/selectbox/FormSelectbox.vue'; import FilterCustomInterval from '../../classes/filter-types/custom-interval/CustomInterval.vue'; @@ -26,9 +26,9 @@ import FilterAutocomplete from '../../classes/filter-types/autocomplete/Autocomp import FilterCheckbox from '../../classes/filter-types/checkbox/Checkbox.vue'; import FilterTaginput from '../../classes/filter-types/taginput/Taginput.vue'; -import FilterCategoryCheckbox from '../../classes/filter-types/category/Checkbox.vue'; -import FilterCategoryTaginput from '../../classes/filter-types/category/Taginput.vue'; -import FilterCategorySelectbox from '../../classes/filter-types/category/Selectbox.vue'; +import FilterTaxonomyCheckbox from '../../classes/filter-types/taxonomy/Checkbox.vue'; +import FilterTaxonomyTaginput from '../../classes/filter-types/taxonomy/Taginput.vue'; +import FilterTaxonomySelectbox from '../../classes/filter-types/taxonomy/Selectbox.vue'; import TainacanFormItem from '../../classes/metadata-types/tainacan-form-item.vue'; import TainacanFiltersList from '../../classes/filter-types/tainacan-filter-item.vue'; @@ -61,10 +61,10 @@ Vue.component('tainacan-selectbox', Selectbox); Vue.component('tainacan-numeric', Numeric); Vue.component('tainacan-date', Date); Vue.component('tainacan-relationship', Relationship); -Vue.component('tainacan-category', Category); +Vue.component('tainacan-taxonomy', Taxonomy); Vue.component('tainacan-form-relationship', FormRelationship); -Vue.component('tainacan-form-category', FormCategory); +Vue.component('tainacan-form-taxonomy', FormTaxonomy); Vue.component('tainacan-form-selectbox', FormSelectbox); Vue.component('tainacan-form-item', TainacanFormItem); Vue.component('tainacan-filter-item', TainacanFiltersList); @@ -75,9 +75,9 @@ Vue.component('tainacan-filter-selectbox', FilterSelectbox); Vue.component('tainacan-filter-autocomplete', FilterAutocomplete); Vue.component('tainacan-filter-checkbox', FilterCheckbox); Vue.component('tainacan-filter-taginput', FilterTaginput); -Vue.component('tainacan-filter-category-checkbox', FilterCategoryCheckbox); -Vue.component('tainacan-filter-category-taginput', FilterCategoryTaginput); -Vue.component('tainacan-filter-category-selectbox', FilterCategorySelectbox); +Vue.component('tainacan-filter-taxonomy-checkbox', FilterTaxonomyCheckbox); +Vue.component('tainacan-filter-taxonomy-taginput', FilterTaxonomyTaginput); +Vue.component('tainacan-filter-taxonomy-selectbox', FilterTaxonomySelectbox); /* Others */ Vue.component('help-button', HelpButton); diff --git a/src/admin/js/router.js b/src/admin/js/router.js index 76c60f5a5..97a5e57c6 100644 --- a/src/admin/js/router.js +++ b/src/admin/js/router.js @@ -9,15 +9,15 @@ import ItemsPage from '../pages/lists/items-page.vue' import ItemPage from '../pages/singles/item-page.vue' import MetadataPage from '../pages/lists/metadata-page.vue' import FiltersPage from '../pages/lists/filters-page.vue' -import CategoriesPage from '../pages/lists/categories-page.vue' -import CategoryPage from '../pages/singles/category-page.vue' +import CategoriesPage from '../pages/lists/taxonomies-page.vue' +import TaxonomyPage from '../pages/singles/taxonomy-page.vue' import EventsPage from '../pages/lists/events-page.vue' import EventPage from '../pages/singles/event-page.vue' // Edition Form Components import CollectionEditionForm from '../components/edition/collection-edition-form.vue' import ItemEditionForm from '../components/edition/item-edition-form.vue' -import CategoryEditionForm from '../components/edition/category-edition-form.vue' +import TaxonomyEditionForm from '../components/edition/taxonomy-edition-form.vue' // Listing components import FiltersList from '../components/lists/filters-list.vue' @@ -58,10 +58,10 @@ const routes = [ { path: '/metadata', name: 'MetadataPage', component: MetadataPage, meta: {title: i18nGet('title_repository_metadata_page'), icon: 'format-list-checks'} }, - { path: '/taxonomies', name: 'CategoriesPage', component: CategoriesPage, meta: {title: i18nGet('title_categories_page'), icon: 'shape'} }, - { path: '/taxonomies/new', name: 'CategoryCreationForm', component: CategoryEditionForm, meta: {title: i18nGet('title_create_category_page'), icon: 'shape'} }, - { path: '/taxonomies/:categoryId/edit', name: 'CategoryEditionForm', component: CategoryEditionForm, meta: {title: i18nGet('title_category_edition_page'), icon: 'shape'} }, - { path: '/taxonomies/:categoryId', name: 'CategoryPage', component: CategoryPage, meta: {title: i18nGet('title_category_page'), icon: 'shape'} }, + { path: '/taxonomies', name: 'CategoriesPage', component: CategoriesPage, meta: {title: i18nGet('title_taxonomies_page'), icon: 'shape'} }, + { path: '/taxonomies/new', name: 'TaxonomyCreationForm', component: TaxonomyEditionForm, meta: {title: i18nGet('title_create_taxonomy_page'), icon: 'shape'} }, + { path: '/taxonomies/:taxonomyId/edit', name: 'TaxonomyEditionForm', component: TaxonomyEditionForm, meta: {title: i18nGet('title_taxonomy_edition_page'), icon: 'shape'} }, + { path: '/taxonomies/:taxonomyId', name: 'TaxonomyPage', component: TaxonomyPage, meta: {title: i18nGet('title_taxonomy_page'), icon: 'shape'} }, { path: '/events', name: 'EventsPage', component: EventsPage, meta: {title: i18nGet('title_repository_events_page'), icon: 'flash'} }, { path: '/events/:eventId', name: 'EventPage', component: EventPage, meta: {title: i18nGet('title_event_page'), icon: 'flash'} }, diff --git a/src/admin/js/theme-main.js b/src/admin/js/theme-main.js index 56a0db773..a235fdf5f 100644 --- a/src/admin/js/theme-main.js +++ b/src/admin/js/theme-main.js @@ -10,10 +10,10 @@ import Selectbox from '../../classes/metadata-types/selectbox/Selectbox.vue'; import Numeric from '../../classes/metadata-types/numeric/Numeric.vue'; import Date from '../../classes/metadata-types/date/Date.vue'; import Relationship from '../../classes/metadata-types/relationship/Relationship.vue'; -import Category from '../../classes/metadata-types/category/Category.vue'; +import Taxonomy from '../../classes/metadata-types/taxonomy/Taxonomy.vue'; import FormRelationship from '../../classes/metadata-types/relationship/FormRelationship.vue'; -import FormCategory from '../../classes/metadata-types/category/FormCategory.vue'; +import FormTaxonomy from '../../classes/metadata-types/taxonomy/FormTaxonomy.vue'; import FormSelectbox from '../../classes/metadata-types/selectbox/FormSelectbox.vue'; import FilterCustomInterval from '../../classes/filter-types/custom-interval/CustomInterval.vue'; @@ -22,9 +22,9 @@ import FilterAutocomplete from '../../classes/filter-types/autocomplete/Autocomp import FilterCheckbox from '../../classes/filter-types/checkbox/Checkbox.vue'; import FilterTaginput from '../../classes/filter-types/taginput/Taginput.vue'; -import FilterCategoryCheckbox from '../../classes/filter-types/category/Checkbox.vue'; -import FilterCategoryTaginput from '../../classes/filter-types/category/Taginput.vue'; -import FilterCategorySelectbox from '../../classes/filter-types/category/Selectbox.vue'; +import FilterTaxonomyCheckbox from '../../classes/filter-types/taxonomy/Checkbox.vue'; +import FilterTaxonomyTaginput from '../../classes/filter-types/taxonomy/Taginput.vue'; +import FilterTaxonomySelectbox from '../../classes/filter-types/taxonomy/Selectbox.vue'; import TaincanFormItem from '../../classes/metadata-types/tainacan-form-item.vue'; import TaincanFiltersList from '../../classes/filter-types/tainacan-filter-item.vue'; @@ -55,10 +55,10 @@ Vue.component('tainacan-selectbox', Selectbox); Vue.component('tainacan-numeric', Numeric); Vue.component('tainacan-date', Date); Vue.component('tainacan-relationship', Relationship); -Vue.component('tainacan-category', Category); +Vue.component('tainacan-taxonomy', Taxonomy); Vue.component('tainacan-form-relationship', FormRelationship); -Vue.component('tainacan-form-category', FormCategory); +Vue.component('tainacan-form-taxonomy', FormTaxonomy); Vue.component('tainacan-form-selectbox', FormSelectbox); Vue.component('tainacan-form-item', TaincanFormItem); Vue.component('tainacan-filter-item', TaincanFiltersList); @@ -69,9 +69,9 @@ Vue.component('tainacan-filter-selectbox', FilterSelectbox); Vue.component('tainacan-filter-autocomplete', FilterAutocomplete); Vue.component('tainacan-filter-checkbox', FilterCheckbox); Vue.component('tainacan-filter-taginput', FilterTaginput); -Vue.component('tainacan-filter-category-checkbox', FilterCategoryCheckbox); -Vue.component('tainacan-filter-category-taginput', FilterCategoryTaginput); -Vue.component('tainacan-filter-category-selectbox', FilterCategorySelectbox); +Vue.component('tainacan-filter-taxonomy-checkbox', FilterTaxonomyCheckbox); +Vue.component('tainacan-filter-taxonomy-taginput', FilterTaxonomyTaginput); +Vue.component('tainacan-filter-taxonomy-selectbox', FilterTaxonomySelectbox); /* Others */ Vue.component('help-button', HelpButton); diff --git a/src/admin/js/utilities.js b/src/admin/js/utilities.js index 66a5b9cbb..f8b022b65 100644 --- a/src/admin/js/utilities.js +++ b/src/admin/js/utilities.js @@ -64,7 +64,7 @@ I18NPlugin.install = function (Vue, options = {}) { return (string != undefined && string != null && string != '' ) ? string : "Invalid i18n key: " + tainacan_plugin.i18n[key]; }, getFrom(entity, key) { - if (entity == 'categories') // Temporary hack, while we decide this terminology... + if (entity == 'taxonomies') // Temporary hack, while we decide this terminology... entity = 'taxonomies' if (tainacan_plugin.i18n['entities_labels'][entity] == undefined) return 'Invalid i18n entity: ' + entity; @@ -72,7 +72,7 @@ I18NPlugin.install = function (Vue, options = {}) { return (string != undefined && string != null && string != '' ) ? string : "Invalid i18n key: " + key; }, getHelperTitle(entity, key) { - if (entity == 'categories') // Temporary hack, while we decide this terminology... + if (entity == 'taxonomies') // Temporary hack, while we decide this terminology... entity = 'taxonomies' if (tainacan_plugin.i18n['helpers_label'][entity] == undefined) return 'Invalid i18n entity: ' + entity; @@ -82,7 +82,7 @@ I18NPlugin.install = function (Vue, options = {}) { return (string != undefined && string != null && string != '' ) ? string : "Invalid i18n helper object."; }, getHelperMessage(entity, key) { - if (entity == 'categories') // Temporary hack, while we decide this terminology... + if (entity == 'taxonomies') // Temporary hack, while we decide this terminology... entity = 'taxonomies' if (tainacan_plugin.i18n['helpers_label'][entity] == undefined) return 'Invalid i18n entity: ' + entity; @@ -197,8 +197,8 @@ RouterHelperPlugin.install = function (Vue, options = {}) { getCategoriesPath(query) { return '/taxonomies/?' + qs.stringify(query); }, - getCategoryTermsPath(categoryId, query) { - return '/categoryId/' + categoryId + '/terms/?' + qs.stringify(query); + getTaxonomyTermsPath(taxonomyId, query) { + return '/taxonomyId/' + taxonomyId + '/terms/?' + qs.stringify(query); }, getFiltersPath(query) { return '/filters/?' + qs.stringify(query); @@ -219,11 +219,11 @@ RouterHelperPlugin.install = function (Vue, options = {}) { getFilterPath(id) { return '/filters/' + id; }, - getCategoryPath(id) { + getTaxonomyPath(id) { return '/taxonomies/' + id; }, - getTermPath(categoryId, termId) { - return '/taxonomies/' + categoryId + '/terms/' + termId; + getTermPath(taxonomyId, termId) { + return '/taxonomies/' + taxonomyId + '/terms/' + termId; }, getEventPath(id) { return '/events/' + id; @@ -250,11 +250,11 @@ RouterHelperPlugin.install = function (Vue, options = {}) { getNewFilterPath() { return '/filters/new'; }, - getNewCategoryPath() { + getNewTaxonomyPath() { return '/taxonomies/new'; }, - getNewTermPath(categoryId) { - return '/taxonomies/' + categoryId + '/terms/new'; + getNewTermPath(taxonomyId) { + return '/taxonomies/' + taxonomyId + '/terms/new'; }, getNewEventPath() { return '/events/new'; @@ -269,11 +269,11 @@ RouterHelperPlugin.install = function (Vue, options = {}) { getFilterEditPath(id) { return '/filters/' + id + '/edit'; }, - getCategoryEditPath(id) { + getTaxonomyEditPath(id) { return '/taxonomies/' + id + '/edit'; }, - getTermEditPath(categoryId, termId) { - return '/taxonomies/' + categoryId + '/terms/' + termId + '/edit'; + getTermEditPath(taxonomyId, termId) { + return '/taxonomies/' + taxonomyId + '/terms/' + termId + '/edit'; }, getEventEditPath(id) { return '/events/' + id + '/edit'; diff --git a/src/admin/pages/lists/categories-page.vue b/src/admin/pages/lists/categories-page.vue deleted file mode 100644 index c17e9cb9b..000000000 --- a/src/admin/pages/lists/categories-page.vue +++ /dev/null @@ -1,236 +0,0 @@ - - - - - - - diff --git a/src/admin/pages/singles/category-page.vue b/src/admin/pages/singles/category-page.vue deleted file mode 100644 index 12c13ffa5..000000000 --- a/src/admin/pages/singles/category-page.vue +++ /dev/null @@ -1,62 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/admin/tainacan-admin-i18n.php b/src/admin/tainacan-admin-i18n.php index d1bffc94e..121cda5f7 100644 --- a/src/admin/tainacan-admin-i18n.php +++ b/src/admin/tainacan-admin-i18n.php @@ -68,7 +68,7 @@ return apply_filters('tainacan-admin-i18n',[ 'title_items_page' => __( 'Items', 'tainacan' ), 'title_repository_metadata_page' => __( 'Repository Metadata', 'tainacan' ), 'title_repository_filters_page' => __( 'Repository Filters', 'tainacan' ), - 'title_categories_page' => __( 'Categories Page', 'tainacan' ), + 'title_taxonomies_page' => __( 'Taxonomies Page', 'tainacan' ), 'title_terms_page' => __( 'Terms', 'tainacan' ), 'title_repository_events_page' => __( 'Repository Events', 'tainacan' ), 'title_collection_page' => __( 'Collection', 'tainacan' ), @@ -76,16 +76,16 @@ return apply_filters('tainacan-admin-i18n',[ 'title_metadatum_page' => __( 'Metadata', 'tainacan' ), 'title_collection_events' => __( 'Collection Events', 'tainacan' ), 'title_filter_page' => __( 'Filter', 'tainacan' ), - 'title_category_page' => __( 'Taxonomy', 'tainacan' ), + 'title_taxonomy_page' => __( 'Taxonomy', 'tainacan' ), 'title_term_page' => __( 'Term', 'tainacan' ), 'title_event_page' => __( 'Event', 'tainacan' ), 'title_create_collection' => __( 'Collection Creation', 'tainacan' ), - 'title_create_category_page' => __( 'Taxonomy Creation', 'tainacan' ), + 'title_create_taxonomy_page' => __( 'Taxonomy Creation', 'tainacan' ), 'title_create_item_collection' => __( 'Create Item on Collection', 'tainacan' ), 'title_create_filter' => __( 'Filter Creation', 'tainacan' ), 'title_collection_settings' => __( 'Settings of Collection', 'tainacan' ), 'title_edit_item' => __( 'Edit Item', 'tainacan' ), - 'title_category_edition_page' => __( 'Taxonomy Edition', 'tainacan' ), + 'title_taxonomy_edition_page' => __( 'Taxonomy Edition', 'tainacan' ), 'title_filter_edition' => __( 'Filter Edition', 'tainacan' ), 'title_metadatum_edition' => __( 'Metadata Edition', 'tainacan' ), 'title_collection_metadata_edition' => __( 'Edit Metadata of', 'tainacan' ), @@ -121,7 +121,7 @@ return apply_filters('tainacan-admin-i18n',[ 'label_choose_thumb' => __( 'Choose Thumbnail', 'tainacan' ), 'label_button_delete_thumb' => __( 'Button Delete Thumbnail', 'tainacan' ), 'label_collections_per_page' => __( 'Collections per Page:', 'tainacan' ), - 'label_categories_per_page' => __( 'Categories per Page:', 'tainacan' ), + 'label_taxonomies_per_page' => __( 'Taxonomies per Page:', 'tainacan' ), 'label_events_per_page' => __( 'Events per Page:', 'tainacan' ), 'label_items_per_page' => __( 'Items per Page:', 'tainacan' ), 'label_active_metadata' => __( 'Active Metadata', 'tainacan' ), @@ -143,9 +143,9 @@ return apply_filters('tainacan-admin-i18n',[ 'label_collection_related' => __( 'Collection Related', 'tainacan' ), 'label_metadata_for_search' => __( 'Metadata for search', 'tainacan' ), 'label_allow_repeated_items' => __( 'Allow repeated items', 'tainacan' ), - 'label_select_category' => __( 'Select taxonomy', 'tainacan' ), - 'label_select_category_input_type' => __( 'Input type', 'tainacan' ), - 'label_category_allow_new_terms' => __( 'Allow new terms', 'tainacan' ), + 'label_select_taxonomy' => __( 'Select taxonomy', 'tainacan' ), + 'label_select_taxonomy_input_type' => __( 'Input type', 'tainacan' ), + 'label_taxonomy_allow_new_terms' => __( 'Allow new terms', 'tainacan' ), 'label_selectbox_init' => __( 'Select', 'tainacan' ), 'label_options' => __( 'Insert options', 'tainacan' ), 'label_attachments' => __( 'Attachments', 'tainacan' ), @@ -160,7 +160,7 @@ return apply_filters('tainacan-admin-i18n',[ 'label_parent_term' => __( 'Parent Term', 'tainacan' ), 'label_new_term' => __( 'New Term', 'tainacan' ), 'label_new_child' => __( 'New Child', 'tainacan' ), - 'label_category_terms' => __( 'Taxonomy Terms', 'tainacan' ), + 'label_taxonomy_terms' => __( 'Taxonomy Terms', 'tainacan' ), 'label_no_parent_term' => __( 'No parent term', 'tainacan' ), 'label_term_without_name' => __( 'Term without name', 'tainacan' ), 'label_inherited' => __( 'Inherited', 'tainacan' ), @@ -193,12 +193,12 @@ return apply_filters('tainacan-admin-i18n',[ '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_selected_categories' => __( 'Delete selected categories', 'tainacan' ), + 'label_delete_selected_taxonomies' => __( 'Delete selected taxonomies', 'tainacan' ), 'label_edit_selected_items' => __( 'Edit selected items', 'tainacan' ), - 'label_edit_selected_categories' => __( 'Edit selected categories', 'tainacan' ), + 'label_edit_selected_taxonomies' => __( 'Edit selected taxonomies', 'tainacan' ), 'label_select_all_collections_page' => __( 'Select all collections on page', 'tainacan' ), 'label_select_all_items_page' => __( 'Select all items on page', 'tainacan' ), - 'label_select_all_categories_page' => __( 'Select all categories on page', 'tainacan' ), + 'label_select_all_taxonomies_page' => __( 'Select all taxonomies on page', 'tainacan' ), 'label_edit_attachments' => __( 'Edit attachments', 'tainacan' ), 'label_blank_collection' => __( 'Blank collection', 'tainacan' ), 'label_dublin_core' => __( 'Dublin Core', 'tainacan' ), @@ -218,7 +218,7 @@ return apply_filters('tainacan-admin-i18n',[ // Instructions. More complex sentences to guide user and placeholders 'instruction_delete_selected_collections' => __( 'Delete selected collections', 'tainacan' ), 'instruction_delete_selected_items' => __( 'Delete selected items', 'tainacan' ), - 'instruction_delete_selected_categories' => __( 'Delete selected categories', 'tainacan' ), + 'instruction_delete_selected_taxonomies' => __( 'Delete selected taxonomies', 'tainacan' ), 'instruction_image_upload_box' => __( 'Drop an image here or click to upload.', 'tainacan' ), 'instruction_select_a_status' => __( 'Select a status:', 'tainacan' ), 'instruction_select_a_filter_type' => __( 'Select a filter type:', 'tainacan' ), @@ -243,9 +243,9 @@ return apply_filters('tainacan-admin-i18n',[ 'info_no_collection_created' => __( 'No collection was created in this repository.', 'tainacan' ), 'info_no_collection_draft' => __( 'No draft collection found.', 'tainacan' ), 'info_no_collection_trash' => __( 'No collection on trash.', 'tainacan' ), - 'info_no_category_draft' => __( 'No draft category found.', 'tainacan' ), - 'info_no_category_trash' => __( 'No category on trash.', 'tainacan' ), - 'info_no_category_created' => __( 'No taxonomy was created in this repository.', 'tainacan' ), + 'info_no_taxonomy_draft' => __( 'No draft taxonomy found.', 'tainacan' ), + 'info_no_taxonomy_trash' => __( 'No taxonomy on trash.', 'tainacan' ), + 'info_no_taxonomy_created' => __( 'No taxonomy was created in this repository.', 'tainacan' ), 'info_no_item_created' => __( 'No item was created in this collection.', 'tainacan' ), 'info_no_item_draft' => __( 'No draft item found.', 'tainacan' ), 'info_no_item_trash' => __( 'No item on trash.', 'tainacan' ), @@ -255,25 +255,25 @@ return apply_filters('tainacan-admin-i18n',[ 'info_item_not_saved' => __( 'Warning: Item not saved.', 'tainacan' ), 'info_no_moderator_on_collection' => __( "This collection doesn't have any moderator yet.", 'tainacan' ), 'info_error_deleting_collection' => __( 'Error on deleting collection.', 'tainacan' ), - 'info_error_deleting_category' => __( 'Error on deleting taxonomy', 'tainacan' ), + 'info_error_deleting_taxonomy' => __( 'Error on deleting taxonomy', 'tainacan' ), 'info_collection_deleted' => __( 'Collection deleted.', 'tainacan' ), 'info_item_deleted' => __( 'Item deleted.', 'tainacan' ), - 'info_category_deleted' => __( 'Taxonomy deleted', 'tainacan' ), + 'info_taxonomy_deleted' => __( 'Taxonomy deleted', 'tainacan' ), 'info_warning_collection_delete' => __( 'Do you really want to permanently delete this collection?', 'tainacan' ), 'info_warning_collection_trash' => __( 'Do you really want to trash this collection?', 'tainacan' ), 'info_warning_item_delete' => __( 'Do you really want to permanently delete this item?', 'tainacan' ), 'info_warning_item_trash' => __( 'Do you really want to trash this item?', 'tainacan' ), - 'info_warning_category_delete' => __( 'Do you really want to delete this taxonomy?', 'tainacan' ), + 'info_warning_taxonomy_delete' => __( 'Do you really want to delete this taxonomy?', 'tainacan' ), 'info_warning_selected_collections_delete' => __( 'Do you really want to permanently delete the selected collections?', 'tainacan' ), 'info_warning_selected_collections_trash' => __( 'Do you really want to trash the selected collections?', 'tainacan' ), 'info_warning_selected_items_delete' => __( 'Do you really want to permanently delete the selected items?', 'tainacan' ), 'info_warning_selected_items_trash' => __( 'Do you really want to trash the selected items?', 'tainacan' ), - 'info_warning_selected_categories_delete' => __( 'Do you really want to delete the selected categories?', 'tainacan' ), + 'info_warning_selected_taxonomies_delete' => __( 'Do you really want to delete the selected taxonomies?', 'tainacan' ), 'info_warning_collection_related' => __( 'The metadata Collection related is required', 'tainacan' ), 'info_warning_no_metadata_found' => __( 'No metadata found in this collection', 'tainacan' ), 'info_showing_items' => __( 'Showing items ', 'tainacan' ), 'info_showing_collections' => __( 'Showing collections ', 'tainacan' ), - 'info_showing_categories' => __( 'Showing categories ', 'tainacan' ), + 'info_showing_taxonomies' => __( 'Showing taxonomies ', 'tainacan' ), 'info_showing_events' => __( 'Showing events ', 'tainacan' ), 'info_to' => __( ' to ', 'tainacan' ), 'info_of' => __( ' of ', 'tainacan' ), @@ -285,7 +285,7 @@ return apply_filters('tainacan-admin-i18n',[ 'info_warning_metadata_not_saved' => __( 'Are you sure? There are metadata not saved, changes will be lost.', 'tainacan' ), 'info_warning_filters_not_saved' => __( 'Are you sure? There are filters not saved, changes will be lost.', 'tainacan' ), 'info_no_description_provided' => __( 'No description provided.', 'tainacan' ), - 'info_warning_category_not_saved' => __( 'Are you sure? The metadata is not saved, changes will be lost.', 'tainacan' ), + 'info_warning_taxonomy_not_saved' => __( 'Are you sure? The metadata is not saved, changes will be lost.', 'tainacan' ), 'info_warning_terms_not_saved' => __( 'Are you sure? There are terms not saved, changes will be lost.', 'tainacan' ), 'info_warning_orphan_terms' => __( 'Are you sure? This term is parent of other terms. These will be converted to root terms.', 'tainacan' ), 'info_no_events' => __( 'No events', 'tainacan' ), @@ -311,7 +311,7 @@ return apply_filters('tainacan-admin-i18n',[ 'tainacan-numeric' => __( 'Numeric', 'tainacan' ), 'tainacan-selectbox' => __( 'Select box', 'tainacan' ), 'tainacan-relationship' => __( 'Relationship', 'tainacan' ), - 'tainacan-category' => __( 'Taxonomy', 'tainacan' ), + 'tainacan-taxonomy' => __( 'Taxonomy', 'tainacan' ), // Tainacan Filter Types 'tainacan-filter-custom-interval' => __( 'Custom Interval', 'tainacan' ), @@ -319,8 +319,8 @@ return apply_filters('tainacan-admin-i18n',[ 'tainacan-filter-autocomplete' => __( 'Autocomplete', 'tainacan' ), 'tainacan-filter-taginput' => __( 'Tag Input', 'tainacan' ), 'tainacan-filter-checkbox' => __( 'Check Box', 'tainacan' ), - 'tainacan-filter-category-taginput' => __( 'Taxonomy Tag Input', 'tainacan' ), - 'tainacan-filter-category-checkbox' => __( 'Taxonomy Check Box', 'tainacan' ), - 'tainacan-filter-category-selectbox' => __( 'Taxonomy Select Box', 'tainacan' ) + 'tainacan-filter-taxonomy-taginput' => __( 'Taxonomy Tag Input', 'tainacan' ), + 'tainacan-filter-taxonomy-checkbox' => __( 'Taxonomy Check Box', 'tainacan' ), + 'tainacan-filter-taxonomy-selectbox' => __( 'Taxonomy Select Box', 'tainacan' ) ]); ?> diff --git a/src/classes/entities/class-tainacan-metadatum.php b/src/classes/entities/class-tainacan-metadatum.php index e293a89ab..9535e82f3 100644 --- a/src/classes/entities/class-tainacan-metadatum.php +++ b/src/classes/entities/class-tainacan-metadatum.php @@ -421,15 +421,15 @@ class Metadatum extends Entity { if (false === $is_valid) return false; - // You cant have a multiple metadatum inside a compound metadatum (except category) + // You cant have a multiple metadatum inside a compound metadatum (except taxonomy) if ($this->get_parent() > 0) { if ( $this->is_multiple() && $this->get_metadata_type_object()->get_primitive_type() != 'term') { - $this->add_error($this->get_id(), __('Compound metadata do not support metadata with multiple values (except categories)', 'tainacan')); + $this->add_error($this->get_id(), __('Compound metadata do not support metadata with multiple values (except taxonomies)', 'tainacan')); return false; } } - // You cant have a category metadatum inside a multiple compound metadatum + // You cant have a taxonomy metadatum inside a multiple compound metadatum if ( $this->get_parent() > 0 && $this->get_metadata_type_object()->get_primitive_type() == 'term' ) { $parent_metadatum = new \Tainacan\Entities\Metadatum($this->get_parent()); if ( $parent_metadatum->is_multiple() ) { @@ -442,7 +442,7 @@ class Metadatum extends Entity { $children = $Tainacan_Metadata->fetch( [ 'parent' => $this->get_id(), - 'metadata_type' => 'Tainacan\Metadata_Types\Category', + 'metadata_type' => 'Tainacan\Metadata_Types\Taxonomy', 'post_status' => 'any' ] , 'OBJECT'); diff --git a/src/classes/filter-types/category/Checkbox.vue b/src/classes/filter-types/category/Checkbox.vue deleted file mode 100644 index 5e0f7d6eb..000000000 --- a/src/classes/filter-types/category/Checkbox.vue +++ /dev/null @@ -1,129 +0,0 @@ - - - diff --git a/src/classes/filter-types/category/Selectbox.vue b/src/classes/filter-types/category/Selectbox.vue deleted file mode 100644 index 713cd7d1a..000000000 --- a/src/classes/filter-types/category/Selectbox.vue +++ /dev/null @@ -1,131 +0,0 @@ - - - diff --git a/src/classes/filter-types/category/Taginput.vue b/src/classes/filter-types/category/Taginput.vue deleted file mode 100644 index 87b68329a..000000000 --- a/src/classes/filter-types/category/Taginput.vue +++ /dev/null @@ -1,142 +0,0 @@ - - - diff --git a/src/classes/filter-types/category/class-tainacan-categorycheckbox.php b/src/classes/filter-types/category/class-tainacan-categorycheckbox.php deleted file mode 100644 index d44a7214d..000000000 --- a/src/classes/filter-types/category/class-tainacan-categorycheckbox.php +++ /dev/null @@ -1,27 +0,0 @@ -set_supported_types(['term']); - $this->set_component('tainacan-filter-category-checkbox'); - } - - /** - * @param $filter - * @return string - */ - - public function render( $filter ){ - return ''; - } -} \ No newline at end of file diff --git a/src/classes/filter-types/category/class-tainacan-categoryselectbox.php b/src/classes/filter-types/category/class-tainacan-categoryselectbox.php deleted file mode 100644 index 01de2b5d1..000000000 --- a/src/classes/filter-types/category/class-tainacan-categoryselectbox.php +++ /dev/null @@ -1,27 +0,0 @@ -set_supported_types(['term']); - $this->set_component('tainacan-filter-category-selectbox'); - } - - /** - * @param $filter - * @return string - */ - - public function render( $filter ){ - return ''; - } -} \ No newline at end of file diff --git a/src/classes/filter-types/category/class-tainacan-categorytaginput.php b/src/classes/filter-types/category/class-tainacan-categorytaginput.php deleted file mode 100644 index 2ed8778a7..000000000 --- a/src/classes/filter-types/category/class-tainacan-categorytaginput.php +++ /dev/null @@ -1,27 +0,0 @@ -set_supported_types(['term']); - $this->set_component('tainacan-filter-category-taginput'); - } - - /** - * @param $filter - * @return string - */ - - public function render( $filter ){ - return ''; - } -} \ No newline at end of file diff --git a/src/classes/metadata-types/category/AddNewTerm.vue b/src/classes/metadata-types/category/AddNewTerm.vue deleted file mode 100644 index 7b3a2bc4f..000000000 --- a/src/classes/metadata-types/category/AddNewTerm.vue +++ /dev/null @@ -1,132 +0,0 @@ - - - \ No newline at end of file diff --git a/src/classes/metadata-types/category/Category.vue b/src/classes/metadata-types/category/Category.vue deleted file mode 100644 index 7b990f9c0..000000000 --- a/src/classes/metadata-types/category/Category.vue +++ /dev/null @@ -1,144 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/classes/metadata-types/category/CategoryCheckbox.vue b/src/classes/metadata-types/category/CategoryCheckbox.vue deleted file mode 100644 index 74c18473d..000000000 --- a/src/classes/metadata-types/category/CategoryCheckbox.vue +++ /dev/null @@ -1,55 +0,0 @@ - - - \ No newline at end of file diff --git a/src/classes/metadata-types/category/CategoryRadio.vue b/src/classes/metadata-types/category/CategoryRadio.vue deleted file mode 100644 index 91c24a373..000000000 --- a/src/classes/metadata-types/category/CategoryRadio.vue +++ /dev/null @@ -1,51 +0,0 @@ - - - \ No newline at end of file diff --git a/src/classes/metadata-types/category/CategorySelectbox.vue b/src/classes/metadata-types/category/CategorySelectbox.vue deleted file mode 100644 index c2e1956fe..000000000 --- a/src/classes/metadata-types/category/CategorySelectbox.vue +++ /dev/null @@ -1,60 +0,0 @@ - - - \ No newline at end of file diff --git a/src/classes/metadata-types/category/CategoryTaginput.vue b/src/classes/metadata-types/category/CategoryTaginput.vue deleted file mode 100644 index ef5fa9135..000000000 --- a/src/classes/metadata-types/category/CategoryTaginput.vue +++ /dev/null @@ -1,83 +0,0 @@ - - \ No newline at end of file diff --git a/src/classes/metadata-types/category/FormCategory.vue b/src/classes/metadata-types/category/FormCategory.vue deleted file mode 100644 index ae1c2ebfc..000000000 --- a/src/classes/metadata-types/category/FormCategory.vue +++ /dev/null @@ -1,197 +0,0 @@ - - - \ No newline at end of file diff --git a/src/classes/metadata-types/category/class-tainacan-category.php b/src/classes/metadata-types/category/class-tainacan-category.php deleted file mode 100644 index baff1bb6f..000000000 --- a/src/classes/metadata-types/category/class-tainacan-category.php +++ /dev/null @@ -1,180 +0,0 @@ -set_primitive_type('term'); - - $this->set_default_options([ - 'allow_new_terms' => false - ]); - - $this->set_form_component('tainacan-form-category'); - $this->set_component('tainacan-category'); - } - - /** - * @inheritdoc - */ - public function get_form_labels(){ - return [ - 'taxonomy_id' => [ - 'title' => __( 'Collection Related', 'tainacan' ), - 'description' => __( 'Select the collection to fetch items', 'tainacan' ), - ], - 'input_type' => [ - 'title' => __( 'Input type', 'tainacan' ), - 'description' => __( 'The html type of the terms list ', 'tainacan' ), - ], - 'allow_new_terms' => [ - 'title' => __( 'Allow new terms', 'tainacan' ), - 'description' => __( 'Allows to create new terms', 'tainacan' ), - ] - ]; - } - - /** - * @param $itemMetadata Item_Metadata_Entity The instace of the entity itemMetadata - * @return string - */ - - public function render( $itemMetadata ){ - $options = ( isset( $this->get_options()['options'] ) ) ? $this->get_options()['options'] : ''; - return 'get_value() ).'\' - name="'.$itemMetadata->get_metadatum()->get_name().'">'; - } - - public function validate_options( Metadatum $metadatum) { - - if ( !in_array($metadatum->get_status(), apply_filters('tainacan-status-require-validation', ['publish','future','private'])) ) - return true; - - if (empty($this->get_option('taxonomy_id'))) - return ['taxonomy_id' => __('Please select a taxonomy', 'tainacan')]; - - $Tainacan_Metadata = Metadata::get_instance(); - - $category_metadata = $Tainacan_Metadata->fetch([ - 'collection_id' => $metadatum->get_collection_id(), - 'metadata_type' => 'Tainacan\\Metadata_Types\\Category' - ], 'OBJECT'); - - $category_metadata = array_map(function ($metadatum_map) { - $fto = $metadatum_map->get_metadata_type_object(); - return [ $metadatum_map->get_id() => $fto->get_option('taxonomy_id') ]; - }, $category_metadata); - - if( is_array( $category_metadata ) ){ - foreach ($category_metadata as $metadatum_id => $category_metadatum) { - if ( is_array( $category_metadatum ) && key($category_metadatum) != $metadatum->get_id() - && in_array($this->get_option('taxonomy_id'), $category_metadatum)) { - return ['taxonomy_id' => __('You can not have 2 taxonomy metadata using the same taxonomy in a collection.', 'tainacan')]; - } - } - } - - return true; - - } - - /** - * Validate item based on metadatum type categories options - * - * @param Item_Metadata_Entity $item_metadata - * - * @return bool Valid or not - */ - public function validate( Item_Metadata_Entity $item_metadata) { - - $item = $item_metadata->get_item(); - - if ( !in_array($item->get_status(), apply_filters('tainacan-status-require-validation', ['publish','future','private'])) ) - return true; - - $valid = true; - - if (false === $this->get_option('allow_new_terms')) { - $terms = $item_metadata->get_value(); - - if (false === $terms) - return true; - - if (!is_array($terms)) - $terms = array($terms); - - foreach ($terms as $term) { - if (is_object($term) && $term instanceof \Tainacan\Entities\Term) { - $term = $term->get_id(); - } - - if (!term_exists($term)) { - $valid = false; - break; - } - } - - } - - return $valid; - - } - - /** - * Return the value of an Item_Metadata_Entity using a metadatum of this metadatum type as an html string - * @param Item_Metadata_Entity $item_metadata - * @return string The HTML representation of the value, containing one or multiple terms, separated by comma, linked to term page - */ - public function get_value_as_html(Item_Metadata_Entity $item_metadata) { - - $value = $item_metadata->get_value(); - - $return = ''; - - if ( $item_metadata->is_multiple() ) { - - $count = 1; - $total = sizeof($value); - - foreach ( $value as $term ) { - if ( $term instanceof \Tainacan\Entities\Term ) { - $return .= $term->_toHtml(); - } - - $count ++; - - if ( $count <= $total ) { - $return .= ', '; - } - - } - - } else { - - if ( $value instanceof \Tainacan\Entities\Term ) { - $return .= $value->_toHtml(); - } - - } - - return $return; - - } - -} \ No newline at end of file diff --git a/src/classes/metadata-types/tainacan-form-item.vue b/src/classes/metadata-types/tainacan-form-item.vue index 8eb3e5445..7b372b4e8 100644 --- a/src/classes/metadata-types/tainacan-form-item.vue +++ b/src/classes/metadata-types/tainacan-form-item.vue @@ -128,7 +128,7 @@ this.changeValue(); }, isTextInputComponent( component ){ - let array = ['tainacan-relationship','tainacan-category']; + let array = ['tainacan-relationship','tainacan-taxonomy']; return !( array.indexOf( component ) >= 0 ); }, setMetadatumTypeMessage( message ){ diff --git a/src/classes/repositories/class-tainacan-metadata.php b/src/classes/repositories/class-tainacan-metadata.php index 4e09cb7c9..d2f9ee8d0 100644 --- a/src/classes/repositories/class-tainacan-metadata.php +++ b/src/classes/repositories/class-tainacan-metadata.php @@ -440,10 +440,10 @@ class Metadata extends Repository { * @see \Tainacan\Repositories\Repository::insert() */ public function insert($metadatum){ - $this->pre_update_category_metadatum($metadatum); + $this->pre_update_taxonomy_metadatum($metadatum); $new_metadatum = parent::insert($metadatum); - $this->update_category_metadatum($new_metadatum); + $this->update_taxonomy_metadatum($new_metadatum); return $new_metadatum; } @@ -459,7 +459,7 @@ class Metadata extends Repository { } public function delete($metadatum_id){ - $this->delete_category_metadatum($metadatum_id); + $this->delete_taxonomy_metadatum($metadatum_id); $deleted = new Entities\Metadatum( wp_trash_post( $metadatum_id ) ); @@ -815,10 +815,10 @@ class Metadata extends Repository { } /** - * Stores the value of the taxonomy_id option to use on update_category_metadatum method. + * Stores the value of the taxonomy_id option to use on update_taxonomy_metadatum method. * */ - private function pre_update_category_metadatum($metadatum) { + private function pre_update_taxonomy_metadatum($metadatum) { $metadata_type = $metadatum->get_metadata_type_object(); $current_tax = ''; if ($metadata_type->get_primitive_type() == 'term') { @@ -831,16 +831,16 @@ class Metadata extends Repository { } /** - * Triggers hooks when saving a Category Metadatum, indicating wich taxonomy was added or removed from a collection. + * Triggers hooks when saving a Taxonomy Metadatum, indicating wich taxonomy was added or removed from a collection. * * This is used by Taxonomies repository to update the collections_ids property of the taxonomy as - * a metadatum type category is inserted or removed + * a metadatum type taxonomy is inserted or removed * * @param [type] $metadatum [description] * * @return void [type] [description] */ - private function update_category_metadatum($metadatum) { + private function update_taxonomy_metadatum($metadatum) { $metadata_type = $metadatum->get_metadata_type_object(); $new_tax = ''; @@ -862,7 +862,7 @@ class Metadata extends Repository { } } - private function delete_category_metadatum($metadatum_id) { + private function delete_taxonomy_metadatum($metadatum_id) { $metadatum = $this->fetch($metadatum_id); $metadata_type = $metadatum->get_metadata_type_object(); diff --git a/src/classes/tainacan-creator.php b/src/classes/tainacan-creator.php index 3687f9e08..acf0f4927 100644 --- a/src/classes/tainacan-creator.php +++ b/src/classes/tainacan-creator.php @@ -72,9 +72,9 @@ function tainacan_autoload($class_name){ } if( in_array('Metadata_Types', $class_path) || in_array('Filter_Types', $class_path) ){ - $exceptions = ['categorytaginput','categorycheckbox','categoryselectbox']; + $exceptions = ['taxonomytaginput','taxonomycheckbox','taxonomyselectbox']; if( in_array( strtolower( $class_name ), $exceptions) ){ - $dir.= 'category/'; + $dir.= 'taxonomy/'; }else{ $dir.= strtolower(str_replace('_', '-' , $class_name)).'/'; } @@ -101,7 +101,7 @@ $Tainacan_Metadata->register_metadata_type('Tainacan\Metadata_Types\Date'); $Tainacan_Metadata->register_metadata_type('Tainacan\Metadata_Types\Numeric'); $Tainacan_Metadata->register_metadata_type('Tainacan\Metadata_Types\Selectbox'); $Tainacan_Metadata->register_metadata_type('Tainacan\Metadata_Types\Relationship'); -$Tainacan_Metadata->register_metadata_type('Tainacan\Metadata_Types\Category'); +$Tainacan_Metadata->register_metadata_type('Tainacan\Metadata_Types\Taxonomy'); $Tainacan_Metadata->register_metadata_type('Tainacan\Metadata_Types\Compound'); $Tainacan_Filters = \Tainacan\Repositories\Filters::get_instance(); @@ -112,9 +112,9 @@ $Tainacan_Filters->register_filter_type('Tainacan\Filter_Types\Selectbox'); $Tainacan_Filters->register_filter_type('Tainacan\Filter_Types\Autocomplete'); $Tainacan_Filters->register_filter_type('Tainacan\Filter_Types\Taginput'); $Tainacan_Filters->register_filter_type('Tainacan\Filter_Types\Checkbox'); -$Tainacan_Filters->register_filter_type('Tainacan\Filter_Types\CategoryTaginput'); -$Tainacan_Filters->register_filter_type('Tainacan\Filter_Types\CategoryCheckbox'); -$Tainacan_Filters->register_filter_type('Tainacan\Filter_Types\CategorySelectbox'); +$Tainacan_Filters->register_filter_type('Tainacan\Filter_Types\TaxonomyTaginput'); +$Tainacan_Filters->register_filter_type('Tainacan\Filter_Types\TaxonomyCheckbox'); +$Tainacan_Filters->register_filter_type('Tainacan\Filter_Types\TaxonomySelectbox'); $Tainacan_Taxonomies = \Tainacan\Repositories\Taxonomies::get_instance(); diff --git a/src/importer/class-tainacan-old-tainacan.php b/src/importer/class-tainacan-old-tainacan.php index 7622a0dbf..440618302 100644 --- a/src/importer/class-tainacan-old-tainacan.php +++ b/src/importer/class-tainacan-old-tainacan.php @@ -60,7 +60,7 @@ class Old_Tainacan extends Importer{ } /** - * create taxonomies ( categories in tainacan old in first level ) + * create taxonomies ( taxonomies in tainacan old in first level ) * next create the terms * */ @@ -69,8 +69,8 @@ class Old_Tainacan extends Importer{ foreach ($this->get_taxonomies() as $taxonomy) { $tax = new Entities\Taxonomy(); - $tax->set_name( $category->name ); - $tax->set_description( $category->description ); + $tax->set_name( $taxonomy->name ); + $tax->set_description( $taxonomy->description ); $tax->set_allow_insert('yes'); $tax->set_status('publish'); @@ -80,12 +80,12 @@ class Old_Tainacan extends Importer{ $this->add_transient('tax_' . $term->term_id . '_id', $tax->get_id()); $this->add_transient('tax_' . $term->term_id . '_name', $tax->get_name()); - if (isset($category->children) && $tax) { - $this->add_all_terms($tax, $category->children); + if (isset($taxonomy->children) && $tax) { + $this->add_all_terms($tax, $taxonomy->children); } } else { - $this->add_error_log('Error creating taxonomy ' . $category->name ); + $this->add_error_log('Error creating taxonomy ' . $taxonomy->name ); $this->add_error_log($tax->get_errors()); $this->abort(); return false; @@ -191,11 +191,11 @@ class Old_Tainacan extends Importer{ */ protected function get_taxonomies(){ - $categories_link = $this->get_url() . $this->tainacan_api_address . "/categories"; - $categories = wp_remote_get($categories_link); - $categories_array = $this->decode_request($categories); + $taxonomies_link = $this->get_url() . $this->tainacan_api_address . "/taxonomies"; + $taxonomies = wp_remote_get($taxonomies_link); + $taxonomies_array = $this->decode_request($taxonomies); - return ($categories_array) ? $categories_array : []; + return ($taxonomies_array) ? $taxonomies_array : []; } /** @@ -215,7 +215,7 @@ class Old_Tainacan extends Importer{ * create recursively the terms from tainacan OLD * * @param Entities\Taxonomy $taxonomy_father - * @param array $children Array of categories from tainacan old + * @param array $children Array of taxonomies from tainacan old * @param (optional) int $term_father the ID of father * * @return array @@ -271,7 +271,7 @@ class Old_Tainacan extends Importer{ $newMetadatum->set_metadata_type('Tainacan\Metadata_Types\\'.$type); $newMetadatum->set_parent( (isset($collection_id)) ? $collection_id : 'default'); - if(strcmp($type, "Category") === 0){ + if(strcmp($type, "Taxonomy") === 0){ $taxonomy_id = $meta->metadata->taxonomy; $related_taxonomy = $this->get_transient('tax_' . $taxonomy_id . '_id'); @@ -280,7 +280,7 @@ class Old_Tainacan extends Importer{ } } else if(strcmp($type, "Relationship") === 0){ - $relation_id = $meta->metadata->object_category_id; + $relation_id = $meta->metadata->object_taxonomy_id; $related_taxonomy = $this->get_transient('tax_' . $relation_id . '_id'); $related_name = $this->get_transient('tax_' . $relation_id . '_name'); @@ -350,7 +350,7 @@ class Old_Tainacan extends Importer{ } else if(strcmp($type, 'item') === 0) { $type = "Relationship"; } else if(strcmp($type, 'tree') === 0) { - $type = "Category"; + $type = "Taxonomy"; } else if(strcmp($type, 'compound') === 0) { $type = "Compound"; } else { diff --git a/src/importer/class-tainacan-test-importer.php b/src/importer/class-tainacan-test-importer.php index 626cc2856..b1800af04 100644 --- a/src/importer/class-tainacan-test-importer.php +++ b/src/importer/class-tainacan-test-importer.php @@ -156,7 +156,7 @@ class Test_Importer extends Importer { $metadatum = new Entities\Metadatum(); $metadatum->set_name('Colora'); $metadatum->set_collection($col1); - $metadatum->set_metadata_type('Tainacan\Metadata_Types\Category'); + $metadatum->set_metadata_type('Tainacan\Metadata_Types\Taxonomy'); $metadatum->set_metadata_type_options([ 'taxonomy_id' => $this->get_transient('tax_1_id'), 'allow_new_terms' => true @@ -177,7 +177,7 @@ class Test_Importer extends Importer { $metadatum = new Entities\Metadatum(); $metadatum->set_name('Qualitya'); $metadatum->set_collection($col1); - $metadatum->set_metadata_type('Tainacan\Metadata_Types\Category'); + $metadatum->set_metadata_type('Tainacan\Metadata_Types\Taxonomy'); $metadatum->set_metadata_type_options([ 'taxonomy_id' => $this->get_transient('tax_2_id'), 'allow_new_terms' => true diff --git a/src/js/store/modules/category/actions.js b/src/js/store/modules/category/actions.js deleted file mode 100644 index c6c65f3e6..000000000 --- a/src/js/store/modules/category/actions.js +++ /dev/null @@ -1,184 +0,0 @@ -import axios from '../../../axios/axios' - -// CATEGORIES -export const createCategory = ({commit}, category) => { - return new Promise(( resolve, reject ) => { - axios.tainacan.post('/taxonomies', { - name: category.name, - description: category.description, - status: category.status, - slug: category.slug, - allow_insert: category.allowInsert - }) - .then( res => { - let category = res.data; - commit('setCategory', category); - - resolve( category ); - }) - .catch(error => { - reject( error.response ); - }); - }); -}; - -export const deleteCategory = ({ commit }, categoryId) => { - return new Promise(( resolve, reject ) => { - axios.tainacan.delete(`/taxonomies/${categoryId}?permanently=${true}`) - .then(res => { - commit('deleteCategory', res.data); - - resolve( res ); - }) - .catch(error => { - reject( error ) - }); - }); -}; - -export const updateCategory = ({ commit }, category) => { - return new Promise(( resolve, reject ) => { - axios.tainacan.patch(`/taxonomies/${category.categoryId}`, { - name: category.name, - description: category.description, - status: category.status, - slug: category.slug ? category.slug : '', - allow_insert: category.allowInsert - }) - .then( res => { - let category = res.data; - - commit('setCategory', category); - - resolve( category ); - }) - .catch(error => { - reject({ error_message: error['response']['data'].error_message, errors: error['response']['data'].errors }); - }); - }); -}; - -export const fetchCategories = ({ commit }, { page, categoriesPerPage, status } ) => { - return new Promise((resolve, reject) => { - let endpoint = `/taxonomies?paged=${page}&perpage=${categoriesPerPage}&context=edit`; - - if (status != undefined && status != '') - endpoint = endpoint + '&status=' + status; - - axios.tainacan.get(endpoint) - .then(res => { - let categories = res.data; - - commit('setCategories', categories); - - resolve({ - 'categories': categories, - 'total': res.headers['x-wp-total'] - }); - }) - .catch(error => { - reject(error); - }); - }); -}; - -export const fetchCategory = ({ commit }, categoryId) => { - return new Promise((resolve, reject) => { - axios.tainacan.get(`/taxonomies/${categoryId}`) - .then(res => { - let category = res.data; - - commit('setCategory', category); - - resolve({ - 'category': category - }) - }) - .catch(error => { - reject(error); - }) - }); -}; - -export const fetchCategoryName = ({ commit }, categoryId) => { - return new Promise((resolve, reject) => { - axios.tainacan.get(`/taxonomies/${categoryId}?fetch_only=name`) - .then(res => { - let name = res.data; - - commit('setCategoryName'); - - resolve(name.name) - }) - .catch(error => { - reject(error) - }) - }); -}; - -// CATEGORY TERMS -export const sendTerm = ({commit}, { categoryId, name, description, parent, headerImageId }) => { - return new Promise(( resolve, reject ) => { - axios.tainacan.post('/taxonomy/' + categoryId + '/terms/', { - name: name, - description: description, - parent: parent, - header_image_id: headerImageId, - }) - .then( res => { - let term = res.data; - commit('setSingleTerm', term); - resolve( term ); - }) - .catch(error => { - reject({ error_message: error['response']['data'].error_message, errors: error['response']['data'].errors }); - }); - }); -}; - -export const deleteTerm = ({ commit }, { categoryId, termId }) => { - return new Promise(( resolve, reject ) => { - axios.tainacan.delete(`/taxonomy/${categoryId}/terms/${termId}?permanently=${true}`) - .then(res => { - let term = res.data; - commit('deleteTerm', termId); - resolve( term ); - }) - .catch(error => { - reject({ error_message: error['response']['data'].error_message, errors: error['response']['data'].errors }); - }); - }); -}; - -export const updateTerm = ({ commit }, { categoryId, termId, name, description, parent, headerImageId }) => { - return new Promise(( resolve, reject ) => { - axios.tainacan.patch(`/taxonomy/${categoryId}/terms/${termId}`, { - name: name, - description: description, - parent: parent, - header_image_id: headerImageId, - }) - .then( res => { - let term = res.data; - commit('setSingleTerm', term); - resolve( term ); - }) - .catch(error => { - reject({ error_message: error['response']['data'].error_message, errors: error['response']['data'].errors }); - }); - }); -}; - -export const fetchTerms = ({ commit }, categoryId ) => { - return new Promise((resolve, reject) => { - axios.tainacan.get(`/taxonomy/${categoryId}/terms/?hideempty=0&order=asc`) - .then(res => { - let terms = res.data; - commit('setTerms', terms); - resolve( terms ); - }) - .catch(error => { - reject( error ); - }); - }); -}; diff --git a/src/js/store/modules/category/getters.js b/src/js/store/modules/category/getters.js deleted file mode 100644 index 3a399a74d..000000000 --- a/src/js/store/modules/category/getters.js +++ /dev/null @@ -1,15 +0,0 @@ -export const getCategory = state => { - return state.category; -}; - -export const getCategories = state => { - return state.categories; -}; - -export const getCategoryName = state => { - return state.categoryName; -}; - -export const getTerms = state => { - return state.terms; -}; \ No newline at end of file diff --git a/src/js/store/modules/category/index.js b/src/js/store/modules/category/index.js deleted file mode 100644 index 2691a67f1..000000000 --- a/src/js/store/modules/category/index.js +++ /dev/null @@ -1,18 +0,0 @@ -import * as actions from './actions'; -import * as getters from './getters'; -import * as mutations from './mutations'; - -const state = { - categories: [], - category: {}, - categoryName: String, - terms: [] -}; - -export default { - namespaced: true, - state, - mutations, - actions, - getters -} \ No newline at end of file diff --git a/src/js/store/modules/category/mutations.js b/src/js/store/modules/category/mutations.js deleted file mode 100644 index 0088b842a..000000000 --- a/src/js/store/modules/category/mutations.js +++ /dev/null @@ -1,44 +0,0 @@ -import Vue from 'vue'; - -// CATEGORIES -export const setCategory = (state, category) => { - state.category = category; -}; - -export const setCategories = (state, categories) => { - state.categories = categories; -}; - -export const setCategoryName = (state, name) => { - state.categoryName = name; -}; - -export const deleteCategory = ( state, category ) => { - let index = state.categories.findIndex(deletedCategory => deletedCategory.id === category.id); - - if (index >= 0) { - state.categories.splice(index, 1); - } -}; - -// CATEGORY TERMS -export const setSingleTerm = (state, term) => { - - let index = state.terms.findIndex(updatedTerm => updatedTerm.id === term.id); - if ( index >= 0){ - Vue.set( state.terms, index, term ); - } else { - state.terms.push( term ); - } -}; - -export const setTerms = (state, terms) => { - state.terms = terms; -}; - -export const deleteTerm = ( state, termId ) => { - let index = state.terms.findIndex(deletedTerm => deletedTerm.id === termId); - if (index >= 0) { - state.terms.splice(index, 1); - } -}; \ No newline at end of file diff --git a/src/js/store/store.js b/src/js/store/store.js index 0f29ed174..ccee53388 100644 --- a/src/js/store/store.js +++ b/src/js/store/store.js @@ -6,7 +6,7 @@ import collection from './modules/collection/'; import metadata from './modules/metadata/'; import filter from './modules/filter/'; import search from './modules/search/'; -import category from './modules/category/'; +import taxonomy from './modules/taxonomy/'; import event from './modules/event'; Vue.use(Vuex); @@ -26,7 +26,7 @@ export default new Vuex.Store({ metadata, filter, search, - category, + taxonomy, event, } }) \ No newline at end of file diff --git a/src/languages/tainacan-pt_BR.po b/src/languages/tainacan-pt_BR.po index b34364fbb..404ba0e15 100644 --- a/src/languages/tainacan-pt_BR.po +++ b/src/languages/tainacan-pt_BR.po @@ -235,7 +235,7 @@ msgid "Repository Filters Page" msgstr "Página de Filtros do repositório" #: admin/tainacan-admin-i18n.php:57 -msgid "Categories Page" +msgid "Taxonomies Page" msgstr "Página de Categorias" # ESTÁ REPETIDO @@ -287,7 +287,7 @@ msgstr "Página de Criação da Coleção" #: admin/tainacan-admin-i18n.php:71 #, fuzzy -#| msgid "Category Creation Page" +#| msgid "Taxonomy Creation Page" msgid "Taxonomy Creation Page" msgstr "Página de Criação da Taxonomia" @@ -311,7 +311,7 @@ msgstr "Editar item" #: admin/tainacan-admin-i18n.php:76 #, fuzzy -#| msgid "Category Creation Page" +#| msgid "Taxonomy Creation Page" msgid "Taxonomy Edition Page" msgstr "Página de Criação da Taxonomia" @@ -473,7 +473,7 @@ msgid "Collections per Page:" msgstr "Coleções por Página:" #: admin/tainacan-admin-i18n.php:111 -msgid "Categories per Page:" +msgid "Taxonomies per Page:" msgstr "Categorias por página:" #: admin/tainacan-admin-i18n.php:112 @@ -561,7 +561,7 @@ msgid "Approved" msgstr "Aprovado" #: admin/tainacan-admin-i18n.php:130 -#: classes/metadata-types/category/class-tainacan-category.php:35 +#: classes/metadata-types/taxonomy/class-tainacan-taxonomy.php:35 #: classes/metadata-types/relationship/class-tainacan-relationship.php:26 msgid "Collection Related" msgstr "Coleção relacionada" @@ -585,12 +585,12 @@ msgid "Select taxonomy" msgstr "Categoria pai" #: admin/tainacan-admin-i18n.php:134 -#: classes/metadata-types/category/class-tainacan-category.php:39 +#: classes/metadata-types/taxonomy/class-tainacan-taxonomy.php:39 msgid "Input type" msgstr "Tipo de entrada" #: admin/tainacan-admin-i18n.php:135 -#: classes/metadata-types/category/class-tainacan-category.php:43 +#: classes/metadata-types/taxonomy/class-tainacan-taxonomy.php:43 msgid "Allow new terms" msgstr "Permitir termos novos" @@ -803,7 +803,7 @@ msgid "Select all items on page" msgstr "Selecione um tipo de filtro." #: admin/tainacan-admin-i18n.php:188 -msgid "Delete selected categories" +msgid "Delete selected taxonomies" msgstr "Deletar categorias selecionadas" #: admin/tainacan-admin-i18n.php:189 @@ -887,7 +887,7 @@ msgstr "Nenhuma coleção foi criada neste repositório." #: admin/tainacan-admin-i18n.php:210 #, fuzzy -#| msgid "No category was created in this repository." +#| msgid "No taxonomy was created in this repository." msgid "No taxonomy was created in this repository." msgstr "Nenhuma taxonomia foi criada neste repositório." @@ -921,7 +921,7 @@ msgstr "Erro ao deletar coleção." #: admin/tainacan-admin-i18n.php:218 #, fuzzy -#| msgid "Error on deleting category" +#| msgid "Error on deleting taxonomy" msgid "Error on deleting taxonomy" msgstr "Erro ao deletar taxonomia" @@ -982,7 +982,7 @@ msgid "Showing collections " msgstr "Exibindo coleções " #: admin/tainacan-admin-i18n.php:231 -msgid "Showing categories " +msgid "Showing taxonomies " msgstr "Exibindo categorias " #: admin/tainacan-admin-i18n.php:232 @@ -1149,13 +1149,13 @@ msgstr "Caixa de verificação" #: admin/tainacan-admin-i18n.php:271 #, fuzzy -#| msgid "Category Tag Input" +#| msgid "Taxonomy Tag Input" msgid "Taxonomy Tag Input" msgstr "Entrada de etiquetas de taxonomia" #: admin/tainacan-admin-i18n.php:272 #, fuzzy -#| msgid "Category Check Box" +#| msgid "Taxonomy Check Box" msgid "Taxonomy Check Box" msgstr "Caixa de verificação de taxonomias" @@ -1592,10 +1592,10 @@ msgstr "é inválida" #, fuzzy #| msgid "" #| "Compound metadata do not support metadata with multiple values (except " -#| "categories)" +#| "taxonomies)" msgid "" "Compound metadata do not support metadata with multiple values (except " -"categories)" +"taxonomies)" msgstr "" "Metadados compostos não suportam metadados com vários valores (exceto " "categorias)" @@ -1604,7 +1604,7 @@ msgstr "" #: classes/entities/class-tainacan-metadatum.php:441 #, fuzzy #| msgid "" -#| "Category metadata can not be used inside Compound metadata with multiple " +#| "Taxonomy metadata can not be used inside Compound metadata with multiple " #| "values" msgid "" "Taxonomy metadata can not be used inside Compound metadata with multiple " @@ -1649,26 +1649,26 @@ msgstr "Novo termo de gênero" msgid "You can not have two terms with the same name at the same level" msgstr "Você não pode ter dois termos com o mesmo nome em um mesmo nível" -#: classes/metadata-types/category/class-tainacan-category.php:36 +#: classes/metadata-types/taxonomy/class-tainacan-taxonomy.php:36 #: classes/metadata-types/relationship/class-tainacan-relationship.php:27 msgid "Select the collection to fetch items" msgstr "Selecione a coleção para buscar itens" -#: classes/metadata-types/category/class-tainacan-category.php:40 +#: classes/metadata-types/taxonomy/class-tainacan-taxonomy.php:40 msgid "The html type of the terms list " msgstr "O tipo de html utilizado na lista de termos" -#: classes/metadata-types/category/class-tainacan-category.php:44 +#: classes/metadata-types/taxonomy/class-tainacan-taxonomy.php:44 msgid "Allows to create new terms" msgstr "Permite a criação de novos termos" -#: classes/metadata-types/category/class-tainacan-category.php:70 +#: classes/metadata-types/taxonomy/class-tainacan-taxonomy.php:70 #, fuzzy -#| msgid "Please select a category" +#| msgid "Please select a taxonomy" msgid "Please select a taxonomy" msgstr "Por favor, selecione uma taxonomia." -#: classes/metadata-types/category/class-tainacan-category.php:88 +#: classes/metadata-types/taxonomy/class-tainacan-taxonomy.php:88 #, fuzzy #| msgid "" #| "You can not have 2 taxonomy metadata using the same taxonomy in a " @@ -2640,37 +2640,37 @@ msgstr "Selecione uma opção" msgid "Collection: %s" msgstr "Coleções: %s" -#~ msgid "Category Select Box" +#~ msgid "Taxonomy Select Box" #~ msgstr "Lista de seleção de taxonomias" -#~ msgid "Category" +#~ msgid "Taxonomy" #~ msgstr "Taxonomia" # MUITO IMPRECISA!!!!!!!!!!! -#~ msgid "Category Terms" +#~ msgid "Taxonomy Terms" #~ msgstr "Termos de Categorias" -#~ msgid "Category deleted" +#~ msgid "Taxonomy deleted" #~ msgstr "Taxonomia deletada" -#~ msgid "Do you really want to delete this category?" +#~ msgid "Do you really want to delete this taxonomy?" #~ msgstr "Você realmente deseja deletar esta taxonomia?" -#~ msgid "Category Edition Page" +#~ msgid "Taxonomy Edition Page" #~ msgstr "Página de edição da taxonomia" -#~ msgid "Select category" +#~ msgid "Select taxonomy" #~ msgstr "Selecionar taxonomia" -#~ msgid "Are you sure? The category is not saved, changes will be lost." +#~ msgid "Are you sure? The taxonomy is not saved, changes will be lost." #~ msgstr "" #~ "Opa, tem certeza? Como a taxonomia não foi salva, as alterações podem ser " #~ "perdidas" -#~ msgid "Category Page" +#~ msgid "Taxonomy Page" #~ msgstr "Página da Taxonomia" -#~ msgid "Categories" +#~ msgid "Taxonomies" #~ msgstr "Taxonomies" #~ msgid "exposer_mapping" diff --git a/src/migrate-post-type.php b/src/migrate-post-type.php index 494d5d2b7..610e42d68 100644 --- a/src/migrate-post-type.php +++ b/src/migrate-post-type.php @@ -85,7 +85,7 @@ function tainacan_migrate_post_type_field_to_metadatum(){ $wpdb->update($wpdb->postmeta, - ['meta_value' => 'Tainacan\Metadata_Types\Category'], + ['meta_value' => 'Tainacan\Metadata_Types\Taxonomy'], ['meta_value' => 'Tainacan\Field_Types\Category'], '%s', '%s'); @@ -96,57 +96,75 @@ function tainacan_migrate_post_type_field_to_metadatum(){ '%s', '%s'); - $wpdb->update($wpdb->postmeta, - ['meta_value' => 'Tainacan\Metadata_Types\Core_Description'], - ['meta_value' => 'Tainacan\Metadatum_Types\Core_Description'], - '%s', '%s'); + $wpdb->update($wpdb->postmeta, + ['meta_value' => 'Tainacan\Metadata_Types\Core_Description'], + ['meta_value' => 'Tainacan\Metadatum_Types\Core_Description'], + '%s', '%s'); - $wpdb->update($wpdb->postmeta, - ['meta_value' => 'Tainacan\Metadata_Types\Core_Title'], - ['meta_value' => 'Tainacan\Metadatum_Types\Core_Title'], - '%s', '%s'); + $wpdb->update($wpdb->postmeta, + ['meta_value' => 'Tainacan\Metadata_Types\Core_Title'], + ['meta_value' => 'Tainacan\Metadatum_Types\Core_Title'], + '%s', '%s'); - $wpdb->update($wpdb->postmeta, - ['meta_value' => 'Tainacan\Metadata_Types\Text'], - ['meta_value' => 'Tainacan\Metadatum_Types\Text'], - '%s', '%s'); + $wpdb->update($wpdb->postmeta, + ['meta_value' => 'Tainacan\Metadata_Types\Text'], + ['meta_value' => 'Tainacan\Metadatum_Types\Text'], + '%s', '%s'); - $wpdb->update($wpdb->postmeta, - ['meta_value' => 'Tainacan\Metadata_Types\Textarea'], - ['meta_value' => 'Tainacan\Metadatum_Types\Textarea'], - '%s', '%s'); + $wpdb->update($wpdb->postmeta, + ['meta_value' => 'Tainacan\Metadata_Types\Textarea'], + ['meta_value' => 'Tainacan\Metadatum_Types\Textarea'], + '%s', '%s'); - $wpdb->update($wpdb->postmeta, - ['meta_value' => 'Tainacan\Metadata_Types\Date'], - ['meta_value' => 'Tainacan\Metadatum_Types\Date'], - '%s', '%s'); + $wpdb->update($wpdb->postmeta, + ['meta_value' => 'Tainacan\Metadata_Types\Date'], + ['meta_value' => 'Tainacan\Metadatum_Types\Date'], + '%s', '%s'); - $wpdb->update($wpdb->postmeta, - ['meta_value' => 'Tainacan\Metadata_Types\Numeric'], - ['meta_value' => 'Tainacan\Metadatum_Types\Numeric'], - '%s', '%s'); + $wpdb->update($wpdb->postmeta, + ['meta_value' => 'Tainacan\Metadata_Types\Numeric'], + ['meta_value' => 'Tainacan\Metadatum_Types\Numeric'], + '%s', '%s'); - $wpdb->update($wpdb->postmeta, - ['meta_value' => 'Tainacan\Metadata_Types\Selectbox'], - ['meta_value' => 'Tainacan\Metadatum_Types\Selectbox'], - '%s', '%s'); + $wpdb->update($wpdb->postmeta, + ['meta_value' => 'Tainacan\Metadata_Types\Selectbox'], + ['meta_value' => 'Tainacan\Metadatum_Types\Selectbox'], + '%s', '%s'); - $wpdb->update($wpdb->postmeta, - ['meta_value' => 'Tainacan\Metadata_Types\Relationship'], - ['meta_value' => 'Tainacan\Metadatum_Types\Relationship'], - '%s', '%s'); + $wpdb->update($wpdb->postmeta, + ['meta_value' => 'Tainacan\Metadata_Types\Relationship'], + ['meta_value' => 'Tainacan\Metadatum_Types\Relationship'], + '%s', '%s'); + + $wpdb->update($wpdb->postmeta, + ['meta_value' => 'Tainacan\Metadata_Types\Compound'], + ['meta_value' => 'Tainacan\Metadatum_Types\Compound'], + '%s', '%s'); + $wpdb->update($wpdb->postmeta, + ['meta_value' => 'Tainacan\Metadata_Types\Taxonomy'], + ['meta_value' => 'Tainacan\Metadatum_Types\Category'], + '%s', '%s'); + + $wpdb->update($wpdb->postmeta, + ['meta_value' => 'Tainacan\Metadata_Types\Taxonomy'], + ['meta_value' => 'Tainacan\Metadata_Types\Category'], + '%s', '%s'); - $wpdb->update($wpdb->postmeta, - ['meta_value' => 'Tainacan\Metadata_Types\Category'], - ['meta_value' => 'Tainacan\Metadatum_Types\Category'], - '%s', '%s'); + $wpdb->update($wpdb->postmeta, + ['meta_value' => 'Tainacan\Filter_Types\TaxonomyTaginput'], + ['meta_value' => 'Tainacan\Filter_Types\CategoryTaginput'], + '%s', '%s'); + $wpdb->update($wpdb->postmeta, + ['meta_value' => 'Tainacan\Filter_Types\TaxonomyCheckbox'], + ['meta_value' => 'Tainacan\Filter_Types\CategoryCheckbox'], + '%s', '%s'); - $wpdb->update($wpdb->postmeta, - ['meta_value' => 'Tainacan\Metadata_Types\Compound'], - ['meta_value' => 'Tainacan\Metadatum_Types\Compound'], - '%s', '%s'); + $wpdb->update($wpdb->postmeta, + ['meta_value' => 'Tainacan\Filter_Types\TaxonomySelectbox'], + ['meta_value' => 'Tainacan\Filter_Types\CategorySelectbox'], + '%s', '%s'); } diff --git a/tests/test-category-metadatum-types.php b/tests/test-category-metadatum-types.php index d4259b91e..899b9d580 100644 --- a/tests/test-category-metadatum-types.php +++ b/tests/test-category-metadatum-types.php @@ -13,10 +13,10 @@ use Tainacan\Entities; /** * Sample test case. */ -class CategoryMetadatumTypes extends TAINACAN_UnitTestCase { +class TaxonomyMetadatumTypes extends TAINACAN_UnitTestCase { - function test_category_metadata_types() { + function test_taxonomy_metadata_types() { $Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance(); $Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::get_instance(); @@ -45,7 +45,7 @@ class CategoryMetadatumTypes extends TAINACAN_UnitTestCase { 'name' => 'meta', 'description' => 'description', 'collection' => $collection, - 'metadata_type' => 'Tainacan\Metadata_Types\Category', + 'metadata_type' => 'Tainacan\Metadata_Types\Taxonomy', 'status' => 'publish', 'metadata_type_options' => [ 'taxonomy_id' => $tax->get_id(), @@ -72,7 +72,7 @@ class CategoryMetadatumTypes extends TAINACAN_UnitTestCase { 'name' => 'meta2', 'description' => 'description', 'collection' => $collection, - 'metadata_type' => 'Tainacan\Metadata_Types\Category', + 'metadata_type' => 'Tainacan\Metadata_Types\Taxonomy', 'status' => 'draft', ), true @@ -122,13 +122,13 @@ class CategoryMetadatumTypes extends TAINACAN_UnitTestCase { $this->assertEquals('Tainacan\Entities\Term', get_class($check_item_metadata->get_value())); - // test 2 metadata with same category + // test 2 metadata with same taxonomy $metadatum2->set_metadata_type_options([ 'taxonomy_id' => $tax->get_id(), ]); $metadatum2->set_status('publish'); - $this->assertFalse($metadatum2->validate(), 'Category Metadatum should not validate when using a category in use by another metadatum in the same collection'); + $this->assertFalse($metadatum2->validate(), 'Taxonomy Metadatum should not validate when using a taxonomy in use by another metadatum in the same collection'); $errors = $metadatum2->get_errors(); $this->assertInternalType('array', $errors); $this->assertArrayHasKey('taxonomy_id', $errors[0]['metadata_type_options']); @@ -168,7 +168,7 @@ class CategoryMetadatumTypes extends TAINACAN_UnitTestCase { 'name' => 'meta', 'description' => 'description', 'collection' => $collection, - 'metadata_type' => 'Tainacan\Metadata_Types\Category', + 'metadata_type' => 'Tainacan\Metadata_Types\Taxonomy', 'status' => 'publish', 'metadata_type_options' => [ 'taxonomy_id' => $tax->get_id(), @@ -243,7 +243,7 @@ class CategoryMetadatumTypes extends TAINACAN_UnitTestCase { 'name' => 'meta', 'description' => 'description', 'collection' => $collection, - 'metadata_type' => 'Tainacan\Metadata_Types\Category', + 'metadata_type' => 'Tainacan\Metadata_Types\Taxonomy', 'status' => 'publish', 'metadata_type_options' => [ 'taxonomy_id' => $tax->get_id(), diff --git a/tests/test-compound-metadatum-types.php b/tests/test-compound-metadatum-types.php index d37855579..44c806cfc 100644 --- a/tests/test-compound-metadatum-types.php +++ b/tests/test-compound-metadatum-types.php @@ -248,7 +248,7 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase { } - function test_validations_category_in_multiple() { + function test_validations_taxonomy_in_multiple() { $Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance(); @@ -275,10 +275,10 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase { $newMetadatum = new \Tainacan\Entities\Metadatum(); $newMetadatum->set_name('test_multiple'); - $newMetadatum->set_metadata_type('Tainacan\Metadata_Types\Category'); + $newMetadatum->set_metadata_type('Tainacan\Metadata_Types\Taxonomy'); $newMetadatum->set_parent($metadatum->get_id()); - $this->assertFalse($newMetadatum->validate(), 'You cant add a category metadatum inside a multiple compound metadatum'); + $this->assertFalse($newMetadatum->validate(), 'You cant add a taxonomy metadatum inside a multiple compound metadatum'); $newMetadatum->set_metadata_type('Tainacan\Metadata_Types\Text'); $this->assertTrue($newMetadatum->validate()); @@ -286,7 +286,7 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase { } - function test_validations_category_in_multiple_2() { + function test_validations_taxonomy_in_multiple_2() { $Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance(); @@ -313,15 +313,15 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase { $newMetadatum = new \Tainacan\Entities\Metadatum(); $newMetadatum->set_name('test_multiple'); - $newMetadatum->set_metadata_type('Tainacan\Metadata_Types\Category'); + $newMetadatum->set_metadata_type('Tainacan\Metadata_Types\Taxonomy'); $newMetadatum->set_parent($metadatum->get_id()); - $this->assertTrue($newMetadatum->validate(), 'You can add a category metadatum inside a not multiple compound metadatum'); + $this->assertTrue($newMetadatum->validate(), 'You can add a taxonomy metadatum inside a not multiple compound metadatum'); $newMetadatum = $Tainacan_Metadata->insert($newMetadatum); $metadatum->set_multiple('yes'); - $this->assertFalse($metadatum->validate(), 'You cant turn a compound metadatum into multiple when there is a category metadatum inside it'); + $this->assertFalse($metadatum->validate(), 'You cant turn a compound metadatum into multiple when there is a taxonomy metadatum inside it'); }