ICEmobile
  1. ICEmobile
  2. MOBI-1175

mobi:contentMenuItem, add support for complex FontAwesome icon combinations

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: EE-1.3.1.GA_P05
    • Fix Version/s: EE-1.3.1.GA_P07
    • Component/s: None
    • Labels:
      None
    • Environment:
      Any

      Description

      The mobi:contentMenuItem has an 'icon' attribute that allows specifying the name of a FontAwesome icon to display it next to the label. This feature is very limited because it can only be used for the simplest case of FontAwesome icons. It doesn't allow stacking, specifying different icon sizes, arbitrary styling or normal characters. This improvement is to add the capability to specify a complex icon configuration.

        Activity

        Arturo Zambrano created issue -
        Hide
        Arturo Zambrano added a comment -

        What the component renders with the 'icon' attribute is just the following markup (assuming that icon="envelope"):

        <i class="fa fa-envelope"></i>
        

        If we want to render a bigger envelope icon that has a red circle in the middle, which in turns contains a number 9 (e.g. the number of e-mails), then the following markup is required.

        <span class="fa-stack fa-lg">
        	<i class="fa fa-envelope-o fa-stack-2x"></i>
        	<i class="fa fa-circle fa-stack-1x" style="color:red;"></i>
        	<strong class="fa fa-stack-1x" style="color:white;">9</strong>
        </span>
        

        So, for this improvement, an attribute that allows to specify arbitrary HTML markup would be the most appropriate solution. Simply using the body of the component to specify this markup is also an appropriate solution.

        Show
        Arturo Zambrano added a comment - What the component renders with the 'icon' attribute is just the following markup (assuming that icon="envelope"): <i class= "fa fa-envelope" > </i> If we want to render a bigger envelope icon that has a red circle in the middle, which in turns contains a number 9 (e.g. the number of e-mails), then the following markup is required. <span class= "fa-stack fa-lg" > <i class= "fa fa-envelope-o fa-stack-2x" > </i> <i class= "fa fa-circle fa-stack-1x" style= "color:red;" > </i> <strong class= "fa fa-stack-1x" style= "color:white;" > 9 </strong> </span> So, for this improvement, an attribute that allows to specify arbitrary HTML markup would be the most appropriate solution. Simply using the body of the component to specify this markup is also an appropriate solution.
        Arturo Zambrano made changes -
        Field Original Value New Value
        Description The mobi:contentStackMenu has an 'icon' attribute that allows specifying the name of a FontAwesome icon to display it next to the label. This feature is very limited because it can only be used for the simplest case of FontAwesome icons. It doesn't allow stacking, specifying different icon sizes and inverting colours. This improvement is to add the capability to specify a complex icon combination. The mobi:contentStackMenu has an 'icon' attribute that allows specifying the name of a FontAwesome icon to display it next to the label. This feature is very limited because it can only be used for the simplest case of FontAwesome icons. It doesn't allow stacking, specifying different icon sizes, arbitrary styling or normal characters. This improvement is to add the capability to specify a complex icon configuration.
        Judy Guglielmin made changes -
        Support Case References Support Case 14210:- https://icesoft.my.salesforce.com/5000g00001mfHPh
        Ken Fyten made changes -
        Fix Version/s EE-1.3.1.GA_P06 [ 13117 ]
        Ken Fyten made changes -
        Assignee Ken Fyten [ ken.fyten ] Arturo Zambrano [ artzambrano ]
        Hide
        Arturo Zambrano added a comment -

        r51961: added 'icon' facet to mobi:contentMenuItem, to render instead of the 'icon' attribute, allowing for more complex icons

        Show
        Arturo Zambrano added a comment - r51961: added 'icon' facet to mobi:contentMenuItem, to render instead of the 'icon' attribute, allowing for more complex icons
        Arturo Zambrano made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Arturo Zambrano made changes -
        Summary mobi:contentStackMenu, add support for complex FontAwesome icon combinations mobi:contentMenuItem, add support for complex FontAwesome icon combinations
        Arturo Zambrano made changes -
        Description The mobi:contentStackMenu has an 'icon' attribute that allows specifying the name of a FontAwesome icon to display it next to the label. This feature is very limited because it can only be used for the simplest case of FontAwesome icons. It doesn't allow stacking, specifying different icon sizes, arbitrary styling or normal characters. This improvement is to add the capability to specify a complex icon configuration. The mobi:contentMenuItem has an 'icon' attribute that allows specifying the name of a FontAwesome icon to display it next to the label. This feature is very limited because it can only be used for the simplest case of FontAwesome icons. It doesn't allow stacking, specifying different icon sizes, arbitrary styling or normal characters. This improvement is to add the capability to specify a complex icon configuration.
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #51961 Thu Sep 28 13:39:33 MDT 2017 art.zambrano MOBI-1175 added 'icon' facet to mobi:contentMenuItem, to render instead of the 'icon' attribute, allowing for more complex icons
        Files Changed
        Commit graph MODIFY /icemobile/trunk/icemobile/jsf/components/component/src/org/icefaces/mobi/component/contentmenuitem/ContentMenuItemRenderer.java
        Commit graph MODIFY /icemobile/trunk/icemobile/jsf/components/component/src/org/icefaces/mobi/component/contentmenuitem/ContentMenuItemMeta.java
        Ken Fyten made changes -
        Fix Version/s EE-1.3.1.GA_P07 [ 13122 ]
        Fix Version/s EE-1.3.1.GA_P06 [ 13117 ]
        Hide
        Judy Guglielmin added a comment - - edited

        i took the facet from the Jira and put it on mobitest/layout/contentStackMenu/contentStackMenu4.jsf
        page.

        I cannot get the facet to render. When I go through the debugger I noticed that the code path for the facet does not get used when this page is rendered. Also, the facet is not encoded unless iconPlacement is non-null.
        I added the iconPlacement attribute, but still not getting the facet to render.

        here is the snippet on that page I added for largeView
        <mobi:largeView>
        <mobi:splitPane columnDivider="30">
        <f:facet name="left">
        <h:form>
        <mobi:contentStackMenu id="contentStackMenu" contentStackId="contentStack">
        <mobi:contentMenuItem label="Menu"/>
        <mobi:contentMenuItem label="Page 1" value="page1" iconPlacement="right"
        icon="envelope">
        <f:facet name="icon">
        <span class="fa-stack fa-lg">
        <i class="fa fa-envelope-o fa-stack-2x"></i>
        <i class="fa fa-circle fa-stack-1x" style="color:red;"></i>
        <strong class="fa fa-stack-1x" style="color:white;">9</strong>
        </span>
        </f:facet>
        </mobi:contentMenuItem>
        <mobi:contentMenuItem label="Page 2" value="page2"/>
        <mobi:contentMenuItem label="Page 3" value="page3"/>
        </mobi:contentStackMenu>

        </h:form>
        </f:facet>
        <f:facet name="right">
        <mobi:contentStack id="contentStack" contentMenuId="contentStackMenu"
        currentId="#

        {contentStackMenu4.currentPane}

        ">
        <mobi:contentPane id="page1" client="true" >
        <h:form>
        <h2>Page 1</h2>
        <mobi:contentStackFormProxy/>
        </h:form>
        </mobi:contentPane>
        <mobi:contentPane id="page2" client="true">
        <h2>Page 2</h2>
        <mobi:contentStackFormProxy/>
        </mobi:contentPane>
        <mobi:contentPane id="page3" client="true">
        <h2>Page 3</h2>
        <mobi:contentStackFormProxy/>
        </mobi:contentPane>
        </mobi:contentStack>
        </f:facet>
        </mobi:splitPane>

        </mobi:largeView>

        mobitest sample is under jsf/components/tests folder.

        the code path for icon in this example is executed at line 285 in the ContentMenuItemRenderer and the facet is not checked here. Might want to refactor that and have the check done in both code paths?

        Show
        Judy Guglielmin added a comment - - edited i took the facet from the Jira and put it on mobitest/layout/contentStackMenu/contentStackMenu4.jsf page. I cannot get the facet to render. When I go through the debugger I noticed that the code path for the facet does not get used when this page is rendered. Also, the facet is not encoded unless iconPlacement is non-null. I added the iconPlacement attribute, but still not getting the facet to render. here is the snippet on that page I added for largeView <mobi:largeView> <mobi:splitPane columnDivider="30"> <f:facet name="left"> <h:form> <mobi:contentStackMenu id="contentStackMenu" contentStackId="contentStack"> <mobi:contentMenuItem label="Menu"/> <mobi:contentMenuItem label="Page 1" value="page1" iconPlacement="right" icon="envelope"> <f:facet name="icon"> <span class="fa-stack fa-lg"> <i class="fa fa-envelope-o fa-stack-2x"></i> <i class="fa fa-circle fa-stack-1x" style="color:red;"></i> <strong class="fa fa-stack-1x" style="color:white;">9</strong> </span> </f:facet> </mobi:contentMenuItem> <mobi:contentMenuItem label="Page 2" value="page2"/> <mobi:contentMenuItem label="Page 3" value="page3"/> </mobi:contentStackMenu> </h:form> </f:facet> <f:facet name="right"> <mobi:contentStack id="contentStack" contentMenuId="contentStackMenu" currentId="# {contentStackMenu4.currentPane} "> <mobi:contentPane id="page1" client="true" > <h:form> <h2>Page 1</h2> <mobi:contentStackFormProxy/> </h:form> </mobi:contentPane> <mobi:contentPane id="page2" client="true"> <h2>Page 2</h2> <mobi:contentStackFormProxy/> </mobi:contentPane> <mobi:contentPane id="page3" client="true"> <h2>Page 3</h2> <mobi:contentStackFormProxy/> </mobi:contentPane> </mobi:contentStack> </f:facet> </mobi:splitPane> </mobi:largeView> mobitest sample is under jsf/components/tests folder. the code path for icon in this example is executed at line 285 in the ContentMenuItemRenderer and the facet is not checked here. Might want to refactor that and have the check done in both code paths?
        Judy Guglielmin made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Assignee Priority P1 [ 10010 ]
        Arturo Zambrano made changes -
        Attachment screenshot icon facet.png [ 22676 ]
        Hide
        Arturo Zambrano added a comment -

        The icon facet is actually working for me, as seen in the screenshot. I just copy/pasted the facet markup and put it inside the 'Page 1' content menu item.

        The iconPlacement and icon attributes are actually not necessary when using the facet, but the facet will still be displayed if those attributes are declared, since it overrides the icon attribute.

        I tested this on Chrome, FF, and Edge.

        This was only committed to http://dev.icesoft.com/svn/ossrepo/icemobile/trunk/icemobile

        Did it have to be committed somewhere else?

        Show
        Arturo Zambrano added a comment - The icon facet is actually working for me, as seen in the screenshot. I just copy/pasted the facet markup and put it inside the 'Page 1' content menu item. The iconPlacement and icon attributes are actually not necessary when using the facet, but the facet will still be displayed if those attributes are declared, since it overrides the icon attribute. I tested this on Chrome, FF, and Edge. This was only committed to http://dev.icesoft.com/svn/ossrepo/icemobile/trunk/icemobile Did it have to be committed somewhere else?
        Arturo Zambrano made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Arturo Zambrano
            Reporter:
            Arturo Zambrano
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: