~ubuntuone-pqm-team/online-services-common-js/stable

« back to all changes in this revision

Viewing changes to build/plugin-collapse/plugin-collapse.js

  • Committer: jonas-drange
  • Date: 2014-04-23 09:48:21 UTC
  • mfrom: (30.1.12 navbar-autocomplete)
  • Revision ID: jonas.drange@canonical.com-20140423094821-kgahgu2z4p9xnws1
[r=stephen-stewart] navbar-autocomplete:
Plugs Y.AutoComplete into an input element.
Manipulates the collapse element so that the autocomplete list is shown.

plugin-collapse:
Publish open, close and toggle events and fire them when appropriate.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
            this.host.addClass('in');
19
19
            this.host.setStyle('height', 0);
20
20
        }
 
21
        this.publish('open');
 
22
        this.publish('close');
 
23
        this.publish('toggle');
21
24
    },
22
25
    open: function() {
23
26
        var host = this.host;
28
31
 
29
32
        plugin.config.height = host.get('scrollHeight') + 'px';
30
33
 
 
34
 
31
35
        host.transition(plugin.config, function(e) {
32
36
            this.replaceClass('collapsing', 'collapse')
33
37
                .removeClass('in');
34
38
 
35
39
            this.collapse.set('state', true);
 
40
            this.collapse.fire('open');
36
41
        });
37
42
    },
38
43
    close: function() {
48
53
                .addClass('in');
49
54
 
50
55
            this.collapse.set('state', false);
 
56
            this.collapse.fire('close');
51
57
        });
52
58
    },
53
59
 
57
63
        } else {
58
64
            this.open();
59
65
        }
 
66
        this.fire('toggle');
60
67
    }
61
68
}, {
62
69
    NS: 'collapse',