Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit 87b4aa7

Browse files
bekospkozlowski-opensource
authored andcommitted
refactor(rating): moving default class names back to template
1 parent ff9d969 commit 87b4aa7

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/rating/docs/readme.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ Rating directive that will take care of visualising a star rating bar.
2525
An optional expression called when user's mouse leaves the control altogether.
2626

2727
* `state-on`
28-
_(Defaults: 'icon-star')_ :
29-
A variable used in default template to specify the class for selected icons.
28+
_(Defaults: null)_ :
29+
A variable used in template to specify the state (class, src, etc) for selected icons.
3030

3131
* `state-off`
32-
_(Defaults: 'icon-star-empty')_ :
33-
A variable used in default template to specify the class for unselected icons.
32+
_(Defaults: null)_ :
33+
A variable used in template to specify the state for unselected icons.
3434

3535
* `rating-states`
3636
_(Defaults: null)_ :

src/rating/rating.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ angular.module('ui.bootstrap.rating', [])
22

33
.constant('ratingConfig', {
44
max: 5,
5-
stateOn: 'icon-star',
6-
stateOff: 'icon-star-empty'
5+
stateOn: null,
6+
stateOff: null
77
})
88

99
.controller('RatingController', ['$scope', '$attrs', '$parse', 'ratingConfig', function($scope, $attrs, $parse, ratingConfig) {

template/rating/rating.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<span ng-mouseleave="reset()">
2-
<i ng-repeat="r in range" ng-mouseenter="enter($index + 1)" ng-click="rate($index + 1)" ng-class="$index < val && r.stateOn || r.stateOff"></i>
2+
<i ng-repeat="r in range" ng-mouseenter="enter($index + 1)" ng-click="rate($index + 1)" ng-class="$index < val && (r.stateOn || 'icon-star') || (r.stateOff || 'icon-star-empty')"></i>
33
</span>

0 commit comments

Comments
 (0)