index.html 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. {% extends "base.html" %}
  2. {% block body %}
  3. <div id="app">
  4. <div class="md-layout">
  5. <div class="md-layout-item">
  6. <md-card id="main-card">
  7. <md-card-header>
  8. <div class="md-title">
  9. <md-button href="/" class="md-icon-button md-primary">
  10. <md-icon>home</md-icon>
  11. </md-button>
  12. Diffido
  13. <md-button href="/schedule.html" class="md-icon-button md-primary">
  14. <md-icon>add_circle_outline</md-icon>
  15. </md-button>
  16. </div>
  17. </md-card-header>
  18. <md-card-content>
  19. <md-table id="schedules-table" v-model="schedules">
  20. <md-table-row slot="md-table-row" slot-scope="{item}">
  21. <md-table-cell md-label="#" md-sort-by="id" md-numeric><a :href="'/schedule.html?id=' + item.id">${ item.id }</a></md-table-cell>
  22. <md-table-cell md-label="title" md-sort-by="title"><a :href="'/schedule.html?id=' + item.id">${ item.title }</a></md-table-cell>
  23. <md-table-cell md-label="url" md-sort-by="email"><a :href="item.url" target="_new">${ item.url }</a></md-table-cell>
  24. <md-table-cell md-label="history" md-sort-by="email">
  25. <md-button :href="'/history.html?id=' + item.id" class="md-icon-button md-primary">
  26. <md-icon>history</md-icon>
  27. </md-button>
  28. </md-table-cell>
  29. </md-table-row>
  30. </md-table>
  31. </md-card-content>
  32. </md-card>
  33. </div>
  34. </div>
  35. </div>
  36. <script>
  37. Vue.use(VueMaterial.default);
  38. var app = new Vue({
  39. el: '#app',
  40. delimiters: ['${', '}'],
  41. data: {
  42. schedules: []
  43. },
  44. mounted: function() {
  45. this.getSchedules();
  46. },
  47. computed: {
  48. },
  49. methods: {
  50. getSchedules: function() {
  51. self = this;
  52. var data = axios.get('/api/schedules').then(function(response) {
  53. var schedules = [];
  54. _.forEach(response.data.schedules || {}, function(value, key) {
  55. value.id = key;
  56. schedules.push(value);
  57. });
  58. self.schedules = schedules;
  59. });
  60. }
  61. }
  62. });
  63. </script>
  64. <style>
  65. body {
  66. background-color: white;
  67. padding: 6px;
  68. }
  69. .md-table {
  70. height: 80%;
  71. }
  72. </style>
  73. {% end %}