mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-01-27 19:50:56 +00:00
Add cleanup function
This commit is contained in:
parent
1abc42851a
commit
5c6d40c18a
1 changed files with 8 additions and 0 deletions
|
@ -29,6 +29,14 @@ module Extra
|
||||||
Sanitize.clean(text.to_s).bbcode_to_html.gsub(/\n|\r\n/, "<br>").html_safe
|
Sanitize.clean(text.to_s).bbcode_to_html.gsub(/\n|\r\n/, "<br>").html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def cleanup_string(str, len=20)
|
||||||
|
str = str.gsub(/[^0-9A-Za-z\-_]/, '')
|
||||||
|
if str.length > len
|
||||||
|
str = str.to_s[0, len]
|
||||||
|
end
|
||||||
|
return str
|
||||||
|
end
|
||||||
|
|
||||||
def move_up(objects, column = "position")
|
def move_up(objects, column = "position")
|
||||||
n = 0
|
n = 0
|
||||||
# the objects need to be assigned before loop or the order is not right
|
# the objects need to be assigned before loop or the order is not right
|
||||||
|
|
Loading…
Reference in a new issue