?
avatar Thammada
Thammada
21 Mar 2015

If a field type "media" is inside "repeatable" field, when the preview attribute of "media" field is set to "true" of "tooltip" no image is previewed when a file is selected.

avatar Thammada Thammada - change - 21 Mar 2015
Labels Removed: ?
avatar Thammada Thammada - open - 21 Mar 2015
avatar zero-24 zero-24 - change - 22 Mar 2015
Category Libraries
avatar zero-24
zero-24 - comment - 22 Mar 2015

@Thammada can you provide example code?


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6530.
avatar Fedik
Fedik - comment - 22 Mar 2015

I can confirm it,
@zero-24 as example you can use xml from that pull #3574

I have no idea how it can be fixed, without another dirty hack :rabbit:

avatar zero-24 zero-24 - change - 22 Mar 2015
Status New Confirmed
avatar brianteeman brianteeman - change - 23 Mar 2015
Labels Added: ?
avatar jrmcar
jrmcar - comment - 15 Apr 2015

Hi,
I'm a student, interested in joomla and i would like to contribute (first time).
I don't really understand how to re-create the bug. Can someone help me please ?


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6530.

avatar Thammada
Thammada - comment - 15 Apr 2015

@zero-24 the following xml snippet can be used as an example

<field name="test" type="repeatable" icon="list"
        label="Test" description="Test descr"
        default=""
        maximum="5">
    <fieldset hidden="true" repeat="true">
        <field name="test_media_preview" type="media" directory=""
            label="media" description="test_media_preview" preview="true"/>
        <field name="test_media_tooltip" type="media" directory=""
            label="media" description="test_media_tooltip" preview="tooltip"/>
    </fieldset>
</field>

The issue is caused by the function incresseAttrName (should be increaseAtrrName by the way) in /media/system/js/repeatable.js which renames all input fields to avoid duplicate input ids by appending an integer suffix. However the code which is used to update the preview of the type="media" also use suffixes like _preview_empty and _preview_img.

For example id="field_name" becomes id="field_name-1" and id="field_name_preview_img" becomes id="field_name_preview_img-1" but the preview function looks for id="field_name_preview-1_preview_img"

I suggest fixing in repeatable.js by using a prefix instead of suffix to prevent duplicate ids, would there be another conflict in that case?

Edit: It would be better to find ids ending with _preview, _preview_img and preview_empty, this does solve the issue when the attribute preview="true" is set, but does not solve the problem when preview="tooltip"

@Fedik do you know what causes the tooltip not to show up?

avatar brianteeman brianteeman - change - 10 Mar 2016
Category Libraries Fields Libraries
avatar wilsonge
wilsonge - comment - 9 Apr 2016

I'm going to close this issue in favour of #6882 which is the same issue but has a more detailed conversation in - to keep things in one place :)

avatar wilsonge wilsonge - change - 9 Apr 2016
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2016-04-09 14:33:17
Closed_By wilsonge
avatar wilsonge wilsonge - close - 9 Apr 2016

Add a Comment

Login with GitHub to post a comment