Prettier formatting.

This commit is contained in:
neviyn 2018-10-10 10:24:02 +01:00
parent 9925a900c6
commit 586fa70104
9 changed files with 426 additions and 419 deletions

View File

@ -27,17 +27,18 @@
<!--suppress CssUnusedSymbol --> <!--suppress CssUnusedSymbol -->
<style> <style>
#app { #app {
font-family: "Avenir", Helvetica, Arial, sans-serif; font-family: "Avenir", Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
text-align: center; text-align: center;
color: #2c3e50; color: #2c3e50;
} }
.fade-enter-active, .fade-leave-active { .fade-enter-active,
transition: opacity .5s; .fade-leave-active {
} transition: opacity 0.5s;
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ { }
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
opacity: 0; opacity: 0;
} }
</style> </style>

View File

@ -23,13 +23,12 @@
</template> </template>
<script> <script>
import 'vue-awesome/icons/database' import "vue-awesome/icons/database";
import 'vue-awesome/icons/ban' import "vue-awesome/icons/ban";
export default { export default {
name: "DatabaseUnavailable" name: "DatabaseUnavailable"
} };
</script> </script>
<style scoped> <style scoped>
</style> </style>

View File

@ -24,11 +24,10 @@
</template> </template>
<script> <script>
export default { export default {
name: "Home" name: "Home"
} };
</script> </script>
<style scoped> <style scoped>
</style> </style>

View File

