tethys/resources/js/landingpage/components/dataset.vue

132 lines
2.9 KiB
Vue
Raw Normal View History

2020-03-06 14:39:05 +00:00
<template>
2020-03-10 17:58:46 +00:00
<div class="box" v-if="dataset">
2020-03-06 14:39:05 +00:00
<div class="dataset_heaader">
2020-03-10 17:58:46 +00:00
<div class="dataset__blog-meta">published: {{ toDayDateTimeString(dataset.server_date_published) }}</div>
<h1 class="dataset__title">{{ dataset.title_output }}</h1>
2020-03-06 14:39:05 +00:00
2020-03-10 17:58:46 +00:00
<p class="dataset__id">{{ dataset.id }}</p>
2020-03-06 14:39:05 +00:00
</div>
<div class="dataset">
2020-03-10 17:58:46 +00:00
<p class="dataset__abstract">{{ dataset.abstract_output }}</p>
2020-03-06 14:39:05 +00:00
2020-03-10 17:58:46 +00:00
<p class="dataset__abstract" v-if="dataset.subject && dataset.subject.length > 0">keywords: {{ dataset.subject.join(', ') }}</p>
<p class="dataset__abstract">creating corporation: {{ dataset.creating_corporation }}</p>
<p class="dataset__abstract">publisher: {{ dataset.publisher_name }}</p>
<p class="dataset__abstract">coverage: {{ dataset.geo_location }}</p>
2020-03-06 14:39:05 +00:00
</div>
</div>
</template>
<script>
import axios from "axios";
import { Component, Vue, Prop } from "vue-property-decorator";
@Component
export default class Dataset extends Vue {
// props: ['id'];
name = "dataset";
@Prop()
id;
metaInfo() {
return {
2020-03-10 17:58:46 +00:00
title: this.dataset && this.dataset.title
2020-03-06 14:39:05 +00:00
};
}
toDayDateTimeString(UNIX_timestamp) {
var a = new Date(UNIX_timestamp * 1000);
var months = [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
];
var year = a.getFullYear();
var month = months[a.getMonth()];
var date = a.getDate();
var hour = a.getHours();
var min = a.getMinutes();
var sec = a.getSeconds();
var time =
date + " " + month + " " + year + " " + hour + ":" + min + ":" + sec;
return time;
}
2020-03-10 17:58:46 +00:00
dataset = null;
2020-03-06 14:39:05 +00:00
host = "https://repository.geologie.ac.at/";
path = "solr/rdr_data/select?";
endpoint = this.host + this.path;
// endpoint = "https://jsonplaceholder.typicode.com/posts/";
getPost(id) {
axios(this.endpoint + "&q=id:" + id)
.then(response => {
2020-03-10 17:58:46 +00:00
this.dataset = response.data.response.docs[0];
// this.dataset.title_output = "Ein etwas längerer Titel zum Testen!!! Test";
2020-03-06 14:39:05 +00:00
})
.catch(error => {
console.log("-----error-------");
console.log(error);
});
}
created() {
this.getPost(this.id);
}
}
</script>
<style lang="scss" scoped>
.box {
margin: 0 auto;
2020-03-10 17:58:46 +00:00
padding: 100px 20px 70px;
2020-03-06 14:39:05 +00:00
// background-color: salmon;
}
.dataset_heaader {
// background-color: lightgray;
position: relative;
}
.dataset {
// max-width: 500px;
&__title {
position: relative;
text-transform: uppercase;
z-index: 1;
}
&__abstract {
position: relative;
z-index: 1;
}
&__id {
position: absolute;
2020-03-10 17:58:46 +00:00
font-size: 250px;
bottom: -40px;
2020-03-06 14:39:05 +00:00
margin: 0;
color: #eeeeee;
right: -20px;
line-height: 1;
font-weight: 900;
z-index: 0;
}
&__blog-meta {
padding: 10px 0 20px;
color: #c2c2c2;
// font-size: 0.8em;
margin-top: -1.7em;
}
}
</style>