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.
Labels |
Removed:
?
|
Category | ⇒ | Libraries |
Status | New | ⇒ | Confirmed |
Labels |
Added:
?
|
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 ?
@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?
Category | Libraries | ⇒ | Fields Libraries |
Status | Confirmed | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-04-09 14:33:17 |
Closed_By | ⇒ | wilsonge |
@Thammada can you provide example code?
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6530.