gitlab-org--gitlab-foss/app/assets/javascripts/wikis.js.coffee

18 lines
526 B
CoffeeScript
Raw Normal View History

2014-10-20 16:48:07 -04:00
class @Wikis
2013-05-02 07:36:53 -04:00
constructor: ->
$('.build-new-wiki').bind "click", (e) ->
$('[data-error~=slug]').addClass("hidden")
$('p.hint').show()
2013-05-02 07:36:53 -04:00
field = $('#new_wiki_path')
valid_slug_pattern = /^[\w\/-]+$/
2013-05-02 07:36:53 -04:00
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")