mirror of
https://github.com/silverstripe/silverstripe-dms
synced 2024-10-22 14:05:56 +02:00
ENHANCEMENT: Show list of documents when page is selected in dropdown
This commit is contained in:
parent
a6f8b83e1a
commit
be809ac2c9
@ -196,6 +196,23 @@ class DMSDocumentAddController extends LeftAndMain {
|
|||||||
|
|
||||||
return json_encode($return);
|
return json_encode($return);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function documentlist() {
|
||||||
|
$page = DataObject::get_by_id('SiteTree', (int) $_GET['pageID']);
|
||||||
|
if($page && $page->Documents()) {
|
||||||
|
$list = '<ul>';
|
||||||
|
|
||||||
|
foreach($page->Documents() as $document) {
|
||||||
|
$list .= '<li>' . $document->ID . ' - ' . Convert::raw2xml($document->Title) . '</li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$list .= '</ul>';
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
} else {
|
||||||
|
return '<p>There are no documents attached to the selected page.</p>';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,5 +40,11 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.document-add-existing input[name=PageSelector]').entwine({
|
||||||
|
onchange: function(event) {
|
||||||
|
$(this).closest('.document-add-existing').find('.document-list').load('admin/pages/adddocument/documentlist?pageID=' + $(this).val());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}(jQuery));
|
}(jQuery));
|
@ -12,6 +12,10 @@
|
|||||||
<span>or Add from page</span>
|
<span>or Add from page</span>
|
||||||
$fieldByName(PageSelector)
|
$fieldByName(PageSelector)
|
||||||
|
|
||||||
|
<div class="document-list">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ss-assetuploadfield">
|
<div class="ss-assetuploadfield">
|
||||||
|
Loading…
Reference in New Issue
Block a user