Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Nova - Display text area content without option show content

I would like to display text area resource field content always without showing option "Show Content" or display it by default.

enter image description here

Is it possible?

like image 470
Saumini Navaratnam Avatar asked Sep 19 '18 12:09

Saumini Navaratnam


1 Answers

As of v1.1.4

There is now an option to always show.

Textarea::make('Title')->alwaysShow()

As of v1.0.19

You cannot. If you take a look at the TextareaField.vue (nova/resources/js/components/Detail/TextareaField.vue):

<template>
    <panel-item :field="field">
        <template slot="value">
            <excerpt :content="field.value" />
        </template>
    </panel-item>
</template>

Then if you take a look at Excerpt.vue (nova/resources/js/components/Excerpt.vue):

<div v-if="hasContent">
    <div v-if="expanded" class="markdown leading-normal" v-html="content" />

    <a
        @click="toggle"
        class="cursor-pointer dim inline-block text-primary font-bold"
        :class="{ 'mt-6': expanded }"
        aria-role="button"
    >
        {{ showHideLabel }}
    </a>
</div>

And the props of the vue:

props: {
    content: {
        type: String,
    },
},

data: () => ({ expanded: false }),

There's no option to pass the expanded attribute.

like image 78
Chin Leung Avatar answered Oct 16 '22 06:10

Chin Leung