blob: 81cfc37b956f5ef458d6fc849db1d5206fd4fa2c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
class @Wikis
constructor: ->
$('.build-new-wiki').bind "click", (e) ->
$('[data-error~=slug]').addClass("hidden")
$('p.hint').show()
field = $('#new_wiki_path')
valid_slug_pattern = /^[\w\/-]+$/
slug = field.val()
if slug.match valid_slug_pattern
path = field.attr('data-wikis-path')
if(slug.length > 0)
location.href = path + "/" + slug
else
e.preventDefault()
$('p.hint').hide()
$('[data-error~=slug]').removeClass("hidden")
|