Menu

ManageBrick - "create" button?

2022-06-17
2022-10-23
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2022-06-17

    Is it possible to add a "create" button at the bottom of the page which gets created using a ManageBrick?

    Rather than a separate menu-item or button on the overview page, I'd like a "create" button on the list overview of available tickets.

    And while thinking about it, would be even better/more in the spotlight if this could be added on top of the list instead (similar to the "actions" in the iTop backend)

     
  • Guillaume Lajarige

    Hello Jeffrey,

    Yes totally, but not as easily as with the backoffice menu API:
    * Create a TWIG template that extends the template of the ManageBrick
    * Overload the pMainHeaderActions block for example to add your markup
    * In the portal XML configuration, specify for this ManageBrick instance (eg. ongoing-tickets-for-portal-user) the TWIG template to use in //brick[@id="ongoing-tickets-for-portal-user"]/templates/template[@id="page"]. See full XML documentation here.

    Hope this helps,
    Guillaume

     
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2022-06-19

    Thanks for the hint, I'll look into this one!

     
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2022-06-20

    This doesn't work properly for ManageBrick, does it?

    I'm under the impression that through the ManageBrickController::GetPageTemplateFromDisplayMode() method a hardcoded path is retrieved from the ManageBrick ( const ENUM_PAGE_TEMPLATE_PATH_TABLE = 'itop-portal-base/portal/templates/bricks/manage/layout-table.html.twig'; ) .

    But that twig file refers to the original layout.html.twig, not the redefined one?

    Is there an elegant solution or should I extend the ManageBrick as a workaround?

     

    Last edit: Jeffrey Bostoen 2022-06-20
  • Guillaume Lajarige

    Oh damn... This is indeed a regression that was introduced in iTop 2.5 with the different display types... 😥
    The overloading of templates for this brick is no longer possible, sorry.

    Guillaume

     
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2022-06-26

    So what would be the best way to go forward?

    Adjsut the existing ManageBrick, perhaps if I get to it, create a pull request?

    Or just extend the ManageBrick or (probably way shorter) create a UI hack?

     
  • Hipska

    Hipska - 2022-06-28

    IMHO, the ManageBrick should be fixed.

     
    👍
    1
  • Pierre Goiffon

    Pierre Goiffon - 2022-07-05

    Jeffrey did create a ticket : [#2079]

     

    Related

    Tickets: #2079

  • Guillaume Lajarige

    Yes the brick should be fixed indeed, but I'm not sure which approach will should take without making its XML definition evolve.

    //brick/templates/template[@id="page"] is supposed to overload the global brick page template (datamodels/2.x/itop-portal-base/portal/templates/bricks/manage/layout.html.twig), but in the case of the ManageBrick it can have several display modes (list, pie, bar), each of these having their own TWIG template.

    So my proposal would be :

    Solution 1 - Best proposition
    In a PR restore overload of the whole brick template
    Do it so the display mode templates extends either the default or the specified template. i'm not sure it's possible though as it would mean having a variable as the parent template.

    Ultimately each display mode should have a template option so we can overload them, but that a whole different matter

    Solution 2 - Not great but can help
    In a PR restore overload of the whole brick template
    Don't do anything else, but that means that the overloaded tempalte can have only 1 display mode. This can be acceptable as it will be only affecting the desired bricks instance.

    Any thoughts?

     

    Last edit: Guillaume Lajarige 2022-10-23
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2022-07-28

    I don't have a real preference to be honest, just a resolution for the use-case.

    A separate feature request to simply enable a "create" button here would also be great.

     
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2022-10-23

    What would be the best way for a fast and proper solution to this?

    It's a bit overkill IMHO to have a separate button for this in a portal, especially if there are already a lot of other buttons as well.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.