Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/backend/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,19 @@
})).data
}

export const policiesCurrent = async () => {
return (await axios.get('/v1/policies/current'));

Check failure on line 102 in src/backend/api.js

View workflow job for this annotation

GitHub Actions / build (22)

Extra semicolon
}

export const policyByDate = async ({ policyType, activeFrom }) => {
return (await axios.get('/v1/policies/{policy_type}/by_active_from/{active_from}', {
params: {
policy_type: policyType,
active_from: activeFrom,
}

Check failure on line 110 in src/backend/api.js

View workflow job for this annotation

GitHub Actions / build (22)

Missing trailing comma
}));

Check failure on line 111 in src/backend/api.js

View workflow job for this annotation

GitHub Actions / build (22)

Extra semicolon
}

export const importEntities = async ({
wikiId,
entityIds = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default {
PolicyNavigationPanel,
},
data: () => ({
// TODO update with info from API
termsOfUseLinks: [
{ title: 'Upcoming Version', routePath: '/terms-of-use/upcoming' },
{ title: '11 April 2022 (current)', routePath: '/terms-of-use' },
Expand Down
88 changes: 88 additions & 0 deletions src/components/Pages/TermsOfUse/TermsOfUseRenderer.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<template>
<v-main>
<pre>
policyId (derived from route): `{{policyId}}`
policy: {{ policy }}
</pre>

<p>
<router-link :to="{ path: '/terms-of-use/2022-01-01' }">
2022-01-01
</router-link></p>

<p><router-link :to="{ path: '/terms-of-use/upcoming' }">
upcoming
</router-link></p>

<hr>

<component :is="policy" v-if="policy" />
</v-main>
</template>

<script>
export const versions = {
"2022-01-01": () => ({ component: import('./terms-of-use/2022-01-01.vue') }),

Check failure on line 25 in src/components/Pages/TermsOfUse/TermsOfUseRenderer.vue

View workflow job for this annotation

GitHub Actions / build (22)

Strings must use singlequote
upcoming: () => ({ component: import('./terms-of-use/upcoming.vue') }),

Check failure on line 26 in src/components/Pages/TermsOfUse/TermsOfUseRenderer.vue

View workflow job for this annotation

GitHub Actions / build (22)

Extra space before value for key 'upcoming'
}

export default {
name: 'TermsOfUseRenderer',
components: {
},
computed: {
policyId: function() {

Check failure on line 34 in src/components/Pages/TermsOfUse/TermsOfUseRenderer.vue

View workflow job for this annotation

GitHub Actions / build (22)

Missing space before function parentheses
return this.$route.params.version;

Check failure on line 35 in src/components/Pages/TermsOfUse/TermsOfUseRenderer.vue

View workflow job for this annotation

GitHub Actions / build (22)

Extra semicolon

Check failure on line 35 in src/components/Pages/TermsOfUse/TermsOfUseRenderer.vue

View workflow job for this annotation

GitHub Actions / build (22)

Expected indentation of 6 spaces but found 8
}

Check failure on line 36 in src/components/Pages/TermsOfUse/TermsOfUseRenderer.vue

View workflow job for this annotation

GitHub Actions / build (22)

Missing trailing comma
},
data() {

Check failure on line 38 in src/components/Pages/TermsOfUse/TermsOfUseRenderer.vue

View workflow job for this annotation

GitHub Actions / build (22)

Missing space before function parentheses
return {
policy: undefined,
}
},
methods: {
async loadPolicy () {
console.warn(this.policyId);
try {
// const response = await this.$api.policiesCurrent();
// const response = await this.$api.policyByDate({policy_type, active_from});

const mockResponses = {
"2022-01-01": {
"metadata": {
"policy_id": 1,
"type": "terms-of-use",
"active_from": "2022-01-01",
"content_vue_file": "terms-of-use/version-1.vue"
}},
upcoming: {
"metadata": {
"policy_id": 1,
"type": "terms-of-use",
"active_from": "upcoming",
"content_vue_file": "terms-of-use/upcoming.vue"
}}
}
const response = mockResponses[this.policyId];

const metadata = await response.metadata;
this.policy = versions[metadata.active_from];
} catch (error) {
console.log(error)
alert('Failed to show policy')
}
},
},
mounted () {
this.loadPolicy()
},
watch: {
policyId: function () {
this.loadPolicy()
},
}
}
</script>

<style scoped>
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@
</template>

<script>
import TermsOfUseNavigationPanel from './TermsOfUseNavigationPanel.vue'
import TermsOfUseNavigationPanel from '../TermsOfUseNavigationPanel.vue'

export default {
name: 'TermsOfUse',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,7 @@
</template>

<script>
import TermsOfUseNavigationPanel from './TermsOfUseNavigationPanel.vue'
import TermsOfUseNavigationPanel from '../TermsOfUseNavigationPanel.vue'

export default {
name: 'TermsOfUseUpcoming',
Expand Down
11 changes: 5 additions & 6 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ import ResetPassword from '@/components/Pages/ResetPassword'
import EmailVerification from '@/components/Pages/EmailVerification'
import CreateWiki from '@/components/Pages/CreateWiki'
import TabSettings from '@/components/Pages/ManageWiki/TabSettings'
import TermsOfUse from '@/components/Pages/TermsOfUse/Current.vue'
import TermsOfUseRenderer from '@/components/Pages/TermsOfUse/TermsOfUseRenderer.vue'
import Privacy from '@/components/Pages/Privacy/Privacy'
import User from '@/components/Pages/User'
import Discovery from '@/components/Pages/Discovery/Discovery'
import Complaint from '@/components/Pages/Complaint.vue'
import HostingPolicy from '@/components/Pages/HostingPolicy.vue'
import TermsOfUseUpcoming from '@/components/Pages/TermsOfUse/Upcoming.vue'
import DsaInfo from '@/components/Pages/DsaInfo/DsaInfo'

Vue.use(Router)
Expand Down Expand Up @@ -74,12 +73,12 @@ const router = new Router({
{
path: '/terms-of-use',
name: 'TermsOfUse',
component: TermsOfUse,
component: TermsOfUseRenderer,
},
{
path: '/terms-of-use/upcoming',
name: 'TermsOfUseUpcoming',
component: TermsOfUseUpcoming,
path: '/terms-of-use/:version',
name: 'TermsOfUseRenderer',
component: TermsOfUseRenderer,
},
{
path: '/hosting-policy/pilot',
Expand Down
Loading