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 -->
<style>
#app {
#app {
font-family: "Avenir", Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
.fade-enter-active, .fade-leave-active {
transition: opacity .5s;
}
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
}
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.5s;
}
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
opacity: 0;
}
}
</style>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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