Merge branch 'develop' of https://github.com/tainacan/tainacan into develop
This commit is contained in:
commit
195da5098c
|
@ -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')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -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')
|
||||
})
|
||||
})
|
||||
|
|
|
@ -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:**
|
||||
|
|
|
@ -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").
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<b-tabs v-model="activeTab">
|
||||
<b-tab-item :label="$i18n.get('taxonomy')">
|
||||
<form
|
||||
v-if="category != null && category != undefined"
|
||||
v-if="taxonomy != null && taxonomy != undefined"
|
||||
class="tainacan-form"
|
||||
label-width="120px">
|
||||
|
||||
|
@ -16,8 +16,8 @@
|
|||
:type="editFormErrors['name'] != undefined ? 'is-danger' : ''"
|
||||
:message="editFormErrors['name'] != undefined ? editFormErrors['name'] : ''">
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('categories', 'name')"
|
||||
:message="$i18n.getHelperMessage('categories', 'name')"/>
|
||||
:title="$i18n.getHelperTitle('taxonomies', 'name')"
|
||||
:message="$i18n.getHelperMessage('taxonomies', 'name')"/>
|
||||
<b-input
|
||||
id="tainacan-text-name"
|
||||
v-model="form.name"
|
||||
|
@ -32,8 +32,8 @@
|
|||
:type="editFormErrors['description'] != undefined ? 'is-danger' : ''"
|
||||
:message="editFormErrors['description'] != undefined ? editFormErrors['description'] : ''">
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('categories', 'description')"
|
||||
:message="$i18n.getHelperMessage('categories', 'description')"/>
|
||||
:title="$i18n.getHelperTitle('taxonomies', 'description')"
|
||||
:message="$i18n.getHelperMessage('taxonomies', 'description')"/>
|
||||
<b-input
|
||||
id="tainacan-text-description"
|
||||
type="textarea"
|
||||
|
@ -48,8 +48,8 @@
|
|||
:type="editFormErrors['status'] != undefined ? 'is-danger' : ''"
|
||||
:message="editFormErrors['status'] != undefined ? editFormErrors['status'] : ''">
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('categories', 'status')"
|
||||
:message="$i18n.getHelperMessage('categories', 'status')"/>
|
||||
:title="$i18n.getHelperTitle('taxonomies', 'status')"
|
||||
:message="$i18n.getHelperMessage('taxonomies', 'status')"/>
|
||||
<b-select
|
||||
id="tainacan-select-status"
|
||||
v-model="form.status"
|
||||
|
@ -71,8 +71,8 @@
|
|||
:type="editFormErrors['slug'] != undefined ? 'is-danger' : ''"
|
||||
:message="editFormErrors['slug'] != undefined ? editFormErrors['slug'] : ''">
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('categories', 'slug')"
|
||||
:message="$i18n.getHelperMessage('categories', 'slug')"/>
|
||||
:title="$i18n.getHelperTitle('taxonomies', 'slug')"
|
||||
:message="$i18n.getHelperMessage('taxonomies', 'slug')"/>
|
||||
<b-icon :class="{'is-loading': isUpdatingSlug}"/>
|
||||
<b-input
|
||||
@input="updateSlug()"
|
||||
|
@ -85,10 +85,10 @@
|
|||
<!-- Allow Insert -->
|
||||
<b-field
|
||||
:addons="false"
|
||||
:label="$i18n.get('label_category_allow_new_terms')">
|
||||
:label="$i18n.get('label_taxonomy_allow_new_terms')">
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('categories', 'allow_insert')"
|
||||
:message="$i18n.getHelperMessage('categories', 'allow_insert')"/>
|
||||
:title="$i18n.getHelperTitle('taxonomies', 'allow_insert')"
|
||||
:message="$i18n.getHelperMessage('taxonomies', 'allow_insert')"/>
|
||||
<div class="block" >
|
||||
<b-checkbox
|
||||
v-model="form.allowInsert"
|
||||
|
@ -103,14 +103,14 @@
|
|||
<div class="field is-grouped form-submit">
|
||||
<div class="control">
|
||||
<button
|
||||
id="button-cancel-category-creation"
|
||||
id="button-cancel-taxonomy-creation"
|
||||
class="button is-outlined"
|
||||
type="button"
|
||||
@click="cancelBack">{{ $i18n.get('cancel') }}</button>
|
||||
</div>
|
||||
<div class="control">
|
||||
<button
|
||||
id="button-submit-category-creation"
|
||||
id="button-submit-taxonomy-creation"
|
||||
@click.prevent="onSubmit"
|
||||
class="button is-success">{{ $i18n.get('save') }}</button>
|
||||
</div>
|
||||
|
@ -121,11 +121,11 @@
|
|||
|
||||
<b-tab-item :label="$i18n.get('terms')">
|
||||
<!-- Terms List -->
|
||||
<terms-list :category-id="categoryId"/>
|
||||
<terms-list :taxonomy-id="taxonomyId"/>
|
||||
</b-tab-item>
|
||||
|
||||
<b-loading
|
||||
:active.sync="isLoadingCategory"
|
||||
:active.sync="isLoadingTaxonomy"
|
||||
:can-cancel="false"/>
|
||||
</b-tabs>
|
||||
</div>
|
||||
|
@ -140,14 +140,14 @@
|
|||
import CustomDialog from '../other/custom-dialog.vue';
|
||||
|
||||
export default {
|
||||
name: 'CategoryEditionForm',
|
||||
name: 'TaxonomyEditionForm',
|
||||
mixins: [ wpAjax ],
|
||||
data(){
|
||||
return {
|
||||
categoryId: String,
|
||||
taxonomyId: String,
|
||||
activeTab: 0,
|
||||
category: null,
|
||||
isLoadingCategory: false,
|
||||
taxonomy: null,
|
||||
isLoadingTaxonomy: false,
|
||||
isUpdatingSlug: false,
|
||||
form: {
|
||||
name: String,
|
||||
|
@ -180,15 +180,15 @@
|
|||
beforeRouteLeave( to, from, next ) {
|
||||
let formNotSaved = false;
|
||||
|
||||
if (this.category.name != this.form.name)
|
||||
if (this.taxonomy.name != this.form.name)
|
||||
formNotSaved = true;
|
||||
if (this.category.description != this.form.description)
|
||||
if (this.taxonomy.description != this.form.description)
|
||||
formNotSaved = true;
|
||||
if (this.category.slug != this.form.slug)
|
||||
if (this.taxonomy.slug != this.form.slug)
|
||||
formNotSaved = true;
|
||||
if (this.category.allow_insert != this.form.allowInsert)
|
||||
if (this.taxonomy.allow_insert != this.form.allowInsert)
|
||||
formNotSaved = true;
|
||||
if (this.category.status != this.form.status)
|
||||
if (this.taxonomy.status != this.form.status)
|
||||
formNotSaved = true;
|
||||
|
||||
if (formNotSaved) {
|
||||
|
@ -198,7 +198,7 @@
|
|||
props: {
|
||||
icon: 'alert',
|
||||
title: this.$i18n.get('label_warning'),
|
||||
message: this.$i18n.get('info_warning_category_not_saved'),
|
||||
message: this.$i18n.get('info_warning_taxonomy_not_saved'),
|
||||
onConfirm: () => {
|
||||
next();
|
||||
}
|
||||
|
@ -209,21 +209,21 @@
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions('category', [
|
||||
'createCategory',
|
||||
'updateCategory',
|
||||
'fetchCategory',
|
||||
...mapActions('taxonomy', [
|
||||
'createTaxonomy',
|
||||
'updateTaxonomy',
|
||||
'fetchTaxonomy',
|
||||
'fetchOnlySlug'
|
||||
]),
|
||||
...mapGetters('category',[
|
||||
'getCategory',
|
||||
...mapGetters('taxonomy',[
|
||||
'getTaxonomy',
|
||||
]),
|
||||
onSubmit() {
|
||||
|
||||
this.isLoadingCategory = true;
|
||||
this.isLoadingTaxonomy = true;
|
||||
|
||||
let data = {
|
||||
categoryId: this.categoryId,
|
||||
taxonomyId: this.taxonomyId,
|
||||
name: this.form.name,
|
||||
description: this.form.description,
|
||||
slug: this.form.slug,
|
||||
|
@ -231,23 +231,23 @@
|
|||
allowInsert: this.form.allowInsert
|
||||
};
|
||||
|
||||
this.updateCategory(data)
|
||||
.then(updatedCategory => {
|
||||
this.updateTaxonomy(data)
|
||||
.then(updatedTaxonomy => {
|
||||
|
||||
this.category = updatedCategory;
|
||||
this.taxonomy = updatedTaxonomy;
|
||||
|
||||
// Fill this.form data with current data.
|
||||
this.form.name = this.category.name;
|
||||
this.form.slug = this.category.slug;
|
||||
this.form.description = this.category.description;
|
||||
this.form.status = this.category.status;
|
||||
this.form.allowInsert = this.category.allow_insert;
|
||||
this.form.name = this.taxonomy.name;
|
||||
this.form.slug = this.taxonomy.slug;
|
||||
this.form.description = this.taxonomy.description;
|
||||
this.form.status = this.taxonomy.status;
|
||||
this.form.allowInsert = this.taxonomy.allow_insert;
|
||||
|
||||
this.isLoadingCategory = false;
|
||||
this.isLoadingTaxonomy = false;
|
||||
this.formErrorMessage = '';
|
||||
this.editFormErrors = {};
|
||||
|
||||
this.$router.push(this.$routerHelper.getCategoriesPath());
|
||||
this.$router.push(this.$routerHelper.getPath());
|
||||
})
|
||||
.catch((errors) => {
|
||||
for (let error of errors.errors) {
|
||||
|
@ -257,7 +257,7 @@
|
|||
}
|
||||
this.formErrorMessage = errors.error_message;
|
||||
|
||||
this.isLoadingCategory = false;
|
||||
this.isLoadingTaxonomy = false;
|
||||
});
|
||||
},
|
||||
updateSlug(){
|
||||
|
@ -267,7 +267,7 @@
|
|||
|
||||
this.isUpdatingSlug = true;
|
||||
|
||||
this.getSamplePermalink(this.categoryId, this.form.name, this.form.slug)
|
||||
this.getSamplePermalink(this.taxonomyId, this.form.name, this.form.slug)
|
||||
.then(samplePermalink => {
|
||||
|
||||
let promise = htmlToJSON.parse(samplePermalink, {
|
||||
|
@ -292,11 +292,11 @@
|
|||
});
|
||||
|
||||
},
|
||||
createNewCategory() {
|
||||
// Puts loading on Draft Category creation
|
||||
this.isLoadingCategory = true;
|
||||
createNewTaxonomy() {
|
||||
// Puts loading on Draft Taxonomy creation
|
||||
this.isLoadingTaxonomy = true;
|
||||
|
||||
// Creates draft Category
|
||||
// Creates draft Taxonomy
|
||||
let data = {
|
||||
name: '',
|
||||
description: '',
|
||||
|
@ -305,22 +305,22 @@
|
|||
allowInsert: '',
|
||||
};
|
||||
|
||||
this.createCategory(data)
|
||||
this.createTaxonomy(data)
|
||||
.then(res => {
|
||||
|
||||
this.categoryId = res.id;
|
||||
this.category = res;
|
||||
this.taxonomyId = res.id;
|
||||
this.taxonomy = res;
|
||||
|
||||
// Fill this.form data with current data.
|
||||
this.form.name = this.category.name;
|
||||
this.form.description = this.category.description;
|
||||
this.form.slug = this.category.slug;
|
||||
this.form.allowInsert = this.category.allow_insert;
|
||||
this.form.name = this.taxonomy.name;
|
||||
this.form.description = this.taxonomy.description;
|
||||
this.form.slug = this.taxonomy.slug;
|
||||
this.form.allowInsert = this.taxonomy.allow_insert;
|
||||
|
||||
// Pre-fill status with publish to incentivate it
|
||||
this.form.status = 'publish';
|
||||
|
||||
this.isLoadingCategory = false;
|
||||
this.isLoadingTaxonomy = false;
|
||||
|
||||
})
|
||||
.catch(error => this.$console.error(error));
|
||||
|
@ -329,7 +329,7 @@
|
|||
this.editFormErrors[attribute] = undefined;
|
||||
},
|
||||
cancelBack(){
|
||||
this.$router.push(this.$routerHelper.getCategoriesPath());
|
||||
this.$router.push(this.$routerHelper.getPath());
|
||||
},
|
||||
labelNewTerms(){
|
||||
return ( this.form.allowInsert === 'yes' ) ? this.$i18n.get('label_yes') : this.$i18n.get('label_no');
|
||||
|
@ -338,26 +338,26 @@
|
|||
created(){
|
||||
|
||||
if (this.$route.fullPath.split("/").pop() === "new") {
|
||||
this.createNewCategory();
|
||||
this.createNewTaxonomy();
|
||||
} else if (this.$route.fullPath.split("/").pop() === "edit" || this.$route.fullPath.split("/").pop() === "terms") {
|
||||
|
||||
this.isLoadingCategory = true;
|
||||
this.isLoadingTaxonomy = true;
|
||||
|
||||
// Obtains current category ID from URL
|
||||
// Obtains current taxonomy ID from URL
|
||||
this.pathArray = this.$route.fullPath.split("/").reverse();
|
||||
this.categoryId = this.pathArray[1];
|
||||
this.taxonomyId = this.pathArray[1];
|
||||
|
||||
this.fetchCategory(this.categoryId).then(res => {
|
||||
this.category = res.category;
|
||||
this.fetchTaxonomy(this.taxonomyId).then(res => {
|
||||
this.taxonomy = res.taxonomy;
|
||||
|
||||
// Fill this.form data with current data.
|
||||
this.form.name = this.category.name;
|
||||
this.form.description = this.category.description;
|
||||
this.form.slug = this.category.slug;
|
||||
this.form.status = this.category.status;
|
||||
this.form.allowInsert = this.category.allow_insert;
|
||||
this.form.name = this.taxonomy.name;
|
||||
this.form.description = this.taxonomy.description;
|
||||
this.form.slug = this.taxonomy.slug;
|
||||
this.form.status = this.taxonomy.status;
|
||||
this.form.allowInsert = this.taxonomy.allow_insert;
|
||||
|
||||
this.isLoadingCategory = false;
|
||||
this.isLoadingTaxonomy = false;
|
||||
});
|
||||
|
||||
if (this.$route.fullPath.split("/").pop() === "terms")
|
|
@ -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,
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
<template>
|
||||
<div
|
||||
v-if="totalCategories > 0 && !isLoading"
|
||||
v-if="total > 0 && !isLoading"
|
||||
class="table-container">
|
||||
|
||||
<div class="selection-control">
|
||||
<div class="field select-all is-pulled-left">
|
||||
<span>
|
||||
<b-checkbox
|
||||
@click.native="selectAllCategoriesOnPage()"
|
||||
:value="allCategoriesOnPageSelected">{{ $i18n.get('label_select_all_categories_page') }}</b-checkbox>
|
||||
@click.native="selectAllOnPage()"
|
||||
:value="allOnPageSelected">{{ $i18n.get('label_select_all_taxonomies_page') }}</b-checkbox>
|
||||
</span>
|
||||
</div>
|
||||
<div class="field is-pulled-right">
|
||||
<b-dropdown
|
||||
position="is-bottom-left"
|
||||
v-if="categories[0].current_user_can_edit"
|
||||
:disabled="!isSelectingCategories"
|
||||
v-if="taxonomies[0].current_user_can_edit"
|
||||
:disabled="!isSelecting"
|
||||
id="bulk-actions-dropdown">
|
||||
<button
|
||||
class="button is-white"
|
||||
|
@ -26,10 +26,10 @@
|
|||
|
||||
<b-dropdown-item
|
||||
id="item-delete-selected-items"
|
||||
@click="deleteSelectedCategories()">
|
||||
{{ $i18n.get('label_delete_selected_categories') }}
|
||||
@click="deleteSelected()">
|
||||
{{ $i18n.get('label_delete_selected_taxonomies') }}
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item disabled>{{ $i18n.get('label_edit_selected_categories') + ' (Not ready)' }}
|
||||
<b-dropdown-item disabled>{{ $i18n.get('label_edit_selected_taxonomies') + ' (Not ready)' }}
|
||||
</b-dropdown-item>
|
||||
</b-dropdown>
|
||||
</div>
|
||||
|
@ -61,55 +61,55 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
:class="{ 'selected-row': selectedCategories[index] }"
|
||||
:class="{ 'selected-row': selected[index] }"
|
||||
:key="index"
|
||||
v-for="(category, index) of categories">
|
||||
v-for="(taxonomy, index) of taxonomies">
|
||||
<!-- Checking list -->
|
||||
<td
|
||||
:class="{ 'is-selecting': isSelectingCategories }"
|
||||
:class="{ 'is-selecting': isSelecting }"
|
||||
class="checkbox-cell">
|
||||
<b-checkbox
|
||||
size="is-small"
|
||||
v-model="selectedCategories[index]"/>
|
||||
v-model="selected[index]"/>
|
||||
</td>
|
||||
<!-- Name -->
|
||||
<td
|
||||
class="column-default-width column-main-content"
|
||||
@click="goToCategoryEditPage(category.id)"
|
||||
@click="goToTaxonomyEditPage(taxonomy.id)"
|
||||
:label="$i18n.get('label_name')"
|
||||
:aria-label="$i18n.get('label_name') + ': ' + category.name">
|
||||
:aria-label="$i18n.get('label_name') + ': ' + taxonomy.name">
|
||||
<p
|
||||
v-tooltip="{
|
||||
content: category.name,
|
||||
content: taxonomy.name,
|
||||
autoHide: false,
|
||||
placement: 'auto-start'
|
||||
}">
|
||||
{{ category.name }}</p>
|
||||
{{ taxonomy.name }}</p>
|
||||
</td>
|
||||
<!-- Description -->
|
||||
<td
|
||||
class="column-large-width"
|
||||
@click="goToCategoryEditPage(category.id)"
|
||||
@click="goToTaxonomyEditPage(taxonomy.id)"
|
||||
:label="$i18n.get('label_description')"
|
||||
:aria-label="$i18n.get('label_description') + ': ' + category.description">
|
||||
:aria-label="$i18n.get('label_description') + ': ' + taxonomy.description">
|
||||
<p
|
||||
v-tooltip="{
|
||||
content: category.description,
|
||||
content: taxonomy.description,
|
||||
autoHide: false,
|
||||
placement: 'auto-start'
|
||||
}">
|
||||
{{ category.description }}</p>
|
||||
{{ taxonomy.description }}</p>
|
||||
</td>
|
||||
<!-- Actions -->
|
||||
<td
|
||||
@click="goToCategoryEditPage(category.id)"
|
||||
@click="goToTaxonomyEditPage(taxonomy.id)"
|
||||
class="actions-cell column-default-width"
|
||||
:label="$i18n.get('label_actions')">
|
||||
<div class="actions-container">
|
||||
<a
|
||||
id="button-edit"
|
||||
:aria-label="$i18n.getFrom('categories','edit_item')"
|
||||
@click="goToCategoryEditPage(category.id)">
|
||||
:aria-label="$i18n.getFrom('taxonomies','edit_item')"
|
||||
@click="goToTaxonomyEditPage(taxonomy.id)">
|
||||
<b-icon
|
||||
type="is-secondary"
|
||||
icon="pencil"/>
|
||||
|
@ -117,7 +117,7 @@
|
|||
<a
|
||||
id="button-delete"
|
||||
:aria-label="$i18n.get('label_button_delete')"
|
||||
@click.prevent.stop="deleteOneCategory(category.id)">
|
||||
@click.prevent.stop="deleteOneTaxonomy(taxonomy.id)">
|
||||
<b-icon
|
||||
type="is-secondary"
|
||||
icon="delete"/>
|
||||
|
@ -136,76 +136,76 @@
|
|||
import CustomDialog from '../other/custom-dialog.vue';
|
||||
|
||||
export default {
|
||||
name: 'CategoriesList',
|
||||
name: 'List',
|
||||
data() {
|
||||
return {
|
||||
selectedCategories: [],
|
||||
allCategoriesOnPageSelected: false,
|
||||
isSelectingCategories: false
|
||||
selected: [],
|
||||
allOnPageSelected: false,
|
||||
isSelecting: false
|
||||
}
|
||||
},
|
||||
props: {
|
||||
isLoading: false,
|
||||
totalCategories: 0,
|
||||
total: 0,
|
||||
page: 1,
|
||||
categoriesPerPage: 12,
|
||||
categories: Array
|
||||
taxonomiesPerPage: 12,
|
||||
taxonomies: Array
|
||||
},
|
||||
watch: {
|
||||
categories() {
|
||||
this.selectedCategories = [];
|
||||
for (let i = 0; i < this.categories.length; i++)
|
||||
this.selectedCategories.push(false);
|
||||
taxonomies() {
|
||||
this.selected = [];
|
||||
for (let i = 0; i < this.taxonomies.length; i++)
|
||||
this.selected.push(false);
|
||||
},
|
||||
selectedCategories() {
|
||||
selected() {
|
||||
let allSelected = true;
|
||||
let isSelecting = false;
|
||||
for (let i = 0; i < this.selectedCategories.length; i++) {
|
||||
if (this.selectedCategories[i] == false) {
|
||||
for (let i = 0; i < this.selected.length; i++) {
|
||||
if (this.selected[i] == false) {
|
||||
allSelected = false;
|
||||
} else {
|
||||
isSelecting = true;
|
||||
}
|
||||
}
|
||||
this.allCategoriesOnPageSelected = allSelected;
|
||||
this.isSelectingCategories = isSelecting;
|
||||
this.allOnPageSelected = allSelected;
|
||||
this.isSelecting = isSelecting;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions('category', [
|
||||
'deleteCategory'
|
||||
...mapActions('taxonomy', [
|
||||
'deleteTaxonomy'
|
||||
]),
|
||||
selectAllCategoriesOnPage() {
|
||||
for (let i = 0; i < this.selectedCategories.length; i++)
|
||||
this.selectedCategories.splice(i, 1, !this.allCategoriesOnPageSelected);
|
||||
selectAllOnPage() {
|
||||
for (let i = 0; i < this.selected.length; i++)
|
||||
this.selected.splice(i, 1, !this.allOnPageSelected);
|
||||
},
|
||||
deleteOneCategory(categoryId) {
|
||||
deleteOneTaxonomy(taxonomyId) {
|
||||
this.$modal.open({
|
||||
parent: this,
|
||||
component: CustomDialog,
|
||||
props: {
|
||||
icon: 'alert',
|
||||
title: this.$i18n.get('label_warning'),
|
||||
message: this.$i18n.get('info_warning_category_delete'),
|
||||
message: this.$i18n.get('info_warning_taxonomy_delete'),
|
||||
onConfirm: () => {
|
||||
this.deleteCategory(categoryId)
|
||||
this.deleteTaxonomy(taxonomyId)
|
||||
.then(() => {
|
||||
// this.$toast.open({
|
||||
// duration: 3000,
|
||||
// message: this.$i18n.get('info_category_deleted'),
|
||||
// message: this.$i18n.get('info_taxonomy_deleted'),
|
||||
// position: 'is-bottom',
|
||||
// type: 'is-secondary',
|
||||
// queue: true
|
||||
// });
|
||||
for (let i = 0; i < this.selectedCategories.length; i++) {
|
||||
if (this.selectedCategories[i].id === this.categoryId)
|
||||
this.selectedCategories.splice(i, 1);
|
||||
for (let i = 0; i < this.selected.length; i++) {
|
||||
if (this.selected[i].id === this.taxonomyId)
|
||||
this.selected.splice(i, 1);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// this.$toast.open({
|
||||
// duration: 3000,
|
||||
// message: this.$i18n.get('info_error_deleting_category'),
|
||||
// message: this.$i18n.get('info_error_deleting_taxonomy'),
|
||||
// position: 'is-bottom',
|
||||
// type: 'is-danger',
|
||||
// queue: true
|
||||
|
@ -215,24 +215,24 @@
|
|||
}
|
||||
});
|
||||
},
|
||||
deleteSelectedCategories() {
|
||||
deleteSelected() {
|
||||
this.$modal.open({
|
||||
parent: this,
|
||||
component: CustomDialog,
|
||||
props: {
|
||||
icon: 'alert',
|
||||
title: this.$i18n.get('label_warning'),
|
||||
message: this.$i18n.get('info_warning_selected_categories_delete'),
|
||||
message: this.$i18n.get('info_warning_selected_taxonomies_delete'),
|
||||
onConfirm: () => {
|
||||
|
||||
for (let i = 0; i < this.categories.length; i++) {
|
||||
if (this.selectedCategories[i]) {
|
||||
this.deleteCategory(this.categories[i].id)
|
||||
for (let i = 0; i < this.taxonomies.length; i++) {
|
||||
if (this.selected[i]) {
|
||||
this.deleteTaxonomy(this.taxonomies[i].id)
|
||||
.then(() => {
|
||||
// this.loadCategories();
|
||||
// this.load();
|
||||
// this.$toast.open({
|
||||
// duration: 3000,
|
||||
// message: this.$i18n.get('info_category_deleted'),
|
||||
// message: this.$i18n.get('info_taxonomy_deleted'),
|
||||
// position: 'is-bottom',
|
||||
// type: 'is-secondary',
|
||||
// queue: false
|
||||
|
@ -240,7 +240,7 @@
|
|||
}).catch(() => {
|
||||
// this.$toast.open({
|
||||
// duration: 3000,
|
||||
// message: this.$i18n.get('info_error_deleting_category'),
|
||||
// message: this.$i18n.get('info_error_deleting_taxonomy'),
|
||||
// position: 'is-bottom',
|
||||
// type: 'is-danger',
|
||||
// queue: false
|
||||
|
@ -248,16 +248,16 @@
|
|||
});
|
||||
}
|
||||
}
|
||||
this.allCategoriesOnPageSelected = false;
|
||||
this.allOnPageSelected = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
goToCategoryPage(categoryId) {
|
||||
this.$router.push(this.$routerHelper.getCategoryPath(categoryId));
|
||||
goToTaxonomyPage(taxonomyId) {
|
||||
this.$router.push(this.$routerHelper.getTaxonomyPath(taxonomyId));
|
||||
},
|
||||
goToCategoryEditPage(categoryId) {
|
||||
this.$router.push(this.$routerHelper.getCategoryEditPath(categoryId));
|
||||
goToTaxonomyEditPage(taxonomyId) {
|
||||
this.$router.push(this.$routerHelper.getTaxonomyEditPath(taxonomyId));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
<div>
|
||||
<b-field
|
||||
:addons="false"
|
||||
:label="$i18n.get('label_category_terms')">
|
||||
:label="$i18n.get('label_taxonomy_terms')">
|
||||
<button
|
||||
class="button is-secondary is-pulled-right"
|
||||
type="button"
|
||||
|
@ -41,7 +41,7 @@
|
|||
<button
|
||||
class="button is-success is-small"
|
||||
type="button"
|
||||
:href="categoryPath + '/' + term.slug">
|
||||
:href="taxonomyPath + '/' + term.slug">
|
||||
{{ $i18n.get('label_view_term') }}
|
||||
</button>
|
||||
-->
|
||||
|
@ -69,7 +69,7 @@
|
|||
</span>
|
||||
<div v-show="term.opened">
|
||||
<term-edition-form
|
||||
:category-id="categoryId"
|
||||
:taxonomy-id="taxonomyId"
|
||||
@onEditionFinished="onTermEditionFinished()"
|
||||
@onEditionCanceled="onTermEditionCanceled(term)"
|
||||
@onErrorFound="formWithErrors = term.id"
|
||||
|
@ -98,8 +98,8 @@ export default {
|
|||
}
|
||||
},
|
||||
props: {
|
||||
categoryId: String,
|
||||
//categoryPath: ''
|
||||
taxonomyId: String,
|
||||
//taxonomyPath: ''
|
||||
},
|
||||
computed: {
|
||||
termsList() {
|
||||
|
@ -110,7 +110,7 @@ export default {
|
|||
termsList() {
|
||||
this.generateOrderedTerms();
|
||||
},
|
||||
categoryId() {
|
||||
taxonomyId() {
|
||||
this.loadTerms();
|
||||
}
|
||||
},
|
||||
|
@ -118,17 +118,17 @@ export default {
|
|||
TermEditionForm
|
||||
},
|
||||
methods: {
|
||||
...mapActions('category', [
|
||||
...mapActions('taxonomy', [
|
||||
'updateTerm',
|
||||
'deleteTerm',
|
||||
'fetchTerms'
|
||||
]),
|
||||
...mapGetters('category',[
|
||||
...mapGetters('taxonomy',[
|
||||
'getTerms'
|
||||
]),
|
||||
addNewTerm() {
|
||||
let newTerm = {
|
||||
categoryId: this.categoryId,
|
||||
taxonomyId: this.taxonomyId,
|
||||
name: this.$i18n.get('label_term_without_name'),
|
||||
description: '',
|
||||
parent: 0,
|
||||
|
@ -141,7 +141,7 @@ export default {
|
|||
},
|
||||
addNewChildTerm(parent, parentIndex) {
|
||||
let newTerm = {
|
||||
categoryId: this.categoryId,
|
||||
taxonomyId: this.taxonomyId,
|
||||
name: this.$i18n.get('label_term_without_name'),
|
||||
description: '',
|
||||
parent: parent.id,
|
||||
|
@ -238,7 +238,7 @@ export default {
|
|||
}
|
||||
} else {
|
||||
|
||||
this.deleteTerm({categoryId: this.categoryId, termId: term.id})
|
||||
this.deleteTerm({taxonomyId: this.taxonomyId, termId: term.id})
|
||||
.then(() => {
|
||||
|
||||
})
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,11 +57,11 @@
|
|||
<router-link
|
||||
tag="a"
|
||||
to="/taxonomies"
|
||||
:class="activeRoute == 'CategoriesPage' ? 'is-active':''">
|
||||
:class="activeRoute == 'Page' ? 'is-active':''">
|
||||
<b-icon
|
||||
size="is-small"
|
||||
icon="shape"/>
|
||||
<span class="menu-text">{{ $i18n.getFrom('categories', 'name') }}</span>
|
||||
<span class="menu-text">{{ $i18n.getFrom('taxonomies', 'name') }}</span>
|
||||
</router-link>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -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':
|
||||
|
|
|
@ -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':
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 Page 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: 'Page', component: Page, 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'} },
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
@ -105,40 +105,25 @@ UserPrefsPlugin.install = function (Vue, options = {}) {
|
|||
'items_per_page': 12,
|
||||
'collections_per_page': 12,
|
||||
'taxonomies_per_page': 12,
|
||||
'events_per_page': 12
|
||||
'events_per_page': 12,
|
||||
'order': 'DESC',
|
||||
'order_by': {
|
||||
id: 'creation_date',
|
||||
name: 'Creation Date'
|
||||
}
|
||||
},
|
||||
init() {
|
||||
wpApi.get('/users/me/')
|
||||
.then( res => {
|
||||
if (res.data.meta['tainacan_prefs'] == undefined || res.data.meta['tainacan_prefs'] == '') {
|
||||
let data = {'meta': {'tainacan_prefs': JSON.stringify(this.tainacanPrefs)} };
|
||||
wpApi.post('/users/me/', qs.stringify(data))
|
||||
.then( updatedRes => {
|
||||
let prefs = JSON.parse(updatedRes.data.meta['tainacan_prefs']);
|
||||
this.tainacanPrefs = prefs;
|
||||
});
|
||||
} else {
|
||||
let prefs = JSON.parse(res.data.meta['tainacan_prefs']);
|
||||
this.tainacanPrefs = prefs;
|
||||
}
|
||||
if (tainacan_plugin.user_prefs == undefined || tainacan_plugin.user_prefs == '') {
|
||||
let data = {'meta': {'tainacan_prefs': JSON.stringify(this.tainacanPrefs)} };
|
||||
wpApi.post('/users/me/', qs.stringify(data))
|
||||
.then( updatedRes => {
|
||||
let prefs = JSON.parse(updatedRes.data.meta['tainacan_prefs']);
|
||||
this.tainacanPrefs = prefs;
|
||||
});
|
||||
},
|
||||
fetch(key) {
|
||||
return new Promise(( resolve, reject ) => {
|
||||
wpApi.get('/users/me/')
|
||||
.then( res => {
|
||||
let prefs = JSON.parse(res.data.meta['tainacan_prefs']);
|
||||
this.tainacanPrefs[key] = prefs[key];
|
||||
if (prefs[key]) {
|
||||
resolve( prefs[key] );
|
||||
} else {
|
||||
reject('Key ' + key + 'does not exists in user preference.');
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
reject( { message: error, value: false});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
let prefs = JSON.parse(tainacan_plugin.user_prefs);
|
||||
this.tainacanPrefs = prefs;
|
||||
}
|
||||
},
|
||||
get(key) {
|
||||
return this.tainacanPrefs[key];
|
||||
|
@ -162,7 +147,7 @@ UserPrefsPlugin.install = function (Vue, options = {}) {
|
|||
});
|
||||
});
|
||||
},
|
||||
clear() {
|
||||
clean() {
|
||||
let data = {'meta': {'tainacan_prefs': ''} };
|
||||
wpApi.post('/users/me/', qs.stringify(data))
|
||||
}
|
||||
|
@ -194,11 +179,11 @@ RouterHelperPlugin.install = function (Vue, options = {}) {
|
|||
getItemsPath(query) {
|
||||
return '/items/?' + qs.stringify(query);
|
||||
},
|
||||
getCategoriesPath(query) {
|
||||
getPath(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 +204,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 +235,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 +254,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';
|
||||
|
|
|
@ -218,16 +218,14 @@ export default {
|
|||
});
|
||||
},
|
||||
mounted(){
|
||||
this.$userPrefs.fetch('collections_per_page')
|
||||
.then((value) => {
|
||||
if (this.collectionsPerPage != value) {
|
||||
this.collectionsPerPage = value;
|
||||
this.loadCollections;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
if (this.collectionsPerPage != this.$userPrefs.get('collections_per_page'))
|
||||
this.collectionsPerPage = this.$userPrefs.get('collections_per_page');
|
||||
|
||||
if (!this.collectionsPerPage) {
|
||||
this.collectionsPerPage = 12;
|
||||
this.$userPrefs.set('collections_per_page', 12);
|
||||
});
|
||||
}
|
||||
|
||||
this.loadCollections();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -143,16 +143,13 @@
|
|||
this.isRepositoryLevel = (this.$route.params.collectionId === undefined);
|
||||
},
|
||||
mounted(){
|
||||
this.$userPrefs.fetch('events_per_page')
|
||||
.then((value) => {
|
||||
if (this.eventsPerPage != value) {
|
||||
this.eventsPerPage = value;
|
||||
this.loadEvents;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
if (this.eventsPerPage != this.$userPrefs.get('events_per_page'))
|
||||
this.eventsPerPage = this.$userPrefs.get('events_per_page');
|
||||
|
||||
if (!this.eventsPerPage) {
|
||||
this.eventsPerPage = 12;
|
||||
this.$userPrefs.set('events_per_page', 12);
|
||||
});
|
||||
}
|
||||
this.loadEvents();
|
||||
|
||||
if (!this.isRepositoryLevel) {
|
||||
|
|
|
@ -184,8 +184,8 @@
|
|||
<option
|
||||
v-for="metadatum in tableMetadata"
|
||||
v-if="
|
||||
metadatum.id === 'creation_date' ||
|
||||
metadatum.id === 'author_name' || (
|
||||
metadatum.slug === 'creation_date' ||
|
||||
metadatum.slug === 'author_name' || (
|
||||
metadatum.id !== undefined &&
|
||||
metadatum.metadata_type_object &&
|
||||
metadatum.metadata_type_object.related_mapped_prop !== 'description' &&
|
||||
|
@ -194,7 +194,7 @@
|
|||
metadatum.metadata_type_object.primitive_type !== 'compound'
|
||||
)"
|
||||
:value="metadatum"
|
||||
:key="metadatum.id">
|
||||
:key="metadatum.slug">
|
||||
{{ metadatum.name }}
|
||||
</option>
|
||||
</b-select>
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
v-if="$userCaps.hasCapability('edit_tainacan-taxonomies')">
|
||||
<div class="header-item">
|
||||
<router-link
|
||||
id="button-create-category"
|
||||
id="button-create-taxonomy"
|
||||
tag="button"
|
||||
class="button is-secondary"
|
||||
:to="{ path: $routerHelper.getNewCategoryPath() }">
|
||||
:to="{ path: $routerHelper.getNewTaxonomyPath() }">
|
||||
{{ $i18n.getFrom('taxonomies', 'new_item') }}
|
||||
</router-link>
|
||||
</div>
|
||||
|
@ -31,15 +31,15 @@
|
|||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
<categories-list
|
||||
<taxonomies-list
|
||||
:is-loading="isLoading"
|
||||
:total-categories="totalCategories"
|
||||
:total-taxonomies="total"
|
||||
:page="page"
|
||||
:categories-per-page="taxonomiesPerPage"
|
||||
:categories="categories"/>
|
||||
:taxonomies-per-page="taxonomiesPerPage"
|
||||
:taxonomies="taxonomies"/>
|
||||
|
||||
<!-- Empty state image -->
|
||||
<div v-if="totalCategories <= 0 && !isLoading">
|
||||
<div v-if="total <= 0 && !isLoading">
|
||||
<section class="section">
|
||||
<div class="content has-text-grey has-text-centered">
|
||||
<p>
|
||||
|
@ -47,16 +47,16 @@
|
|||
icon="inbox"
|
||||
size="is-large"/>
|
||||
</p>
|
||||
<p v-if="status == undefined || status == ''">{{ $i18n.get('info_no_category_created') }}</p>
|
||||
<p v-if="status == 'draft'">{{ $i18n.get('info_no_category_draft') }}</p>
|
||||
<p v-if="status == 'trash'">{{ $i18n.get('info_no_category_trash') }}</p>
|
||||
<p v-if="status == undefined || status == ''">{{ $i18n.get('info_no_taxonomy_created') }}</p>
|
||||
<p v-if="status == 'draft'">{{ $i18n.get('info_no_taxonomy_draft') }}</p>
|
||||
<p v-if="status == 'trash'">{{ $i18n.get('info_no_taxonomy_trash') }}</p>
|
||||
<router-link
|
||||
v-if="status == undefined || status == ''"
|
||||
id="button-create-category"
|
||||
id="button-create-taxonomy"
|
||||
tag="button"
|
||||
class="button is-primary"
|
||||
:to="{ path: $routerHelper.getNewCategoryPath() }">
|
||||
{{ $i18n.getFrom('categories', 'new_item') }}
|
||||
:to="{ path: $routerHelper.getNewTaxonomyPath() }">
|
||||
{{ $i18n.getFrom('taxonomies', 'new_item') }}
|
||||
</router-link>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -64,24 +64,24 @@
|
|||
<!-- Footer -->
|
||||
<div
|
||||
class="pagination-area"
|
||||
v-if="totalCategories > 0">
|
||||
v-if="total > 0">
|
||||
<div class="shown-items">
|
||||
{{
|
||||
$i18n.get('info_showing_categories') +
|
||||
$i18n.get('info_showing_taxonomies') +
|
||||
(taxonomiesPerPage * (page - 1) + 1) +
|
||||
$i18n.get('info_to') +
|
||||
getLastCategoryNumber() +
|
||||
$i18n.get('info_of') + totalCategories + '.'
|
||||
getLastTaxonomyNumber() +
|
||||
$i18n.get('info_of') + total + '.'
|
||||
}}
|
||||
</div>
|
||||
<div class="items-per-page">
|
||||
<b-field
|
||||
horizontal
|
||||
:label="$i18n.get('label_categories_per_page')">
|
||||
:label="$i18n.get('label_taxonomies_per_page')">
|
||||
<b-select
|
||||
:value="taxonomiesPerPage"
|
||||
@input="onChangeCategoriesPerPage"
|
||||
:disabled="categories.length <= 0">
|
||||
@input="onChangePerPage"
|
||||
:disabled="taxonomies.length <= 0">
|
||||
<option value="12">12</option>
|
||||
<option value="24">24</option>
|
||||
<option value="48">48</option>
|
||||
|
@ -92,7 +92,7 @@
|
|||
<div class="pagination">
|
||||
<b-pagination
|
||||
@change="onPageChange"
|
||||
:total="totalCategories"
|
||||
:total="total"
|
||||
:current.sync="page"
|
||||
order="is-centered"
|
||||
size="is-small"
|
||||
|
@ -106,36 +106,36 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import CategoriesList from "../../components/lists/categories-list.vue";
|
||||
import List from "../../components/lists/taxonomies-list.vue";
|
||||
import { mapActions, mapGetters } from 'vuex';
|
||||
//import moment from 'moment'
|
||||
|
||||
export default {
|
||||
name: 'CategoriesPage',
|
||||
name: 'Page',
|
||||
data(){
|
||||
return {
|
||||
isLoading: false,
|
||||
totalCategories: 0,
|
||||
total: 0,
|
||||
page: 1,
|
||||
taxonomiesPerPage: 12,
|
||||
status: ''
|
||||
}
|
||||
},
|
||||
components: {
|
||||
CategoriesList
|
||||
List
|
||||
},
|
||||
methods: {
|
||||
...mapActions('category', [
|
||||
'fetchCategories',
|
||||
...mapActions('taxonomy', [
|
||||
'fetch',
|
||||
]),
|
||||
...mapGetters('category', [
|
||||
'getCategories'
|
||||
...mapGetters('taxonomy', [
|
||||
'get'
|
||||
]),
|
||||
onChangeTab(status) {
|
||||
this.status = status;
|
||||
this.loadCategories();
|
||||
this.load();
|
||||
},
|
||||
onChangeCategoriesPerPage(value) {
|
||||
onChangePerPage(value) {
|
||||
this.taxonomiesPerPage = value;
|
||||
this.$userPrefs.set('taxonomies_per_page', value)
|
||||
.then((newValue) => {
|
||||
|
@ -144,48 +144,46 @@
|
|||
.catch(() => {
|
||||
this.$console.log("Error settings user prefs for taxonomies per page")
|
||||
});
|
||||
this.loadCategories();
|
||||
this.load();
|
||||
},
|
||||
onPageChange(page) {
|
||||
this.page = page;
|
||||
this.loadCategories();
|
||||
this.load();
|
||||
},
|
||||
loadCategories() {
|
||||
load() {
|
||||
this.isLoading = true;
|
||||
|
||||
this.fetchCategories({ 'page': this.page, 'taxonomiesPerPage': this.taxonomiesPerPage, 'status': this.status })
|
||||
this.fetch({ 'page': this.page, 'taxonomiesPerPage': this.taxonomiesPerPage, 'status': this.status })
|
||||
.then((res) => {
|
||||
this.isLoading = false;
|
||||
this.totalCategories = res.total;
|
||||
this.total = res.total;
|
||||
})
|
||||
.catch(() => {
|
||||
this.isLoading = false;
|
||||
});
|
||||
},
|
||||
getLastCategoryNumber() {
|
||||
getLastTaxonomyNumber() {
|
||||
let last = (Number(this.taxonomiesPerPage * (this.page - 1)) + Number(this.taxonomiesPerPage));
|
||||
return last > this.totalCategories ? this.totalCategories : last;
|
||||
return last > this.total ? this.total : last;
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
categories(){
|
||||
return this.getCategories();
|
||||
taxonomies(){
|
||||
return this.get();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.taxonomiesPerPage = this.$userPrefs.get('taxonomies_per_page');
|
||||
},
|
||||
mounted(){
|
||||
this.$userPrefs.fetch('taxonomies_per_page')
|
||||
.then((value) => {
|
||||
if (this.taxonomiesPerPage != value) {
|
||||
this.taxonomiesPerPage = value;
|
||||
this.loadCategories;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
if (this.taxonomiesPerPage != this.$userPrefs.get('taxonomies_per_page'))
|
||||
this.taxonomiesPerPage = this.$userPrefs.get('taxonomies_per_page');
|
||||
|
||||
if (!this.taxonomiesPerPage) {
|
||||
this.taxonomiesPerPage = 12;
|
||||
this.$userPrefs.set('taxonomies_per_page', 12);
|
||||
});
|
||||
}
|
||||
|
||||
this.loadCategories();
|
||||
}
|
||||
}
|
|
@ -4,16 +4,16 @@
|
|||
<div class="card">
|
||||
<div class="card-content">
|
||||
<p class="title">
|
||||
{{ category.name }}
|
||||
{{ taxonomy.name }}
|
||||
</p>
|
||||
<p class="subtitle">
|
||||
{{ category.description }}
|
||||
{{ taxonomy.description }}
|
||||
</p>
|
||||
</div>
|
||||
<footer class="card-footer">
|
||||
<router-link
|
||||
class="card-footer-item"
|
||||
:to="{ path: $routerHelper.getCategoryEditPath(categoryId)}">
|
||||
:to="{ path: $routerHelper.getTaxonomyEditPath(taxonomyId)}">
|
||||
{{ $i18n.getFrom('taxonomies','edit_item') }}
|
||||
</router-link>
|
||||
<a class="card-footer-item">
|
||||
|
@ -29,29 +29,29 @@
|
|||
import { mapActions, mapGetters } from 'vuex';
|
||||
|
||||
export default {
|
||||
name: 'CategoryPage',
|
||||
name: 'TaxonomyPage',
|
||||
data(){
|
||||
return {
|
||||
categoryId: Number,
|
||||
taxonomyId: Number,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions('category', [
|
||||
'fetchCategory'
|
||||
...mapActions('taxonomy', [
|
||||
'fetchTaxonomy'
|
||||
]),
|
||||
...mapGetters('category', [
|
||||
'getCategory'
|
||||
...mapGetters('taxonomy', [
|
||||
'getTaxonomy'
|
||||
])
|
||||
},
|
||||
computed: {
|
||||
category(){
|
||||
return this.getCategory();
|
||||
taxonomy(){
|
||||
return this.getTaxonomy();
|
||||
}
|
||||
},
|
||||
created(){
|
||||
this.categoryId = parseInt(this.$route.params.categoryId);
|
||||
this.taxonomyId = parseInt(this.$route.params.taxonomyId);
|
||||
|
||||
this.fetchCategory(this.categoryId);
|
||||
this.fetchTaxonomy(this.taxonomyId);
|
||||
}
|
||||
|
||||
}
|
|
@ -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' )
|
||||
]);
|
||||
?>
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
getValuesCategory( taxonomy ){
|
||||
getValuesTaxonomy( taxonomy ){
|
||||
return axios.get('/taxonomy/' + taxonomy + '/terms?hideempty=0&order=asc' ).then( res => {
|
||||
for (let item of res.data) {
|
||||
this.taxonomy = item.taxonomy;
|
||||
|
@ -72,7 +72,7 @@
|
|||
axios.get('/collection/'+ this.collection +'/metadata/' + this.metadatum)
|
||||
.then( res => {
|
||||
let metadatum = res.data;
|
||||
promise = this.getValuesCategory( metadatum.metadata_type_options.taxonomy_id );
|
||||
promise = this.getValuesTaxonomy( metadatum.metadata_type_options.taxonomy_id );
|
||||
|
||||
promise.then( () => {
|
||||
this.isLoading = false;
|
|
@ -56,7 +56,7 @@
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
getValuesCategory( taxonomy ){
|
||||
getValuesTaxonomy( taxonomy ){
|
||||
return axios.get('/taxonomy/' + taxonomy + '/terms?hideempty=0' ).then( res => {
|
||||
for (let item of res.data) {
|
||||
this.taxonomy = item.taxonomy;
|
||||
|
@ -74,7 +74,7 @@
|
|||
axios.get('/collection/'+ this.collection +'/metadata/' + this.metadatum)
|
||||
.then( res => {
|
||||
let metadatum = res.data;
|
||||
promise = this.getValuesCategory( metadatum.metadata_type_options.taxonomy_id );
|
||||
promise = this.getValuesTaxonomy( metadatum.metadata_type_options.taxonomy_id );
|
||||
|
||||
promise.then( () => {
|
||||
this.isLoading = false;
|
|
@ -88,7 +88,7 @@
|
|||
axios.get(endpoint)
|
||||
.then( res => {
|
||||
let metadatum = res.data;
|
||||
promise = this.getValuesCategory( metadatum.metadata_type_options.taxonomy_id, q );
|
||||
promise = this.getValuesTaxonomy( metadatum.metadata_type_options.taxonomy_id, q );
|
||||
this.isLoading = true;
|
||||
promise.then( () => {
|
||||
this.isLoading = false;
|
||||
|
@ -102,7 +102,7 @@
|
|||
this.$console.log(error);
|
||||
});
|
||||
},
|
||||
getValuesCategory( taxonomy, query ){
|
||||
getValuesTaxonomy( taxonomy, query ){
|
||||
return axios.get('/taxonomy/' + taxonomy + '/terms?hideempty=0&order=asc' ).then( res => {
|
||||
for (let term of res.data) {
|
||||
if( term.name.toLowerCase().indexOf( query.toLowerCase() ) >= 0 ){
|
|
@ -6,11 +6,11 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|||
/**
|
||||
* Class TainacanMetadatumType
|
||||
*/
|
||||
class CategoryCheckbox extends Filter_Type {
|
||||
class TaxonomyCheckbox extends Filter_Type {
|
||||
|
||||
function __construct(){
|
||||
$this->set_supported_types(['term']);
|
||||
$this->set_component('tainacan-filter-category-checkbox');
|
||||
$this->set_component('tainacan-filter-taxonomy-checkbox');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,7 +19,7 @@ class CategoryCheckbox extends Filter_Type {
|
|||
*/
|
||||
|
||||
public function render( $filter ){
|
||||
return '<tainacan-filter-category-checkbox name="'.$filter->get_name().'"
|
||||
return '<tainacan-filter-taxonomy-checkbox name="'.$filter->get_name().'"
|
||||
filter_type="'.$filter->get_metadatum()->get_metadata_type().'"
|
||||
collection_id="'.$filter->get_collection_id().'"
|
||||
metadatum_id="'.$filter->get_metadatum()->get_id().'"></tainacan-filter-checkbox>';
|
|
@ -6,11 +6,11 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|||
/**
|
||||
* Class TainacanMetadatumType
|
||||
*/
|
||||
class CategorySelectbox extends Filter_Type {
|
||||
class TaxonomySelectbox extends Filter_Type {
|
||||
|
||||
function __construct(){
|
||||
$this->set_supported_types(['term']);
|
||||
$this->set_component('tainacan-filter-category-selectbox');
|
||||
$this->set_component('tainacan-filter-taxonomy-selectbox');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,7 +19,7 @@ class CategorySelectbox extends Filter_Type {
|
|||
*/
|
||||
|
||||
public function render( $filter ){
|
||||
return '<tainacan-filter-category-selectbox name="'.$filter->get_name().'"
|
||||
return '<tainacan-filter-taxonomy-selectbox name="'.$filter->get_name().'"
|
||||
filter_type="'.$filter->get_metadatum()->get_metadata_type().'"
|
||||
collection_id="'.$filter->get_collection_id().'"
|
||||
metadatum_id="'.$filter->get_metadatum()->get_id().'"></tainacan-filter-selectbox>';
|
|
@ -6,11 +6,11 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|||
/**
|
||||
* Class Taginput
|
||||
*/
|
||||
class CategoryTaginput extends Filter_Type {
|
||||
class TaxonomyTaginput extends Filter_Type {
|
||||
|
||||
function __construct(){
|
||||
$this->set_supported_types(['term']);
|
||||
$this->set_component('tainacan-filter-category-taginput');
|
||||
$this->set_component('tainacan-filter-taxonomy-taginput');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,7 +19,7 @@ class CategoryTaginput extends Filter_Type {
|
|||
*/
|
||||
|
||||
public function render( $filter ){
|
||||
return '<tainacan-filter-category-taginput name="'.$filter->get_name().'"
|
||||
return '<tainacan-filter-taxonomy-taginput name="'.$filter->get_name().'"
|
||||
filter_type="'.$filter->get_metadatum()->get_metadata_type().'"
|
||||
collection_id="'.$filter->get_collection_id().'"
|
||||
metadatum_id="'.$filter->get_metadatum()->get_id().'"></tainacan-filter-taginput>';
|
|
@ -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 ){
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
:type="taxonomyType"
|
||||
:message="taxonomyMessage">
|
||||
<label class="label is-inline">
|
||||
{{ $i18n.get('label_select_category') }}<span :class="taxonomyType" > * </span>
|
||||
{{ $i18n.get('label_select_taxonomy') }}<span :class="taxonomyType" > * </span>
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('tainacan-category', 'taxonomy_id')"
|
||||
:message="$i18n.getHelperMessage('tainacan-category', 'taxonomy_id')"/>
|
||||
:title="$i18n.getHelperTitle('tainacan-taxonomy', 'taxonomy_id')"
|
||||
:message="$i18n.getHelperMessage('tainacan-taxonomy', 'taxonomy_id')"/>
|
||||
</label>
|
||||
<b-select
|
||||
name="field_type_options[taxonomy_id]"
|
||||
|
@ -31,15 +31,15 @@
|
|||
|
||||
<b-field :addons="false">
|
||||
<label class="label">
|
||||
{{ $i18n.get('label_select_category_input_type') }}
|
||||
{{ $i18n.get('label_select_taxonomy_input_type') }}
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('tainacan-category', 'input_type')"
|
||||
:message="$i18n.getHelperMessage('tainacan-category', 'input_type')"/>
|
||||
:title="$i18n.getHelperTitle('tainacan-taxonomy', 'input_type')"
|
||||
:message="$i18n.getHelperMessage('tainacan-taxonomy', 'input_type')"/>
|
||||
</label>
|
||||
<b-select
|
||||
v-if="listInputType"
|
||||
name="metadata_type_options[component_type]"
|
||||
placeholder="Select the input type for the category metadatum"
|
||||
placeholder="Select the input type for the taxonomy metadatum"
|
||||
@input="emitValues()"
|
||||
v-model="input_type">
|
||||
<option
|
||||
|
@ -52,7 +52,7 @@
|
|||
|
||||
<b-select
|
||||
name="metadata_type_options[input_type]"
|
||||
placeholder="Select the input type for the category metadatum"
|
||||
placeholder="Select the input type for the taxonomy metadatum"
|
||||
v-model="input_type"
|
||||
@input="emitValues()"
|
||||
v-else>
|
||||
|
@ -69,10 +69,10 @@
|
|||
|
||||
<b-field :addons="false">
|
||||
<label class="label">
|
||||
{{ $i18n.get('label_category_allow_new_terms') }}
|
||||
{{ $i18n.get('label_taxonomy_allow_new_terms') }}
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('tainacan-category', 'allow_new_terms')"
|
||||
:message="$i18n.getHelperMessage('tainacan-category', 'allow_new_terms')"/>
|
||||
:title="$i18n.getHelperTitle('tainacan-taxonomy', 'allow_new_terms')"
|
||||
:message="$i18n.getHelperMessage('tainacan-taxonomy', 'allow_new_terms')"/>
|
||||
</label>
|
||||
<div class="block">
|
||||
<b-checkbox
|
||||
|
@ -110,10 +110,10 @@
|
|||
this.allow_new_terms = ( this.value.allow_new_terms ) ? this.value.allow_new_terms : 'no';
|
||||
}
|
||||
|
||||
this.single_types['tainacan-category-radio'] = 'Radio';
|
||||
this.single_types['tainacan-category-selectbox'] = 'Selectbox';
|
||||
this.multiple_types['tainacan-category-tag-input'] = 'Tag Input';
|
||||
this.multiple_types['tainacan-category-checkbox'] = 'Checkbox';
|
||||
this.single_types['tainacan-taxonomy-radio'] = 'Radio';
|
||||
this.single_types['tainacan-taxonomy-selectbox'] = 'Selectbox';
|
||||
this.multiple_types['tainacan-taxonomy-tag-input'] = 'Tag Input';
|
||||
this.multiple_types['tainacan-taxonomy-checkbox'] = 'Checkbox';
|
||||
|
||||
this.isReady = true;
|
||||
},
|
||||
|
@ -122,12 +122,12 @@
|
|||
if( this.metadatum && this.metadatum.multiple === 'no' ){
|
||||
let types = Object.keys( this.single_types );
|
||||
let hasValue = this.value && this.value.input_type && types.indexOf( this.value.input_type ) >= 0;
|
||||
this.setInputType( ( hasValue ) ? this.value.input_type : 'tainacan-category-radio' );
|
||||
this.setInputType( ( hasValue ) ? this.value.input_type : 'tainacan-taxonomy-radio' );
|
||||
return true;
|
||||
} else {
|
||||
let types = Object.keys( this.multiple_types );
|
||||
let hasValue = this.value && this.value.input_type && types.indexOf( this.value.input_type ) >= 0;
|
||||
this.setInputType( ( hasValue ) ? this.value.input_type : 'tainacan-category-checkbox' );
|
||||
this.setInputType( ( hasValue ) ? this.value.input_type : 'tainacan-taxonomy-checkbox' );
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
@ -147,7 +147,7 @@
|
|||
taxonomy_id: '',
|
||||
loading: true,
|
||||
allow_new_terms: 'yes',
|
||||
input_type: 'tainacan-category-radio',
|
||||
input_type: 'tainacan-taxonomy-radio',
|
||||
multiple_types: {},
|
||||
single_types: {},
|
||||
taxonomyType:'',
|
|
@ -8,7 +8,7 @@
|
|||
:options="getOptions(0)"/>
|
||||
<add-new-term
|
||||
class="add-new-term"
|
||||
v-if="getComponent() !== 'tainacan-category-tag-input' && allowNew"
|
||||
v-if="getComponent() !== 'tainacan-taxonomy-tag-input' && allowNew"
|
||||
:taxonomy_id="taxonomy"
|
||||
:metadatum="metadatum"
|
||||
:item_id="metadatum.item.id"
|
||||
|
@ -19,10 +19,10 @@
|
|||
</template>
|
||||
<script>
|
||||
import { tainacan as axios } from '../../../js/axios/axios'
|
||||
import TainacanCategoryRadio from './CategoryRadio.vue'
|
||||
import TainacanCategoryCheckbox from './CategoryCheckbox.vue'
|
||||
import TainacanCategoryTagInput from './CategoryTaginput.vue'
|
||||
import TainacanCategorySelectbox from './CategorySelectbox.vue'
|
||||
import TainacanTaxonomyRadio from './TaxonomyRadio.vue'
|
||||
import TainacanTaxonomyCheckbox from './TaxonomyCheckbox.vue'
|
||||
import TainacanTaxonomyTagInput from './TaxonomyTaginput.vue'
|
||||
import TainacanTaxonomySelectbox from './TaxonomySelectbox.vue'
|
||||
import AddNewTerm from './AddNewTerm.vue'
|
||||
|
||||
export default {
|
||||
|
@ -41,10 +41,10 @@
|
|||
this.getTermsId();
|
||||
},
|
||||
components: {
|
||||
TainacanCategoryRadio,
|
||||
TainacanCategoryCheckbox,
|
||||
TainacanCategoryTagInput,
|
||||
TainacanCategorySelectbox,
|
||||
TainacanTaxonomyRadio,
|
||||
TainacanTaxonomyCheckbox,
|
||||
TainacanTaxonomyTagInput,
|
||||
TainacanTaxonomySelectbox,
|
||||
AddNewTerm
|
||||
},
|
||||
data(){
|
|
@ -5,7 +5,7 @@
|
|||
:id="id"
|
||||
v-model="selected"
|
||||
@input="emitChange()"
|
||||
:placeholder="$i18n.get('label_select_category')"
|
||||
:placeholder="$i18n.get('label_select_taxonomy')"
|
||||
expanded>
|
||||
<option
|
||||
v-for="(option, index) in options"
|
|
@ -11,7 +11,7 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|||
/**
|
||||
* Class TainacanMetadatumType
|
||||
*/
|
||||
class Category extends Metadata_Type {
|
||||
class Taxonomy extends Metadata_Type {
|
||||
|
||||
function __construct(){
|
||||
// call metadatum type constructor
|
||||
|
@ -22,8 +22,8 @@ class Category extends Metadata_Type {
|
|||
'allow_new_terms' => false
|
||||
]);
|
||||
|
||||
$this->set_form_component('tainacan-form-category');
|
||||
$this->set_component('tainacan-category');
|
||||
$this->set_form_component('tainacan-form-taxonomy');
|
||||
$this->set_component('tainacan-taxonomy');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,20 +71,20 @@ class Category extends Metadata_Type {
|
|||
|
||||
$Tainacan_Metadata = Metadata::get_instance();
|
||||
|
||||
$category_metadata = $Tainacan_Metadata->fetch([
|
||||
$taxonomy_metadata = $Tainacan_Metadata->fetch([
|
||||
'collection_id' => $metadatum->get_collection_id(),
|
||||
'metadata_type' => 'Tainacan\\Metadata_Types\\Category'
|
||||
'metadata_type' => 'Tainacan\\Metadata_Types\\Taxonomy'
|
||||
], 'OBJECT');
|
||||
|
||||
$category_metadata = array_map(function ($metadatum_map) {
|
||||
$taxonomy_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);
|
||||
}, $taxonomy_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)) {
|
||||
if( is_array( $taxonomy_metadata ) ){
|
||||
foreach ($taxonomy_metadata as $metadatum_id => $taxonomy_metadatum) {
|
||||
if ( is_array( $taxonomy_metadatum ) && key($taxonomy_metadatum) != $metadatum->get_id()
|
||||
&& in_array($this->get_option('taxonomy_id'), $taxonomy_metadatum)) {
|
||||
return ['taxonomy_id' => __('You can not have 2 taxonomy metadata using the same taxonomy in a collection.', 'tainacan')];
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ class Category extends Metadata_Type {
|
|||
}
|
||||
|
||||
/**
|
||||
* Validate item based on metadatum type categories options
|
||||
* Validate item based on metadatum type taxonomies options
|
||||
*
|
||||
* @param Item_Metadata_Entity $item_metadata
|
||||
*
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -21,15 +21,15 @@ class Old_Tainacan extends Importer{
|
|||
[
|
||||
'name' => 'Create Collections',
|
||||
'callback' => 'create_collections'
|
||||
],
|
||||
[
|
||||
'name' => 'Link relationship metadata',
|
||||
'callback' => 'link_relationships'
|
||||
],
|
||||
[
|
||||
'name' => 'Import Items',
|
||||
'callback' => 'process_collections'
|
||||
],
|
||||
[
|
||||
'name' => 'Link relationship metadata',
|
||||
'callback' => 'close_taxonomies'
|
||||
],
|
||||
[
|
||||
'name' => 'Finalize',
|
||||
'callback' => 'finish_processing'
|
||||
|
@ -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;
|
||||
|
@ -112,6 +112,21 @@ class Old_Tainacan extends Importer{
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* create all collections and its metadata
|
||||
*
|
||||
*/
|
||||
public function create_collections(){
|
||||
|
||||
foreach ($this->fetch_collections() as $collection) {
|
||||
|
||||
if ( isset($collection->post_title) && $collection->post_status === 'publish') {
|
||||
//TODO: insert collection and its metadata
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method implemented by the child importer class to proccess each item
|
||||
* @return int
|
||||
|
@ -157,17 +172,30 @@ class Old_Tainacan extends Importer{
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* return all taxonomies from tainacan old
|
||||
* @return array
|
||||
*/
|
||||
protected function fetch_collections(){
|
||||
|
||||
$collections_link = $this->get_url() . $this->tainacan_api_address . "/collections";
|
||||
$collections = wp_remote_get($collections_link);
|
||||
$collections_array = $this->decode_request($collections);
|
||||
|
||||
return ($collections_array) ? $collections_array : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* return all taxonomies from tainacan old
|
||||
* @return array
|
||||
*/
|
||||
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 : [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -187,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
|
||||
|
@ -207,6 +235,14 @@ class Old_Tainacan extends Importer{
|
|||
|
||||
$inserted_term = $this->term_repo->insert($new_term);
|
||||
|
||||
if (is_wp_error($inserted_term)) {
|
||||
|
||||
$this->add_error_log($inserted_term->get_error_message());
|
||||
$this->abort();
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/*Insert old tainacan id*/
|
||||
$this->add_transient('term_' . $term->term_id . '_id', $inserted_term->get_id());
|
||||
$this->add_transient('term_' . $term->term_id . '_name', $inserted_term->get_name());
|
||||
|
@ -225,7 +261,75 @@ class Old_Tainacan extends Importer{
|
|||
* @return int $metadatum_id
|
||||
*/
|
||||
protected function create_metadata( $node_metadata_old, $collection_id = null){
|
||||
//TODO: create process to insert different types of metadata
|
||||
$newMetadatum = new Entities\Metadatum();
|
||||
$meta = $node_metadata_old;
|
||||
|
||||
$name = $meta->name;
|
||||
$type = $this->define_type($meta->type);
|
||||
|
||||
$newMetadatum->set_name($name);
|
||||
$newMetadatum->set_metadata_type('Tainacan\Metadata_Types\\'.$type);
|
||||
$newMetadatum->set_parent( (isset($collection_id)) ? $collection_id : 'default');
|
||||
|
||||
if(strcmp($type, "Taxonomy") === 0){
|
||||
$taxonomy_id = $meta->metadata->taxonomy;
|
||||
|
||||
$related_taxonomy = $this->get_transient('tax_' . $taxonomy_id . '_id');
|
||||
if ($related_taxonomy) {
|
||||
$newMetadatum->set_metadata_type_options(['taxonomy_id' => $related_taxonomy]);
|
||||
}
|
||||
|
||||
} else if(strcmp($type, "Relationship") === 0){
|
||||
$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');
|
||||
|
||||
if(isset($related_taxonomy)){
|
||||
$newMetadatum->set_metadata_type_options(['collection_id' => $related_taxonomy]);
|
||||
}
|
||||
|
||||
} else if(strcmp($type, "Compound") === 0){
|
||||
|
||||
if( isset( $meta->metadata->children ) ){
|
||||
foreach( $meta->metadata->children as $child ){
|
||||
$this->create_metadata( $node_metadata_old, $collection_id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*Properties of metadatum*/
|
||||
if(isset($meta->metadata)){
|
||||
if($meta->metadata->required == 1){
|
||||
$newMetadatum->set_required(true);
|
||||
}
|
||||
|
||||
if(!empty($meta->metadata->default_value)){
|
||||
$newMetadatum->set_default_value($meta->metadata->default_value);
|
||||
}
|
||||
|
||||
if(!empty($meta->metadata->cardinality)){
|
||||
|
||||
if($meta->metadata->cardinality > 1){
|
||||
$newMetadatum->set_multiple('yes');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if($newMetadatum->validate()){
|
||||
$inserted_metadata = $this->meta_repo->insert( $newMetadatum );
|
||||
|
||||
if(isset( $related_name) )
|
||||
$this->add_transient('relation_' . $inserted_metadata->get_id() . '_name', $related_name);
|
||||
|
||||
return $inserted_metadata->get_id();
|
||||
} else{
|
||||
$this->add_error_log('Error creating metadata ' . $name );
|
||||
$this->add_error_log($newMetadatum->get_errors());
|
||||
$this->abort();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -246,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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -35,20 +35,57 @@ export default {
|
|||
},
|
||||
watch: {
|
||||
'$route' (to, from) {
|
||||
if (this.$route.params.collectionId)
|
||||
this.collectionId = parseInt(this.$route.params.collectionId);
|
||||
|
||||
this.collectionId = !this.$route.params.collectionId ? this.$route.params.collectionId : parseInt(this.$route.params.collectionId);
|
||||
|
||||
if (this.$route.name == null || this.$route.name == undefined || this.$route.name == 'CollectionItemsPage' || this.$route.name == 'ItemsPage') {
|
||||
if (this.$route.query.perpage == undefined) {
|
||||
let perPage = (this.collectionId != undefined ? this.$userPrefs.get('items_per_page_' + this.collectionId) : this.$userPrefs.get('items_per_page'));
|
||||
this.$route.query.perpage = perPage ? perPage : 12;
|
||||
|
||||
if (this.$route.query.perpage == undefined || to.params.collectionId != from.params.collectionId) {
|
||||
let perPageKey = (this.collectionId != undefined ? 'items_per_page_' + this.collectionId : 'items_per_page');
|
||||
let perPageValue = this.$userPrefs.get(perPageKey);
|
||||
|
||||
if (perPageValue)
|
||||
this.$route.query.perpage = perPageValue;
|
||||
else {
|
||||
this.$route.query.perpage = 12;
|
||||
this.$userPrefs.set(perPageKey, 12);
|
||||
}
|
||||
}
|
||||
if (this.$route.query.paged == undefined)
|
||||
if (this.$route.query.paged == undefined || to.params.collectionId != from.params.collectionId)
|
||||
this.$route.query.paged = 1;
|
||||
if (this.$route.query.order == undefined)
|
||||
if (this.$route.query.order == undefined || to.params.collectionId != from.params.collectionId)
|
||||
this.$route.query.order = 'DESC';
|
||||
if (this.$route.query.orderby == undefined)
|
||||
this.$route.query.orderby = 'date';
|
||||
if (this.$route.query.orderby == undefined || to.params.collectionId != from.params.collectionId) {
|
||||
let orderByKey = (this.collectionId != undefined ? 'order_by_' + this.collectionId : 'order_by');
|
||||
let orderBy = this.$userPrefs.get(orderByKey);
|
||||
|
||||
if (orderBy) {
|
||||
if (orderBy.slug == 'creation_date') {
|
||||
this.$route.query.orderby = 'date';
|
||||
} else if (orderBy.slug == 'author_name') {
|
||||
this.$route.query.orderby = 'author_name';
|
||||
} else if (orderBy.metadata_type_object.primitive_type == 'float' || orderBy.metadata_type_object.primitive_type == 'int') {
|
||||
this.$route.query.orderby = 'meta_value_num';
|
||||
this.$route.query.meta_key = orderBy.id;
|
||||
} else if (orderBy.metadata_type_object.primitive_type == 'date') {
|
||||
this.$route.query.orderby = 'meta_value';
|
||||
this.$route.query.meta_key = orderBy.id;
|
||||
this.$route.query.meta_type = 'DATETIME';
|
||||
} else if (orderBy.metadata_type_object.core) {
|
||||
this.$route.query.orderby = orderBy.metadata_type_object.related_mapped_prop;
|
||||
} else {
|
||||
this.$route.query.orderby = 'meta_value';
|
||||
this.$route.query.meta_key = orderBy.id;
|
||||
}
|
||||
|
||||
} else {
|
||||
this.$route.query.orderby = 'date';
|
||||
this.$userPrefs.set(orderByKey, {
|
||||
id: 'creation_date',
|
||||
name: this.$i18n.get('label_creation_date')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if(this.$route.query.metaquery && this.$route.query.metaquery.advancedSearch){
|
||||
this.$store.dispatch('search/set_advanced_query', this.$route.query.metaquery);
|
||||
|
@ -108,14 +145,16 @@ export default {
|
|||
setItemsPerPage(itemsPerPage) {
|
||||
let prefsPerPage = this.collectionId != undefined ? 'items_per_page_' + this.collectionId : 'items_per_page';
|
||||
this.$userPrefs.set(prefsPerPage, itemsPerPage)
|
||||
.catch(() => {
|
||||
this.$console.log("Error settings user prefs for items per page")
|
||||
});
|
||||
.catch(() => { this.$console.log("Error settings user prefs for items per page.") });
|
||||
|
||||
this.$store.dispatch('search/setItemsPerPage', itemsPerPage);
|
||||
this.updateURLQueries();
|
||||
},
|
||||
setOrderBy(newOrderBy) {
|
||||
let prefsOrderBy = this.collectionId != undefined ? 'order_by_' + this.collectionId : 'order_by';
|
||||
this.$userPrefs.set(prefsOrderBy, newOrderBy)
|
||||
.catch(() => { this.$console.log("Error settings user prefs for order by.") });
|
||||
|
||||
this.$store.dispatch('search/setOrderBy', newOrderBy);
|
||||
this.updateURLQueries();
|
||||
},
|
||||
|
|
|
@ -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;
|
||||
};
|
|
@ -9,6 +9,7 @@ export const fetchItems = ({ rootGetters, dispatch, commit }, { collectionId, is
|
|||
// Adds queries for filtering
|
||||
let postQueries = rootGetters['search/getPostQuery'];
|
||||
let query = '';
|
||||
|
||||
// Sets a flag to inform components that an empty sate is or not due to filtering
|
||||
let hasFiltered = false;
|
||||
let advancedSearchResults = false;
|
||||
|
|
|
@ -70,12 +70,13 @@ export const setStatus= ({ commit }, status ) => {
|
|||
};
|
||||
|
||||
// Sorting queries
|
||||
export const setOrderBy = ({ commit }, orderBy ) => {
|
||||
|
||||
export const setOrderBy = ({ state, commit }, orderBy ) => {
|
||||
commit('cleanPostQueryAttribute', { attr: 'orderby' } );
|
||||
|
||||
// Primitive Types: string, date, item, term, compound, float
|
||||
if (orderBy.id == 'creation_date') {
|
||||
if (orderBy.slug == 'creation_date') {
|
||||
commit('setPostQueryAttribute', { attr: 'orderby', value: 'date' } );
|
||||
} else if (orderBy.id == 'author_name') {
|
||||
} else if (orderBy.slug == 'author_name') {
|
||||
commit('setPostQueryAttribute', { attr: 'orderby', value: 'author_name' } );
|
||||
} else if (orderBy.metadata_type_object.primitive_type == 'float' || orderBy.metadata_type_object.primitive_type == 'int') {
|
||||
commit('setPostQueryAttribute', { attr: 'meta_key', value: orderBy.id } );
|
||||
|
@ -90,6 +91,7 @@ export const setOrderBy = ({ commit }, orderBy ) => {
|
|||
commit('setPostQueryAttribute', { attr: 'meta_key', value: orderBy.id } );
|
||||
commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value' } );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
export const setOrder = ({ commit }, order ) => {
|
||||
|
|
|
@ -4,6 +4,10 @@ export const setPostQueryAttribute = ( state, { attr, value }) => {
|
|||
Vue.set( state.postquery, attr , value );
|
||||
};
|
||||
|
||||
export const cleanPostQueryAttribute = ( state, { attr }) => {
|
||||
Vue.set( state.postquery, attr , null );
|
||||
};
|
||||
|
||||
export const setPostQuery = ( state, postquery ) => {
|
||||
state.postquery = postquery;
|
||||
};
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
import axios from '../../../axios/axios'
|
||||
|
||||
// CATEGORIES
|
||||
export const createCategory = ({commit}, category) => {
|
||||
// TAXONOMIES
|
||||
export const createTaxonomy = ({commit}, taxonomy) => {
|
||||
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
|
||||
name: taxonomy.name,
|
||||
description: taxonomy.description,
|
||||
status: taxonomy.status,
|
||||
slug: taxonomy.slug,
|
||||
allow_insert: taxonomy.allowInsert
|
||||
})
|
||||
.then( res => {
|
||||
let category = res.data;
|
||||
commit('setCategory', category);
|
||||
let taxonomy = res.data;
|
||||
commit('setTaxonomy', taxonomy);
|
||||
|
||||
resolve( category );
|
||||
resolve( taxonomy );
|
||||
})
|
||||
.catch(error => {
|
||||
reject( error.response );
|
||||
|
@ -22,11 +22,11 @@ export const createCategory = ({commit}, category) => {
|
|||
});
|
||||
};
|
||||
|
||||
export const deleteCategory = ({ commit }, categoryId) => {
|
||||
export const deleteTaxonomy = ({ commit }, taxonomyId) => {
|
||||
return new Promise(( resolve, reject ) => {
|
||||
axios.tainacan.delete(`/taxonomies/${categoryId}?permanently=${true}`)
|
||||
axios.tainacan.delete(`/taxonomies/${taxonomyId}?permanently=${true}`)
|
||||
.then(res => {
|
||||
commit('deleteCategory', res.data);
|
||||
commit('deleteTaxonomy', res.data);
|
||||
|
||||
resolve( res );
|
||||
})
|
||||
|
@ -36,21 +36,21 @@ export const deleteCategory = ({ commit }, categoryId) => {
|
|||
});
|
||||
};
|
||||
|
||||
export const updateCategory = ({ commit }, category) => {
|
||||
export const updateTaxonomy = ({ commit }, taxonomy) => {
|
||||
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
|
||||
axios.tainacan.patch(`/taxonomies/${taxonomy.taxonomyId}`, {
|
||||
name: taxonomy.name,
|
||||
description: taxonomy.description,
|
||||
status: taxonomy.status,
|
||||
slug: taxonomy.slug ? taxonomy.slug : '',
|
||||
allow_insert: taxonomy.allowInsert
|
||||
})
|
||||
.then( res => {
|
||||
let category = res.data;
|
||||
let taxonomy = res.data;
|
||||
|
||||
commit('setCategory', category);
|
||||
commit('setTaxonomy', taxonomy);
|
||||
|
||||
resolve( category );
|
||||
resolve( taxonomy );
|
||||
})
|
||||
.catch(error => {
|
||||
reject({ error_message: error['response']['data'].error_message, errors: error['response']['data'].errors });
|
||||
|
@ -58,21 +58,21 @@ export const updateCategory = ({ commit }, category) => {
|
|||
});
|
||||
};
|
||||
|
||||
export const fetchCategories = ({ commit }, { page, categoriesPerPage, status } ) => {
|
||||
export const fetch = ({ commit }, { page, taxonomiesPerPage, status } ) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let endpoint = `/taxonomies?paged=${page}&perpage=${categoriesPerPage}&context=edit`;
|
||||
let endpoint = `/taxonomies?paged=${page}&perpage=${taxonomiesPerPage}&context=edit`;
|
||||
|
||||
if (status != undefined && status != '')
|
||||
endpoint = endpoint + '&status=' + status;
|
||||
|
||||
axios.tainacan.get(endpoint)
|
||||
.then(res => {
|
||||
let categories = res.data;
|
||||
let taxonomies = res.data;
|
||||
|
||||
commit('setCategories', categories);
|
||||
commit('set', taxonomies);
|
||||
|
||||
resolve({
|
||||
'categories': categories,
|
||||
'taxonomies': taxonomies,
|
||||
'total': res.headers['x-wp-total']
|
||||
});
|
||||
})
|
||||
|
@ -82,16 +82,16 @@ export const fetchCategories = ({ commit }, { page, categoriesPerPage, status }
|
|||
});
|
||||
};
|
||||
|
||||
export const fetchCategory = ({ commit }, categoryId) => {
|
||||
export const fetchTaxonomy = ({ commit }, taxonomyId) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.tainacan.get(`/taxonomies/${categoryId}`)
|
||||
axios.tainacan.get(`/taxonomies/${taxonomyId}`)
|
||||
.then(res => {
|
||||
let category = res.data;
|
||||
let taxonomy = res.data;
|
||||
|
||||
commit('setCategory', category);
|
||||
commit('setTaxonomy', taxonomy);
|
||||
|
||||
resolve({
|
||||
'category': category
|
||||
'taxonomy': taxonomy
|
||||
})
|
||||
})
|
||||
.catch(error => {
|
||||
|
@ -100,13 +100,13 @@ export const fetchCategory = ({ commit }, categoryId) => {
|
|||
});
|
||||
};
|
||||
|
||||
export const fetchCategoryName = ({ commit }, categoryId) => {
|
||||
export const fetchTaxonomyName = ({ commit }, taxonomyId) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.tainacan.get(`/taxonomies/${categoryId}?fetch_only=name`)
|
||||
axios.tainacan.get(`/taxonomies/${taxonomyId}?fetch_only=name`)
|
||||
.then(res => {
|
||||
let name = res.data;
|
||||
|
||||
commit('setCategoryName');
|
||||
commit('setTaxonomyName');
|
||||
|
||||
resolve(name.name)
|
||||
})
|
||||
|
@ -116,10 +116,10 @@ export const fetchCategoryName = ({ commit }, categoryId) => {
|
|||
});
|
||||
};
|
||||
|
||||
// CATEGORY TERMS
|
||||
export const sendTerm = ({commit}, { categoryId, name, description, parent, headerImageId }) => {
|
||||
// TAXONOMY TERMS
|
||||
export const sendTerm = ({commit}, { taxonomyId, name, description, parent, headerImageId }) => {
|
||||
return new Promise(( resolve, reject ) => {
|
||||
axios.tainacan.post('/taxonomy/' + categoryId + '/terms/', {
|
||||
axios.tainacan.post('/taxonomy/' + taxonomyId + '/terms/', {
|
||||
name: name,
|
||||
description: description,
|
||||
parent: parent,
|
||||
|
@ -136,9 +136,9 @@ export const sendTerm = ({commit}, { categoryId, name, description, parent, head
|
|||
});
|
||||
};
|
||||
|
||||
export const deleteTerm = ({ commit }, { categoryId, termId }) => {
|
||||
export const deleteTerm = ({ commit }, { taxonomyId, termId }) => {
|
||||
return new Promise(( resolve, reject ) => {
|
||||
axios.tainacan.delete(`/taxonomy/${categoryId}/terms/${termId}?permanently=${true}`)
|
||||
axios.tainacan.delete(`/taxonomy/${taxonomyId}/terms/${termId}?permanently=${true}`)
|
||||
.then(res => {
|
||||
let term = res.data;
|
||||
commit('deleteTerm', termId);
|
||||
|
@ -150,9 +150,9 @@ export const deleteTerm = ({ commit }, { categoryId, termId }) => {
|
|||
});
|
||||
};
|
||||
|
||||
export const updateTerm = ({ commit }, { categoryId, termId, name, description, parent, headerImageId }) => {
|
||||
export const updateTerm = ({ commit }, { taxonomyId, termId, name, description, parent, headerImageId }) => {
|
||||
return new Promise(( resolve, reject ) => {
|
||||
axios.tainacan.patch(`/taxonomy/${categoryId}/terms/${termId}`, {
|
||||
axios.tainacan.patch(`/taxonomy/${taxonomyId}/terms/${termId}`, {
|
||||
name: name,
|
||||
description: description,
|
||||
parent: parent,
|
||||
|
@ -169,9 +169,9 @@ export const updateTerm = ({ commit }, { categoryId, termId, name, description,
|
|||
});
|
||||
};
|
||||
|
||||
export const fetchTerms = ({ commit }, categoryId ) => {
|
||||
export const fetchTerms = ({ commit }, taxonomyId ) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.tainacan.get(`/taxonomy/${categoryId}/terms/?hideempty=0&order=asc`)
|
||||
axios.tainacan.get(`/taxonomy/${taxonomyId}/terms/?hideempty=0&order=asc`)
|
||||
.then(res => {
|
||||
let terms = res.data;
|
||||
commit('setTerms', terms);
|
|
@ -0,0 +1,15 @@
|
|||
export const getTaxonomy = state => {
|
||||
return state.taxonomy;
|
||||
};
|
||||
|
||||
export const get = state => {
|
||||
return state.taxonomies;
|
||||
};
|
||||
|
||||
export const getTaxonomyName = state => {
|
||||
return state.taxonomyName;
|
||||
};
|
||||
|
||||
export const getTerms = state => {
|
||||
return state.terms;
|
||||
};
|
|
@ -3,9 +3,9 @@ import * as getters from './getters';
|
|||
import * as mutations from './mutations';
|
||||
|
||||
const state = {
|
||||
categories: [],
|
||||
category: {},
|
||||
categoryName: String,
|
||||
taxonomies: [],
|
||||
taxonomy: {},
|
||||
taxonomyName: String,
|
||||
terms: []
|
||||
};
|
||||
|
|
@ -1,27 +1,27 @@
|
|||
import Vue from 'vue';
|
||||
|
||||
// CATEGORIES
|
||||
export const setCategory = (state, category) => {
|
||||
state.category = category;
|
||||
// TAXONOMIES
|
||||
export const setTaxonomy = (state, taxonomy) => {
|
||||
state.taxonomy = taxonomy;
|
||||
};
|
||||
|
||||
export const setCategories = (state, categories) => {
|
||||
state.categories = categories;
|
||||
export const set = (state, taxonomies) => {
|
||||
state.taxonomies = taxonomies;
|
||||
};
|
||||
|
||||
export const setCategoryName = (state, name) => {
|
||||
state.categoryName = name;
|
||||
export const setTaxonomyName = (state, name) => {
|
||||
state.taxonomyName = name;
|
||||
};
|
||||
|
||||
export const deleteCategory = ( state, category ) => {
|
||||
let index = state.categories.findIndex(deletedCategory => deletedCategory.id === category.id);
|
||||
export const deleteTaxonomy = ( state, taxonomy ) => {
|
||||
let index = state.taxonomies.findIndex(deletedTaxonomy => deletedTaxonomy.id === taxonomy.id);
|
||||
|
||||
if (index >= 0) {
|
||||
state.categories.splice(index, 1);
|
||||
state.taxonomies.splice(index, 1);
|
||||
}
|
||||
};
|
||||
|
||||
// CATEGORY TERMS
|
||||
// TAXONOMY TERMS
|
||||
export const setSingleTerm = (state, term) => {
|
||||
|
||||
let index = state.terms.findIndex(updatedTerm => updatedTerm.id === term.id);
|
|
@ -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,
|
||||
}
|
||||
})
|
|
@ -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"
|
||||
|
|
|
@ -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');
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue