hummingbird-me/hummingbird

View on GitHub
frontend/app/components/awesome-rating.js

Summary

Maintainability
A
0 mins
Test Coverage
import Ember from 'ember';

export default Ember.Component.extend({
  classNames: ["awesome-rating-widget"],
  type: "advanced",
  editable: false,
  rating: null,
  media: null,

  applyAwesomeRating: function() {
    this.$().AwesomeRating({
      rating: this.get('rating'),
      type: this.get('type'),
      editable: this.get('editable'),
      update: (newRating) => {
        if (newRating === 0 || this.get('rating') === newRating) {
          newRating = null;
        }
        this.sendAction('action', newRating, this.get('media'));
      }
    });
  }.on('didInsertElement').observes('rating')
});