2018-01-16 22:24:30 +01:00
|
|
|
{% extends "base.html" %}
|
|
|
|
|
|
|
|
{% block body %}
|
2018-01-17 22:54:06 +01:00
|
|
|
<div id="app">
|
|
|
|
<div class="md-layout">
|
2018-01-18 22:46:48 +01:00
|
|
|
<div class="md-layout-item" md-card>
|
|
|
|
<md-table id="schedules-table" v-model="schedules">
|
|
|
|
<md-table-toolbar>
|
|
|
|
<h1 class="md-title">Schedules <a href="schedule.html">add new</a></h1>
|
|
|
|
</md-table-toolbar>
|
|
|
|
<md-table-row slot="md-table-row" slot-scope="{item}">
|
|
|
|
<md-table-cell md-label="#" md-sort-by="id" md-numeric>${ item.id }</md-table-cell>
|
2018-01-20 14:56:34 +01:00
|
|
|
<md-table-cell md-label="title" md-sort-by="title"><a :href="settingsUrl(item)">${ item.title }</a></md-table-cell>
|
2018-01-18 22:46:48 +01:00
|
|
|
<md-table-cell md-label="url" md-sort-by="email">${ item.url }</md-table-cell>
|
|
|
|
</md-table-row>
|
2018-01-17 22:54:06 +01:00
|
|
|
</md-table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
Vue.use(VueMaterial.default);
|
|
|
|
|
|
|
|
var app = new Vue({
|
2018-01-18 22:46:48 +01:00
|
|
|
el: '#app',
|
|
|
|
delimiters: ['${', '}'],
|
|
|
|
data: {
|
|
|
|
schedules: []
|
|
|
|
},
|
|
|
|
mounted: function() {
|
|
|
|
this.getSchedules();
|
|
|
|
},
|
2018-01-20 14:56:34 +01:00
|
|
|
computed: {
|
|
|
|
},
|
2018-01-18 22:46:48 +01:00
|
|
|
methods: {
|
2018-01-20 14:56:34 +01:00
|
|
|
settingsUrl: function(item) {
|
|
|
|
if (!(item && item.id !== undefined)) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
return '/schedule.html?id=' + item.id;
|
|
|
|
},
|
2018-01-18 22:46:48 +01:00
|
|
|
getSchedules: function() {
|
|
|
|
self = this;
|
|
|
|
var data = axios.get('/api/schedules').then(function(response) {
|
|
|
|
console.log(response);
|
2018-01-20 14:56:34 +01:00
|
|
|
var schedules = [];
|
|
|
|
_.forEach(response.data.schedules || {}, function(value, key) {
|
|
|
|
value.id = key;
|
|
|
|
schedules.push(value);
|
|
|
|
});
|
|
|
|
self.schedules = schedules;
|
2018-01-18 22:46:48 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2018-01-17 22:54:06 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
</script>
|
|
|
|
<style>
|
|
|
|
|
|
|
|
body {
|
|
|
|
background-color: white;
|
|
|
|
}
|
|
|
|
|
|
|
|
.md-table {
|
|
|
|
width: 60%;
|
2018-01-20 14:56:34 +01:00
|
|
|
min-height: 400px;
|
|
|
|
max-height: 800px;
|
2018-01-17 22:54:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
2018-01-16 22:24:30 +01:00
|
|
|
{% end %}
|