Uploaded image for project: 'Grouper'
  1. Grouper
  2. GRP-1506

New feature - Configurable subject icons (ready for pull)

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 2.3.0, 2.4.0
    • Fix Version/s: 2.3.1, 2.4.0, 2.3.0.patch
    • Component/s: UI
    • Labels:
      None

      Description

      Our institutional Grouper config uses four distinct sources. To make it easier to identify them, we have customized a few UI classes and added new properties, so that different icons are used for different subjects. An example showing usage (set in grouper-ui.properties) is:

      grouperUi.screenSubjectIcon2.screenHtmlEl.default = ${'<i class="fa fa-user"></i> '}

      • this is added to grouper-ui.base.properties as the default or fallback which can be overrided per subject id. If for some reason a patcher fails to upgrade grouper-ui.base.properties, the same value is hardcoded in GrouperUiUtils so that the existing person icon is still displayed as before.

      grouperUi.screenSubjectIcon2.sourceId.0 = student
      grouperUi.screenSubjectIcon2.screenHtmlEl.0 = ${'<i class="fa fa-graduation-cap"></i> '}
      grouperUi.screenSubjectIcon2.sourceId.1 = nonstudent
      grouperUi.screenSubjectIcon2.screenHtmlEl.1 = ${'<i class="fa fa-coffee"></i> '}

      • like the other indexed properties, these start at zero and iterate through sequential grouperUi.screenSubjectIcon2.sourceId.N indexes. If any defined sourceId value matches the source ID for a subject, the corresponding grouperUi.screenSubjectIcon2.screenHtmlEl.N value is used for the icon HTML instead of the default.

      Any valid EL can work here. For example, you can set a different icon based on attributes. E.g.,:

      grouperUi.screenSubjectIcon2.screenHtmlEl.1 = ${subject.attributes['businessCategory']==null ? '<i class="fa fa-question-circle"></i> ' : subject.attributes['businessCategory'].iterator().next() == 'Account Payable' ? '<i style="color: red" class="fa fa-coffee"></i> ' : '<i class="fa fa-coffee"></i> '}

      There is also a change in grouperText/grouper.text.*.base.properties, just to replace the hardcoded HTML with the dynamic value. If you have customized guiSubjectShortLink from the base default, you may want to change your version to use the dynamic icon.

      This works everywhere in the New UI (at least where I checked) - see links for example screenshots:

      This only affects the New UI, not the Admin UI or Lite UI.

      As it's a major feature add, I didn't know if this would be better as a straight pull request, or as an optional package. The changeset are currently in my Github fork.

        Attachments

          Activity

            People

            • Assignee:
              mchyzer Chris Hyzer
              Reporter:
              cer28 Chad Redman
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: