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

« back to all changes in this revision

Viewing changes to build/plugin-collapse/plugin-collapse-debug.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
        Y.log('open height: ' + plugin.config.height, 'debug', 'plugin-collapse');
 
35
 
31
36
        host.transition(plugin.config, function(e) {
32
37
            this.replaceClass('collapsing', 'collapse')
33
38
                .removeClass('in');
34
39
 
35
40
            this.collapse.set('state', true);
 
41
            this.collapse.fire('open');
36
42
        });
37
43
    },
38
44
    close: function() {
48
54
                .addClass('in');
49
55
 
50
56
            this.collapse.set('state', false);
 
57
            this.collapse.fire('close');
51
58
        });
52
59
    },
53
60
 
57
64
        } else {
58
65
            this.open();
59
66
        }
 
67
        this.fire('toggle');
60
68
    }
61
69
}, {
62
70
    NS: 'collapse',