on 2017 Oct 09 11:24 AM
Good day!
Would be nice with some help locating any potential errors, as i have clearly misunderstood something or gone blind to my own code.
I am trying to register a new decorator in the Hybris 6.5 smartedit, but no cigar. The following steps have been taken:
Installed Smartedit including its dependencies
Tested out of the box extensions, and everything seems to work as intended.
Created a custom extension following the guide here: https://help.hybris.com/6.5.0/hcd/6d55d5fba206425b9acecda9f2311483.html
Uncommented and imported the project data.
Tested the new extension. Data loads fine, no console errors. The AB analytics toolbar item and perspective loads, but not the component decorators. All tests are green.
Created a new sample component following this guide: https://help.hybris.com/6.5.0/hcd/7cebd4f5dc2a430fbe878f88baf2bd9c.html
Fixed the few bugs and simplified the code a bit. Ran grunt through "ant build", passes build.
Checked that it loads correctly through chrome console. No apparent errors.
Played around with mappings, tried static component names as well as different regex and restrict combinations. Ran grunt every time code was updated.
Here is the code:
.../web/features/mysmarteditmodule/sampleDecorator/sampleDecorator.js:
angular.module('sampleDecoratorModule', ['mysmarteditmoduleTemplates'])
.directive('sampleDecorator', function() {
return {
templateUrl: 'web/features/mysmarteditmodule/sampleDecorator/sampleDecoratorTemplate.html',
restrict: 'C',
transclude: true,
replace: false,
scope: {
smarteditComponentId: '@',
smarteditComponentType: '@',
active: '='
},
link: function($scope) {
$scope.visible = false;
$scope.mouseleave = function() {
console.log("Mouse leave");
};
$scope.mouseenter = function() {
console.log("Mouse enter");
};
}
};
});
.../web/features/mysmarteditmodule/sampleDecorator/sampleDecoratorTemplate.html:
<div>
<div data-ng-mouseleave="mouseleave()" data-ng-if="active">
<div data-ng-mouseenter="mouseenter()">
<div data-ng-transclude></div>
<span id='decoratorText'>decorator wired</span>
</div>
</div>
<div data-ng-mouseleave="mouseleave()" data-ng-if="!active">
<div data-ng-transclude></div>
</div>
</div>
.../web/features/mysmarteditmodule/mysmarteditmodule.js:
angular.module('mysmarteditmodule', [
'decoratorServiceModule',
'sampleDecoratorModule'
])
.run(function(decoratorService) {
decoratorService.addMappings({
'*': ['sampleDecorator']
});
});
As you can see i removed the AB analytics module for simplification. So this decorator should print some text on mouse enter or leave on all components, which it does not.
Am i missing something here? Do i need to register it for a specific perspective? If so, the guide does not reflect this.
Request clarification before answering.
Better late than never. If the problem still exist try this:
angular.module('mysmarteditmodule', [
'sampleDecoratorModule',
'decoratorServiceModule'
])
.run(function(decoratorService) {
decoratorService.addMappings({
'*': ['sampleDecorator']
});
decoratorService.enable('sampleDecorator');
});
Would be great if you can respond if this work.
Beste regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.