0004-Bug-786-Recreate-the-selects-elements-for-the-select.patch

Fix on master - Hector Sanjuan, 08/31/2011 11:31 PM

Download (5.23 KB)

View differences:

src/sunstone/public/js/plugins/hosts-tab.js
218 218
    "Host.update_dialog" : {
219 219
        type: "custom",
220 220
        call: function() {
221
            popUpTemplateUpdateDialog("Host",hosts_select,getSelectedNodes(dataTable_hosts));
221
            popUpTemplateUpdateDialog("Host",
222
                                      makeSelectOptions(dataTable_hosts,
223
                                                        1,//id_col
224
                                                        2,//name_col
225
                                                        [],
226
                                                        []
227
                                                       ),
228
                                      getSelectedNodes(dataTable_hosts));
222 229
        }
223 230
    },
224 231

  
src/sunstone/public/js/plugins/images-tab.js
222 222
    "Image.update_dialog" : {
223 223
        type: "custom",
224 224
        call: function() {
225
            popUpTemplateUpdateDialog("Image",images_select,getSelectedNodes(dataTable_images));
225
            popUpTemplateUpdateDialog("Image",
226
                                      makeSelectOptions(dataTable_images,
227
                                          1,//id_col
228
                                          4,//name_col
229
                                          [],
230
                                          []
231
                                      ),
232
                                      getSelectedNodes(dataTable_images));
226 233
        }
227 234
    },
228 235

  
src/sunstone/public/js/plugins/templates-tab.js
639 639
    "Template.update_dialog" : {
640 640
        type: "custom",
641 641
        call: function() {
642
            popUpTemplateUpdateDialog("Template",templates_select,getSelectedNodes(dataTable_templates));
642
            popUpTemplateUpdateDialog("Template",
643
                                      makeSelectOptions(dataTable_templates,
644
                                                        1,//id_col
645
                                                        4,//name_col
646
                                                        [],
647
                                                        []//bad status col
648
                                                       ),
649
                                      getSelectedNodes(dataTable_templates));
643 650
        }
644 651
    },
645 652

  
......
862 869
        makeSelectOptions(dataTable_templates,
863 870
                          1,//id_col
864 871
                          4,//name_col
865
                          [7],//published_col
872
                          [7],//enabled_col
866 873
                          ["no"]//bad status col
867 874
                         );
868 875

  
src/sunstone/public/js/sunstone-util.js
643 643

  
644 644
    $('#template_update_select',dialog).change(function(){
645 645
        var id = $(this).val();
646
        var dialog = $('#template_update_dialog');
647
        if (id.length){
646
        if (id && id.length){
647
            var dialog = $('#template_update_dialog');
648 648
            var resource = $('#template_update_button',dialog).val();
649 649
            $('#template_update_textarea',dialog).val("Loading...");
650 650
            Sunstone.runAction(resource+".fetch_template",id);
......
678 678
        //grep them
679 679
        var new_select= sel_elems.length > 1? '<option value="">Please select</option>' : "";
680 680
        $('option','<select>'+select_items+'</select>').each(function(){
681
            if ($.inArray($(this).val(),sel_elems) >= 0){
682
                new_select+='<option value="'+$(this).val()+'">'+$(this).text()+'</option>';
681
            var val = $(this).val();
682
            if ($.inArray(val,sel_elems) >= 0){
683
                new_select+='<option value="'+val+'">'+$(this).text()+'</option>';
683 684
            };
684 685
        });
685 686
        $('#template_update_select',dialog).html(new_select);
686
-