Skip to content

Commit

Permalink
fix input default() method
Browse files Browse the repository at this point in the history
  • Loading branch information
kongulov committed Sep 22, 2021
1 parent 04399c7 commit 51c5ae9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion resources/js/components/FormField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
:resource-name="resourceName"
:resource-id="resourceId"
:resource="resource"
:field="component"
:field="fieldDefaultValue(component)"
:errors="errors"
:via-resource="viaResource"
:via-resource-id="viaResourceId"
Expand All @@ -47,6 +47,11 @@ export default {
}
},
methods: {
fieldDefaultValue(field) {
if (field.value === '' && field.defaultValue !== '') field.value = field.defaultValue;
return field;
},
isCreatePage(){
return this.resourceId === undefined;
},
Expand Down
1 change: 1 addition & 0 deletions src/NovaTabTranslatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ protected function createTranslatedField(Field $originalField, string $locale):

$translatedField->attribute = 'translations';
$translatedField->withMeta([
'defaultValue' => $translatedField->defaultCallback,
'locale' => $locale,
'showOnIndex' => $translatedField->showOnIndex,
'showOnDetail' => $translatedField->showOnDetail,
Expand Down

0 comments on commit 51c5ae9

Please sign in to comment.