From 493451c77723a6540644000116cdc14002205f8f Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Tue, 28 Dec 2021 21:14:17 +0100 Subject: [PATCH] Remove legacy list CoffeeScript --- app/javascript/legacy/lists.coffee | 90 ------------------------------ app/javascript/packs/legacy.coffee | 1 - 2 files changed, 91 deletions(-) delete mode 100644 app/javascript/legacy/lists.coffee diff --git a/app/javascript/legacy/lists.coffee b/app/javascript/legacy/lists.coffee deleted file mode 100644 index 99376beb..00000000 --- a/app/javascript/legacy/lists.coffee +++ /dev/null @@ -1,90 +0,0 @@ -($ document).on "click", "input[type=checkbox][name=gm-list-check]", -> - box = $(this) - box.attr 'disabled', 'disabled' - - listName = box[0].dataset.list - - count = Number ($ "span##{listName}-members").html() - boxChecked = box[0].checked - - count += if boxChecked then 1 else -1 - - $.ajax - url: '/ajax/list_membership' - type: 'POST' - data: - user: box[0].dataset.user - list: listName - add: boxChecked - success: (data, status, jqxhr) -> - if data.success - box[0].checked = if data.checked? then data.checked else !boxChecked - ($ "span##{listName}-members").html(count) - showNotification data.message, data.success - error: (jqxhr, status, error) -> - box[0].checked = false - console.log jqxhr, status, error - showNotification translate('frontend.error.message'), false - complete: (jqxhr, status) -> - box.removeAttr "disabled" - - -$(document).on "keyup", "input#new-list-name", (evt) -> - if evt.which == 13 # return key - evt.preventDefault() - $("button#create-list").trigger 'click' - - -($ document).on "click", "button#create-list", -> - btn = $(this) - btn.button "loading" - input = ($ "input#new-list-name") - - $.ajax - url: '/ajax/create_list' - type: 'POST' - data: - name: input.val() - user: btn[0].dataset.user - dataType: 'json' - success: (data, status, jqxhr) -> - if data.success - ($ "#lists-list ul.list-group").append(data.render) - input.val '' - showNotification data.message, data.success - error: (jqxhr, status, error) -> - console.log jqxhr, status, error - showNotification translate('frontend.error.message'), false - complete: (jqxhr, status) -> - btn.button "reset" - - -($ document).on "click", "a#delete-list", (ev) -> - ev.preventDefault() - btn = $(this) - list = btn[0].dataset.list - - swal - title: translate('frontend.list.title') - text: translate('frontend.list.text') - type: "warning" - showCancelButton: true - confirmButtonColor: "#DD6B55" - confirmButtonText: translate('views.actions.delete') - cancelButtonText: translate('views.actions.cancel') - closeOnConfirm: true - , -> - $.ajax - url: '/ajax/destroy_list' - type: 'POST' - data: - list: list - dataType: 'json' - success: (data, status, jqxhr) -> - if data.success - ($ "li.list-group-item#list-#{list}").slideUp() - showNotification data.message, data.success - error: (jqxhr, status, error) -> - console.log jqxhr, status, error - showNotification translate('frontend.error.message'), false - complete: (jqxhr, status) -> diff --git a/app/javascript/packs/legacy.coffee b/app/javascript/packs/legacy.coffee index 14db464e..67db5f5e 100644 --- a/app/javascript/packs/legacy.coffee +++ b/app/javascript/packs/legacy.coffee @@ -25,7 +25,6 @@ import I18n from '../legacy/i18n' import '../legacy/answerbox' import '../legacy/questionbox' import '../legacy/inbox' -import '../legacy/lists' import '../legacy/memes' import '../legacy/notifications' import '../legacy/pagination'