blob: 72f70966d932cbbcb43a716aef50e0ba33806e9d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import _ from 'underscore';
import React from 'react';
export default {
activeLink(url) {
return window.location.pathname.indexOf(window.baseUrl + url) === 0 ? 'active' : null;
},
renderLink(url, title, highlightUrl = url) {
let fullUrl = window.baseUrl + url;
let check = _.isFunction(highlightUrl) ? highlightUrl : this.activeLink;
return (
<li key={highlightUrl} className={check(highlightUrl)}>
<a href={fullUrl}>{title}</a>
</li>
);
},
renderNewLink(url, title, highlightUrl = url) {
let fullUrl = window.baseUrl + url;
let check = _.isFunction(highlightUrl) ? highlightUrl : this.activeLink;
return (
<li key={highlightUrl} className={check(highlightUrl)}>
<a href={fullUrl} className="nowrap">{title} <span className="spacer-left badge">New</span></a>
</li>
);
}
};
|