cms/app-client/app/helpers/popularity.js
author ymh <ymh.work@gmail.com>
Wed, 08 Feb 2017 15:25:24 +0100
changeset 502 74fba571487e
parent 468 8fe093d88efe
permissions -rw-r--r--
Complete the notice display. add various fields to document to correctly display the notice. Correct bug #0025746

import Ember from 'ember';

export function popularity([target, minimum, maximum]) {
    var classname = ['not-popular', 'popular', 'very-popular'];
    var interval = ( maximum + 1 - minimum ) / classname.length;

    var i = Math.floor((target-minimum)/interval);

    return classname[i];
}

export default Ember.Helper.helper(popularity);