Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-137842

Make Editable Fragment Fields Repeatable



      The live editing in fragments is very user friendly and is great for creating one of something. The challenge in UX comes when trying to add more than one of something. This is relatively easy in Web Content with the use of repeatable fields. A site admin can click the plus icon to add a second, third or fourth thing.

      Take the carousel slider fragment for example.

      In that fragment multiple slides have to be hard coded, so the user would only be given the choice of how ever many HTML blocks were provided for them. Contrast to Web Content and that feature is much more flexible than Fragments.



      A surrounding div say around the slider carousel HTML in the fragment could be provided to denote that a plus/minus icon (+ and -) be added in page edit mode of a content page. This would then allow a site admin to easily repeat however many HTML blocks they need to without the fragment creator having to have hard coded those blocks (and subsequent unique ID's).

      The tag could be:


      Unfortunately while we can create collections and such, this is just too complicated for the average user and as a seasoned front end dev using Liferay for many years, it's too complicated for me to implement and then train my users.

      We have the perfect solution in Web Content with repeatable fields and that feature should be implemented urgently to help us move to fragments. Else we will have to stick with the easier way in Web Content.

      jQuery Workaround:

      I do have an ugly workaround to this and that is to try to use jQuery to dynamically create blocks of HTML. Say in the configuration of the fragment I can offer a dropdown to the user (how many things of a thing are needed), say they have said I wanted 5 things, I can loop around a jQuery and dynamically create those 5 blocks of repeated HTML.

      The problem is that these HTML blocks are never saved when publishing the page.


      Fragment Configuration Example:

      The other workaround is to add multiple fields into the fragment configuration

      Say I have a fragment that need to display 4 videos (thumbnails etc, as in a playlist) ... I can give 4 text fields in the fragment configuration for each of the video iframe src for the user to input, but I am still limited to a set number of things of a thing. If they wanted 5 or 6 videos I couldn't do that?


        Issue Links



              mateo.hermosin Mateo Hermosin
              lee.jordan1 Lee Jordan
              0 Vote for this issue
              0 Start watching this issue




                  Version Package