Michiel Rop pushed to branch feature/wpm at cms-community / hippo-addon-channel-manager
Commits: 48e8cd07 by Michiel Rop at 2017-04-24T16:34:47+02:00 CHANNELMGR-1240 Select Master Branch When the item with the name of the current channel is selected a call is made to the HST MountService to select the master mount for that channel. - - - - - 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 @@ -22,7 +22,6 @@ class ProjectToggleController { this.$translate = $translate; this.OverlayService = OverlayService; - this.ChannelService = ChannelService; this.ProjectService = ProjectService; this.available = ProjectService.available; const channel = ChannelService.getChannel(); @@ -30,27 +29,25 @@ class ProjectToggleController { this.withBranch = [this.MASTER]; this.selectedProject = this.MASTER; this._setProjects(); - this.available = false; - } - $OnInit() { - this.available = this.ProjectService.available; } _setProjects() { - this.ProjectService.projects(this.ChannelService.getChannel().id) + this.ProjectService.projects() .then((response) => { this.withBranch = this.withBranch.concat(response.withBranch); this.withoutBranch = response.withoutBranch; }); } projectChanged() { - if (this.selectedProject.id === this.MASTER.id) return; + if (this.selectedProject.id === this.MASTER.id) { + this.ProjectService.doSelectMaster(); + return; + } if (this.withBranch.indexOf(this.selectedProject) >= 0) { this.ProjectService.doSelectBranch(this.selectedProject); } else { this.ProjectService.doCreateBranch(this.selectedProject); } } - } export default ProjectToggleController; ===================================== 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 @@ -29,8 +29,8 @@ class ProjectService { this.HstService = HstService; } - projects(id) { - const url = `${this.ConfigService.getCmsContextPath()}${REST_API_PATH}/${id}/channel`; + projects() { + const url = `${this.ConfigService.getCmsContextPath()}${REST_API_PATH}/${this.ChannelService.getChannel().mountId}/channel`; return this.$http({ method: 'GET', url, headers: {}, data: {} }) .then(result => result.data); } @@ -43,6 +43,10 @@ class ProjectService { this.HstService.doPost(project.id, this.ChannelService.getChannel().mountId, 'selectbranch'); } + doSelectMaster() { + this.HstService.doPost(null, this.ChannelService.getChannel().mountId, 'selectmaster'); + } + } export default ProjectService; View it on GitLab: https://code.onehippo.org/cms-community/hippo-addon-channel-manager/commit/48e8cd0771e983c46bb483118191a6525071fe43
_______________________________________________ Hippocms-svn mailing list Hippocms-svn@lists.onehippo.org https://lists.onehippo.org/mailman/listinfo/hippocms-svn