Skip to content

Commit

Permalink
Merge branch 'feature/display-sources' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
arthaud-proust committed Oct 20, 2023
2 parents a4a1544 + cc8bd64 commit dc40c3b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
3 changes: 2 additions & 1 deletion resources/js/Components/Form/TextListInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import TextInput from "@/Components/Form/TextInput.vue";
const props = defineProps<{
modelValue: Array<string>;
placeholder?: string;
}>();
const emit = defineEmits<{
Expand Down Expand Up @@ -35,7 +36,7 @@ function handleDeleteLine(index: number) {
<div>
<ul class="flex flex-col gap-2">
<li class="flex gap-2" v-for="(str, index) in modelValue" :key="index">
<TextInput class="w-full" :model-value="str" @update:modelValue="(value)=>handleInput(index, value)" />
<TextInput class="w-full" :model-value="str" @update:modelValue="(value)=>handleInput(index, value)" :placeholder="placeholder" />
<button class="p-2 border h-full" @click="handleDeleteLine(index)">x</button>
</li>
</ul>
Expand Down
1 change: 1 addition & 0 deletions resources/js/Pages/News/Partials/NewsForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ function handleSubmit() {

<TextListInput
id="summary"
placeholder="Ex: https://lemonde.com"
class="mt-1 block w-full"
v-model="form.sources"
/>
Expand Down
21 changes: 17 additions & 4 deletions resources/js/Pages/News/Show.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,23 @@ defineProps<{

<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
<h2 class="p-6 text-gray-900">{{ news.title }}</h2>
<p class="p-6 text-gray-900">{{ news.summary }}</p>
<a v-if="news.video" :href="news.video" class="p-6 text-gray-600">Voir la vidéo</a>
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg p-6">
<h2>{{ news.title }}</h2>
<p>{{ news.summary }}</p>

<h3 class="mt-2">Sources</h3>
<ul>
<li v-for="(source, index) in news.sources" :key="index">
<a :href="source" target="_blank" rel="noreferrer">{{ source }}</a>
</li>
<li v-if="!news.sources?.length">
Aucune source pour l'instant.
<Link :href="route('news.edit', news)">Rajoutez-en une</Link>
</li>
</ul>

<hr class="mt-4 mb-2">
<a v-if="news.video" :href="news.video">Voir la vidéo</a>
</div>
</div>
</div>
Expand Down

0 comments on commit dc40c3b

Please sign in to comment.