diff options
author | Marvin Borner | 2018-05-23 22:23:28 +0200 |
---|---|---|
committer | Marvin Borner | 2018-05-23 22:23:28 +0200 |
commit | b66a61addb6c8e66cb26fcf74b532d68891267e4 (patch) | |
tree | 05e9449ff25bdc98f68105f41923ccb9f6ef5095 /main/app/sprinkles/admin/assets/userfrosting/js/widgets/roles.js | |
parent | 1d4ef435177a5f9b6d1a289800d933e49be0c550 (diff) |
Refactored code, many fixes and improvements in chat backend+frontend
Diffstat (limited to 'main/app/sprinkles/admin/assets/userfrosting/js/widgets/roles.js')
-rw-r--r-- | main/app/sprinkles/admin/assets/userfrosting/js/widgets/roles.js | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/main/app/sprinkles/admin/assets/userfrosting/js/widgets/roles.js b/main/app/sprinkles/admin/assets/userfrosting/js/widgets/roles.js index 0e32651..42b58ed 100644 --- a/main/app/sprinkles/admin/assets/userfrosting/js/widgets/roles.js +++ b/main/app/sprinkles/admin/assets/userfrosting/js/widgets/roles.js @@ -15,7 +15,7 @@ function attachRoleForm() { */ // Auto-generate slug - form.find('input[name=name]').on('input change', function() { + form.find('input[name=name]').on('input change', function () { var manualSlug = form.find('#form-role-slug-override').prop('checked'); if (!manualSlug) { var slug = getSlug($(this).val()); @@ -23,7 +23,7 @@ function attachRoleForm() { } }); - form.find('#form-role-slug-override').on('change', function() { + form.find('#form-role-slug-override').on('change', function () { if ($(this).prop('checked')) { form.find('input[name=slug]').prop('readonly', false); } else { @@ -35,7 +35,7 @@ function attachRoleForm() { // Set up the form for submission form.ufForm({ validators: page.validators - }).on("submitSuccess.ufForm", function() { + }).on("submitSuccess.ufForm", function () { // Reload page on success window.location.reload(); }); @@ -51,7 +51,7 @@ function bindRoleButtons(el) { */ // Manage permissions button - el.find('.js-role-permissions').click(function() { + el.find('.js-role-permissions').click(function () { var slug = $(this).data('slug'); $("body").ufModal({ sourceUrl: site.uri.public + "/modals/roles/permissions", @@ -70,26 +70,25 @@ function bindRoleButtons(el) { permissionWidget.ufCollection({ dropdown: { ajax: { - url : site.uri.public + '/api/permissions' + url: site.uri.public + '/api/permissions' }, - placeholder : "Select a permission" + placeholder: "Select a permission" }, dropdownTemplate: modal.find('#role-permissions-select-option').html(), - rowTemplate : modal.find('#role-permissions-row').html() + rowTemplate: modal.find('#role-permissions-row').html() }); // Get current roles and add to widget $.getJSON(site.uri.public + '/api/roles/r/' + slug + '/permissions') - .done(function (data) { - $.each(data.rows, function (idx, permission) { - permission.text = permission.name; - permissionWidget.ufCollection('addRow', permission); + .done(function (data) { + $.each(data.rows, function (idx, permission) { + permission.text = permission.name; + permissionWidget.ufCollection('addRow', permission); + }); }); - }); // Set up form for submission - form.ufForm({ - }).on("submitSuccess.ufForm", function() { + form.ufForm({}).on("submitSuccess.ufForm", function () { // Reload page on success window.location.reload(); }); @@ -100,7 +99,7 @@ function bindRoleButtons(el) { * Buttons that launch a modal dialog */ // Edit role details button - el.find('.js-role-edit').click(function() { + el.find('.js-role-edit').click(function () { $("body").ufModal({ sourceUrl: site.uri.public + "/modals/roles/edit", ajaxParams: { @@ -113,7 +112,7 @@ function bindRoleButtons(el) { }); // Delete role button - el.find('.js-role-delete').click(function() { + el.find('.js-role-delete').click(function () { $("body").ufModal({ sourceUrl: site.uri.public + "/modals/roles/confirm-delete", ajaxParams: { @@ -127,17 +126,17 @@ function bindRoleButtons(el) { var form = modal.find('.js-form'); form.ufForm() - .on("submitSuccess.ufForm", function() { - // Reload page on success - window.location.reload(); - }); + .on("submitSuccess.ufForm", function () { + // Reload page on success + window.location.reload(); + }); }); }); } function bindRoleCreationButton(el) { // Link create button - el.find('.js-role-create').click(function() { + el.find('.js-role-create').click(function () { $("body").ufModal({ sourceUrl: site.uri.public + "/modals/roles/create", msgTarget: $("#alerts-page") |