|
@@ -121,6 +121,28 @@ export default class AttachmentList extends React.Component {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ renderNoAttachmentsMessage() {
|
|
|
|
|
+ const { refsContext } = this.props;
|
|
|
|
|
+
|
|
|
|
|
+ let message;
|
|
|
|
|
+
|
|
|
|
|
+ if (refsContext.prefix != null) {
|
|
|
|
|
+ message = `${refsContext.prefix} and descendant pages have no attachments`;
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ message = `${refsContext.pagePath} has no attachments`;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div className="text-muted">
|
|
|
|
|
+ <small>
|
|
|
|
|
+ <i className="fa fa-fw fa-info-circle" aria-hidden="true"></i>
|
|
|
|
|
+ {message}
|
|
|
|
|
+ </small>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
renderContents() {
|
|
renderContents() {
|
|
|
const { refsContext } = this.props;
|
|
const { refsContext } = this.props;
|
|
|
|
|
|
|
@@ -144,6 +166,11 @@ export default class AttachmentList extends React.Component {
|
|
|
if (this.state.isLoaded) {
|
|
if (this.state.isLoaded) {
|
|
|
const { attachments } = this.state;
|
|
const { attachments } = this.state;
|
|
|
|
|
|
|
|
|
|
+ // no attachments
|
|
|
|
|
+ if (attachments.length === 0) {
|
|
|
|
|
+ return this.renderNoAttachmentsMessage();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return (refsContext.isExtractImg)
|
|
return (refsContext.isExtractImg)
|
|
|
? <ExtractedAttachments attachments={attachments} refsContext={refsContext} />
|
|
? <ExtractedAttachments attachments={attachments} refsContext={refsContext} />
|
|
|
: attachments.map((attachment) => {
|
|
: attachments.map((attachment) => {
|