Michiel Rop pushed to branch feature/wpm at cms-community / hippo-addon-channel-manager
Commits: 792ca7c2 by Michiel Rop at 2017-04-24T12:41:47+02:00 CHANNELMGR-1240 Add Full Channel Name to dropdown - Add Full Channel Name to dropdown. - Make backend call on to project ( when selecting the default no call is made ) - Remove $OnInit, because functionally is does not add anything. - - - - - 2 changed files: - frontend-ng/src/angularjs/channel/projectToggle/projectToggle.controller.js - frontend-ng/src/angularjs/services/project.service.js Changes: ===================================== frontend-ng/src/angularjs/channel/projectToggle/projectToggle.controller.js ===================================== --- a/frontend-ng/src/angularjs/channel/projectToggle/projectToggle.controller.js +++ b/frontend-ng/src/angularjs/channel/projectToggle/projectToggle.controller.js @@ -15,7 +15,6 @@ * */ -const MASTER = { name: 'Default', id: 'master' }; class ProjectToggleController { constructor($translate, OverlayService, ChannelService, ProjectService) { @@ -26,14 +25,16 @@ class ProjectToggleController { this.ChannelService = ChannelService; this.ProjectService = ProjectService; this.available = ProjectService.available; - this.withBranch = [MASTER]; - this.selectedProject = MASTER; + const channel = ChannelService.getChannel(); + this.MASTER = { name: channel.name, id: channel.id }; + this.withBranch = [this.MASTER]; + this.selectedProject = this.MASTER; this._setProjects(); + this.available = false; } - $onInit() { - this._activate(); + $OnInit() { + this.available = this.ProjectService.available; } - _setProjects() { this.ProjectService.projects(this.ChannelService.getChannel().id) .then((response) => { @@ -41,12 +42,8 @@ class ProjectToggleController { this.withoutBranch = response.withoutBranch; }); } - - _activate() { - this._projectChanged(); - } - - _projectChanged() { + projectChanged() { + if (this.selectedProject.id === this.MASTER.id) return; if (this.withBranch.indexOf(this.selectedProject) >= 0) { this.ProjectService.doSelectBranch(this.selectedProject); } else { ===================================== frontend-ng/src/angularjs/services/project.service.js ===================================== --- a/frontend-ng/src/angularjs/services/project.service.js +++ b/frontend-ng/src/angularjs/services/project.service.js @@ -25,21 +25,6 @@ class ProjectService { this.$http = $http; this.ConfigService = ConfigService; this.PathService = PathService; - this.available = false; - this.doInitializeIsAvailable(); - } - - doInitializeIsAvailable() { - this.$http({ - method: 'GET', - url: `${this.ConfigService.getCmsContextPath()}${REST_API_PATH}`, - }).then(() => { - this.available = true; - }); - } - - get isAvailable() { - return this.available; } projects(id) { @@ -48,13 +33,6 @@ class ProjectService { .then(result => result.data); } - _addBranch(branch) { - return (project) => { - project.isBranch = branch; - return project; - }; - } - doCreateBranch(project) { // todo(mrop) add url const url = ''; View it on GitLab: https://code.onehippo.org/cms-community/hippo-addon-channel-manager/commit/792ca7c2ff1b28c4fa5c7eb8de60c53518a22d27
_______________________________________________ Hippocms-svn mailing list Hippocms-svn@lists.onehippo.org https://lists.onehippo.org/mailman/listinfo/hippocms-svn