From cf8d457dbdbda94c6231440b360b9403ba4bf6d9 Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Tue, 6 Mar 2018 16:42:38 -0300 Subject: [PATCH] Adds more default attributes to Field Edition. --- src/admin/components/fields-list.vue | 74 +++++++++++++------------- src/admin/js/utilities.js | 2 +- src/admin/tainacan-admin-i18n.php | 2 + src/js/store/modules/fields/actions.js | 1 - 4 files changed, 41 insertions(+), 38 deletions(-) diff --git a/src/admin/components/fields-list.vue b/src/admin/components/fields-list.vue index ce7b95aa2..fd849cd8b 100644 --- a/src/admin/components/fields-list.vue +++ b/src/admin/components/fields-list.vue @@ -24,38 +24,52 @@
-
+ -

{{ field.name }}

{{ $i18n.get('edit') }}

- + - - + +
- - {{ $i18n.get('label_required') }} - + false-value="no" + native-value="yes" + name="required"> + {{ editForm.required }} +
- - {{ $i18n.get('label_allow_multiple') }} - + false-value="no" + native-value="yes" + name="multiple"> + {{ isSwitchedCustom }} +
- + + + {{ $i18n.get('label_unique_value') }} + + + +
- - + @@ -119,7 +132,8 @@ export default { isLoadingFields: false, isLoadingField: false, editForm: {}, - openedFieldId: '' + openedFieldId: '', + isSwitchedCustom: 'yes' } }, methods: { @@ -145,10 +159,12 @@ export default { this.updateFieldsOrder(); } }, - saveEdition(field) { + saveEdition($event, field) { + let formElement = document.getElementById('fieldEditForm'); let formData = new FormData(formElement); this.openedFieldId = field.id; + let formObj = {} for (var [key, value] of formData.entries()) { formObj[key] = value; @@ -279,6 +295,9 @@ export default { font-style: italic; color: gray; } + form { + padding: 5px; + } .loading-spinner { animation: spinAround 500ms infinite linear; @@ -331,23 +350,6 @@ export default { } } - #fieldEditForm { - position: absolute; - right: 0px; - padding: 20px; - height: 100%; - bottom: 0px; - width: 50%; - - @media screen and (max-width: 769px) { - width: 50%; - position: relative; - box-shadow: none; - border: none; - padding: 10px; - } - } - diff --git a/src/admin/js/utilities.js b/src/admin/js/utilities.js index 7ccf7720f..65922206c 100644 --- a/src/admin/js/utilities.js +++ b/src/admin/js/utilities.js @@ -49,7 +49,7 @@ UserPrefsPlugin.install = function (Vue, options = {}) { data = {'meta': [{'metakey': metakey, 'metavalue': value, 'prevvalue': prevValue}]}; else data = {'meta': [{'metakey': metakey, 'metavalue': value}]}; - + //data['delete'] = true; return new Promise(( resolve, reject ) => { wpApi.post('/wp/v2/users/me/?' + qs.stringify(data)) .then( res => { diff --git a/src/admin/tainacan-admin-i18n.php b/src/admin/tainacan-admin-i18n.php index 6d99eb3af..bf4706da4 100644 --- a/src/admin/tainacan-admin-i18n.php +++ b/src/admin/tainacan-admin-i18n.php @@ -78,6 +78,8 @@ return [ 'label_table_fields' => __('Fields on table', 'tainacan'), 'label_required' => __('Required', 'tainacan'), 'label_allow_multiple' => __('Allow multiple values', 'tainacan'), + 'label_default_value' => __('Default value', 'tainacan'), + 'label_unique_value' => __('Unique value', 'tainacan'), // Instructions. More complex sentences to guide user and placeholders 'instruction_dragndrop_fields_collection' => __('Drag and drop Fields here to add them to Collection.', 'tainacan'), diff --git a/src/js/store/modules/fields/actions.js b/src/js/store/modules/fields/actions.js index 1a1ec179e..94ad50280 100644 --- a/src/js/store/modules/fields/actions.js +++ b/src/js/store/modules/fields/actions.js @@ -76,7 +76,6 @@ export const updateField = ( { commit }, { collectionId, fieldId, isRepositoryLe else endpoint = '/fields/' + fieldId; - console.log(options); axios.put(endpoint, options) .then( res => { commit('setField', { collection_id: collectionId, name: name, field_type: fieldType, status: status });