lap_tran avatar lap_tran committed 3e22220 Merge

Update the minimum height of empty placeholder of Recently Updated macro
to 160px including border

Comments (0)

Files changed (8)

src/main/java/com/atlassian/confluence/plugins/macros/advanced/recentupdate/RecentlyChangedContentMacro.java

         QueryParameters queryParams = new QueryParameters(labelParamValue, authorParamValue, contentTypeParamValue, spaceKeyParamValue);
         PaginationParameters paginationParams = new StartIndexPaginationParameters(0, maxResults);
 
+        Map<String, Object> macroRenderContext = getMacroVelocityContext();
+        if (StringUtils.isNotBlank(paramWidth))
+        {
+            macroRenderContext.put("width", paramWidth);
+        }
+        if (!hideHeading)
+        {
+            macroRenderContext.put("title", i18n.getText("recently.updated"));
+        }
+
         RecentUpdatesManager recentUpdatesManager = new DefaultRecentUpdatesManager(searchManager);
         Page<SearchResult> pageOfResults = recentUpdatesManager.find(queryParams, paginationParams);
+        if (!pageOfResults.morePages() && pageOfResults.getItems().isEmpty())
+        {
+            return renderEmptyTemplate(macroRenderContext);
+        }
 
         ConfluenceUserPreferences pref = userAccessor.getConfluenceUserPreferences(AuthenticatedUserThreadLocal.getUser());
         DateFormatter dateFormatter = pref.getDateFormatter(formatSettingsManager, localeManager);
         final UpdateItemFactory updateItemFactory = new DefaultUpdateItemFactory(dateFormatter, i18n, contentTypesDisplayMapper);
 
-        Map<String, Object> macroRenderContext = getMacroVelocityContext();
-
-        if (StringUtils.isNotBlank(paramWidth))
-            macroRenderContext.put("width", paramWidth);
-
         final ChangesUrl contentFilterUrl = new ChangesUrl(new QueryParameters(labelParamValue, authorParamValue, null, spaceKeyParamValue), paginationParams, theme);
         macroRenderContext.put("changesUrl", contentFilterUrl.get());
 
         macroRenderContext.put("i18n", i18n);
         macroRenderContext.put("servingFirstPageOfResults", true);
 
-        if (!hideHeading)
-            macroRenderContext.put("title", i18n.getText("recently.updated"));
-
         // ADVMACROS-273 - Mobile view support for recently-updated macro
         boolean mobile = false;
         if ("mobile".equals(conversionContext.getOutputDeviceType()))
         return VelocityUtils.getRenderedTemplate(getTemplate(theme), macroRenderContext);
     }
 
+    String renderEmptyTemplate(Map<String, Object> macroRenderContext)
+    {
+        final String emptyTemplate = "com/atlassian/confluence/plugins/macros/advanced/recentupdate/no-updates.vm";
+        return VelocityUtils.getRenderedTemplate(emptyTemplate, macroRenderContext);
+    }
+
     Map<String, Object> getMacroVelocityContext()
     {
         return MacroUtils.defaultVelocityContext();

src/main/resources/com/atlassian/confluence/plugins/macros/advanced/css/recently-updated-common.css

     border-top: 1px solid #ccc;
 }
 
