|
7 | 7 | cacheTemplates.$inject = ["$templateCache"]; |
8 | 8 |
|
9 | 9 | function cacheTemplates($templateCache) { |
10 | | - $templateCache.put("idp-item.html","<ion-item ng-class=getItemDirectionClasses()>{{idpLabel}} <button class=button ng-class=getInputButtonType() ng-click=showPopup()>{{prettyFormatDuration()}}</button></ion-item>"); |
| 10 | + $templateCache.put("idp-item.html","<ion-item ng-class=getItemClasses()><i ng-if=idpLabelIcon class=\"icon {{idpLabelIcon}}\"></i> {{idpLabel}} <button class=button ng-class=getInputButtonType() ng-click=showPopup()>{{prettyFormatDuration()}}</button></ion-item>"); |
11 | 11 |
|
12 | 12 | $templateCache.put("popup-minutes-seconds.html","<div class=row><span class=\"idp-control col col-offset-20 col-25\"><button type=button class=\"button button-clear button-small idp-control-arrow\" ng-click=\"increment(\'minutes\')\" on-hold=\"updateOnHold(\'minutes\', \'increment\')\" on-release=releaseHold()><i class=\"icon ion-chevron-up\"></i></button><div ng-bind=popupDuration.minutes class=idp-unit-box></div><button type=button class=\"button button-clear button-small idp-control-arrow\" ng-click=\"decrement(\'minutes\')\" on-hold=\"updateOnHold(\'minutes\', \'decrement\')\" on-release=releaseHold()><i class=\"icon ion-chevron-down\"></i></button></span> <label class=\"col col-10 idp-unit-separator\">:</label> <span class=\"idp-control col col-25\"><button type=button class=\"button button-clear button-small idp-control-arrow\" ng-click=\"increment(\'seconds\')\" on-hold=\"updateOnHold(\'seconds\', \'increment\')\" on-release=releaseHold()><i class=\"icon ion-chevron-up\"></i></button><div ng-bind=popupDuration.seconds class=idp-unit-box></div><button type=button class=\"button button-clear button-small idp-control-arrow\" ng-click=\"decrement(\'seconds\')\" on-hold=\"updateOnHold(\'seconds\', \'decrement\')\" on-release=releaseHold()><i class=\"icon ion-chevron-down\"></i></button></span></div>"); |
13 | 13 | } |
|
38 | 38 | scope: { |
39 | 39 | idpConfig: '=', |
40 | 40 | idpLabel: '@', |
| 41 | + idpLabelIcon: '@', |
41 | 42 | idpOutput: '=' |
42 | 43 | }, |
43 | 44 | link: linkFunc |
|
55 | 56 | if (typeof scope.idpLabel === 'undefined' || scope.idpLabel === null) { |
56 | 57 | scope.idpLabel = 'Duration'; |
57 | 58 | } |
| 59 | + if (typeof scope.idpLabelIcon === 'undefined' || scope.idpLabel === null) { |
| 60 | + scope.idpLabelIcon = false; |
| 61 | + } |
58 | 62 | if (typeof scope.idpOutput === 'undefined' || scope.idpOutput === null) { |
59 | 63 | scope.idpOutput = 0; |
60 | 64 | } |
|
77 | 81 | }; |
78 | 82 |
|
79 | 83 | scope.showPopup = _showPopup; |
80 | | - scope.getItemDirectionClasses = _getItemDirectionClasses; |
| 84 | + scope.getItemClasses = _getItemClasses; |
81 | 85 | scope.getInputButtonType = _getInputButtonType; |
82 | 86 | scope.increment = _increment; |
83 | 87 | scope.decrement = _decrement; |
|
159 | 163 | }); |
160 | 164 | } |
161 | 165 |
|
162 | | - function _getItemDirectionClasses() { |
| 166 | + function _getItemClasses() { |
| 167 | + var itemClasses = ''; |
| 168 | + |
| 169 | + // Don't forget a white-space after each appended class |
163 | 170 | if (config.rtl) { |
164 | | - return 'idp-dir-rtl item-button-left'; |
| 171 | + itemClasses += 'idp-dir-rtl item-button-left '; |
165 | 172 | } else { |
166 | | - return 'item-button-right'; |
| 173 | + itemClasses += 'item-button-right '; |
167 | 174 | } |
| 175 | + |
| 176 | + if (scope.idpLabelIcon && config.rtl) { |
| 177 | + itemClasses += 'item-icon-right '; |
| 178 | + } else if (scope.idpLabelIcon) { |
| 179 | + itemClasses += 'item-icon-left '; |
| 180 | + } |
| 181 | + |
| 182 | + return itemClasses; |
168 | 183 | } |
169 | 184 |
|
170 | 185 | function _getInputButtonType() { |
|
0 commit comments