-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from ssciwr/fix_52_news_items_editable_from_ad…
…min_interface News items can be edited from admin interface
- Loading branch information
Showing
11 changed files
with
136 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<script setup lang="ts"> | ||
import { FwbButton, FwbTextarea } from "flowbite-vue"; | ||
import { useSettingsStore } from "@/stores/settings"; | ||
const settingsStore = useSettingsStore(); | ||
</script> | ||
|
||
<template> | ||
<div class="flex flex-col mb-2 p-2" v-if="settingsStore.settings"> | ||
<fwb-textarea | ||
v-model="settingsStore.settings.about_md" | ||
:rows="32" | ||
class="mb-2" | ||
label="About page text (markdown)" | ||
></fwb-textarea> | ||
<fwb-button @click="settingsStore.saveChanges" class="mt-2" color="green"> | ||
Save | ||
</fwb-button> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<script setup lang="ts"> | ||
import { FwbButton, FwbInput, FwbListGroupItem } from "flowbite-vue"; | ||
import { computed } from "vue"; | ||
import { useSettingsStore } from "@/stores/settings"; | ||
const settingsStore = useSettingsStore(); | ||
type Item = { | ||
id: string; | ||
url: string; | ||
text: string; | ||
}; | ||
const items = computed((): Array<Item> => { | ||
try { | ||
return JSON.parse(settingsStore.settings.news_items_json); | ||
} catch (e) { | ||
console.log(e); | ||
return []; | ||
} | ||
}); | ||
function add() { | ||
settingsStore.settings.news_items_json = JSON.stringify( | ||
items.value.concat([{ id: "", url: "", text: "" }]), | ||
); | ||
} | ||
function remove(id: string) { | ||
settingsStore.settings.news_items_json = JSON.stringify( | ||
items.value.filter((item) => item.id !== id), | ||
); | ||
} | ||
function save() { | ||
settingsStore.settings.news_items_json = JSON.stringify(items.value); | ||
settingsStore.saveChanges(); | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class="flex flex-col mb-2 p-2" v-if="settingsStore.settings"> | ||
<fwb-list-group-item v-for="item in items" v-bind:key="item.id"> | ||
<div class="flex flex-col mb-4 flex-grow mr-2"> | ||
<fwb-input v-model="item.id" label="ID" class="mb-1" /> | ||
<fwb-input v-model="item.url" label="URL" class="mb-1" /> | ||
<fwb-input v-model="item.text" label="Text" class="mb-1" /> | ||
<fwb-button | ||
color="red" | ||
class="grow-0" | ||
@click=" | ||
() => { | ||
remove(item.id); | ||
} | ||
" | ||
>Delete</fwb-button | ||
> | ||
</div> | ||
</fwb-list-group-item> | ||
<fwb-list-group-item> | ||
<fwb-button @click="add" class="my-2 grow">Add new item</fwb-button> | ||
</fwb-list-group-item> | ||
<fwb-button @click="save" class="mt-2" color="green"> Save </fwb-button> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters