history.html 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. {% extends "base.html" %}
  2. {% block body %}
  3. <div id="app">
  4. <div class="md-layout">
  5. <div class="md-layout-item" md-card>
  6. <md-table id="history-table" v-model="history">
  7. <md-table-toolbar>
  8. <h1 class="md-title">History</h1>
  9. </md-table-toolbar>
  10. <md-table-row slot="md-table-row" slot-scope="{item}">
  11. <md-table-cell>
  12. (<a :href="'/diff.html?id=' + id + '&oldid=' + item.id + '&diff=' + lastid">cur</a> | <a :href="'/diff.html?id=' + id + '&diff=' + item.id">prev</a>)
  13. <md-radio name="oldid" v-model="oldid" :value="item.id" v-if="item.seq > 1" :seq="item.seq"></md-radio><span id="placeholder" v-if="item.seq == 1"> ---- </span>
  14. <md-radio name="diff" v-model="diff" :value="item.id" :seq="item.seq"></md-radio>
  15. </md-table-cell>
  16. <md-table-cell md-label="commit ID" md-sort-by="id">${ item.id }</md-table-cell>
  17. <md-table-cell md-label="message" md-sort-by="message">${ item.message }</md-table-cell>
  18. </md-table-row>
  19. </md-table>
  20. </div>
  21. </div>
  22. </div>
  23. <script>
  24. Vue.use(VueMaterial.default);
  25. var app = new Vue({
  26. el: '#app',
  27. delimiters: ['${', '}'],
  28. data: {
  29. history: [],
  30. oldid: null,
  31. diff: null,
  32. lasstid: null,
  33. {% if isinstance(id, str) %}
  34. id: "{{id}}",
  35. {% else %}
  36. id: null,
  37. {% end %}
  38. },
  39. mounted: function() {
  40. this.getHistory();
  41. },
  42. methods: {
  43. getHistory: function() {
  44. self = this;
  45. var data = axios.get('/api/history/' + this.id).then(function(response) {
  46. console.log(response);
  47. self.history = response.data.history;
  48. self.lastid = response.data.lastid;
  49. });
  50. }
  51. }
  52. });
  53. </script>
  54. <style>
  55. body {
  56. background-color: white;
  57. }
  58. .md-table {
  59. width: 60%;
  60. min-height: 800px;
  61. max-height: 800px;
  62. }
  63. </style>
  64. {% end %}