summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/project_avatar.js
blob: a6d3ba9eb868de8b7e6b71723992fa52f87ae0c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, one-var, one-var-declaration-per-line, no-useless-escape, max-len */
(function() {
  this.ProjectAvatar = (function() {
    function ProjectAvatar() {
      $('.js-choose-project-avatar-button').bind('click', function() {
        var form;
        form = $(this).closest('form');
        return form.find('.js-project-avatar-input').click();
      });
      $('.js-project-avatar-input').bind('change', function() {
        var filename, form;
        form = $(this).closest('form');
        filename = $(this).val().replace(/^.*[\\\/]/, '');
        return form.find('.js-avatar-filename').text(filename);
      });
    }

    return ProjectAvatar;
  })();
}).call(this);