Skip to content

Hardcoded jp_container - multiple components #6

@olenderhub

Description

@olenderhub

Hello,

As I noticed there is a problem when you want to have multiple jplayer-component.
Checked http://jplayer.org/latest/demo-03/
and there is a cssSelectorAncestor.

In the code, it's hardcoded with #jp_container_1
https://github.com/MammothHR/ember-jplayer/blob/master/addon/components/jplayer-component.js#L22

The same in the HTML (emblem)
https://github.com/MammothHR/ember-jplayer/blob/master/addon/templates/components/jplayer-component.embl#L2

That should be changed dynamically, because if you have multiple components, then you turn all of them at once, also ID should be unique and is not.

My proposition to solve this issue is do something like:
cssSelectorAncestor: `#jp_container_${this.elementId}`
in https://github.com/MammothHR/ember-jplayer/blob/master/addon/components/jplayer-component.js#L22

and the same thing do in emblem using for example concat helper
(you can see example of concat here https://www.emberjs.com/blog/2018/07/02/ember-3-2-released.html)

Some information about elementId in a discussion on https://stackoverflow.com/questions/26159979/how-to-get-emberjs-generated-element-id-in-controller

Best regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions