Welcome to mirror list, hosted at ThFree Co, Russian Federation.

wikis.js.coffee « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1ee827f1fa3c2b4c7dc93db15a9b6374024b4d3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#= require latinise

class @Wikis
  constructor: ->
    $('.new-wiki-page').on 'submit', (e) =>
      $('[data-error~=slug]').addClass('hidden')
      field = $('#new_wiki_path')
      slug = @slugify(field.val())

      if (slug.length > 0)
        path = field.attr('data-wikis-path')
        location.href = path + '/' + slug
        e.preventDefault()

  dasherize: (value) ->
    value.replace(/[_\s]+/g, '-')

  slugify: (value) =>
    @dasherize(value.trim().toLowerCase().latinise())