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

19 lines
467 B
CoffeeScript
Raw Normal View History

#= require latinise
2015-04-26 12:48:37 +05:30
class @Wikis
2014-09-02 18:07:02 +05:30
constructor: ->
$('.build-new-wiki').bind 'click', (e) =>
$('[data-error~=slug]').addClass('hidden')
2014-09-02 18:07:02 +05:30
field = $('#new_wiki_path')
slug = @slugify(field.val())
2014-09-02 18:07:02 +05:30
if (slug.length > 0)
2015-09-11 14:41:01 +05:30
path = field.attr('data-wikis-path')
location.href = path + '/' + slug
dasherize: (value) ->
value.replace(/[_\s]+/g, '-')
slugify: (value) =>
@dasherize(value.trim().toLowerCase().latinise())