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

wikis.js « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d92c0a9574f092070cd4bdec29fc75f175f44b86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Generated by CoffeeScript 1.10.0
(function() {
  var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };

  this.Wikis = (function() {
    function Wikis() {
      this.slugify = bind(this.slugify, this);
      $('.new-wiki-page').on('submit', (function(_this) {
        return function(e) {
          var field, path, slug;
          $('[data-error~=slug]').addClass('hidden');
          field = $('#new_wiki_path');
          slug = _this.slugify(field.val());
          if (slug.length > 0) {
            path = field.attr('data-wikis-path');
            location.href = path + '/' + slug;
            return e.preventDefault();
          }
        };
      })(this));
    }

    Wikis.prototype.dasherize = function(value) {
      return value.replace(/[_\s]+/g, '-');
    };

    Wikis.prototype.slugify = function(value) {
      return this.dasherize(value.trim().toLowerCase().latinise());
    };

    return Wikis;

  })();

}).call(this);