diff --git a/app/templates/editor/modal/confirm-modal.jade b/app/templates/editor/modal/confirm-modal.jade index bd8cc708c..58f016311 100644 --- a/app/templates/editor/modal/confirm-modal.jade +++ b/app/templates/editor/modal/confirm-modal.jade @@ -1,11 +1,11 @@ extends /templates/core/modal-base block modal-header-content - h3 #{confirmTitle} + h3= view.title block modal-body-content - p #{confirmBody} + p= view.body block modal-footer-content - button.btn.btn-secondary#decline-button(type="button", data-dismiss="modal") #{confirmDecline} - button.btn.btn-primary#confirm-button(type="button", data-dismiss=closeOnConfirm === true ? "modal" : undefined) #{confirmConfirm} + button.btn.btn-secondary#decline-button(type="button", data-dismiss="modal")= view.decline + button.btn.btn-primary#confirm-button(type="button", data-dismiss=closeOnConfirm === true ? "modal" : undefined)= view.confirm diff --git a/app/views/account/AccountSettingsView.coffee b/app/views/account/AccountSettingsView.coffee index d13ec39c5..d6a1a6eca 100644 --- a/app/views/account/AccountSettingsView.coffee +++ b/app/views/account/AccountSettingsView.coffee @@ -64,10 +64,10 @@ module.exports = class AccountSettingsView extends CocoView onClickDeleteAccountButton: (e) -> @validateCredentialsForDestruction @$el.find('#delete-account-form'), => renderData = - confirmTitle: 'Are you really sure?' - confirmBody: 'This will completely delete your account. This action CANNOT be undone. Are you entirely sure?' - confirmDecline: 'Cancel' - confirmConfirm: 'DELETE Your Account' + title: 'Are you really sure?' + body: 'This will completely delete your account. This action CANNOT be undone. Are you entirely sure?' + decline: 'Cancel' + confirm: 'DELETE Your Account' confirmModal = new ConfirmModal renderData confirmModal.on 'confirm', @deleteAccount @openModalView confirmModal @@ -75,10 +75,10 @@ module.exports = class AccountSettingsView extends CocoView onClickResetProgressButton: -> @validateCredentialsForDestruction @$el.find('#reset-progress-form'), => renderData = - confirmTitle: 'Are you really sure?' - confirmBody: 'This will completely erase your progress: code, levels, achievements, earned gems, and course work. This action CANNOT be undone. Are you entirely sure?' - confirmDecline: 'Cancel' - confirmConfirm: 'Erase ALL Progress' + title: 'Are you really sure?' + body: 'This will completely erase your progress: code, levels, achievements, earned gems, and course work. This action CANNOT be undone. Are you entirely sure?' + decline: 'Cancel' + confirm: 'Erase ALL Progress' confirmModal = new ConfirmModal renderData confirmModal.on 'confirm', @resetProgress @openModalView confirmModal diff --git a/app/views/editor/achievement/AchievementEditView.coffee b/app/views/editor/achievement/AchievementEditView.coffee index e39cceaa4..b84ef46d2 100644 --- a/app/views/editor/achievement/AchievementEditView.coffee +++ b/app/views/editor/achievement/AchievementEditView.coffee @@ -85,10 +85,10 @@ module.exports = class AchievementEditView extends RootView confirmRecalculation: (e, all=false) -> renderData = - 'confirmTitle': 'Are you really sure?' - 'confirmBody': "This will trigger recalculation of #{if all then 'all achievements' else 'the achievement'} for all users. Are you really sure you want to go down this path?" - 'confirmDecline': 'Not really' - 'confirmConfirm': 'Definitely' + title: 'Are you really sure?' + body: "This will trigger recalculation of #{if all then 'all achievements' else 'the achievement'} for all users. Are you really sure you want to go down this path?" + decline: 'Not really' + confirm: 'Definitely' confirmModal = new ConfirmModal renderData confirmModal.on 'confirm', @recalculateAchievement @@ -100,10 +100,10 @@ module.exports = class AchievementEditView extends RootView confirmDeletion: -> renderData = - 'confirmTitle': 'Are you really sure?' - 'confirmBody': 'This will completely delete the achievement, potentially breaking a lot of stuff you don\'t want breaking. Are you entirely sure?' - 'confirmDecline': 'Not really' - 'confirmConfirm': 'Definitely' + title: 'Are you really sure?' + body: 'This will completely delete the achievement, potentially breaking a lot of stuff you don\'t want breaking. Are you entirely sure?' + decline: 'Not really' + confirm: 'Definitely' confirmModal = new ConfirmModal renderData confirmModal.on 'confirm', @deleteAchievement diff --git a/app/views/editor/modal/ConfirmModal.coffee b/app/views/editor/modal/ConfirmModal.coffee index 8017aec21..9812a0801 100644 --- a/app/views/editor/modal/ConfirmModal.coffee +++ b/app/views/editor/modal/ConfirmModal.coffee @@ -8,19 +8,12 @@ module.exports = class ConfirmModal extends ModalView closeOnConfirm: true events: - 'click #decline-button': 'onDecline' - 'click #confirm-button': 'onConfirm' + 'click #decline-button': 'onClickDecline' + 'click #confirm-button': 'onClickConfirm' - constructor: (@renderData={}, options={}) -> - super(options) + initialize: (options) -> + _.assign @, _.pick(options, 'title', 'body', 'decline', 'confirm', 'closeOnConfirm', 'closeButton') - getRenderData: -> - context = super() - context.closeOnConfirm = @closeOnConfirm - _.extend context, @renderData + onClickDecline: -> @trigger 'decline' - setRenderData: (@renderData) -> - - onDecline: -> @trigger 'decline' - - onConfirm: -> @trigger 'confirm' + onClickConfirm: -> @trigger 'confirm' diff --git a/app/views/editor/poll/PollEditView.coffee b/app/views/editor/poll/PollEditView.coffee index 5489a6a0d..d1972b299 100644 --- a/app/views/editor/poll/PollEditView.coffee +++ b/app/views/editor/poll/PollEditView.coffee @@ -98,10 +98,10 @@ module.exports = class PollEditView extends RootView confirmDeletion: -> renderData = - 'confirmTitle': 'Are you really sure?' - 'confirmBody': 'This will completely delete the poll, potentially breaking a lot of stuff you don\'t want breaking. Are you entirely sure?' - 'confirmDecline': 'Not really' - 'confirmConfirm': 'Definitely' + title: 'Are you really sure?' + body: 'This will completely delete the poll, potentially breaking a lot of stuff you don\'t want breaking. Are you entirely sure?' + decline: 'Not really' + confirm: 'Definitely' confirmModal = new ConfirmModal renderData confirmModal.on 'confirm', @deletePoll