+.macro-blank-experience {
+    -webkit-border-radius: 3px;
+    border-radius: 3px;
+    border: 1px solid #cccccc;
+    min-height: 120px;
+    padding: 20px 190px 20px 20px;
+}
+
+.columnLayout.threeColumns .macro-blank-experience,
+.columnLayout .cell.aside .macro-blank-experience,
+.columnLayout.three-equal .macro-blank-experience,
+.columnLayout.sidebars .macro-blank-experience {
+    background: none;
+    padding: 20px;
+}
+
+.recently-updated.macro-blank-experience {
+    background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALsAAAD4BAMAAABGcoqbAAAAA3NCSVQICAjb4U/gAAAAGFBMVEX///9wcHBwcHBwcHBwcHBwcHBwcHBwcHDJYMTAAAAACHRSTlMAESIzRFVmd1lsqD8AAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAAAFXRFWHRDcmVhdGlvbiBUaW1lADI4LzYvMTPX6j40AAAGJklEQVR4nM2czVbcOBCFbZPs0xyyF2k66ww/+wkEZjsBNOxnCDwB6defbtLusaWqUt1SaQ5a5RD5c/nqSpbUVnWdpfSLT7Oy+GDC0OzDT0Q59rnDgmLvnqGWnYqS3aDqEQrwuidQwLfF+ABkg1Ll2ADvtXDTAyiFMfLVwowFEgimQ3wDXc+nxwA3vpGu5Iv05fVVHV+O/eT5sSr+gjIn6xfx/0Od7st4V4EvjwRnp3Y8NM7geLMlVfh6uoSvl0bEO9AFvIM0At5DGgHvQmfxLtKw+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LdtF70ZvGWrrgIffPGA8T3wnt9udKYd8DeEz5zpbJ0UH3zx8E8zbwqfOtO5bTO8b9uiP0miJcU7i5/incXHfsyGS9a2oS3eV3zoMwhDyfC+4gOfoFhKJr6vOjneVR3g4yVTyfC+1sw/l3RVJxc/eOL34p/fn7ZQZ8Tf7HbsnNUZxf9jfdtCnVH8ix9j9K49axR/3Ov1Viezjm/jEh8Ke4afO981fOr7eEc89Yl5cMQT6niGT6kTHPkE3rNx2x6toM+d+OHJ41DBD08eWKpDhsm/SXWqWvdwiqcPi1W0bv9/HudiznO5HUZjjhka+X1mvIHEux0EbHyMkTugauBThzC58L2OkHJnSJ0OwLJHm0H+KHKKb3z4uPHRaSEDh8vBbyFJhsexdSmBiMeheynHB5yMiMBL+U8cEh7IKUrkdA1pbQovp28RHiCPi8KXMqxUpsoohE/egEliR+IVCWLmaUoW3AU0fh7+OZcbarHgc6z8+iyExs/Dv3m5LD5NXpYPbIqY+bj/sF9KQ/jnnzx+Ks/1D0v+nOVfQvRTec7OeIhQtpex+MapkQqJYqrxLtmRBHzjpFoefAnfOKGZA1/GV8sj46v5BXwtvzi3kOWXsxxWpzmUsxxWJ2kUsxzWp5hcRl4c9Zxd4POp1Nqm94TWG2BiVXg1A/ofXkoiGUpNuYvVfGPWX51AFWmXmyYsVtygOp9z02TRr4WebLsm055PjBds3P8Cxc49+S9fo6IAAAAASUVORK5CYII=)
+        right no-repeat;
+}

src/main/resources/com/atlassian/confluence/plugins/macros/advanced/i18n.properties

 recentlyupdated.width.desc=(optional) width of the rendered table on Confluence page. Defaults to 100%.
 recentlyupdated.spaces.desc.default=Defaults to the current space (@self).
 recentlyupdated.type.desc.default=Defaults to all types. In shared mode, the personal information type is excluded from the defaults.
-recentlyupdated.no.updates=No recent updates found.
+recentlyupdated.no.updates=As you and your team create content this area will fill up and display the latest updates.
 recentlyupdated.type.criteria.param.desc=(optional) search for types of content.<br/> \
   Accepted values: \
   <ul> \

src/main/resources/com/atlassian/confluence/plugins/macros/advanced/recentupdate/no-updates.vm

+<div class="recently-updated macro-blank-experience" #if ($width)style="width: $generalUtil.htmlEncode($width)"#end>
+    #parse ("/com/atlassian/confluence/plugins/macros/advanced/recentupdate/sub-heading.vm")
+    <p>$i18n.getText('recentlyupdated.no.updates')</p>
+</div>

src/main/resources/com/atlassian/confluence/plugins/macros/advanced/recentupdate/themes/concise/updates.vm

 <ul>
-#if ($updateItems.size() > 0)
     #foreach ($updateItem in $updateItems)
     <li class="update-item">
         <div class="update-item-icon">
         </div>
     </li>
     #end
-#else
-    <li class="first update-item">$i18n.getText('recentlyupdated.no.updates')</li>
-#end
 </ul>
 #if (!$mobile)
 #parse ("/com/atlassian/confluence/plugins/macros/advanced/recentupdate/more-updates.vm")

src/main/resources/com/atlassian/confluence/plugins/macros/advanced/recentupdate/themes/sidebar/updates.vm

 <ul>
-#if ($updateItems.size() > 0)
     #foreach ($updateItem in $updateItems)
     <li class="#if($velocityCount == 1 && $servingFirstPageOfResults)first#end update-item">
         <div class="update-item-icon">
         </div>
     </li>
     #end
-#else
-    <li class="first update-item">$i18n.getText('recentlyupdated.no.updates')</li>
-#end
 </ul>
 #if (!$mobile)
 #parse ("/com/atlassian/confluence/plugins/macros/advanced/recentupdate/more-updates.vm")

src/main/resources/com/atlassian/confluence/plugins/macros/advanced/recentupdate/themes/social/updates.vm

 <ul class="update-groupings">
-    #if ($groupings.size() > 0)
     #foreach ($grouping in $groupings)
