Uploaded image for project: 'Magnolia UI'
  1. Magnolia UI
  2. MGNLUI-262

Do not use hardcoded captions for apps

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 5.0
    • 5.0
    • content app
    • None

    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";
          }
      

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              fgrilli Federico Grilli
              fgrilli Federico Grilli
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Checklists

                  Task DoD