~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/registry/javascript/distroseries.js

Add test for Parents widget.

Show diffs side-by-side

added added

removed removed

Lines of Context:
225
225
     */
226
226
    clean_display: function() {
227
227
        this.fieldNode.empty();
228
 
        this.fieldNode = Y.Node.create("<div />")
229
 
            .set('text', '[No parent for this series yet!]');
 
228
        this.fieldNode.append(Y.Node.create("<div />")
 
229
            .set('text', '[No parent for this series yet!]'));
230
230
    },
231
231
 
232
232
    /**
253
253
    },
254
254
 
255
255
    /**
 
256
     * Helper method to create a select widget from a list and add it
 
257
     * to a node.
 
258
     *
 
259
     * @method build_selector
 
260
     */
 
261
    build_selector: function(node, res_list, class_name) {
 
262
        var select = Y.Node.create('<select disabled="disabled"/>')
 
263
        res_list.forEach(
 
264
            function(choice) {
 
265
                select.appendChild('<option />').set('text', choice)
 
266
            });
 
267
        node.one('td.'+class_name).append(select);
 
268
        node.one('input').on('click', function(e) {
 
269
            var select = node.one('td.'+class_name).one('select');
 
270
            if (select.hasAttribute('disabled')) {
 
271
                select.removeAttribute('disabled');
 
272
            }
 
273
            else {
 
274
                select.setAttribute('disabled', 'disabled');
 
275
            }
 
276
        });
 
277
    },
 
278
 
 
279
    /**
256
280
     * Build a select widget from a list retrieved from the api.
257
281
     *
258
282
     * @method build_select
259
283
     */
260
284
    build_select: function(node, class_name, path) {
 
285
        var self = this;
261
286
        var on = {
262
287
            success: function(res_list) {
263
 
                var select = Y.Node.create('<select disabled="disabled"/>')
264
 
                res_list.forEach(
265
 
                    function(choice) {
266
 
                        select.appendChild('<option />').set('text', choice)
267
 
                    });
268
 
                node.one('td.'+class_name).append(select);
269
 
                node.one('input').on('click', function(e) {
270
 
                    var select = node.one('td.'+class_name).one('select');
271
 
                    if (select.hasAttribute('disabled')) {
272
 
                        select.removeAttribute('disabled');
273
 
                    }
274
 
                    else {
275
 
                        select.setAttribute('disabled', 'disabled');
276
 
                    }
277
 
                });
278
 
 
 
288
                self.build_selector(node, res_list, class_name);
279
289
            },
280
290
            failure: function() {
281
291
                var failed_node = Y.Node.create('<span />')
598
608
     */
599
609
    clean_display: function() {
600
610
        this.fieldNode.empty();
601
 
        this.fieldNode = Y.Node.create("<div />")
602
 
            .set('text', '[No architectures to select from yet!]');
 
611
        this.fieldNode.append(Y.Node.create("<div />")
 
612
            .set('text', '[No architectures to select from yet!]'));
603
613
        this.renderUI();
604
614
    },
605
615
 
924
934
     */
925
935
    clean_display: function() {
926
936
        this.fieldNode.empty();
927
 
        this.fieldNode = Y.Node.create("<div />")
928
 
            .set('text', '[No package sets to select from yet!]');
 
937
        this.fieldNode.append(Y.Node.create("<div />")
 
938
            .set('text', '[No package sets to select from yet!]'));
929
939
        this.renderUI();
930
940
    },
931
941
 
1145
1155
                    "Copy Source and Rebuild")
1146
1156
            }
1147
1157
        };
 
1158
        debugger;
1148
1159
        var parent = this.deriveFromChoice.get("value");
1149
1160
        this.client.named_post(
1150
 
            parent, "deriveDistroSeries", config);
 
1161
            this.context.self_link, "deriveDistroSeries", config);
1151
1162
    }
1152
1163
 
1153
1164
});