ref: master
plugins/work_assignment/public/javascripts/work_assignment.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
//= require_self //= require ./submission //= require ./submissions window.work_assignment = { t: function (key, options) { return I18n.t(key, $.extend(options, {scope: 'work_assignment_plugin'})) }, folder: { load: function () { this.loadButtons() this.table.load() }, loadButtons: function () { $(".view-author-versions").each(function(index, bt) { bt.onclick = function () { var folderId = this.getAttribute("data-folder-id"); var tr = $(".submission-from-"+folderId); tr.toggle() } }); }, table: { submissions: [], detail: { mount: function(index, row, detail) { var id = row._data.id var submissions = work_assignment.folder.table.submissions[parseInt(id)] var tag = $('<submissions>').get(0) $(detail).append(tag) riot.mount(tag, {submissions: submissions}) }, }, load: function () { $('#authors-submissions').bootstrapTable({ striped: true, toolbar: '#toolbar', search: true, detailView: true, onExpandRow: this.detail.mount, columns: [ {field: 'author', sortable: true}, {field: 'submissionDate', sortable: true}, {field: 'versions', sortable: false}, {field: 'actions', sortable: false}, ], }) $(document).ready(function () { $('[data-toggle="tooltip"]').tooltip() }) }, }, }, } |