Skip to content

Commit c27427f

Browse files
author
Adam Bradley
committed
fix active class for list items and complex items, closes #498
1 parent a6a2906 commit c27427f

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

js/ext/angular/test/list.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ <h1 class="title">List Tests</h1>
109109
option-buttons="optionButtons1">
110110

111111
<!-- shows that the item directive does not need attributes and can get values from the list attributes -->
112-
<item item="item" class="item-message" ng-repeat="item in items">
112+
<item item="item" class="item-message" ng-repeat="item in items" ng-class="{ active: item.isActive}">
113113
<img ng-src="{{item.face}}">
114114
<h2>{{item.from}}</h2>
115115
<p>{{item.text}}</p>
@@ -153,7 +153,7 @@ <h2>Nic Cage</h2>
153153
<p>I am not a demon. I am a lizard, a shark, a heat-seeking panther. I want to be Bob Denver on acid playing the accordion.</p>
154154
</div>
155155

156-
<a class="item item-icon-left" href="{{ item.url }}" ng-repeat="item in urlItems">
156+
<a class="item item-icon-left" href="{{ item.url }}" ng-repeat="item in urlItems" ng-class="{ active: item.isActive}">
157157
<i class="icon {{ item.icon }}"></i>
158158
{{ item.text }}
159159
</a>
@@ -190,7 +190,7 @@ <h1>YELLOW {{slideBox.slideIndex}}</h1>
190190
$scope.items = [
191191
{ from: 'Ben', face: 'https://pbs.twimg.com/profile_images/378800000571933189/278e8e1b7871a115b95fc550cd07af40.png', text: 'Did you prepare?' },
192192
{ from: 'Adam', face: 'https://pbs.twimg.com/profile_images/2927292174/25b170ee2e3044fd936ad1319bc4b82d_bigger.jpeg', text: 'Don\'t forget to smile!' },
193-
{ from: 'Tim', face: 'https://pbs.twimg.com/profile_images/378800000290028838/ee3303b02223f25cb0f9b082b55b2eeb.jpeg', text: 'Bring some shirts!' }
193+
{ from: 'Tim', face: 'https://pbs.twimg.com/profile_images/378800000290028838/ee3303b02223f25cb0f9b082b55b2eeb.jpeg', text: 'Bring some shirts!', isActive: true }
194194
];
195195

196196

@@ -246,7 +246,7 @@ <h1>YELLOW {{slideBox.slideIndex}}</h1>
246246

247247
$scope.urlItems = [
248248
{ text: 'Biography', icon: 'ion-person', url: 'http://en.wikipedia.org/wiki/Nicolas_Cage' },
249-
{ text: 'Fan Club', icon: 'ion-star', url: 'http://cagealot.com/' }
249+
{ text: 'Fan Club', icon: 'ion-star', url: 'http://cagealot.com/', isActive: true }
250250
];
251251

252252
});

scss/_items.scss

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,12 @@
8989
}
9090

9191
// Link and Button Active States
92-
a.item, button.item {
92+
//a.item:active,
93+
//button.item:active
94+
95+
.item.active,
96+
.ionic-pseudo .item:active,
97+
.item-complex.active .item-content {
9398
@include item-active-style($item-default-active-bg, $item-default-active-border);
9499

95100
// Different active themes for <a> and <button> items

scss/_mixins.scss

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
}
8787
}
8888

89+
8990
// Item Mixins
9091
// --------------------------------------------------
9192

@@ -96,11 +97,8 @@
9697
}
9798

9899
@mixin item-active-style($active-bg-color, $active-border-color) {
99-
&.active,
100-
.ionic-pseudo &:active {
101-
background-color: $active-bg-color;
102-
border-color: $active-border-color;
103-
}
100+
background-color: $active-bg-color;
101+
border-color: $active-border-color;
104102
}
105103

106104

0 commit comments

Comments
 (0)