duplicate-field.js
2 years ago
email-reports.js
2 years ago
notices.js
2 years ago
scroll-to-top.js
2 years ago
sticky-sidebar.js
2 years ago
support.js
2 years ago
user-roles.js
1 year ago
user-roles.js
35 lines
| 1 | const $ = jQuery; |
| 2 | |
| 3 | const UserRoles = { |
| 4 | setup: function() { |
| 5 | var self = this; |
| 6 | $('#capabilities-form').on('submit', function(e){ |
| 7 | e.preventDefault(); |
| 8 | self.save(); |
| 9 | }); |
| 10 | }, |
| 11 | save: function() { |
| 12 | $('#save-permissions').addClass('saving'); |
| 13 | var capabilities = {}; |
| 14 | |
| 15 | $('.role').each(function(){ |
| 16 | const role = $(this).find('select').attr('name') |
| 17 | const val = $(this).find('select').val() |
| 18 | capabilities[role] = val |
| 19 | }); |
| 20 | |
| 21 | var whiteLabel = $('#iawp_white_label').prop('checked'); |
| 22 | |
| 23 | const data = { |
| 24 | ...iawpActions.update_capabilities, |
| 25 | 'capabilities': capabilities, |
| 26 | 'white_label': whiteLabel, |
| 27 | }; |
| 28 | |
| 29 | jQuery.post(ajaxurl, data, function (response) { |
| 30 | $('#save-permissions').removeClass('saving'); |
| 31 | }); |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | export { UserRoles }; |