diff --git a/app/controllers/admin/badge_achievements_controller.rb b/app/controllers/admin/badge_achievements_controller.rb index 5fd001dca..798883293 100644 --- a/app/controllers/admin/badge_achievements_controller.rb +++ b/app/controllers/admin/badge_achievements_controller.rb @@ -15,11 +15,10 @@ module Admin @badge_achievement = BadgeAchievement.find(params[:id]) if @badge_achievement.destroy - flash[:success] = "Badge achievement has been deleted!" + render json: { message: "Badge achievement has been deleted!" }, status: :ok else - flash[:danger] = @badge_achievement.errors_as_sentence + render json: { error: "Something went wrong." }, status: :unprocessable_entity end - redirect_to admin_badge_achievements_path end def award diff --git a/app/javascript/admin/adminModal.js b/app/javascript/admin/adminModal.js index 4ff4f5cc4..d29a1a620 100644 --- a/app/javascript/admin/adminModal.js +++ b/app/javascript/admin/adminModal.js @@ -4,6 +4,8 @@ * @function adminModal * @param {Object} modalProps Properties of the Modal * @param {string} modalProps.title The title of the modal. + * @param {string} modalProps.controllerName The name of the controller activating the modal. + * @param {string} modalProps.closeModalFunction The name of the function that closes the modal. * @param {string} modalProps.body The modal's content. May use HTML tags for styling. * @param {string} modalProps.leftBtnText The text for the modal's left button. * @param {string} modalProps.leftBtnAction The function that fires when left button is clicked. @@ -16,6 +18,8 @@ */ export const adminModal = function ({ title, + controllerName, + closeModalFunction, body, leftBtnText, leftBtnAction, @@ -31,7 +35,7 @@ export const adminModal = function ({
${title}
-