|
153 | 153 | // Get supporting files in map <url, icon url> |
154 | 154 | HashMap<String, String> suppFiles = SkylineToolsStoreController.getSupplementaryFiles(tool); |
155 | 155 | Iterator suppIter = suppFiles.entrySet().iterator(); |
| 156 | + boolean hasDocs = tool.hasDocumentation(); |
| 157 | + int docCount = suppFiles.size() + (hasDocs ? 1 : 0); |
156 | 158 |
|
157 | 159 | final String curToolOwners = StringUtils.join(SkylineToolsStoreController.getToolOwners(tool), ", "); |
158 | 160 | toolOwners.put(tool.getRowId(), curToolOwners); |
|
203 | 205 | <button type="button" id="download-tool-btn-<%=tool.getRowId()%>" class="styled-button">Download <span class="visually-hidden"><%=h(tool.getName())%></span></button> |
204 | 206 | <% addHandler("download-tool-btn-" + tool.getRowId(), "click", "window.location.href = " + q(urlFor(SkylineToolsStoreController.DownloadToolAction.class).addParameter("id", tool.getRowId()))); %> |
205 | 207 | <% |
206 | | - if (suppFiles.size() == 1) { |
| 208 | + if (docCount == 1 && hasDocs) { |
| 209 | +%> |
| 210 | + <a href="<%=h(tool.getDocsUrl())%>" target="_blank" rel="noopener noreferrer"><button type="button" class="styled-button">Documentation <span class="visually-hidden"><%=h(tool.getName())%></span></button></a> |
| 211 | +<% |
| 212 | + } else if (docCount == 1) { |
207 | 213 | Map.Entry suppPair = (Map.Entry)suppIter.next(); |
208 | 214 | %> |
209 | | - <a href="<%=h(suppPair.getKey())%>"><button type="button" class="styled-button">Documentation</button></a> |
210 | | -<% } else if (suppFiles.size() > 1) { %> |
| 215 | + <a href="<%=h(suppPair.getKey())%>"><button type="button" class="styled-button">Documentation <span class="visually-hidden"><%=h(tool.getName())%></span></button></a> |
| 216 | +<% } else if (docCount > 1) { %> |
211 | 217 | <div class="menuMouseArea"> |
212 | | - <button type="button" class="styled-button">Documentation</button> |
| 218 | + <button type="button" class="styled-button">Documentation <span class="visually-hidden"><%=h(tool.getName())%></span></button> |
213 | 219 | <ul class="dropMenu"> |
| 220 | +<% if (hasDocs) { %> |
| 221 | + <li><a href="<%=h(tool.getDocsUrl())%>" target="_blank" rel="noopener noreferrer"><img class="menuIconImg" src="<%= h(imgDir) %>link.png" alt="Documentation">Online Documentation</a></li> |
| 222 | +<% } %> |
214 | 223 | <% |
215 | 224 | while (suppIter.hasNext()) { |
216 | 225 | Map.Entry suppPair = (Map.Entry)suppIter.next(); |
|
0 commit comments