zotero-web-library
Version:
Web library from zotero.org
36 lines (30 loc) • 1.05 kB
JavaScript
;
var log = require('libzotero/lib/Log').Logger('zotero-web-library:feedLink');
var React = require('react');
var FeedLink = React.createClass({
displayName: 'FeedLink',
render: function render() {
var library = this.props.library;
var urlconfig = Zotero.ui.getItemsConfig(library);
var requestUrl = Zotero.ajax.apiRequestUrl(urlconfig) + Zotero.ajax.apiQueryString(urlconfig, false);
var feedUrl = requestUrl.replace(Zotero.config.baseApiUrl, Zotero.config.baseFeedUrl);
var newkeyurl = Zotero.url.requestReadApiKeyUrl(library.libraryType, library.libraryID, feedUrl);
var feedHref;
if (!Zotero.config.librarySettings.publish) {
feedHref = newkeyurl;
} else {
feedHref = feedUrl;
}
return React.createElement(
'p',
null,
React.createElement(
'a',
{ href: feedHref, type: 'application/atom+xml', rel: 'alternate', className: 'feed-link' },
React.createElement('span', { className: 'sprite-icon sprite-feed' }),
'Subscribe to this feed'
)
);
}
});
module.exports = FeedLink;