~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/app/javascript/expander.js

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-07-14 15:43:38 UTC
  • mfrom: (13302.6.40 replace-expanders-2)
  • Revision ID: launchpad@pqm.canonical.com-20110714154338-3figmpb0g53ioey7
[r=adeuring][bug=807434] Migrate a few remaining expanders to the new
        generic Expander widget.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
 *     animate_node: A node to perform an animation on.  Mostly useful for
54
54
 *         animating table rows/cells when you want to animate the inner
55
55
 *         content (eg. a <div>).
 
56
 *     no_animation: Set to true if no animation should be used.  Useful for
 
57
 *         when you can't rearrange the nodes so animations apply to them
 
58
 *         (eg. we want to show a bunch of rows in the same table).
56
59
 */
57
60
function Expander(icon_node, content_node, config) {
58
61
    if (!Y.Lang.isObject(icon_node)) {
75
78
    } else {
76
79
        this._animate_node = this.content_node;
77
80
    }
78
 
    this._animation = Y.lazr.effects.reversible_slide_out(
79
 
        this._animate_node);
 
81
 
 
82
    if (this.config.no_animation !== true) {
 
83
        this._animation = Y.lazr.effects.reversible_slide_out(
 
84
            this._animate_node);
 
85
    } else {
 
86
        this._animation = undefined;
 
87
    }
80
88
 
81
89
    // Is setup complete?  Skip any animations until it is.
82
90
    this.fully_set_up = false;
142
150
    foldContentNode: function(expand, no_animation) {
143
151
        var expander = this;
144
152
        var has_paused = false;
145
 
        if (no_animation === true) {
 
153
        if (no_animation === true || Y.Lang.isUndefined(this._animation)) {
146
154
            // Make the animation have the proper direction set from
147
155
            // the start.
148
 
            this._animation.set('reverse', expand);
 
156
            if (!Y.Lang.isUndefined(this._animation)) {
 
157
                this._animation.set('reverse', expand);
 
158
            }
149
159
            expander.setContentClassIf(
150
160
                !expand, expander.css_classes.unseen);
151
161
        } else {
203
213
        }
204
214
        var from_height = this._animate_node.getStyle('height');
205
215
        this._animate_node.setContent(output);
 
216
        if (Y.Lang.isUndefined(this._animation)) {
 
217
            return;
 
218
        }
206
219
        var to_height = this._animate_node.get('scrollHeight');
207
220
        if (this._animation.get('running')) {
208
221
            this._animation.stop();