summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/aside.js
blob: 7b546e79ee06235fa005de4ccd8ffeb6ffb0bbbf (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
(function() {
  this.Aside = (function() {
    function Aside() {
      $(document).off("click", "a.show-aside");
      $(document).on("click", 'a.show-aside', function(e) {
        var btn, icon;
        e.preventDefault();
        btn = $(e.currentTarget);
        icon = btn.find('i');
        if (icon.hasClass('fa-angle-left')) {
          btn.parent().find('section').hide();
          btn.parent().find('aside').fadeIn();
          return icon.removeClass('fa-angle-left').addClass('fa-angle-right');
        } else {
          btn.parent().find('aside').hide();
          btn.parent().find('section').fadeIn();
          return icon.removeClass('fa-angle-right').addClass('fa-angle-left');
        }
      });
    }

    return Aside;

  })();

}).call(this);