Conversation
I am currently working on supporting tags in this component, while also supporting ember data. You can pass in an ember data record array (DS.RecordArray) instance, and it will create new tags based on the `type` of the recordarray. This PR is still a WIP, any feedback is welcome!
addon/components/select-2.js
Outdated
There was a problem hiding this comment.
I am forcing the lowercase of the ID here, since you don't want tags that only differ in uppercase or lowercase and are still added.
There was a problem hiding this comment.
Seems fine with me, especially since this only applies for tagging=true 👍
addon/components/select-2.js
Outdated
There was a problem hiding this comment.
I need to check the type of the value property here, so it can both support ember data record arrays and simple objects.
|
Thanks for the work you put into this! I like how you aim for a high code quality and test coverage, it is great. I added some comments to the code, but I'm already very happy with the direction this is going. |
|
@iStefo Good to hear 👍 I am sure many people will like this feature. I think this will be the only library that has ember data support build in for creating tags. Without the need of implementing factory actions for every select box. I will work on your comments and refactor my code some more. Also, I think it is nicer to name the option A small change, but I think it fits better. |
|
Actually, I'm not sure about naming this option |
|
@iStefo Ah, np, will leave it as |
ember objects instead of ember data models. This is automatically determined by this component.
|
@iStefo I made some good progress and expanded the examples page. It currently uses the matcher to prevent creating new tags that already exists. Because I use the matcher is also handles diacritics. Also added support for plain ember arrays & objects. What do you think of the examples so far, is it enough? Also, how should we handle |
|
I checked out your branch and fixed the example code indentation (general indentation for the examples.hbs is still a mess, though). How can I incorporate my changes to the PR? PR your forked repo? Sounds unnecessarily complicated though, should I send you my .patch? |
|
Wow. This is awesome Thank you! |
|
Hey guys - what's the latest on this? I took a look at the diff and tried to apply some of the Ember Data changes to my local copy but can't figure out where is the correct spot with ember addon. As for this PR, why are we limiting Ember Data support to only when "tags" are being used? Shouldn't I just be able to use a Let me know if I can help or provide more info as this is a blocker for me right now. |
|
+1 I also need this functionality and was glad I found out someone already worked on it, but it's been a while already, is it ready to be merged? Any ways I could help? |
|
Hmm, I see select2 (and select2-ember) already supports |
There was a problem hiding this comment.
I had to change Ember.ArrayProxy to DS.ManyArray to get this to work as expected. I'm on Ember 1.13.7 and Ember Data 1.13.8, and when I use the hasMany relationship as value, this is false, and my values aren't properly displayed. Obviously this would break for those not using Ember Data.
|
Are these changes usable when we install the addon? I'm trying to get it to work but it seems i still can't add new tags. {{select-2
content=tag_list
optionValuePath="name"
optionLabelPath="name"
optionIdPath="name"
value=selectedTags
multiple=true
createTags=true
placeholder="Choose some Tags"
}}Is there something i'm doing wrong? |
|
Any update on this? I'm using Ember v1.13.3 with Ember Data v1.13.5 and it is not working. It appears that the new value is not getting added to the |
This fixes issue #7
I am currently working on supporting tags in this component, while also supporting ember data. You can pass in an ember data record array (
DS.RecordArray) instance, and it will create new tags based on thetypeof the recordarray, almost magic.This PR is still a WIP and is still made with only ember data in mind, any feedback is welcome!
@iStefo Could you review this, note this is still a WIP, but would like to know your ideas on this.
Currently, the following settings work as you would expect:
titleorname.Example usage (you could leave out
contenthere if you don't want to preload some tags):TODO
createTagandremoveTagthat can override default behaviour