Skip to content

Commit

Permalink
user orgs!!
Browse files Browse the repository at this point in the history
  • Loading branch information
davay42 committed Jan 29, 2021
1 parent 797a72e commit 71475a9
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 10 deletions.
10 changes: 9 additions & 1 deletion src/components/page/container.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
)
list-items(
:wide="false",
v-for="type in organisations[org].model[item.type]",
v-for="type in types",
:key="type",
:type="type",
:editable="editable",
Expand Down Expand Up @@ -106,6 +106,14 @@ gunItem.map().on((data: any, key: string) => {
item[key] = data;
});
const types = computed(() => {
if (organisations[props.org]) {
return organisations[props.org].model[item.type];
} else {
return model[item.type];
}
});
const edit = reactive({
icon: false,
title: false,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/org/[org].vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template lang="pug">
main#main
.title
router-link(to="/org/") Organisations / {{ organisations[org].title }}
router-link(to="/org/") Organisations / {{ organisations?.[org]?.title || org }}
router-view(v-slot="{ Component }")
transition(name="fade")
component(:is="Component")
Expand Down
14 changes: 11 additions & 3 deletions src/pages/org/[org]/[type].vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
type-icon.type(
@click="$router.push(`/org/${org}/${atype}`)",
:class="{ active: atype == type }",
v-for="atype in Object.keys(organisations[org].model)",
v-for="atype in types",
:key="atype",
:type="atype"
)
Expand All @@ -14,13 +14,21 @@
</template>

<script setup lang="ts">
import { defineProps } from "vue";
import { organisations } from "../../../store/model";
import { computed, defineProps } from "vue";
import { model, organisations } from "../../../store/model";
const props = defineProps({
type: String,
org: String,
});
const types = computed(() => {
if (organisations[props.org]) {
return Object.keys(organisations[props.org].model);
} else {
return Object.keys(model);
}
});
</script>

<style lang="stylus" scoped>
Expand Down
16 changes: 12 additions & 4 deletions src/pages/org/[org]/index.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<template lang="pug">
.types {{ organisations[org] }}
.types {{ organisations?.[org] }}
type-counter(
@click="$router.push(`/org/${org}/${type}`)",
v-for="type in Object.keys(organisations[org].model)",
v-for="type in types",
:key="type",
:type="type",
:parent="org"
)
</template>

<script setup lang="ts">
import { defineProps } from "vue";
import { computed, defineProps } from "vue";
import { useTitle } from "@vueuse/core";
import { organisations } from "../../../store/model";
import { model, organisations } from "../../../store/model";
const props = defineProps({
org: String,
Expand All @@ -22,6 +22,14 @@ useTitle(`Explore ${props.org}`);
function explore(ev) {
console.log(ev);
}
const types = computed(() => {
if (organisations[props.org]) {
return Object.keys(organisations[props.org].model);
} else {
return Object.keys(model);
}
});
</script>

<style lang="stylus" scoped>
Expand Down
8 changes: 7 additions & 1 deletion src/pages/org/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@ main#main
:type="type",
:parent="path"
)
form.custom(@submit.prevent.stop)
input(type="text", v-model="customOrg")
router-link(:to="`/org/${customOrg}`") {{ customOrg }}
</template>

<script setup lang="ts">
import { organisations, types } from "../../store/model";
import { useTitle } from "@vueuse/core";
import { ref } from "vue";
useTitle("Explore");
useTitle("Organisations");
const customOrg = ref("");
</script>

<style lang="stylus" scoped>
Expand Down

0 comments on commit 71475a9

Please sign in to comment.