summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/group_avatar.js
blob: f03b47b1c1da46386f2971980beb7c33a5188909 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* eslint-disable func-names, space-before-function-paren, wrap-iife, quotes, no-var, one-var, one-var-declaration-per-line, no-useless-escape, max-len */

window.GroupAvatar = (function() {
  function GroupAvatar() {
    $('.js-choose-group-avatar-button').on("click", function() {
      var form;
      form = $(this).closest("form");
      return form.find(".js-group-avatar-input").click();
    });
    $('.js-group-avatar-input').on("change", function() {
      var filename, form;
      form = $(this).closest("form");
      filename = $(this).val().replace(/^.*[\\\/]/, '');
      return form.find(".js-avatar-filename").text(filename);
    });
  }

  return GroupAvatar;
})();