index.html 2.3 KB

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