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

extendedTimeout, doesn't apply exiting class to component. #117

Open
alexanderjeurissen opened this issue Nov 4, 2015 · 5 comments
Open

Comments

@alexanderjeurissen
Copy link

I'm in the process of migrating to ember-cli, using ember-cli-rails.

I wrote two components, one flash-queue which renders a flash-message component for each flash message object.

Those components work as expected and flash messages are shown. The source code of my two components and there templates can be seen below.

flash-queue component:

import Ember from 'ember';

export default Ember.Component.extend({
  classNames: ['FlashQueue']
});
<div>
  {{#each flashMessages.queue as |flash|}}
    {{flash-message flash=flash}}
  {{/each}}
</div>

flash-message component:

import Ember from 'ember';

export default Ember.Component.extend({
  classNames: ['flash-message'],
  classNameBindings: 'flashType',
  flashType: Ember.computed('flash', function() {
    return `is-${this.get('flash.type')}`;
  }),

  elementInserted: (function() {
    var $self = this.$("#message");
    $self.hide();
    $self.fadeIn(500);
  }).on('didInsertElement')
});
<div id="message">
  {{flash.message}}
</div>

Scss Styling:

We use Scss, and have some conditional styling of the background-color based on the presence of is-<type> class. as in is-error would apply a red background. below is a snippet of the styles applied to the flash-message component:

  #message {
    background-color: $color-notice;
    color: #fff;
    opacity: 1.0;
    font-size: 1em;
    line-height: 1.2em;
    padding: 1em;
    text-align: center;

    &.exiting {
      opacity: 0.0;
      transition: opacity .5s ease-in-out;
      -moz-transition: opacity .5s ease-in-out;
      -webkit-transition: opacity .5s ease-in-out;
    }
  }

config/environment.js

    flashMessageDefaults: {
      timeout: 3000,
      extendedTimeout: 1000,
      priority: 200,
      showProgress: true,
      type: 'info',
      types: ['info', 'error', 'success'],
      injectionFactories: ['route', 'component', 'controller']
    }

the fade in works (obviously) however when inspecting in the console the exiting class is never applied to the flash-message component.

@alexanderjeurissen
Copy link
Author

@poteto could you elaborate on this ?

@kmiyashiro
Copy link
Contributor

If you didn't extend flash-message from this add-on, you will have to add the exiting and active bindings to your flash-message component. https://github.com/poteto/ember-cli-flash/blob/develop/addon/components/flash-message.js#L22

It's also a little confusing that you named your component the exact same name as the component that this add-on provides.

@alexanderjeurissen
Copy link
Author

@kmiyashiro I didn't extend the flash-message component from the add-on, because i was unaware that was possible when i also want to override the ClassNames and ClassNameBindings the later being dependent on a computed property.

on top of that I also like to use my own template for the flash message component.

so if it's possible to extend the default component and have the above customizations then I'm more then happy to do so.

I agree that the naming is confusing as it is the same name as the component provided by the add-on.

@alexanderjeurissen
Copy link
Author

I guess the code would look something like this:

import flashComponent from 'ember-cli-flash/flash-message';

export default flashComponent.extend({
  classNames: ['flash-message'],
  classNameBindings: 'flashType',

  flashType: Ember.computed('flash', function() {
    return `is-${this.get('flash.type')}`;
  }),

  elementInserted: (function() {
    var $self = this.$("#message");
    $self.hide();
    $self.fadeIn(500);
  }).on('didInsertElement')
});

not sure if the import statement is correct.

homu added a commit that referenced this issue Jun 20, 2016
Update ember-cli-qunit to version 2.0.3 🚀

Hello lovely humans,

[ember-cli-qunit](https://www.npmjs.com/package/ember-cli-qunit) just published its new version 2.0.3.

<table>
  <tr>
    <th align=left>
      State
    </th>
    <td>
      Update 🚀
    </td>
  </tr>
  <tr>
    <th align=left>
      Dependency
    </td>
    <td>
      ember-cli-qunit
    </td>
  </tr>
  <tr>
    <th align=left>
      New version
    </td>
    <td>
      2.0.3
    </td>
  </tr>
  <tr>
    <th align=left>
      Type
    </td>
    <td>
      devDependency
    </td>
  </tr>
</table>

This version is **not covered** by your **current version range**.

Without accepting this pull request your project will work just like it did before. There might be a bunch of new features, fixes and perf improvements that the maintainers worked on for you though.

I recommend you look into these changes and try to get onto the latest version of ember-cli-qunit.
Given that you have a decent test suite, a passing build is a strong indicator that you can take advantage of these changes by merging the proposed change into your project. Otherwise this branch is a great starting point for you to work on the update.

Do you have any ideas how I could improve these pull requests? Did I report anything you think isn’t right?
Are you unsure about how things are supposed to work?

There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html) and while I’m just a bot, there is a group of people who are happy to teach me new things. [Let them know](https://github.com/greenkeeperio/greenkeeper/issues/new).

Good luck with your project ✨

You rock!

🌴

---
The new version differs by 18 commits .

- [`d7e9565`](ember-cli/ember-cli-qunit@d7e9565) <code>Release v2.0.3</code>
- [`82eb35f`](ember-cli/ember-cli-qunit@82eb35f) <code>Merge pull request #119 from trentmwillis/kill-bower</code>
- [`df449e2`](ember-cli/ember-cli-qunit@df449e2) <code>Remove ember-qunit-notifications and import qunit-notifications from NPM</code>
- [`9394629`](ember-cli/ember-cli-qunit@9394629) <code>release v2.0.2</code>
- [`2f695a4`](ember-cli/ember-cli-qunit@2f695a4) <code>Merge pull request #118 from ember-cli/call-super</code>
- [`45b80f6`](ember-cli/ember-cli-qunit@45b80f6) <code>support both supers</code>
- [`8e629a5`](ember-cli/ember-cli-qunit@8e629a5) <code>release v2.0.1</code>
- [`c088400`](ember-cli/ember-cli-qunit@c088400) <code>call super in init</code>
- [`d08c35a`](ember-cli/ember-cli-qunit@d08c35a) <code>Merge pull request #117 from trentmwillis/load-failure</code>
- [`7b45b1b`](ember-cli/ember-cli-qunit@7b45b1b) <code>Re-throw TestLoader failures during QUnit.done</code>
- [`a24fbc2`](ember-cli/ember-cli-qunit@a24fbc2) <code>Release v2.0.0.</code>
- [`e5378ba`](ember-cli/ember-cli-qunit@e5378ba) <code>Merge pull request #113 from trentmwillis/test-loader</code>
- [`115d56b`](ember-cli/ember-cli-qunit@115d56b) <code>Allow ember-cli-test-loader from NPM or Bower</code>
- [`865729c`](ember-cli/ember-cli-qunit@865729c) <code>Merge pull request #114 from Turbo87/extract-jshint</code>
- [`425a26e`](ember-cli/ember-cli-qunit@425a26e) <code>Remove JSHint lintTree</code>

There are 18 commits in total. See the [full diff](ember-cli/ember-cli-qunit@75c5c78...d7e9565).

---
This pull request was created by [greenkeeper.io](https://greenkeeper.io/).

<sub>Tired of seeing this sponsor message? ⚡ `greenkeeper upgrade`</sub>
@mrkongo
Copy link

mrkongo commented Sep 26, 2016

+1

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

No branches or pull requests

3 participants