Limiting Tags field
Hey There,
I was wondering, if there is a way to limit how many tags can be added to an item? I've looked through the code, maybe I missed something but I found no possibility to do so.
Cheers, David
Nope, not at present.
On Thu, Sep 4, 2014 at 9:09 AM, David Lonyai [email protected] wrote:
Hey There,
I was wondering, if there is a way to limit how many tags can be added to an item? I've looked through the code, maybe I missed something but I found no possibility to do so.
Cheers, David
— Reply to this email directly or view it on GitHub https://github.com/punkave/apostrophe/issues/157.
*THOMAS BOUTELL, *DEV & OPS P'UNK AVENUE | (215) 755-1330 | punkave.com
Hey @jsumnersmith and @stuartromanek, as folks who deal with client projects a lot, how do you feel about the idea of an option to limit the number of tags you can apply to something?
@pixeleet, we do have the lockTags option (in app.js) which prevents non-admins from creating any new tags. That might have the effect you're really looking for, if it is similar to a client of ours who needed to prevent hundreds of users from creating a vast, out-of-control folksonomy.
While we haven't had a use case for it, I can see it being a useful option somewhere down the line.
Hey Tom,
Thanks for the quick reply. That could be a temporary solution.
The use-case is the following: We're creating a website for the community for an open-office style workplace. Users can register themselves and record the basic details, tags are a part of that.
We can have the content-manager do the tagging, but if this is the case, changing a tag has to go through them and adding new people is more challenging.
It would be most fortunate to be able to limit the tags to a maximum of three for every user as that is how much content we're able to display in a block at once.
For now I can do a workaround where we only use the first three tags and that should be ok for now.
If you guys are too busy on other stuff I can start digging and see if I can implement it in a way that fits the Apostrophe team's coding style.
Is that an idea?
cheers, David
Hey, we love pull requests!
jQuery Selective already has a limit option. However apos.enableTags (in user.js) currently does not have a provision for passing extra options to it. It would need that missing third argument, and editor.js in apostrophe-schemas would need to recognize a "limit" option in fields of type "tags" and pass it on when calling enableTags. Basically a small amount of missing plumbing.
The schema really should also enforce the restriction in the converter when saving. That is, the self.converters.form.tags code in schemas/index.js would need to look for a limit property of the field and respect it if present.
Then you'd be able to use addFields to re-configure the "tag" field in the schema for people, giving it a "limit" property.
Not sure how deep in the guts of Apostrophe you are at this point, so I don't know much of this makes sense, but it's good notes for whoever winds up implementing this in any case (:
On Thu, Sep 4, 2014 at 9:19 AM, David Lonyai [email protected] wrote:
Hey Tom,
Thanks for the quick reply. That could be a temporary solution.
The use-case is the following: We're creating a website for the community for an open-office style workplace. Users can register themselves and record the basic details, tags are a part of that.
We can have the content-manager do the tagging, but if this is the case, changing a tag has to go through them and adding new people is more challenging.
It would be most fortunate to be able to limit the tags to a maximum of three for every user as that is how much content we're able to display in a block at once.
For now I can do a workaround where we only use the first three tags and that should be ok for now.
If you guys are too busy on other stuff I can start digging and see if I can implement it in a way that fits the Apostrophe team's coding style.
Is that an idea?
cheers, David
— Reply to this email directly or view it on GitHub https://github.com/punkave/apostrophe/issues/157#issuecomment-54474256.
*THOMAS BOUTELL, *DEV & OPS P'UNK AVENUE | (215) 755-1330 | punkave.com
Yeah, I haven't needed it yet but it would be a nice-to-have option
Thanks Tom!
I've been digging for some time now. So I can grasp the magic more or less.
I'll come back to the issue tomorrow or early next week and start coding based on your well written guidelines!
Thanks a lot guys! I love working with Apos;)
Hi @pixeleet, I saw you submitted a pull request for this, but @boutell had mentioned it needing some adjustments. Did you get a chance to update it?
To my understanding it's already merged ;) https://github.com/punkave/apostrophe/pull/159
2015-02-21 5:02 GMT+01:00 benirose [email protected]:
Hi @pixeleet https://github.com/pixeleet, I saw you submitted a pull request for this, but @boutell https://github.com/boutell had mentioned it needing some adjustments. Did you get a chance to update it?
— Reply to this email directly or view it on GitHub https://github.com/punkave/apostrophe/issues/157#issuecomment-75354546.
Great!