optimize 'hide help button' code

This commit is contained in:
Arpit Jalan 2017-06-19 22:20:09 +05:30
parent 2bf2d506bf
commit 34126eb9e0
3 changed files with 8 additions and 6 deletions

View File

@ -6,6 +6,7 @@ import computed from 'ember-addons/ember-computed-decorators';
export default Ember.Controller.extend(ModalFunctionality, {
offerHelp: null,
helpSeen: false,
@computed('accountEmailOrUsername', 'disabled')
submitDisabled(accountEmailOrUsername, disabled) {
@ -59,8 +60,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
},
help() {
this.set('offerHelp', I18n.t('forgot_password.help'));
$('.forgot-password-help-btn').hide();
this.setProperties({ offerHelp: I18n.t('forgot_password.help'), helpSeen: true });
}
}

View File

@ -94,7 +94,7 @@ const ApplicationRoute = Discourse.Route.extend(OpenComposer, {
showCreateAccount: unlessReadOnly('handleShowCreateAccount', I18n.t("read_only_mode.login_disabled")),
showForgotPassword() {
this.controllerFor('forgot-password').set('offerHelp', null);
this.controllerFor('forgot-password').setProperties({ offerHelp: null, helpSeen: false });
showModal('forgotPassword', { title: 'forgot_password.title' });
},

View File

@ -17,9 +17,11 @@
{{d-button class="btn-large btn-primary"
label="forgot_password.button_ok"
action="ok"}}
{{d-button class="btn-large forgot-password-help-btn"
label="forgot_password.button_help"
action="help"}}
{{#unless helpSeen}}
{{d-button class="btn-large"
label="forgot_password.button_help"
action="help"}}
{{/unless}}
{{/unless}}
</div>
</form>