@ -19,11 +19,11 @@
</template> </template>
<script> <script>
import Vue from "vue"; import Vue from "vue";
export default { export default {
name: "newSite", name: "newSite",
data: function () { data: function() {
return { return {
siteName: null, siteName: null,
dismissSecs: 5, dismissSecs: 5,
@ -36,10 +36,9 @@
mounted() { mounted() {
Vue.axios Vue.axios
.get("/site") .get("/site")
.then(response => { .then(response => {})
})
.catch(error => { .catch(error => {
if(error.response.status === 404){ if (error.response.status === 404) {
this.$router.push("/dberror"); this.$router.push("/dberror");
return; return;
} }
@ -48,13 +47,13 @@
}); });
}, },
methods: { methods: {
countDownChanged: function (dismissCountDown) { countDownChanged: function(dismissCountDown) {
this.dismissCountDown = dismissCountDown; this.dismissCountDown = dismissCountDown;
}, },
showAlert: function () { showAlert: function() {
this.dismissCountDown = this.dismissSecs; this.dismissCountDown = this.dismissSecs;
}, },
onSubmit: function (e) { onSubmit: function(e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
var form = document.getElementById("submission-form"); var form = document.getElementById("submission-form");
@ -66,7 +65,7 @@
}; };
if (form.checkValidity()) { if (form.checkValidity()) {
Vue.axios Vue.axios
.post("/site", {'name': this.siteName}, axiosConfig) .post("/site", { name: this.siteName }, axiosConfig)
.then(response => { .then(response => {
this.alertVariant = "success"; this.alertVariant = "success";
this.alertText = "Successfully added " + response.data.text; this.alertText = "Successfully added " + response.data.text;
@ -81,5 +80,5 @@
} }
} }
} }
}; };
</script> </script>

View File

@ -43,7 +43,7 @@ export default {
this.siteOptions = response.data; this.siteOptions = response.data;
}) })
.catch(error => { .catch(error => {
if(error.response.status === 404){ if (error.response.status === 404) {
this.$router.push("/dberror"); this.$router.push("/dberror");
return; return;
} }
@ -70,10 +70,14 @@ export default {
}; };
if (form.checkValidity()) { if (form.checkValidity()) {
Vue.axios Vue.axios
.post("/tutor", { .post(
'siteId': this.siteSelection, "/tutor",
'name': this.tutorName {
}, axiosConfig) siteId: this.siteSelection,
name: this.tutorName
},
axiosConfig
)
.then(response => { .then(response => {
this.alertVariant = "success"; this.alertVariant = "success";
this.alertText = "Successfully added " + response.data.text; this.alertText = "Successfully added " + response.data.text;

View File

@ -105,15 +105,15 @@
</template> </template>
<script> <script>
import "bootstrap/dist/css/bootstrap.css"; import "bootstrap/dist/css/bootstrap.css";
import "bootstrap-vue/dist/bootstrap-vue.css"; import "bootstrap-vue/dist/bootstrap-vue.css";
import "vue-awesome/icons/tag"; import "vue-awesome/icons/tag";
import {mapState} from "vuex"; import { mapState } from "vuex";
import Vue from "vue"; import Vue from "vue";
export default { export default {
name: "observation", name: "observation",
data: function () { data: function() {
return { return {
observations: [ observations: [
{ {
@ -131,39 +131,39 @@
...mapState(["description", "type", "whom", "site", "tutors"]) ...mapState(["description", "type", "whom", "site", "tutors"])
}, },
methods: { methods: {
addAnotherObservation: function () { addAnotherObservation: function() {
this.observations.push({ this.observations.push({
type: null, type: null,
rating: null, rating: null,
strengths: null, strengths: null,
improvements: null improvements: null
}); });
Vue.nextTick(function () { Vue.nextTick(function() {
window.scrollTo( window.scrollTo(
0, 0,
document.body.scrollHeight || document.documentElement.scrollHeight document.body.scrollHeight || document.documentElement.scrollHeight
); );
}); });
}, },
deleteObservation: function (index) { deleteObservation: function(index) {
this.observations.splice(index, 1); this.observations.splice(index, 1);
if (this.observations.length === 0) { if (this.observations.length === 0) {
this.addAnotherObservation(); this.addAnotherObservation();
} }
this.updateTotals(); this.updateTotals();
}, },
changeType: function (index, ev) { changeType: function(index, ev) {
this.observations[index].type = ev; this.observations[index].type = ev;
this.updateTotals(); this.updateTotals();
}, },
changeRating: function (index, ev) { changeRating: function(index, ev) {
this.observations[index].rating = parseInt(ev); this.observations[index].rating = parseInt(ev);
this.updateTotals(); this.updateTotals();
}, },
updateTotals: function () { updateTotals: function() {
var iTotals = [0, 0, 0, 0, 0]; var iTotals = [0, 0, 0, 0, 0];
var counts = [0, 0, 0, 0, 0]; var counts = [0, 0, 0, 0, 0];
this.observations.forEach(function (element) { this.observations.forEach(function(element) {
if (element.rating > 0) { if (element.rating > 0) {
switch (element.type) { switch (element.type) {
case "MONITORING": case "MONITORING":
@ -197,7 +197,7 @@
} }
} }
}, },
onSubmit: function (e) { onSubmit: function(e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
var form = document.getElementById("submission-form"); var form = document.getElementById("submission-form");
@ -210,13 +210,13 @@
this.$refs.submissionModal.show(); this.$refs.submissionModal.show();
}, },
clearPassword() { clearPassword() {
this.submitPassword = null this.submitPassword = null;
}, },
handleOk(evt) { handleOk(evt) {
// Prevent modal from closing // Prevent modal from closing
evt.preventDefault(); evt.preventDefault();
if (this.submitPassword !== null) { if (this.submitPassword !== null) {
this.handleSubmit() this.handleSubmit();
} }
}, },
handleSubmit() { handleSubmit() {
@ -230,19 +230,23 @@
}; };
var self = this; var self = this;
Vue.axios Vue.axios
.post("/observation", { .post(
"/observation",
{
site: this.site, site: this.site,
tutors: this.tutors, tutors: this.tutors,
observed: this.description, observed: this.description,
whom: this.whom, whom: this.whom,
type: this.type, type: this.type,
entries: JSON.parse(JSON.stringify(this.observations)) entries: JSON.parse(JSON.stringify(this.observations))
}, axiosConfig) },
.then(function (response) { axiosConfig
)
.then(function(response) {
self.$router.push("/complete"); self.$router.push("/complete");
console.log(response); console.log(response);
}) })
.catch(function (error) { .catch(function(error) {
console.log(error); console.log(error);
}); });
} }
@ -250,19 +254,19 @@
form.classList.add("was-validated"); form.classList.add("was-validated");
} }
} }
}; };
</script> </script>
<style> <style>
.top-buffer { .top-buffer {
margin-top: 10px; margin-top: 10px;
} }
.bottom-buffer { .bottom-buffer {
margin-bottom: 10px; margin-bottom: 10px;
} }
.image-centered-text { .image-centered-text {
position: absolute; position: absolute;
top: 50%; top: 50%;
left: 50%; left: 50%;
@ -270,18 +274,18 @@
font-size: 50px; font-size: 50px;
color: white; color: white;
text-shadow: -2px 0 black, 0 2px black, 2px 0 black, 0 -2px black; text-shadow: -2px 0 black, 0 2px black, 2px 0 black, 0 -2px black;
} }
.image-opacity { .image-opacity {
opacity: 0.5; opacity: 0.5;
} }
.centered-image { .centered-image {
position: relative; position: relative;
text-align: center; text-align: center;
} }
.sidebar { .sidebar {
width: 160px; /* Set the width of the sidebar */ width: 160px; /* Set the width of the sidebar */
position: fixed; /* Fixed Sidebar (stay in place on scroll) */ position: fixed; /* Fixed Sidebar (stay in place on scroll) */
z-index: 1; /* Stay on top */ z-index: 1; /* Stay on top */
@ -289,20 +293,20 @@
left: 0; left: 0;
overflow-x: hidden; /* Disable horizontal scroll */ overflow-x: hidden; /* Disable horizontal scroll */
padding-top: 20px; padding-top: 20px;
} }
.sidebar-vert-padding { .sidebar-vert-padding {
margin-bottom: 25%; margin-bottom: 25%;
} }
@media screen and (max-height: 500px) { @media screen and (max-height: 500px) {
.sidebar { .sidebar {
top: 0; /* Stay at the top */ top: 0; /* Stay at the top */
} }
} }
img { img {
height: 80px; height: 80px;
object-fit: contain; object-fit: contain;
} }
</style> </style>

View File

@ -9,15 +9,14 @@
</template> </template>
<script> <script>
import {mapState} from "vuex"; import { mapState } from "vuex";
export default { export default {
name: "ObservationComplete", name: "ObservationComplete",
computed: { computed: {
...mapState(["description", "type", "whom", "site", "tutors"]) ...mapState(["description", "type", "whom", "site", "tutors"])
} }
} };
</script> </script>
<style scoped> <style scoped>
</style> </style>

View File

@ -80,12 +80,12 @@
</template> </template>
<script> <script>
import Vue from "vue"; import Vue from "vue";
import "vue-awesome/icons/spinner"; import "vue-awesome/icons/spinner";
import "vue-awesome/icons/exclamation-circle"; import "vue-awesome/icons/exclamation-circle";
import {mapState, mapMutations} from "vuex"; import { mapState, mapMutations } from "vuex";
export default { export default {
name: "startnew", name: "startnew",
data() { data() {
return { return {
@ -106,7 +106,7 @@
this.loaded = true; this.loaded = true;
}) })
.catch(error => { .catch(error => {
if(error.response.status === 404){ if (error.response.status === 404) {
this.$router.push("/dberror"); this.$router.push("/dberror");
return; return;
} }
@ -119,7 +119,7 @@
...mapState(["site", "description", "type", "tutors", "whom"]) ...mapState(["site", "description", "type", "tutors", "whom"])
}, },
watch: { watch: {
site: function () { site: function() {
this.loadingTutors = true; this.loadingTutors = true;
this.tutorOptions = []; this.tutorOptions = [];
this.tutors = []; this.tutors = [];
@ -135,16 +135,18 @@
"setWhom", "setWhom",
"resetStore" "resetStore"
]), ]),
getTutors: function () { getTutors: function() {
if (this.site != null) { if (this.site != null) {
Vue.axios.get("/site/" + this.site + "/tutors").then(response => { Vue.axios
.get("/site/" + this.site + "/tutors")
.then(response => {
this.tutorOptions = response.data; this.tutorOptions = response.data;
this.loadingTutors = false; this.loadingTutors = false;
}).catch(error => { })
if(error.response.status === 404){ .catch(error => {
if (error.response.status === 404) {
this.$router.push("/dberror"); this.$router.push("/dberror");
return; return;
} }
this.errorStatus = error.response.status; this.errorStatus = error.response.status;
this.errorMessage = error.response.data; this.errorMessage = error.response.data;
@ -152,7 +154,7 @@
}); });
} }
}, },
onSubmit: function (e) { onSubmit: function(e) {
console.log("submit"); console.log("submit");
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
@ -164,5 +166,5 @@
form.classList.add("was-validated"); form.classList.add("was-validated");
} }
} }
}; };
</script> </script>