Skip to content

Commit

Permalink
Merge pull request #13 from dachcom-digital/pimcore_10.5_ready
Browse files Browse the repository at this point in the history
Pimcore 10.5 ready
  • Loading branch information
solverat committed Feb 13, 2023
2 parents 265f200 + 01cdd1d commit cc0a906
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 60 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ This Bundle allows you to synchronise your job offers with various connectors li

| Release | Supported Pimcore Versions | Supported Symfony Versions | Release Date | Maintained | Branch |
|---------|----------------------------|----------------------------|--------------|----------------|------------|
| **2.x** | `10.1` - `10.5` | `5.4` | -- | Feature Branch | dev-master |
| **2.x** | `10.5` | `5.4` | -- | Feature Branch | dev-master |
| **1.x** | `6.0` - `6.9` | `3.4`, `^4.4` | 27.04.2020 | Unsupported | 1.x |


## Installation

```json
"require" : {
"dachcom-digital/jobs" : "~2.0.0",
"dachcom-digital/jobs" : "~2.1.0",
}
```

Expand Down
3 changes: 3 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Upgrade Notes

## 2.1.0
- [FEATURE] Pimcore 10.5 support only

## Migrating from Version 1.x to Version 2.0.0

### Global Changes
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
}
},
"require": {
"pimcore/pimcore": "^10.1",
"pimcore/pimcore": "^10.5",
"doctrine/orm": "^2.7"
},
"require-dev": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pimcore.object.tags.jobConnectorContext = Class.create(pimcore.object.tags.abstr
this.contextDefinitions = data.context_definitions;
this.connectors = data.connectors;
this.fieldConfig = fieldConfig;
this.eventDispatcherKey = pimcore.eventDispatcher.registerTarget(this.eventDispatcherKey, this);
document.addEventListener(pimcore.events.postSaveObject, this.postSaveObject.bind(this));
},

getGridColumnConfig: function (field) {
Expand Down Expand Up @@ -46,8 +46,8 @@ pimcore.object.tags.jobConnectorContext = Class.create(pimcore.object.tags.abstr

getLayoutEdit: function () {
this.component = this.getEditLayout();
this.component.on('destroy', function () {
pimcore.eventDispatcher.unregisterTarget(this.eventDispatcherKey);
this.component.on('destroy', function() {
document.removeEventListener(pimcore.events.postSaveObject, this.postSaveObject.bind(this));
}.bind(this));

return this.component;
Expand Down
76 changes: 22 additions & 54 deletions src/JobsBundle/Resources/public/js/plugin.js
Original file line number Diff line number Diff line change
@@ -1,59 +1,27 @@
pimcore.registerNS('pimcore.plugin.Jobs');

pimcore.plugin.Jobs = Class.create(pimcore.plugin.admin, {

getClassName: function () {
return 'pimcore.plugin.Jobs';
},

initialize: function () {
pimcore.plugin.broker.registerPlugin(this);

if (!String.prototype.format) {
String.prototype.format = function () {
var args = arguments;
return this.replace(/{(\d+)}/g, function (match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match
;
});
};
}
},

uninstall: function () {
// void
},

pimcoreReady: function (params, broker) {

var jobsMenu, user = pimcore.globalmanager.get('user');

if (!user.isAllowed('jobs_permission_settings')) {
return false;
}

jobsMenu = new Ext.Action({
id: 'jobs_bundle_setting_button',
text: t('jobs.settings.configuration'),
iconCls: 'jobs_icon_bundle',
handler: this.openSettingsPanel.bind(this)
});
document.addEventListener(pimcore.events.pimcoreReady, (e) => {

var user = pimcore.globalmanager.get('user'),
openSettings = function (config) {
try {
pimcore.globalmanager.get('jobs_bundle_settings').activate();
} catch (e) {
pimcore.globalmanager.add('jobs_bundle_settings', new Jobs.SettingsPanel(config));
}
};

if (!user.isAllowed('jobs_permission_settings')) {
return false;
}

if (layoutToolbar.settingsMenu) {
layoutToolbar.settingsMenu.add(jobsMenu);
}
},
jobsMenu = new Ext.Action({
id: 'jobs_bundle_setting_button',
text: t('jobs.settings.configuration'),
iconCls: 'jobs_icon_bundle',
handler: openSettings.bind(this)
});

openSettingsPanel: function () {
try {
pimcore.globalmanager.get('jobs_bundle_settings').activate();
} catch (e) {
pimcore.globalmanager.add('jobs_bundle_settings', new Jobs.SettingsPanel());
}
if (layoutToolbar.settingsMenu) {
layoutToolbar.settingsMenu.add(jobsMenu);
}

});

new pimcore.plugin.Jobs();

0 comments on commit cc0a906

Please sign in to comment.