summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/group_avatar.js
blob: c28ce86d7afc8cc8878b67d5c2265057b3f3421c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
(function() {
  this.GroupAvatar = (function() {
    function GroupAvatar() {
      $('.js-choose-group-avatar-button').bind("click", function() {
        var form;
        form = $(this).closest("form");
        return form.find(".js-group-avatar-input").click();
      });
      $('.js-group-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 GroupAvatar;

  })();

}).call(this);