Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PaperSelect error message #1164

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

wukongrita
Copy link

@wukongrita wukongrita commented Sep 8, 2020

Hi @miguelcobain ,
This will add the error message to show on PaperSelect component ( issue #1158 )
So the error message will appear at the bottom of the PaperSelect, like so:
image

@miguelcobain
Copy link
Owner

Thank you, @wukongrita.
The problem with this is that it just renders the passed in errors.

You should use this.validationErrorMessages instead, that contains the manually passed in errors as well as other custom validation errors.
This was indeed a regression. Here is how it looked like before the refactor:
https://github.com/miguelcobain/ember-paper/blob/v1.0.0-beta.1/addon/templates/components/paper-select.hbs#L51-L67

Can you please update this PR?

@wukongrita
Copy link
Author

Something like adding:

.
.
.
    @noMatchesMessageComponent="paper-select/no-matches-message"
    @searchMessageComponent="paper-select/search-message"
    @onClose={{this.close}}
    @onOpen={{this.open}}
    @onFocus={{this.focus}}
    @onBlur={{this.blur}}
    as |opt term|>
    {{yield opt term}}
  </PowerSelect>

  {{#unless hideAllMessages}}
    <div class="md-errors-spacer">
      {{#if maxlength}}
        <div class="md-char-counter">{{renderCharCount}}</div>
      {{/if}}
    </div>
    {{#if isInvalidAndTouched}}
      <div class="md-input-messages-animation md-auto-hide" ng-messages>
        {{#each validationErrorMessages as |error index|}}
          <div id="error-{{inputElementId}}-{{index}}"
          class="paper-input-error ng-enter ng-enter-active" ng-message>
            {{error.message}}
          </div>
        {{/each}}
      </div>
    {{/if}}
  {{/unless}}

</md-input-container>

at the addon/components/paper-select/template.hbs ?

@wukongrita wukongrita force-pushed the fix-paper-select-error-message branch from 7209270 to dd42c15 Compare October 24, 2020 06:11
@wukongrita
Copy link
Author

Thank you, @wukongrita.
The problem with this is that it just renders the passed in errors.

You should use this.validationErrorMessages instead, that contains the manually passed in errors as well as other custom validation errors.
This was indeed a regression. Here is how it looked like before the refactor:
https://github.com/miguelcobain/ember-paper/blob/v1.0.0-beta.1/addon/templates/components/paper-select.hbs#L51-L67

Can you please update this PR?

@miguelcobain , is the updated PR ( dd42c15 ) is what you meant?

@wukongrita
Copy link
Author

@miguelcobain any other things that missing from the updated PR?

@wukongrita
Copy link
Author

@miguelcobain done, removed the charCount div section...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants