Manager user selection on repository level

This commit is contained in:
Rodrigo Guimarães 2020-11-25 03:36:14 -03:00
parent 98a9ec07cb
commit ad7bf0f157
2 changed files with 10 additions and 6 deletions

View File

@ -501,14 +501,14 @@ class REST_Metadata_Controller extends REST_Controller {
return new \WP_REST_Response( [
'error_message' => $error_message,
'metadatum_id' => $metadatum_id
'metadatum_id' => $metadatum_id
] );
} elseif ($collection_id && $metadatum->get_collection_id() === 'default'){
$error_message = __('This metadata is not a collection metadata', 'tainacan');
return new \WP_REST_Response( [
'error_message' => $error_message,
'metadatum_id' => $metadatum_id
'metadatum_id' => $metadatum_id
] );
}
@ -529,7 +529,7 @@ class REST_Metadata_Controller extends REST_Controller {
return new \WP_REST_Response([
'error_message' => __('One or more values are invalid.', 'tainacan'),
'errors' => $prepared_metadata->get_errors(),
'metadatum' => $this->prepare_item_for_response($prepared_metadata, $request)
'metadatum' => $this->prepare_item_for_response($prepared_metadata, $request)
], 400);
}

View File

@ -214,6 +214,7 @@
<b-checkbox
class="is-inline-block"
v-model="editForm.repository_level"
@input="clearErrors('repository_level')"
name="repository_level"
true-value="yes"
false-value="no"
@ -321,10 +322,13 @@
...mapActions('metadata', [
'updateMetadatum'
]),
saveEdition(metadatum) {
saveEdition(metadatum) {
if ((metadatum.metadata_type_object && metadatum.metadata_type_object.form_component) || metadatum.edit_form == '') {
let repository = this.editForm.repository_level;
if (repository && repository === 'yes') {
this.isRepositoryLevel = true;
}
if ((metadatum.metadata_type_object && metadatum.metadata_type_object.form_component) || metadatum.edit_form == '') {
this.fillExtraFormData(this.editForm);
this.isUpdating = true;
this.updateMetadatum({