Opened 12 years ago
Closed 12 years ago
#186 closed defect (bug) (fixed)
"request" keyword is added multiple times
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Priority: | normal | |
Component: | Make (Get Involved) / P2 | Keywords: | |
Cc: |
Description
On the Polyglots blog, if you click "request" several times in a row, the keyword is appended multiple times, which looks weird (see the screenshot).
This is the click handler:
$('.p2-request-tag').click( function() { var tags = $('#tags'), val = tags.val(); if ( val === 'Tag it' ) tags.val( 'request, '); else tags.val( 'request, ' + val ); });
I don't see it anywhere in the open sourced code, but this should fix it:
$('.p2-request-tag').click( function() { var tags = $('#tags'), val = tags.val(); if ( val === 'Tag it' ) tags.val( 'request, '); else if ( 'request,' != val.substr( 0, 8 ) ) tags.val( 'request, ' + val ); });
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
Fixed.
I opted to use
val.indexOf( 'request' ) < 0
instead of'request,' != val.substr( 0, 8 )
as the conditional check before adding 'request' into the tags field so that if the tag appears anywhere (instead of just the beginning) then it won't be added via the helper link.