Jasper Floor pushed to branch master at cms-community / hippo-cms
Commits: f233366f by Bert Leunis at 2017-03-20T14:47:21+01:00 CMS-10661 make -preview node structures lighter - - - - - 05e610fd by Bert Leunis at 2017-03-23T14:42:59+01:00 CMS-10661 extend unit test for hst-preview distinction - - - - - c352f354 by jasper.floor at 2017-05-02T17:28:15+02:00 CMS-10661 Merge master changes in feature/CMS-10661 - - - - - f1368cf2 by jasper.floor at 2017-05-02T17:31:58+02:00 CMS-10661 Reintegrate feature/CMS-10661 - - - - - 3 changed files: - console/frontend/src/main/java/org/hippoecm/frontend/plugins/console/icons/JcrNodeIcon.java - console/frontend/src/main/resources/org/hippoecm/frontend/plugins/console/console.css - console/frontend/src/test/java/org/hippoecm/frontend/plugins/console/browser/JcrNodeIconTest.java Changes: ===================================== console/frontend/src/main/java/org/hippoecm/frontend/plugins/console/icons/JcrNodeIcon.java ===================================== --- a/console/frontend/src/main/java/org/hippoecm/frontend/plugins/console/icons/JcrNodeIcon.java +++ b/console/frontend/src/main/java/org/hippoecm/frontend/plugins/console/icons/JcrNodeIcon.java @@ -17,6 +17,7 @@ package org.hippoecm.frontend.plugins.console.icons; import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -51,7 +52,7 @@ public class JcrNodeIcon { public static final String FA_UNKNOWN_NODE_CSS_CLASS = FA_CSS_CLASS + " " + FA_UNKNOWN_NODE_ICON_CLASS + " " + DEFAULT_NODE_CSS_CLASS; private static final List<String> nodeTypes = new ArrayList<>(); - private static final Map<String, String> pathCssClass = new HashMap<>(); + private static final Map<String, String> pathCssMatchers = new LinkedHashMap<>(); private static final Map<String, FontAwesomeIcon> primaryTypeNameIcons = new HashMap<>(); static { @@ -177,15 +178,16 @@ public class JcrNodeIcon { primaryTypeNameIcons.put("targeting:services", FontAwesomeIcon.SUN_O); primaryTypeNameIcons.put("targeting:service", FontAwesomeIcon.CERTIFICATE); - pathCssClass.put("/hst:hst", "hst"); - pathCssClass.put("/" + CONFIGURATION_PATH, "conf"); - pathCssClass.put("/content", "content"); - pathCssClass.put("/hippo:namespaces", "namespaces"); - pathCssClass.put("/formdata", "formdata"); - pathCssClass.put("/webfiles", "webfiles"); - pathCssClass.put("/hippo:reports", "reports"); - pathCssClass.put("/hippo:log", "log"); - pathCssClass.put("/targeting:targeting", "targeting"); + pathCssMatchers.put("^/hst:hst.*-preview.*$", "hst-preview"); + pathCssMatchers.put("^/hst:hst.*$", "hst"); + pathCssMatchers.put("^/" + CONFIGURATION_PATH + ".*$", "conf"); + pathCssMatchers.put("^/content.*$", "content"); + pathCssMatchers.put("^/hippo:namespaces.*$", "namespaces"); + pathCssMatchers.put("^/formdata.*$", "formdata"); + pathCssMatchers.put("^/webfiles.*$", "webfiles"); + pathCssMatchers.put("^/hippo:reports.*$", "reports"); + pathCssMatchers.put("^/hippo:log.*$", "log"); + pathCssMatchers.put("^/targeting:targeting.*$", "targeting"); } /** @@ -250,9 +252,9 @@ public class JcrNodeIcon { return VIRTUAL_NODE_CSS_CLASS; } - for (Map.Entry<String, String> pathColor : pathCssClass.entrySet()) { - if (path.startsWith(pathColor.getKey())) { - return NODE_CSS_CLASS_PREFIX + pathColor.getValue(); + for (Map.Entry<String, String> pathCssMatcher : pathCssMatchers.entrySet()) { + if (path.matches(pathCssMatcher.getKey())) { + return NODE_CSS_CLASS_PREFIX + pathCssMatcher.getValue(); } } } catch (RepositoryException e) { ===================================== console/frontend/src/main/resources/org/hippoecm/frontend/plugins/console/console.css ===================================== --- a/console/frontend/src/main/resources/org/hippoecm/frontend/plugins/console/console.css +++ b/console/frontend/src/main/resources/org/hippoecm/frontend/plugins/console/console.css @@ -1,5 +1,5 @@ /* - * Copyright 2008-2016 Hippo B.V. (http://www.onehippo.com) + * Copyright 2008-2017 Hippo B.V. (http://www.onehippo.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -326,6 +326,14 @@ li.hippo-console-menu-actions-save.session-changes a { color: #673ab7; } +.jcrnode-hst-preview { + color: #b39ddb; +} + +.jcrnode-hst-preview + span { + color: #757575; +} + .jcrnode-conf { color: #009688; } ===================================== console/frontend/src/test/java/org/hippoecm/frontend/plugins/console/browser/JcrNodeIconTest.java ===================================== --- a/console/frontend/src/test/java/org/hippoecm/frontend/plugins/console/browser/JcrNodeIconTest.java +++ b/console/frontend/src/test/java/org/hippoecm/frontend/plugins/console/browser/JcrNodeIconTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2016 Hippo B.V. (http://www.onehippo.com) + * Copyright 2015-2017 Hippo B.V. (http://www.onehippo.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import javax.jcr.RepositoryException; import org.hippoecm.frontend.plugins.console.icons.JcrNodeIcon; import org.hippoecm.repository.api.WorkflowException; import org.junit.Test; +import org.onehippo.repository.mock.MockNode; import org.onehippo.repository.testutils.RepositoryTestCase; import static org.junit.Assert.assertEquals; @@ -78,4 +79,20 @@ public class JcrNodeIconTest extends RepositoryTestCase { public void testNodeIsNull() { assertEquals(JcrNodeIcon.getIconCssClass(null), "fa fa-exclamation-circle jcrnode-default"); } + + @Test + public void testHstPreview() throws RepositoryException { + MockNode hstHst = MockNode.root().addNode("hst:hst", "hst:hst"); + assertEquals(JcrNodeIcon.getIconCssClass(hstHst), "fa fa-cloud jcrnode-hst"); + + MockNode hstConfigurations = hstHst.addNode("hst:configurations", "hst:configurations"); + assertEquals(JcrNodeIcon.getIconCssClass(hstConfigurations), "fa fa-cogs jcrnode-hst"); + + MockNode hstConfigurationPreview = hstConfigurations.addNode("myhippoproject-preview", "hst:configuration"); + assertEquals(JcrNodeIcon.getIconCssClass(hstConfigurationPreview), "fa fa-cog jcrnode-hst-preview"); + + MockNode hstConfiguration = hstConfigurations.addNode("myhippoproject", "hst:configuration"); + assertEquals(JcrNodeIcon.getIconCssClass(hstConfiguration), "fa fa-cog jcrnode-hst"); + } + } View it on GitLab: https://code.onehippo.org/cms-community/hippo-cms/compare/27aae6343337d0cba0bd50dc99b0c946a240626c...f1368cf2e4c0ae4d6f291ae31c43f81d5dd008ff
_______________________________________________ Hippocms-svn mailing list Hippocms-svn@lists.onehippo.org https://lists.onehippo.org/mailman/listinfo/hippocms-svn