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, { export default Ember.Controller.extend(ModalFunctionality, {
offerHelp: null, offerHelp: null,
helpSeen: false,
@computed('accountEmailOrUsername', 'disabled') @computed('accountEmailOrUsername', 'disabled')
submitDisabled(accountEmailOrUsername, disabled) { submitDisabled(accountEmailOrUsername, disabled) {
@ -59,8 +60,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
}, },
help() { help() {
this.set('offerHelp', I18n.t('forgot_password.help')); this.setProperties({ offerHelp: I18n.t('forgot_password.help'), helpSeen: true });
$('.forgot-password-help-btn').hide();
} }
} }

View File

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

View File

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