Skip to content

Commit

Permalink
Merge pull request #354 from Netflix/ihaken-home-resources
Browse files Browse the repository at this point in the history
Support for admin configs to add additional arbitrary JS to home layout.
  • Loading branch information
JackOfMostTrades authored Oct 16, 2017
2 parents ee93a2e + 1933c07 commit f196430
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public Viewable showIndex() {
final Collection<AdminPageInfo> adminPages = adminPageRegistry.getAllPages();
model.put("adminPages", adminPages);
}
if (adminContainerConfig != null) {
model.put("homeScriptResources", adminContainerConfig.homeScriptResources());
}

return new Viewable("/webadmin/home.ftl", model, adminContainerConfig.getClass());
}
Expand Down
5 changes: 5 additions & 0 deletions karyon2-admin-web/src/main/resources/webadmin/home.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
<#macro body>
<script type="text/javascript">
<#include "home.js"/>
<#if homeScriptResources??>
<#list homeScriptResources as resource>
<#include resource />
</#list>
</#if>
</script>
<#import "/layout/bootstrap/macros.ftl" as nf/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ public Map<String, Object> getJerseyConfigProperties() {
}
return result;
}

@Override
public List<String> homeScriptResources() {
return Collections.emptyList();
}

@Override
public List<Filter> additionalFilters() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ public interface AdminContainerConfig {
List<Filter> additionalFilters();
List<Connector> additionalConnectors();
Map<String, Object> getJerseyConfigProperties();

List<String> homeScriptResources();
}

0 comments on commit f196430

Please sign in to comment.