FIX Use ModuleLoader for requirements, and use path resolver for thirdparty dir

This commit is contained in:
Robbie Averill 2017-09-13 13:37:13 +12:00
parent 31bcd0d439
commit 4e7792a132
2 changed files with 7 additions and 4 deletions

View File

@ -8,6 +8,7 @@ use SilverStripe\ContentReview\Jobs\ContentReviewNotificationJob;
use SilverStripe\ContentReview\Models\ContentReviewLog; use SilverStripe\ContentReview\Models\ContentReviewLog;
use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Injector\Injector;
use SilverStripe\Core\Manifest\ModuleLoader;
use SilverStripe\Forms\FieldList; use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\LiteralField; use SilverStripe\Forms\LiteralField;
use SilverStripe\Forms\FormAction; use SilverStripe\Forms\FormAction;
@ -165,8 +166,9 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
return; return;
} }
Requirements::css('silverstripe/contentreview:client/dist/styles/contentreview.css'); $module = ModuleLoader::getModule('silverstripe/contentreview');
Requirements::javascript('silverstripe/contentreview:client/dist/js/contentreview.js'); Requirements::css($module->getRelativeResourcePath('client/dist/styles/contentreview.css'));
Requirements::javascript($module->getRelativeResourcePath('client/dist/js/contentreview.js'));
$reviewTab = LiteralField::create('ContentReviewButton', $this->owner->renderWith(__CLASS__ . '_button')); $reviewTab = LiteralField::create('ContentReviewButton', $this->owner->renderWith(__CLASS__ . '_button'));
$actions->insertAfter('MajorActions', $reviewTab); $actions->insertAfter('MajorActions', $reviewTab);
@ -327,7 +329,8 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
*/ */
public function updateSettingsFields(FieldList $fields) public function updateSettingsFields(FieldList $fields)
{ {
Requirements::javascript("silverstripe/contentreview:client/dist/js/contentreview.js"); $module = ModuleLoader::getModule('silverstripe/contentreview');
Requirements::javascript($module->getRelativeResourcePath('client/dist/js/contentreview.js'));
// Display read-only version only // Display read-only version only
if (!Permission::check("EDIT_CONTENT_REVIEW_FIELDS")) { if (!Permission::check("EDIT_CONTENT_REVIEW_FIELDS")) {

View File

@ -13,11 +13,11 @@ const {
const ENV = process.env.NODE_ENV; const ENV = process.env.NODE_ENV;
const PATHS = { const PATHS = {
MODULES: 'node_modules', MODULES: 'node_modules',
THIRDPARTY: 'thirdparty',
FILES_PATH: '../', FILES_PATH: '../',
ROOT: Path.resolve(), ROOT: Path.resolve(),
SRC: Path.resolve('client/src'), SRC: Path.resolve('client/src'),
DIST: Path.resolve('client/dist'), DIST: Path.resolve('client/dist'),
THIRDPARTY: Path.resolve('thirdparty'),
}; };
const config = [ const config = [