Uploaded image for project: 'Kuali Rice Development'
  1. Kuali Rice Development
  2. KULRICE-6841

UIF Framework - Introduce the concept of data element attributes

    Details

    • Type: Task
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.2.0-m1, 2.2
    • Component/s: Development
    • Security Level: Public (Public: Anyone can view)
    • Labels:
      None
    • Rice Module:
      KRAD
    • KAI Review Status:
      Not Required
    • KTI Review Status:
      Not Required

      Description

      In order to better support some of the upcoming features we need the facility to add additional HTML custom attributes (part of the HMTL5) spec. Here is a rough outline:

      I think this would be a good time to introduce the concept for future work (we can decide if we want to rewrite existing code later).

      Should be easy to implement:

      • Add Map<String, String> data to ComponentBase (and Component interface)
      • In attributeBuilding.tag, build up a new data variable. This would read the map entries and for each entry add the attribute with 'data- {entry.key}

        ="

        {entry.value}

        "' to the variable string.

      • Pick up the new variables from span, div tag builders and other templates after call to attributeBuilder

      Then in the script tag pass the component and call attributeBuilder, then adding the data variable would result in:

      <input type="hidden" data-role="script" data-for="u99"/>

      Then when doing refresh on the component we can find its script with:

      jq('hidden[data-role="script"][data-for="' + componentId + '"])

        Attachments

          Issue Links

            Activity

            Hide
            bsmith Brian Smith (Inactive) added a comment -

            Implementation in code is sligtly different, same concepts

            Show
            bsmith Brian Smith (Inactive) added a comment - Implementation in code is sligtly different, same concepts
            Hide
            jkneal Jerry Neal (Inactive) added a comment -

            Brian,

            The one thing I didn't see is where we are picked up the dataAttributes map and building the attributes for the component element tag. I see we are using it for script, but not others.

            For example I was thinking the attributeBuilder.tag would pick up any entries in the map and then build the tag attributes and values (as described in the Jira description), then the caller (for example the for the group div or other components) would pick up the $

            {data}

            variable and add it to the tag.

            If you didn't get to this I can assign it to someone else. You have plenty of other things to work on.

            thanks,
            Jerry

            Show
            jkneal Jerry Neal (Inactive) added a comment - Brian, The one thing I didn't see is where we are picked up the dataAttributes map and building the attributes for the component element tag. I see we are using it for script, but not others. For example I was thinking the attributeBuilder.tag would pick up any entries in the map and then build the tag attributes and values (as described in the Jira description), then the caller (for example the for the group div or other components) would pick up the $ {data} variable and add it to the tag. If you didn't get to this I can assign it to someone else. You have plenty of other things to work on. thanks, Jerry
            Hide
            bsmith Brian Smith (Inactive) added a comment -

            I didnt add it to attributeBuilder but the property is used by div and span tags

            Show
            bsmith Brian Smith (Inactive) added a comment - I didnt add it to attributeBuilder but the property is used by div and span tags
            Hide
            jkneal Jerry Neal (Inactive) added a comment -

            Thanks Brian,
            I think might be good to add to attribute builder and then we can use it from all our elements.

            I'll open back up and have another dev do the work so you can continue with validation messages.

            Jerry

            Show
            jkneal Jerry Neal (Inactive) added a comment - Thanks Brian, I think might be good to add to attribute builder and then we can use it from all our elements. I'll open back up and have another dev do the work so you can continue with validation messages. Jerry
            Hide
            bsmith Brian Smith (Inactive) added a comment - - edited

            Sorry I wasnt exactly clear, it is available on all components already without AttributeBuilder, there is a getter that has the string already setup you just need to add it to the tags where necessary, right now they are only on span and div, see those tag files. We do need to add it to every control and ContentElement in addition though

            Show
            bsmith Brian Smith (Inactive) added a comment - - edited Sorry I wasnt exactly clear, it is available on all components already without AttributeBuilder, there is a getter that has the string already setup you just need to add it to the tags where necessary, right now they are only on span and div, see those tag files. We do need to add it to every control and ContentElement in addition though
            Hide
            jkneal Jerry Neal (Inactive) added a comment -

            Eric,

            Please see Brian's last comment. Basically just look at the div tag where it includes the data attributes from component, and include that for the other templates (all controls, image, link, label, iframe, action buttons/links/images, message field, and so on)

            thanks,
            Jerry

            Show
            jkneal Jerry Neal (Inactive) added a comment - Eric, Please see Brian's last comment. Basically just look at the div tag where it includes the data attributes from component, and include that for the other templates (all controls, image, link, label, iframe, action buttons/links/images, message field, and so on) thanks, Jerry
            Hide
            kunadawa Eric Njogu (Inactive) added a comment -

            Most of the controls support data element attributes except the radio button - which is rendered as a multiple input elements, each with a different id. Should the data attributes be placed on the wrapping div in this case?

            Show
            kunadawa Eric Njogu (Inactive) added a comment - Most of the controls support data element attributes except the radio button - which is rendered as a multiple input elements, each with a different id. Should the data attributes be placed on the wrapping div in this case?

              People

              • Assignee:
                kunadawa Eric Njogu (Inactive)
                Reporter:
                jkneal Jerry Neal (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: