Ariel Weinberger pushed to branch feature/CC-CHANNELMGR-1634 at cms-community / hippo-addon-channel-manager
Commits: 5876a406 by Ariel Weinberger at 2017-12-29T12:55:26+01:00 CHANNELMGR-1634 Convert error handling for document type field in controller - - - - - 66d64774 by Ariel Weinberger at 2017-12-29T12:56:54+01:00 CHANNELMGR-1634 Set title to "Create new content" in converted step 1 - - - - - 1 changed file: - frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/step1/step1.controller.js Changes: ===================================== frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/step1/step1.controller.js ===================================== --- a/frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/step1/step1.controller.js +++ b/frontend-ng/src/app/channel/sidePanels/rightSidePanel/create-content/step1/step1.controller.js @@ -17,17 +17,22 @@ import { Observable } from 'rxjs'; class RightSidePanelCtrl { - constructor(CreateContentService) { + constructor ($translate, + CreateContentService, + FeedbackService) { 'ngInject'; + this.$translate = $translate; this.CreateContentService = CreateContentService; + this.FeedbackService = FeedbackService; + this.title = 'Create new content'; this.isFullWidth = false; this.urlUpdate = false; this.documentType = null; } - $onInit() { + $onInit () { if (!this.options) { throw new Error('Input "options" is required'); } @@ -42,12 +47,12 @@ class RightSidePanelCtrl { ); } - setWidthState(state) { + setWidthState (state) { this.isFullWidth = state; this.onFullWidth({ state }); } - _onLoadDocumentTypes(types) { + _onLoadDocumentTypes (types) { this.documentTypes = types; if (this.documentTypes.length === 1) { @@ -55,8 +60,14 @@ class RightSidePanelCtrl { } } - _onErrorLoadingTemplateQuery(error) { - // TODO: implement + _onErrorLoadingTemplateQuery (error) { + if (error.data && error.data.reason) { + const errorKey = this.$translate.instant(`ERROR_${error.data.reason}`); + this.FeedbackService.showError(errorKey); + } else { + console.error('Unknown error creating new draft document', error); + } } } + export default RightSidePanelCtrl; View it on GitLab: https://code.onehippo.org/cms-community/hippo-addon-channel-manager/compare/b670150cf4ce4be5b67895199fb2da57fb73a9d8...66d647749deb7d388ec33fe630a3db8d3d5a517b --- View it on GitLab: https://code.onehippo.org/cms-community/hippo-addon-channel-manager/compare/b670150cf4ce4be5b67895199fb2da57fb73a9d8...66d647749deb7d388ec33fe630a3db8d3d5a517b You're receiving this email because of your account on code.onehippo.org.
_______________________________________________ Hippocms-svn mailing list Hippocms-svn@lists.onehippo.org https://lists.onehippo.org/mailman/listinfo/hippocms-svn