From 4bb1863f5113e9a9d0a035c64484c2d9300e138e Mon Sep 17 00:00:00 2001 From: "James R. Griffin III" <1443986+jrgriffiniii@users.noreply.github.com> Date: Mon, 18 Nov 2024 10:58:11 -0600 Subject: [PATCH] Porting group management functionality into a first-order Class for import as a ES6 Module (#1986) --- .circleci/config.yml | 4 +- app/assets/config/manifest.js | 2 +- app/assets/javascripts/edit_group_utils.js | 138 ------------- app/javascript/entrypoints/application.js | 11 + .../entrypoints/edit_group_utils.js | 193 ++++++++++++++++++ app/views/groups/edit.html.erb | 1 - package.json | 3 + spec/system/group_edit_spec.rb | 4 +- 8 files changed, 211 insertions(+), 145 deletions(-) delete mode 100644 app/assets/javascripts/edit_group_utils.js create mode 100644 app/javascript/entrypoints/edit_group_utils.js diff --git a/.circleci/config.yml b/.circleci/config.yml index 22fca716e..45e540da0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -71,9 +71,7 @@ jobs: - install_dependencies - run: name: Run eslint - # Quote directory globs so not they are expanded by shell, - # and every file will be checked, regardless of extension. - command: yarn run eslint 'app/assets/javascripts/**' 'app/javascript/**' + command: yarn lint test: working_directory: *root diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index 55d219081..4dd78ed8d 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -1,4 +1,4 @@ //= link_tree ../images //= link_directory ../stylesheets .css //= link edit_work_utils.js -//= link edit_group_utils.js + diff --git a/app/assets/javascripts/edit_group_utils.js b/app/assets/javascripts/edit_group_utils.js deleted file mode 100644 index ffa8ed955..000000000 --- a/app/assets/javascripts/edit_group_utils.js +++ /dev/null @@ -1,138 +0,0 @@ -$(() => { - // Issues the HTTP DELETE to remove a user's access from a group - function deleteUserFromGroup(el, url, uid) { - $.ajax({ - type: 'DELETE', - url: url.replace('uid-placeholder', uid), - data: { authenticity_token: pdc.formAuthenticityToken }, - success() { - // Remove the
  • for the user - $(`.li-user-${uid}`).remove(); - }, - error(x) { - alert(x.responseJSON.message); - }, - }); - } - - // Adds the information for a given user to the lists of administrators/submitters - // for the group. - // `elList` is the reference to the