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

Commit

Permalink
refactor(rating): moving default class names back to template
Browse files Browse the repository at this point in the history
  • Loading branch information
bekos authored and pkozlowski-opensource committed Aug 27, 2013
1 parent ff9d969 commit 87b4aa7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/rating/docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ Rating directive that will take care of visualising a star rating bar.
An optional expression called when user's mouse leaves the control altogether.

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

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

* `rating-states`
_(Defaults: null)_ :
Expand Down
4 changes: 2 additions & 2 deletions src/rating/rating.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ angular.module('ui.bootstrap.rating', [])

.constant('ratingConfig', {
max: 5,
stateOn: 'icon-star',
stateOff: 'icon-star-empty'
stateOn: null,
stateOff: null
})

.controller('RatingController', ['$scope', '$attrs', '$parse', 'ratingConfig', function($scope, $attrs, $parse, ratingConfig) {
Expand Down
2 changes: 1 addition & 1 deletion template/rating/rating.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<span ng-mouseleave="reset()">
<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>
<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>
</span>

0 comments on commit 87b4aa7

Please sign in to comment.