Created
August 26, 2015 12:53
-
-
Save thirdknife/c1205815713b586c619f to your computer and use it in GitHub Desktop.
Riot JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <my-communities> | |
| <h1 class="caddy__heading"> | |
| <a href="#"> | |
| Communities | |
| </a> | |
| <a href="javascript:;" class="minimise-community-list-parent"> | |
| <i class="minimise-community-list"></i> | |
| </a> | |
| </h1> | |
| <ul class="caddy__list user-communities-list"> | |
| <li each={ communities } class="caddy__list-item { isSelected() } l-cols l-center-start"> | |
| <img class="facepic facepic--small" style="margin-right: 0.4em;" src="{ avatarUrl() }"/> | |
| <a href="{ community.slug }"> | |
| <span class="txt-capitalize">{ community.name }</span> | |
| </a> | |
| </li> | |
| </ul> | |
| <script> | |
| this.communities = _.map(opts.communities, function(community) { | |
| var communityFn = function(fn) { return _.bind(fn, community) } | |
| community.avatarUrl = communityFn(function() { | |
| return Socialite.util.url.avatar(this.community.avatar); | |
| }); | |
| community.isSelected = communityFn(function() { | |
| return this.community.slug == window.location.href.substr(window.location.href.lastIndexOf('/') + 1) ? 'is-selected' : ''; | |
| }); | |
| return community; | |
| }); | |
| </script> | |
| </my-communities> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment