Clean up Tag implementation

1 view
Skip to first unread message

eksatx

unread,
Jun 30, 2009, 7:20:55 PM6/30/09
to CommunityEngine
My users have been complaining about a few fit 'n' finish issues with
tags.

There are three obvious things:

1. You can separate tags with either spaces or commas
2. You can't have a tag with spaces
3. You can have a tag with special characters (like quotes)

This has lead to users trying to tag things like this:

something, another thing

Instead of two tags, they end up with three tags: "something" +
"another" + "thing"

The other weird thing is that the tag_list.to_s method lists the tags
separated by spaces with a + sign after tags like this:

something+ another+ thing

Inexperienced users have reported being confused by this.

Here is what I am proposing to do:

1. Disallow any whitespace in the tag_list input
2. Allow only alphanumeric characters in the tag_list input
3. Display the tag list separated by commas
4. Automatically Capitalize tags -- not sure if everybody would want
this
4. Provide a tag admin interface so the administrator can easily edit/
delete tags (mainly to make it easy to delete inappropriate tags).

I should be able to knock this out quickly, but I wanted to get some
feedback from the group first to make sure my changes seem appropriate
for everybody.

Bruno Bornsztein

unread,
Jul 1, 2009, 7:40:08 AM7/1/09
to communi...@googlegroups.com
These are use cases that should be covered (acts_as_taggable_on_steroids is built to cover them). If they aren't working, I consider these bugs, not feature requests.

1. Disallow any whitespace in the tag_list input
Not necessary.
 
2. Allow only alphanumeric characters in the tag_list input
Probably not needed: tags should be URL encoded when used in route generation.
 
3. Display the tag list separated by commas
Sure, that's fine... I often use a little tag icon by each tag as well.
 
4. Automatically Capitalize tags -- not sure if everybody would want
this
I'd say no to this.
 
4. Provide a tag admin interface so the administrator can easily edit/
delete tags (mainly to make it easy to delete inappropriate tags).
Great idea!


Bottom line: sounds like our tagging implementation is a little broken (not handling commas, quotes correctly) and needs fixing.

Errol Siegel

unread,
Jul 1, 2009, 10:59:36 AM7/1/09
to communi...@googlegroups.com
Thanks for  the feedback.

Just to clarify: the item about showing tags in a comma-separated list only applies to the New and Edit views -- they are shown separated by plus signs in the text input field.

I have used AATOS in other projects and not seen these behaviors so what you are saying  makes sense -- there may be some bugs in the CE code that is causing these issues.

I'll come up with some specific, reproducible use cases.  If you agree that they are bugs then I'll add them to Lighthouse (and help fix them).

Bruno Bornsztein

unread,
Jul 1, 2009, 1:34:48 PM7/1/09
to communi...@googlegroups.com
Great. Thanks!

sprite

unread,
Jul 1, 2009, 5:05:08 PM7/1/09
to CommunityEngine
I just patched in the latest tags code from edge into my code base and
I'm experiencing the same issues.

Surrounding the tags in quotes makes them one tag

>> TagList.from('Multiword Tag, Oneword')
=> ["Multiword", "Tag", "Oneword"]
>> TagList.from('"Multiword Tag", "Oneword"')
=> ["Oneword", "Multiword Tag"]



On Jul 1, 1:34 pm, Bruno Bornsztein <bruno.bornszt...@gmail.com>
wrote:
> Great. Thanks!
>
> On Wed, Jul 1, 2009 at 9:59 AM, Errol Siegel <errolsie...@gmail.com> wrote:
> > Thanks for  the feedback.
>
> > Just to clarify: the item about showing tags in a comma-separated list only
> > applies to the New and Edit views -- they are shown separated by plus signs
> > in the text input field.
>
> > I have used AATOS in other projects and not seen these behaviors so what
> > you are saying  makes sense -- there may be some bugs in the CE code that is
> > causing these issues.
>
> > I'll come up with some specific, reproducible use cases.  If you agree that
> > they are bugs then I'll add them to Lighthouse (and help fix them).
>
> > On Wed, Jul 1, 2009 at 6:40 AM, Bruno Bornsztein <
> > bruno.bornszt...@gmail.com> wrote:
>
> >> These are use cases that *should* be covered

sprite

unread,
Jul 1, 2009, 5:11:35 PM7/1/09
to CommunityEngine
Changing delimiter to

self.delimiter = ','

in tag_list.rb seems to take care of the problem. Let me know if that
works.

On Jul 1, 1:34 pm, Bruno Bornsztein <bruno.bornszt...@gmail.com>
wrote:
> Great. Thanks!
>
> On Wed, Jul 1, 2009 at 9:59 AM, Errol Siegel <errolsie...@gmail.com> wrote:
> > Thanks for  the feedback.
>
> > Just to clarify: the item about showing tags in a comma-separated list only
> > applies to the New and Edit views -- they are shown separated by plus signs
> > in the text input field.
>
> > I have used AATOS in other projects and not seen these behaviors so what
> > you are saying  makes sense -- there may be some bugs in the CE code that is
> > causing these issues.
>
> > I'll come up with some specific, reproducible use cases.  If you agree that
> > they are bugs then I'll add them to Lighthouse (and help fix them).
>
> > On Wed, Jul 1, 2009 at 6:40 AM, Bruno Bornsztein <
> > bruno.bornszt...@gmail.com> wrote:
>
> >> These are use cases that *should* be covered

eksatx

unread,
Jul 1, 2009, 7:22:35 PM7/1/09
to CommunityEngine
You are on the right track, but there must be more to it than that.

1. That is how that file started out. It was changed to its current
state to fix some other bug.
2. Changing it back causes 10 tests to fail.

I have entered a bug. With any luck Bruno can shed some light on the
situation.

Meanwhile, I am going to move ahead with creating an admin interface
for editing tags. I think that will be useful regardless of the
outcome of this particular issue.

eksatx

unread,
Jul 4, 2009, 12:50:09 PM7/4/09
to CommunityEngine
On closer examination, I see that all the tests that fail are because
of the handling of spaces.

The tests create objects with tag_list="tag1 tag2" and then expect it
to create two tags.

If I change all the tests to expect tags to be comma-separated, then
they all pass fine.

I guess we're getting into an area of opinion, and Bruno's is the
opinion that matters (as far as what goes into the official repo).

Based on experience with my CE site (as well as having developed
numerous other sites that rely on AAToS), and also based on feedback
Bruno provided previously in this thread, here is what I recommend:

1. Use only a comma as a tag separator in input text fields.
2. Allow spaces and plus signs in tag names (not as separators)

I think this makes usage predictable and intuitive.

As far as I can tell, simply changing the setting for the delimiter
back to the default of a comma (and updating the functional tests)
seems to accomplish this.

Bruno -- can you weigh in here? Are there other things that will not
work right this way? Perhaps things that don't have tests yet?

Btw, I created a simple tag admin interface. I will send a pull
request for this some time this weekend.

Bruno Bornsztein

unread,
Jul 6, 2009, 10:51:34 AM7/6/09
to communi...@googlegroups.com
1. Use only a comma as a tag separator in input text fields.
2. Allow spaces and plus signs in tag names (not as separators)
That's fine with me. Let's just make sure to update the form labels to make it clear (i.e. "Tags (comma-separated)")


Bruno -- can you weigh in here?  Are there other things that will not
work right this way?  Perhaps things that don't have tests yet?
Nope, that should be fine. 
Thanks,
Bruno 

Errol Siegel

unread,
Jul 6, 2009, 1:09:13 PM7/6/09
to communi...@googlegroups.com
Great.  I'll do a more thorough search for labels as you suggested and make any necessary updates.
Reply all
Reply to author
Forward
0 new messages