2018-12-12 18:37:19 +00:00
|
|
|
/**
|
|
|
|
* @module referencePreview
|
|
|
|
*/
|
|
|
|
|
|
|
|
import { renderPopup } from '../popup/popup';
|
|
|
|
import { escapeHTML } from '../templateUtil';
|
|
|
|
|
2019-01-24 15:33:29 +00:00
|
|
|
const mw = mediaWiki;
|
|
|
|
|
2018-12-12 18:37:19 +00:00
|
|
|
/**
|
|
|
|
* @param {ext.popups.PreviewModel} model
|
|
|
|
* @return {string} HTML string.
|
|
|
|
*/
|
|
|
|
export function renderReferencePreview(
|
|
|
|
model
|
|
|
|
) {
|
2019-01-24 18:24:36 +00:00
|
|
|
const title = escapeHTML( model.title || mw.msg( 'popups-refpreview-footnote' ) ),
|
2019-01-28 07:54:49 +00:00
|
|
|
url = escapeHTML( model.url ),
|
2019-01-23 19:26:48 +00:00
|
|
|
linkMsg = escapeHTML( mw.msg( 'popups-refpreview-jump-to-reference' ) );
|
2018-12-12 18:37:19 +00:00
|
|
|
|
|
|
|
return renderPopup( model.type,
|
|
|
|
`
|
2019-01-24 18:24:36 +00:00
|
|
|
<strong class='mwe-popups-title'>${ title }</strong>
|
2018-12-12 18:37:19 +00:00
|
|
|
<div class='mwe-popups-extract'>
|
|
|
|
<span class='mwe-popups-message'>${ model.extract }</span>
|
|
|
|
</div>
|
|
|
|
<footer>
|
2019-01-28 07:54:49 +00:00
|
|
|
<a href='${ url }' class='mwe-popups-read-link'>${ linkMsg }</a>
|
2018-12-12 18:37:19 +00:00
|
|
|
</footer>
|
|
|
|
`
|
|
|
|
);
|
|
|
|
}
|