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

How do I extend GrowlNotifications? #153

Closed
farzher opened this issue Jul 20, 2014 · 6 comments
Closed

How do I extend GrowlNotifications? #153

farzher opened this issue Jul 20, 2014 · 6 comments

Comments

@farzher
Copy link

farzher commented Jul 20, 2014

You have iconType defined like this in the itemViewClass

iconType: (function() {
    var hash, type;
    type = this.get('content.type');
    hash = {
      'info': 'fa-bullhorn',
      'success': 'fa-check',
      'warning': 'fa-exclamation',
      'danger': 'fa-times'
    };
    return hash[type] || '';
  }).property('content.type')

How can I extend this with a basic piece of custom behavior?
I just want to change return hash[type] || ''; to return hash[type] || type; so I'm able to also pass in custom font awesome icons.

I'm stuck, I can't figure this out without hacking.

@rizkytahara
Copy link

+1

@asaf
Copy link
Collaborator

asaf commented Jul 23, 2014

Change and send a PR, I'll merge

@farzher
Copy link
Author

farzher commented Jul 23, 2014

Well, in this case I guess that change is good for everyone, but I was asking how can I extend edits for just my application, so I can have full control over my own app, but still receive updates from your library.

For example I also check type to see if it contains a /, if it does I render an img tag with type as the src, otherwise I render it as a font-awesome icon. Not all of my edits should be pushed to bootstrap-for-ember

@asaf
Copy link
Collaborator

asaf commented Jul 24, 2014

If a component is not extensible enough then you can extend the component
and override some of its methods to suite your needs.

On Wed, Jul 23, 2014 at 9:04 PM, Stephen Kamenar notifications@github.com
wrote:

Well, in this case I guess that change is good for everyone, but I was
asking how can I extend edits for just my application, so I can have full
control over my own app, but still receive updates from your library.

For example I also check type to see if it contains a /, if it does I
render an img tag with type as the src, otherwise I render it as a
font-awesome icon. Not all of my edits should be pushed to
bootstrap-for-ember


Reply to this email directly or view it on GitHub
#153 (comment)
.

@farzher
Copy link
Author

farzher commented Jul 24, 2014

Well, that's my question, how do I extend iconType method?

It's part of the itemViewClass, I'm not sure how to extend that. (Normal component methods are np)

@asaf
Copy link
Collaborator

asaf commented Aug 1, 2014

You can just do:
MyNotif = GrowlNotiComp.extend
overrideSomeMethod: ->
#your implementation here

Specifically regarding your need, this component is not really a 'bootstrap' one, im planning to push this into: https://github.com/indexiatech/ember-components

It will have more configuration than this one,

So track it, it will have the ability to configure icons easily.
indexiatech/ember-components#30

@asaf asaf closed this as completed Aug 1, 2014
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