Michiel Eggermont pushed to branch feature/projectdocs at cms-community / hippo-addon-channel-manager
Commits: 38cc69fd by Michiel Eggermont at 2018-02-07T12:02:51+01:00 CHANNELMGR-1702 Use channelId of parent if channel has a branchId Currently the channel store only contains master channels. So the Ext javascript code in the client only knows about master channels too. If a channel branch must be opened in the channel editor we can't use the channelId of the branch, but instead use the channelId of it's parent, i.e. use channelDocument#branchOf(). Then we must also tell the javascript code the id of the branch so that the hst can be requested to set the active branch (via a rest call) for rendering the preview of the site. Preferably we would of course want to populate the channel store with all channels (master and branches), which would make it possible to just use the channelId directly without the branchId. We can't do that however because then the channel overview would also show all the branches as channels. The user would not be able to tell which channel is master and which are branches because the look the same. To implement this properly we first need a good design. - - - - - 1 changed file: - frontend/src/main/java/org/onehippo/cms7/channelmanager/plugins/channelactions/ChannelActionsPlugin.java Changes: ===================================== frontend/src/main/java/org/onehippo/cms7/channelmanager/plugins/channelactions/ChannelActionsPlugin.java ===================================== --- a/frontend/src/main/java/org/onehippo/cms7/channelmanager/plugins/channelactions/ChannelActionsPlugin.java +++ b/frontend/src/main/java/org/onehippo/cms7/channelmanager/plugins/channelactions/ChannelActionsPlugin.java @@ -18,7 +18,6 @@ package org.onehippo.cms7.channelmanager.plugins.channelactions; import java.io.Serializable; import java.rmi.RemoteException; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.LinkedHashMap; @@ -31,6 +30,7 @@ import java.util.concurrent.Future; import javax.jcr.Node; import javax.jcr.RepositoryException; +import org.apache.commons.lang.StringUtils; import org.apache.wicket.Component; import org.apache.wicket.MarkupContainer; import org.apache.wicket.markup.html.basic.Label; @@ -259,7 +259,12 @@ public class ChannelActionsPlugin extends CompatibilityWorkflowPlugin<Workflow> @Override protected void invoke() { if (channelManagerService != null) { - channelManagerService.viewChannel(channelDocument.getChannelId(), channelDocument.getPathInfo()); + final String branchId = channelDocument.getBranchId(); + if (StringUtils.isNotBlank(branchId)) { + channelManagerService.viewChannel(channelDocument.getBranchOf(), channelDocument.getPathInfo(), branchId); + } else { + channelManagerService.viewChannel(channelDocument.getChannelId(), channelDocument.getPathInfo()); + } } else { log.info("Cannot view channel, no channel manager service available"); } View it on GitLab: https://code.onehippo.org/cms-community/hippo-addon-channel-manager/commit/38cc69fd3292366ddc1f42a2135c6da0db7d303e --- View it on GitLab: https://code.onehippo.org/cms-community/hippo-addon-channel-manager/commit/38cc69fd3292366ddc1f42a2135c6da0db7d303e 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