-        <li class="#if ($velocityCount == 1 && $servingFirstPageOfResults)first#end grouping">
-            #set ($linkedProfilePictureHtml = $grouping.updater.linkedProfilePicture)
-            #set ($linkedFullNameHtml = $grouping.updater.linkedFullName)
-            <div class="update-item-profile">
-                $linkedProfilePictureHtml
-            </div>
-            <ul class="update-items">
-                <div>$linkedFullNameHtml</div>
-                #foreach ($updateItem in $grouping.updateItems)
-                <li class="update-item">
-                    <div class="update-item-icon">
-                        <span class="icon $updateItem.iconClass"></span>
-                    </div>
-                    <div class="update-item-details">
-                        <span class="update-item-content">
-                            #if ($performingHtmlExport)
-                                $updateItem.linkedUpdateTargetForHtmlExport
-                            #else
-                                $updateItem.linkedUpdateTarget
-                            #end
-                        </span>
-                        <span class="update-item-date">$updateItem.descriptionAndDate</span>
-                        #if ($updateItem.changesLink && !$mobile)
-                            <span class="update-item-changes"> $updateItem.changesLink</span>
+    <li class="#if ($velocityCount == 1 && $servingFirstPageOfResults)first#end grouping">
+        #set ($linkedProfilePictureHtml = $grouping.updater.linkedProfilePicture)
+        #set ($linkedFullNameHtml = $grouping.updater.linkedFullName)
+        <div class="update-item-profile">
+            $linkedProfilePictureHtml
+        </div>
+        <ul class="update-items">
+            <div>$linkedFullNameHtml</div>
+            #foreach ($updateItem in $grouping.updateItems)
+            <li class="update-item">
+                <div class="update-item-icon">
+                    <span class="icon $updateItem.iconClass"></span>
+                </div>
+                <div class="update-item-details">
+                    <span class="update-item-content">
+                        #if ($performingHtmlExport)
+                            $updateItem.linkedUpdateTargetForHtmlExport
+                        #else
+                            $updateItem.linkedUpdateTarget
                         #end
-                        #if ($updateItem.permLink)<span class="update-item-permlink"><a href="$updateItem.permLink"><span>Permalink</span></a></span>#end
-                        #if ($stringUtils.isNotBlank($updateItem.body))<div class="update-item-body">$updateItem.body</div>#end
-                    </div>
-                </li>
-                #end
-            </ul>
-        </li>
+                    </span>
+                    <span class="update-item-date">$updateItem.descriptionAndDate</span>
+                    #if ($updateItem.changesLink && !$mobile)
+                        <span class="update-item-changes"> $updateItem.changesLink</span>
+                    #end
+                    #if ($updateItem.permLink)<span class="update-item-permlink"><a href="$updateItem.permLink"><span>Permalink</span></a></span>#end
+                    #if ($stringUtils.isNotBlank($updateItem.body))<div class="update-item-body">$updateItem.body</div>#end
+                </div>
+            </li>
+            #end
+        </ul>
+    </li>
     #end
-#else
-    <li class="no-results-message">$i18n.getText('recentlyupdated.no.updates')</li>
-#end
 </ul>
 #if (!$mobile)
 #parse ("/com/atlassian/confluence/plugins/macros/advanced/recentupdate/more-updates.vm")

src/test/java/it/com/atlassian/confluence/plugins/macros/advanced/RecentlyChangedContentMacroTestCase.java

 public class RecentlyChangedContentMacroTestCase extends AbstractConfluencePluginWebTestCaseBase
 {
     private static final String MACRO_NAME = "recently-updated";
+    private static final String BLANK_MESSAGE =
+            "As you and your team create content this area will fill up and display the latest updates.";
 
     @Override
     protected void setUp() throws Exception
         getIndexHelper().update();
 
         viewPageById(macroContainerPageId);
-        assertTextPresent("No recent updates found.");
+        assertTextPresent(BLANK_MESSAGE);
     }
 
     public void testSortReverseWithoutSortParamHasNoEffect()
         getIndexHelper().update();
 
         viewPageById(pageHelper.getId());
-        assertTextPresent("No recent updates found.");
-//        assertTextPresent(invalidSpaceKey +"' is not an existing space's key");
+        assertTextPresent(BLANK_MESSAGE);
     }
 
     public void testContentFilterByPersonalLabel()
         assertEquals("width: x\"</pre><script>alert(1)</script>", getElementAttributByXPath("//div[@class='wiki-content']//div[@class='recently-updated recently-updated-concise'", "style"));
     }
 
+    public void testBlankExperienceHasClassAndWidth()
+    {
+        final long testBlankPageId = createPage(TEST_SPACE_KEY, "BlankTest", "{recently-updated:width=50%|types=blog}");
+        viewPageById(testBlankPageId);
+        assertEquals("width: 50%", getElementAttributByXPath("//div[@class='wiki-content']//div[@class='recently-updated macro-blank-experience'", "style"));
+    }
+
     private long setUserStatus(String s) throws JSONException
     {
         gotoPage(addFormSecurityToken("/status/update.action?text=" + s));
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.