Pages now have proper titles.

This commit is contained in:
neviyn 2018-10-12 11:57:33 +01:00
parent 6172c3c024
commit 73f1640515
12 changed files with 30 additions and 3 deletions

View File

@ -10,9 +10,11 @@ import "bootstrap-vue/dist/bootstrap-vue.css";
import datePicker from "vue-bootstrap-datetimepicker"; import datePicker from "vue-bootstrap-datetimepicker";
import "pc-bootstrap4-datetimepicker/build/css/bootstrap-datetimepicker.css"; import "pc-bootstrap4-datetimepicker/build/css/bootstrap-datetimepicker.css";
import Icon from "vue-awesome/components/Icon"; import Icon from "vue-awesome/components/Icon";
import titleMixin from './mixins/titleMixin';
Vue.config.productionTip = false; Vue.config.productionTip = false;
axios.defaults.baseURL = "/api"; axios.defaults.baseURL = "/api";
Vue.mixin(titleMixin);
Vue.use(VueAxios, axios); Vue.use(VueAxios, axios);
Vue.use(BootstrapVue); Vue.use(BootstrapVue);
Vue.use(datePicker); Vue.use(datePicker);

View File

@ -0,0 +1,15 @@
function getTitle(vm) {
const { title } = vm.$options;
if (title) {
return typeof title === "function" ? title.call(vm) : title;
}
}
export default {
created() {
const title = getTitle(this);
if (title) {
document.title = title;
}
}
};

View File

@ -25,7 +25,8 @@
import "vue-awesome/icons/briefcase"; import "vue-awesome/icons/briefcase";
import "vue-awesome/icons/home"; import "vue-awesome/icons/home";
export default { export default {
name: "About" name: "About",
title: "About"
}; };
</script> </script>

View File

@ -27,7 +27,8 @@ import "vue-awesome/icons/database";
import "vue-awesome/icons/unlink"; import "vue-awesome/icons/unlink";
import "vue-awesome/icons/desktop"; import "vue-awesome/icons/desktop";
export default { export default {
name: "DatabaseUnavailable" name: "DatabaseUnavailable",
title: "Database Error"
}; };
</script> </script>

View File

@ -28,7 +28,8 @@ import "vue-awesome/icons/file-alt";
import "vue-awesome/icons/th-list"; import "vue-awesome/icons/th-list";
import "vue-awesome/icons/chart-line"; import "vue-awesome/icons/chart-line";
export default { export default {
name: "Home" name: "Home",
title: "Observations Database"
}; };
</script> </script>

View File

@ -23,6 +23,7 @@ import Vue from "vue";
export default { export default {
name: "newSite", name: "newSite",
title: "New Site",
data: function() { data: function() {
return { return {
siteName: null, siteName: null,

View File

@ -24,6 +24,7 @@
import Vue from "vue"; import Vue from "vue";
export default { export default {
name: "newTutor", name: "newTutor",
title: "New Tutor",
data() { data() {
return { return {
siteOptions: [], siteOptions: [],

View File

@ -127,6 +127,7 @@ import Vue from "vue";
export default { export default {
name: "observation", name: "observation",
title: "Observation",
data: function() { data: function() {
return { return {
observations: [ observations: [

View File

@ -12,6 +12,7 @@
import { mapState } from "vuex"; import { mapState } from "vuex";
export default { export default {
name: "ObservationComplete", name: "ObservationComplete",
title: "Observation Complete",
computed: { computed: {
...mapState(["description", "type", "whom", "site", "tutors"]) ...mapState(["description", "type", "whom", "site", "tutors"])
} }

View File

@ -87,6 +87,7 @@ import { mapState, mapMutations } from "vuex";
export default { export default {
name: "startnew", name: "startnew",
title: "Start New Observation",
data() { data() {
return { return {
siteOptions: [], siteOptions: [],

View File

@ -67,6 +67,7 @@ var moment = require("moment");
export default { export default {
name: "stats", name: "stats",
title: "Statistics",
components: { StatsView }, components: { StatsView },
data: function() { data: function() {
return { return {

View File

@ -108,6 +108,7 @@ import "vue-awesome/icons/search";
var moment = require("moment"); var moment = require("moment");
export default { export default {
name: "viewobservations", name: "viewobservations",
title: "Observations History",
data: function() { data: function() {
return { return {
startDate: moment().subtract(7, "days"), startDate: moment().subtract(7, "days"),