Set tags max length to 160
This commit is contained in:
@@ -8,7 +8,7 @@ App.Tags =
|
|||||||
|
|
||||||
unless $this.data('initialized') is 'yes'
|
unless $this.data('initialized') is 'yes'
|
||||||
$this.on('click', ->
|
$this.on('click', ->
|
||||||
name = $(this).text()
|
name = '"' + $(this).text() + '"'
|
||||||
current_tags = $tag_input.val().split(',').filter(Boolean)
|
current_tags = $tag_input.val().split(',').filter(Boolean)
|
||||||
|
|
||||||
if $.inArray(name, current_tags) >= 0
|
if $.inArray(name, current_tags) >= 0
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
class TagSanitizer
|
class TagSanitizer
|
||||||
DISALLOWED_STRINGS = %w(? < > = /)
|
DISALLOWED_STRINGS = %w[? < > = /]
|
||||||
|
|
||||||
def sanitize_tag(tag)
|
def sanitize_tag(tag)
|
||||||
tag = tag.dup
|
tag = tag.dup
|
||||||
DISALLOWED_STRINGS.each do |s|
|
DISALLOWED_STRINGS.each do |s|
|
||||||
tag.gsub!(s, '')
|
tag.gsub!(s, "")
|
||||||
end
|
end
|
||||||
tag.truncate(TagSanitizer.tag_max_length)
|
tag.truncate(TagSanitizer.tag_max_length)
|
||||||
end
|
end
|
||||||
@@ -14,7 +14,7 @@ class TagSanitizer
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.tag_max_length
|
def self.tag_max_length
|
||||||
40
|
160
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user