Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 87f4c67

Browse files
committed
Merge pull request #199 from appirio-tech/sup-2335-handle-color
add handle color in tc-site nav
2 parents cb157ab + c0a9161 commit 87f4c67

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

src/footer.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,23 @@ <h2>Comment Examples</h2>
175175
} else {
176176
photoLink = tcconfig.communityURL + '/i/m/nophoto_login.gif';
177177
}
178+
179+
var color = '';
180+
var ratings = data['ratingSummary'];
181+
if (ratings) {
182+
var maxRating = 0;
183+
for (var i = 0; i < ratings.length; i++) {
184+
if (maxRating < ratings[i]['rating']) {
185+
maxRating = ratings[i]['rating'];
186+
color = ratings[i]['colorStyle'].split(": ")[1];
187+
}
188+
}
189+
} else if (data['isPM'] == true) {
190+
color = '#FF9900';
191+
}
192+
178193
$timeout(function() {
194+
vm.handleStyle = { color: color };
179195
vm.photoURL = photoLink;
180196
});
181197
});

src/js/app/header/partials/header-nav.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<div class="menu-item-header">
2121
<a ng-href={{vm.profileLink}} class="profile-link-dropdown">
2222
<img ng-src="{{vm.photoURL}}" class="user-avatar"/>
23-
<span class="username">{{vm.userHandle}}</span>
23+
<span ng-style="vm.handleStyle" class="username">{{vm.userHandle}}</span>
2424
</a>
2525
</div>
2626
<a href="/settings/profile" class="btn-link btn-edit-profile show-small">EDIT</a>

wp/wp-content/themes/tcs-responsive/footer.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,23 @@ function _kms(u){
256256
} else {
257257
photoLink = tcconfig.communityURL + '/i/m/nophoto_login.gif';
258258
}
259+
260+
var color = '';
261+
var ratings = data['ratingSummary'];
262+
if (ratings) {
263+
var maxRating = 0;
264+
for (var i = 0; i < ratings.length; i++) {
265+
if (maxRating < ratings[i]['rating']) {
266+
maxRating = ratings[i]['rating'];
267+
color = ratings[i]['colorStyle'].split(": ")[1];
268+
}
269+
}
270+
} else if (data['isPM'] == true) {
271+
color = '#FF9900';
272+
}
273+
259274
$timeout(function() {
275+
vm.handleStyle = { color: color };
260276
vm.photoURL = photoLink;
261277
});
262278
});

0 commit comments

Comments
 (0)