Add inline admin create forms to home page components
Deploy with Docker Compose / deploy (push) Successful in 28s
Deploy with Docker Compose / deploy (push) Successful in 28s
Lazy-load create forms (Post, Activity, Favorite, Rowing) directly into their corresponding home components with an admin-only toggle button, replacing the need to navigate to the admin page. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
@@ -4,6 +4,8 @@ import Button from "@/components/input/Button.vue";
|
||||
import { ref } from "vue";
|
||||
import { gql } from "@/graphql";
|
||||
|
||||
const emit = defineEmits(["done", "cancel"]);
|
||||
|
||||
const type = ref("");
|
||||
const name = ref("");
|
||||
const link = ref("");
|
||||
@@ -18,6 +20,7 @@ async function post() {
|
||||
name.value = "";
|
||||
link.value = "";
|
||||
console.log(data.createActivity);
|
||||
emit("done");
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
@@ -31,5 +34,6 @@ async function post() {
|
||||
<input type="text" v-model="name" placeholder="Name" @keyup.enter="post" />
|
||||
<input type="text" v-model="link" placeholder="Link" @keyup.enter="post" />
|
||||
<Button @click="post">Upload</Button>
|
||||
<Button @click="emit('cancel')">Cancel</Button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -4,6 +4,8 @@ import Button from "@/components/input/Button.vue";
|
||||
import { ref } from "vue";
|
||||
import { gql } from "@/graphql";
|
||||
|
||||
const emit = defineEmits(["done", "cancel"]);
|
||||
|
||||
const type = ref("");
|
||||
const name = ref("");
|
||||
const link = ref("");
|
||||
@@ -18,6 +20,7 @@ async function post() {
|
||||
name.value = "";
|
||||
link.value = "";
|
||||
console.log(data.createFavorite);
|
||||
emit("done");
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
@@ -31,5 +34,6 @@ async function post() {
|
||||
<input type="text" v-model="name" placeholder="Name" @keyup.enter="post" />
|
||||
<input type="text" v-model="link" placeholder="Link" @keyup.enter="post" />
|
||||
<Button @click="post">Upload</Button>
|
||||
<Button @click="emit('cancel')">Cancel</Button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -3,6 +3,8 @@ import Button from "@/components/input/Button.vue";
|
||||
import { ref } from "vue";
|
||||
import { gql } from "@/graphql";
|
||||
|
||||
const emit = defineEmits(["done", "cancel"]);
|
||||
|
||||
const title = ref("");
|
||||
const content = ref("");
|
||||
|
||||
@@ -15,6 +17,7 @@ async function post() {
|
||||
title.value = "";
|
||||
content.value = "";
|
||||
console.log(data.createPost);
|
||||
emit("done");
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
@@ -31,6 +34,6 @@ async function post() {
|
||||
placeholder="Content"
|
||||
></textarea>
|
||||
<Button @click="post">Upload</Button>
|
||||
<!-- make textarea take up most the space -->
|
||||
<Button @click="emit('cancel')">Cancel</Button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -3,6 +3,8 @@ import Button from "@/components/input/Button.vue";
|
||||
import { ref } from "vue";
|
||||
import axios from "axios";
|
||||
|
||||
const emit = defineEmits(["done", "cancel"]);
|
||||
|
||||
const images = ref([]);
|
||||
const results = ref([]);
|
||||
|
||||
@@ -35,6 +37,7 @@ async function submit() {
|
||||
);
|
||||
|
||||
images.value = [];
|
||||
emit("done");
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -43,6 +46,7 @@ async function submit() {
|
||||
<h1>Create Rowing</h1>
|
||||
<input type="file" accept="image/jpeg,image/png,image/gif,image/webp" multiple @change="onFileChange" />
|
||||
<Button @click="submit">Upload</Button>
|
||||
<Button @click="emit('cancel')">Cancel</Button>
|
||||
<div v-for="r in results" :key="r.name">
|
||||
<span class="text-primary">{{ r.name }}: </span>
|
||||
<span :class="r.ok ? 'text-secondary' : 'text-red-500'">{{ r.status }}</span>
|
||||
|
||||
Reference in New Issue
Block a user