Skip to content

Commit

Permalink
Merge pull request #323 from creative-commoners/pulls/5.0/ss4-updates
Browse files Browse the repository at this point in the history
FIX Update ownerBaseClass in WorkflowApplicable for SS4 and convert to vendor module
  • Loading branch information
NightJar authored Oct 27, 2017
2 parents f85cf3f + 8cad2d1 commit 21e795b
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 23 deletions.
8 changes: 3 additions & 5 deletions code/admin/AdvancedWorkflowAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,9 @@ protected function init()
{
parent::init();

$module = ModuleLoader::getModule('symbiote/silverstripe-advancedworkflow');

Requirements::add_i18n_javascript($module->getRelativeResourcePath('client/lang'));
Requirements::javascript($module->getRelativeResourcePath('client/dist/js/advancedworkflow.js'));
Requirements::css($module->getRelativeResourcePath('client/dist/styles/advancedworkflow.css'));
Requirements::add_i18n_javascript('symbiote/silverstripe-advancedworkflow:client/lang');
Requirements::javascript('symbiote/silverstripe-advancedworkflow:client/dist/js/advancedworkflow.js');
Requirements::css('symbiote/silverstripe-advancedworkflow:client/dist/styles/advancedworkflow.css');
}

/*
Expand Down
3 changes: 1 addition & 2 deletions code/extensions/AdvancedWorkflowExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ public function startworkflow($data, $form, $request)
*/
public function updateEditForm(Form $form)
{
$module = ModuleLoader::getModule('symbiote/silverstripe-advancedworkflow');
Requirements::javascript($module->getRelativeResourcePath('client/dist/js/advancedworkflow.js'));
Requirements::javascript('symbiote/silverstripe-advancedworkflow:client/dist/js/advancedworkflow.js');
$svc = singleton(WorkflowService::class);
$p = $form->getRecord();
$active = $svc->getWorkflowFor($p);
Expand Down
2 changes: 1 addition & 1 deletion code/extensions/WorkflowApplicable.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public function onAfterWrite()
public function WorkflowInstances()
{
return WorkflowInstance::get()->filter(array(
'TargetClass' => $this->ownerBaseClass,
'TargetClass' => $this->owner->baseClass(),
'TargetID' => $this->owner->ID
));
}
Expand Down
14 changes: 6 additions & 8 deletions code/extensions/WorkflowEmbargoExpiryExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,23 +93,21 @@ public function updateCMSFields(FieldList $fields)
// requirements
// ------------

$module = ModuleLoader::getModule('symbiote/silverstripe-advancedworkflow');

Requirements::add_i18n_javascript($module->getRelativeResourcePath('client/lang'));
Requirements::add_i18n_javascript('symbiote/silverstripe-advancedworkflow:client/lang');

// Add timepicker functionality
// @see /~https://github.com/trentrichardson/jQuery-Timepicker-Addon
Requirements::css(
$module->getRelativeResourcePath('thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.css')
'symbiote/silverstripe-advancedworkflow:thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.css'
);
Requirements::css($module->getRelativeResourcePath('client/dist/styles/advancedworkflow.css'));
Requirements::css('symbiote/silverstripe-advancedworkflow:client/dist/styles/advancedworkflow.css');
Requirements::javascript(
$module->getRelativeResourcePath('thirdparty/javascript/jquery-ui/timepicker/jquery-ui-sliderAccess.js')
'symbiote/silverstripe-advancedworkflow:thirdparty/javascript/jquery-ui/timepicker/jquery-ui-sliderAccess.js'
);
Requirements::javascript(
$module->getRelativeResourcePath('thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.js')
'symbiote/silverstripe-advancedworkflow:thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.js'
);
Requirements::javascript($module->getRelativeResourcePath('client/dist/js/advancedworkflow.js'));
Requirements::javascript('symbiote/silverstripe-advancedworkflow:client/dist/js/advancedworkflow.js');

// Fields
// ------
Expand Down
6 changes: 2 additions & 4 deletions code/formfields/WorkflowField.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,8 @@ public function getTemplate()

public function FieldHolder($properties = array())
{
$workflow = ModuleLoader::getModule('symbiote/silverstripe-advancedworkflow');

Requirements::javascript($workflow->getRelativeResourcePath('client/dist/js/advancedworkflow.js'));
Requirements::css($workflow->getRelativeResourcePath('client/dist/styles/advancedworkflow.css'));
Requirements::javascript('symbiote/silverstripe-advancedworkflow:client/dist/js/advancedworkflow.js');
Requirements::css('symbiote/silverstripe-advancedworkflow:client/dist/styles/advancedworkflow.css');

return $this->Field($properties);
}
Expand Down
10 changes: 7 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "symbiote/silverstripe-advancedworkflow",
"description": "Adds configurable workflow support to the CMS, with a GUI for creating custom workflow definitions.",
"type": "silverstripe-module",
"type": "silverstripe-vendormodule",
"keywords": ["silverstripe", "advancedworkflow", "workflow"],
"license": "BSD-3-Clause",
"authors": [
Expand All @@ -26,10 +26,14 @@
"squizlabs/php_codesniffer": "^3.0"
},
"extra": {
"installer-name": "advancedworkflow",
"branch-alias": {
"dev-master": "5.0.x-dev"
}
},
"expose": [
"client/dist",
"client/lang",
"images"
]
},
"suggest": {
"symbiote/silverstripe-queuedjobs": "Allow automated workflow transitions with queued system jobs"
Expand Down

0 comments on commit 21e795b

Please sign in to comment.