app/assets/javascripts/sufia/app.js in sufia-7.2.0 vs app/assets/javascripts/sufia/app.js in sufia-7.3.0.rc1

- old
+ new

@@ -7,17 +7,28 @@ this.saveWorkFixed(); this.popovers(); this.permissions(); this.notifications(); this.transfers(); - this.relationships_table(); - this.file_manager_init(); + this.relationshipsTable(); + this.fileManager(); + this.selectWorkType(); this.datatable(); + this.admin(); }, + admin: function() { + var AdminSetControls = require('sufia/admin/admin_set_controls'); + var controls = new AdminSetControls($('#admin-set-controls')); + }, + datatable: function () { - $('.datatable').DataTable(); + // This keeps the datatable from being added to a table that already has it. + // This is a problem when turbolinks is active. + if ($('.dataTables_wrapper').size() === 0) { + $('.datatable').DataTable(); + } }, autocomplete: function () { var ac = require('sufia/autocomplete'); var autocomplete = new ac.Autocomplete() @@ -48,12 +59,16 @@ }); }, permissions: function () { var perm = require('sufia/permissions/control'); + // On the edit work page new perm.PermissionsControl($("#share"), 'tmpl-work-grant'); + // On the edit fileset page new perm.PermissionsControl($("#permission"), 'tmpl-file-set-grant'); + // On the batch edit page + new perm.PermissionsControl($("#form_permissions"), 'tmpl-work-grant'); }, notifications: function () { var note = require('sufia/notifications'); $('[data-update-poll-url]').each(function () { @@ -65,17 +80,24 @@ transfers: function () { $("#proxy_deposit_request_transfer_to").userSearch(); }, - relationships_table: function () { + relationshipsTable: function () { var rel = require('sufia/relationships/table'); $('table.relationships-ajax-enabled').each(function () { new rel.RelationshipsTable($(this)); }); }, - file_manager_init: function () { + selectWorkType: function () { + var selectWork = require('sufia/select_work_type'); + $("[data-behavior=select-work]").each(function () { + new selectWork($(this)) + }); + }, + + fileManager: function () { var fm = require('curation_concerns/file_manager'); var file_manager = new fm }, };