debian-mirror-gitlab/app/assets/javascripts/wikis.js.coffee

18 lines
526 B
CoffeeScript
Raw Normal View History

2015-04-26 12:48:37 +05:30
class @Wikis
2014-09-02 18:07:02 +05:30
constructor: ->
2015-09-11 14:41:01 +05:30
$('.build-new-wiki').bind "click", (e) ->
$('[data-error~=slug]').addClass("hidden")
$('p.hint').show()
2014-09-02 18:07:02 +05:30
field = $('#new_wiki_path')
2015-09-11 14:41:01 +05:30
valid_slug_pattern = /^[\w\/-]+$/
2014-09-02 18:07:02 +05:30
2015-09-11 14:41:01 +05:30
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")