[MGNLUI-262] Do not use hardcoded captions for apps Created: 29/Nov/12 Updated: 11/Feb/13 Resolved: 13/Dec/12 |
|
| Status: | Closed |
| Project: | Magnolia UI |
| Component/s: | content app |
| Affects Version/s: | 5.0 |
| Fix Version/s: | 5.0 |
| Type: | Improvement | Priority: | Major |
| Reporter: | Federico Grilli | Assignee: | Federico Grilli |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Template: |
|
| Acceptance criteria: |
Empty
|
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
| Description |
|
In many content apps, i.e. info.magnolia.ui.app.contacts.ContactsMainSubApp I am seeing overriding AbstractContentSubApp#getCaption() method and return an hardcoded string with (sub)app name. Since sub and app descriptors already provide us with this info, it would make coding an Content App even simpler and cleaner if we'd just used that caption in the default impl of AbstractContentSubApp#getCaption(). Something like the following. Notice that if the subAppDescriptor#getLabel() is blank we fallback to the appDescriptor()#getLabel(). If the latter is blank too we warn the user with a message. @Override
public String getCaption() {
String label = subAppContext.getSubAppDescriptor().getLabel();
if(StringUtils.isNotBlank(label)) {
return label;
}
label = subAppContext.getAppContext().getAppDescriptor().getLabel();
return StringUtils.isNotBlank(label) ? label : "missing App label";
}
|