diff --git a/app/javascript/legacy/questionbox/all.coffee b/app/javascript/legacy/questionbox/all.coffee deleted file mode 100644 index 7e3160a0..00000000 --- a/app/javascript/legacy/questionbox/all.coffee +++ /dev/null @@ -1,33 +0,0 @@ -$(document).on "click", "button[name=qb-all-ask]", -> - btn = $(this) - btn.button "loading" - $("textarea[name=qb-all-question]").attr "readonly", "readonly" - - $.ajax - url: '/ajax/ask' - type: 'POST' - data: - rcpt: 'followers' - question: $("textarea[name=qb-all-question]").val() - anonymousQuestion: false - success: (data, status, jqxhr) -> - if data.success - $("textarea[name=qb-all-question]").val '' - $('#modal-ask-followers').modal('hide') - 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" - $("textarea[name=qb-all-question]").removeAttr "readonly" - -# hotkey for accessing this quickly -$(document).on "keydown", (evt) -> - if evt.keyCode == 77 and (evt.ctrlKey or evt.metaKey) - $('.btn[name=toggle-all-ask]').trigger 'click' - -# see GitHub issue #2 -($ document).on "keydown", "textarea[name=qb-all-question]", (evt) -> - if evt.keyCode == 13 and (evt.ctrlKey or evt.metaKey) - ($ "button[name=qb-all-ask]").trigger 'click' diff --git a/app/javascript/legacy/questionbox/destroy.coffee b/app/javascript/legacy/questionbox/destroy.coffee deleted file mode 100644 index f0188575..00000000 --- a/app/javascript/legacy/questionbox/destroy.coffee +++ /dev/null @@ -1,30 +0,0 @@ -$(document).on "click", "a[data-action=ab-question-destroy]", (ev) -> - ev.preventDefault() - btn = $(this) - qid = btn[0].dataset.qId - swal - title: translate('frontend.destroy_own.confirm.title') - text: translate('frontend.destroy_own.confirm.text') - type: "warning" - showCancelButton: true - confirmButtonColor: "#DD6B55" - confirmButtonText: translate('views.actions.y') - cancelButtonText: translate('views.actions.n') - closeOnConfirm: true - , -> - $.ajax - url: '/ajax/destroy_question' # TODO: find a way to use rake routes instead of hardcoding them here - type: 'POST' - data: - question: qid - success: (data, status, jqxhr) -> - if data.success - if btn[0].dataset.redirect != undefined - window.location.pathname = btn[0].dataset.redirect - else - $("div.answerbox[data-q-id=#{qid}], div.questionbox[data-id=#{qid}]").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/legacy/questionbox/index.coffee b/app/javascript/legacy/questionbox/index.coffee deleted file mode 100644 index ad4fdc55..00000000 --- a/app/javascript/legacy/questionbox/index.coffee +++ /dev/null @@ -1,4 +0,0 @@ -import './all' -import './destroy' -import './report' -import './user' \ No newline at end of file diff --git a/app/javascript/legacy/questionbox/report.coffee b/app/javascript/legacy/questionbox/report.coffee deleted file mode 100644 index a1ab32de..00000000 --- a/app/javascript/legacy/questionbox/report.coffee +++ /dev/null @@ -1,5 +0,0 @@ -$(document).on "click", "a[data-action=ab-question-report]", (ev) -> - ev.preventDefault() - btn = $(this) - qId = btn[0].dataset.qId - reportDialog "question", qId, -> btn.button "reset" diff --git a/app/javascript/legacy/questionbox/user.coffee b/app/javascript/legacy/questionbox/user.coffee deleted file mode 100644 index 507372f5..00000000 --- a/app/javascript/legacy/questionbox/user.coffee +++ /dev/null @@ -1,41 +0,0 @@ -$(document).on "click", "button[name=qb-ask]", -> - btn = $(this) - btn.button "loading" - promote = btn[0].dataset.promote == "true" - $("textarea[name=qb-question]").attr "readonly", "readonly" - anonymousQuestion = if $("input[name=qb-anonymous]")[0] != undefined - $("input[name=qb-anonymous]")[0].checked - else - true - $.ajax - url: '/ajax/ask' # TODO: find a way to use rake routes instead of hardcoding them here - type: 'POST' - data: - rcpt: $("input[name=qb-to]").val() - question: $("textarea[name=qb-question]").val() - anonymousQuestion: anonymousQuestion - success: (data, status, jqxhr) -> - if data.success - $("textarea[name=qb-question]").val '' - if promote - $("div#question-box").hide() - $("div#question-box-promote").show() - 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" - $("textarea[name=qb-question]").removeAttr "readonly" - - -# for that promotional thing -$(document).on "click", "button#new-question", -> - $("div#question-box").show() - $("div#question-box-promote").hide() - - -# see GitHub issue #2 -($ document).on "keydown", "textarea[name=qb-question]", (evt) -> - if evt.keyCode == 13 and evt.ctrlKey - ($ "button[name=qb-ask]").trigger 'click' diff --git a/app/javascript/packs/legacy.coffee b/app/javascript/packs/legacy.coffee index bd7aa038..426c6ce0 100644 --- a/app/javascript/packs/legacy.coffee +++ b/app/javascript/packs/legacy.coffee @@ -23,7 +23,6 @@ require('jquery-minicolors/jquery.minicolors.css') import I18n from '../legacy/i18n' import '../legacy/answerbox' -import '../legacy/questionbox' import '../legacy/memes' import '../legacy/notifications' import '../legacy/pagination'