Skip to content
Snippets Groups Projects

Product/510-niceProjectUrl

Merged Marcel Nellesen requested to merge Product/510-niceProjectUrl into Sprint/2020-10
1 file
+ 12
7
Compare changes
  • Side-by-side
  • Inline
+ 12
7
@@ -16,7 +16,7 @@
<span v-for="(project, index) in results['Projects']" :key="`${index}-${project.id}`">
<b-row>
<b-col sm="12">
<a :href="baseUrl + '/p/'+ project.id + '/'">{{ project.displayName }}</a>
<a :href="getExternalProjectLink(project.slug)">{{ project.displayName }}</a>
</b-col>
</b-row>
</span>
@@ -29,7 +29,7 @@
<span v-for="(subproject, index) in results['SubProjects']" :key="`${index}-${subproject.id}`">
<b-row>
<b-col sm="12">
<a :href="baseUrl + '/p/'+ subproject.id + '/'">{{ subproject.displayName }}</a>
<a :href="getExternalProjectLink(subproject.slug)">{{ subproject.displayName }}</a>
</b-col>
</b-row>
</span>
@@ -43,8 +43,8 @@
<b-row>
<b-col sm="12">
{{ resource.displayName }}
<a :href="baseUrl + '/p/'+ resource.projectId + '/SitePages/CreateResource.aspx?resource_id='+ resource.id">{{ $t('editResource') }}</a> /
<a :href="baseUrl + '/p/'+ resource.projectId + '/SitePages/ViewResource.aspx?resource_id='+ resource.id">{{ $t('viewResource') }}</a>
<a :href="getExternalProjectLink(resource.slug, 'CreateResource', {resource_id: resource.id})">{{ $t('editResource') }}</a> /
<a :href="getExternalProjectLink(resource.slug, 'ViewResource', {resource_id: resource.id})">{{ $t('viewResource') }}</a>
</b-col>
</b-row>
</span>
@@ -68,6 +68,7 @@
<script lang="ts">
import Vue from 'vue';
import { ProjectApi, SearchApi } from '@coscine/api-connection';
import { LinkUtil } from '@coscine/app-util';
import Loading from 'vue-loading-overlay';
import 'vue-loading-overlay/dist/vue-loading.css';
@@ -118,6 +119,9 @@ export default Vue.extend({
const query = new URL(window.location.href).searchParams.get('query');
return query !== null ? decodeURIComponent(query) : '';
},
getExternalProjectLink(slug: string = '', page: string = 'Home', queryParams: {} = {}) {
return LinkUtil.getExternalProjectLink(slug, page, queryParams);
},
search() {
this.isWaitingForResponse = true;
const url = new URL(window.location.href);
@@ -148,11 +152,12 @@ export default Vue.extend({
this.results.SubProjects.length = 0;
this.results.Resources.length = 0;
for (const datum of response.data.Projects) {
this.results.Projects.push({id: datum.Id, displayName: datum.DisplayName }); }
this.results.Projects.push({id: datum.Id, displayName: datum.DisplayName, slug: datum.Slug }); }
for (const datum of response.data.SubProjects) {
this.results.SubProjects.push({id: datum.Id, displayName: datum.DisplayName }); }
this.results.SubProjects.push({id: datum.Id, displayName: datum.DisplayName, slug: datum.Slug }); }
for (const datum of response.data.Resources) {
this.results.Resources.push({id: datum.Id, displayName: datum.DisplayName, projectId: datum.ProjectId }); }
this.results.Resources.push({id: datum.Id,
displayName: datum.DisplayName, projectId: datum.ProjectId, slug: datum.Slug }); }
this.isWaitingForResponse = false;
this.$forceUpdate();
},
Loading