Pages now have proper titles.
This commit is contained in:
parent
6172c3c024
commit
73f1640515
@ -10,9 +10,11 @@ import "bootstrap-vue/dist/bootstrap-vue.css";
|
||||
import datePicker from "vue-bootstrap-datetimepicker";
|
||||
import "pc-bootstrap4-datetimepicker/build/css/bootstrap-datetimepicker.css";
|
||||
import Icon from "vue-awesome/components/Icon";
|
||||
import titleMixin from './mixins/titleMixin';
|
||||
|
||||
Vue.config.productionTip = false;
|
||||
axios.defaults.baseURL = "/api";
|
||||
Vue.mixin(titleMixin);
|
||||
Vue.use(VueAxios, axios);
|
||||
Vue.use(BootstrapVue);
|
||||
Vue.use(datePicker);
|
||||
|
15
frontend/src/mixins/titleMixin.js
Normal file
15
frontend/src/mixins/titleMixin.js
Normal 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;
|
||||
}
|
||||
}
|
||||
};
|
@ -25,7 +25,8 @@
|
||||
import "vue-awesome/icons/briefcase";
|
||||
import "vue-awesome/icons/home";
|
||||
export default {
|
||||
name: "About"
|
||||
name: "About",
|
||||
title: "About"
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -27,7 +27,8 @@ import "vue-awesome/icons/database";
|
||||
import "vue-awesome/icons/unlink";
|
||||
import "vue-awesome/icons/desktop";
|
||||
export default {
|
||||
name: "DatabaseUnavailable"
|
||||
name: "DatabaseUnavailable",
|
||||
title: "Database Error"
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -28,7 +28,8 @@ import "vue-awesome/icons/file-alt";
|
||||
import "vue-awesome/icons/th-list";
|
||||
import "vue-awesome/icons/chart-line";
|
||||
export default {
|
||||
name: "Home"
|
||||
name: "Home",
|
||||
title: "Observations Database"
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -23,6 +23,7 @@ import Vue from "vue";
|
||||
|
||||
export default {
|
||||
name: "newSite",
|
||||
title: "New Site",
|
||||
data: function() {
|
||||
return {
|
||||
siteName: null,
|
||||
|
@ -24,6 +24,7 @@
|
||||
import Vue from "vue";
|
||||
export default {
|
||||
name: "newTutor",
|
||||
title: "New Tutor",
|
||||
data() {
|
||||
return {
|
||||
siteOptions: [],
|
||||
|
@ -127,6 +127,7 @@ import Vue from "vue";
|
||||
|
||||
export default {
|
||||
name: "observation",
|
||||
title: "Observation",
|
||||
data: function() {
|
||||
return {
|
||||
observations: [
|
||||
|
@ -12,6 +12,7 @@
|
||||
import { mapState } from "vuex";
|
||||
export default {
|
||||
name: "ObservationComplete",
|
||||
title: "Observation Complete",
|
||||
computed: {
|
||||
...mapState(["description", "type", "whom", "site", "tutors"])
|
||||
}
|
||||
|
@ -87,6 +87,7 @@ import { mapState, mapMutations } from "vuex";
|
||||
|
||||
export default {
|
||||
name: "startnew",
|
||||
title: "Start New Observation",
|
||||
data() {
|
||||
return {
|
||||
siteOptions: [],
|
||||
|
@ -67,6 +67,7 @@ var moment = require("moment");
|
||||
|
||||
export default {
|
||||
name: "stats",
|
||||
title: "Statistics",
|
||||
components: { StatsView },
|
||||
data: function() {
|
||||
return {
|
||||
|
@ -108,6 +108,7 @@ import "vue-awesome/icons/search";
|
||||
var moment = require("moment");
|
||||
export default {
|
||||
name: "viewobservations",
|
||||
title: "Observations History",
|
||||
data: function() {
|
||||
return {
|
||||
startDate: moment().subtract(7, "days"),
|
||||
|
Loading…
Reference in New Issue
Block a user