Jason Guiditta
2008-May-27 22:35 UTC
[Ovirt-devel] [PATCH] reload content area when something in the tree is clicked, and update the links w/in the tabs. Rough, early cut.
Signed-off-by: Jason Guiditta <jguiditt at redhat.com> --- wui/src/app/controllers/hardware_controller.rb | 3 ++ .../jquery-treeview/jquery.treeview.async.js | 26 ++++++++++++++++++++ 2 files changed, 29 insertions(+), 0 deletions(-) diff --git a/wui/src/app/controllers/hardware_controller.rb b/wui/src/app/controllers/hardware_controller.rb index 0eaf76f..97e8207 100644 --- a/wui/src/app/controllers/hardware_controller.rb +++ b/wui/src/app/controllers/hardware_controller.rb @@ -35,6 +35,9 @@ class HardwareController < ApplicationController flash[:notice] = 'You do not have permission to view this hardware pool: redirecting to top level' redirect_to :controller => "dashboard" end + if params[:ajax] + render :layout => false #:template => 'hardware/show.html.erb' + end end def json_view_tree diff --git a/wui/src/public/javascripts/jquery-treeview/jquery.treeview.async.js b/wui/src/public/javascripts/jquery-treeview/jquery.treeview.async.js index 8161bd1..d277a32 100644 --- a/wui/src/public/javascripts/jquery-treeview/jquery.treeview.async.js +++ b/wui/src/public/javascripts/jquery-treeview/jquery.treeview.async.js @@ -49,6 +49,32 @@ function load(settings, params, child, container) { } else { current.html("<span class=\"" + settings.span_class + "\"" + span_onclick + ">" + link_open + this.text + link_close + "</span>") .appendTo(parent); + $('li #' + this.id + ' span > a') + .bind('click', function() { +// $.ajax({ +// url: this.href, +// type: 'GET', +// data: {ajax:true}, +// dataType: 'html', +// success: function(data) { alert(data);}, +// error: function(xhr) {alert(xhr.status + ' ' + xhr.statusText);} +// }) + $('#content-area').load(this.href,{ajax:true}); + var new_id = $(this).parent().parent().get(0).id; + $('ul[class=tab_nav] a').each(function(){ + this.href = this.href.slice(0,this.href.lastIndexOf('/'+1)) + new_id; + }); + $('ul[class=tab_nav] li').each(function(){ + $(this).removeClass('current'); + }); + $('#nav_summary').addClass('current'); + //var current_e = $('span[class^=current_]'); + //current_e.removeClass(current_e.attr('class')); + //$(this).addClass('current_folder'); + //var my_container = $(container); + return false; + }); + } if (this.classes) { current.children("span").addClass(this.classes); -- 1.5.4.1 --=-FeeZJ3ybHM80BpIC4CGc Content-Disposition: attachment; filename=0002-make-the-tree-links-ajax-calls-that-refresh-t.patch Content-Type: application/mbox; name=0002-make-the-tree-links-ajax-calls-that-refresh-t.patch Content-Transfer-Encoding: base64 RnJvbSA0MjEwY2JkMDdhZGFlOGY3YTYxNDBjMDhhNTdjYzNmYjA4ZThjNThlIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBKYXNvbiBHdWlkaXR0YSA8amd1aWRpdHRAcmVkaGF0LmNvbT4K RGF0ZTogRnJpLCAzMCBNYXkgMjAwOCAxNTowMDoxOSAtMDQwMApTdWJqZWN0OiBbUEFUQ0hdICAg ICAqICBtYWtlIHRoZSB0cmVlIGxpbmtzIGFqYXggY2FsbHMgdGhhdCByZWZyZXNoIHRoZSBtYWlu IGNvbnRlbnQgcGFuZWwKICAgICAqIHJlZmFjdG9yIHRhYiBuYXYgdG8gYmUgaW4gYSBzZXBhcmF0 ZWx5IGNhbGxhYmxlIGxheW91dAogICAgICogdXBkYXRlIGFueXRoaW5nIG9uIHRoZSB0cmVlIHBh bmVsIHRoYXQgbWFrZXMgdXNlIG9mIHRoZSBjdXJyZW50IHNlbGVjdGlvbiBhbmQgY2hhbmdlIHRo ZSBuZXcvZGVsZXRlIGxpbmtzIGFwcHJvcHJpYXRlbHkgRG9uZQogICAgICogY2hhbmdlIHRyZWUg d2lkZ2V0IHRvIHN1cHBvcnQgc2hvd2luZyBzZWxlY3RlZCBub2RlIHcvbyBwYWdlIHJlZnJlc2gK ICAgICAqIG1ha2UgdGhlIHRhYnMgb24gdGhlIG1haW4gcGFuZWwgaW50byBhamF4IGNhbGxzIHRo YXQgdXBkYXRlIHRoZSBtYWluIGNvbnRlbnQgcGFuZWwgdG8gc2hvdyBhIGRpZmZlcmVudCB0YWIu IFJldiAxIG1ha2VzIGEgbmV3IGNhbGwgd2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1bmN0aW9uKCl7ICAgICAg ICAgCisgICAgICAgICAgICAkKCdhW3JlbCo9ZmFjZWJveF0nKS5saXZlcXVlcnkoZnVuY3Rpb24o KXskKHRoaXMpLmZhY2Vib3goKTt9LGZ1bmN0aW9uKCl7fSk7CisgICAgICAgICAgICAkKCdhW3Jl bCo9Y2xvc2VdJykudHJpZ2dlcignY2xvc2UuZmFjZWJveCcpOworICAgICAgICAgICAgJCgnI3Np ZGUgYScpLmxpdmVxdWVyeShmdW5jdGlvbigpeworICAgICAgICAgICAgICAgICQodGhpcykuYmlu ZCgnY2xpY2snLCBmdW5jdGlvbigpeyAKKyAgICAgICAgICAgICAgICAgICAgJCgnI3NpZGUgc3Bh bicpLmVhY2goZnVuY3Rpb24oKXsKKyAgICAgICAgICAgICAgICAgICAgICAgIHZhciBub2RlVHlw ZSA9ICQodGhpcykuYXR0cignY2xhc3MnKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChu b2RlVHlwZS5pbmRleE9mKCdfJykgIT0gLTEpeworICAgICAgICAgICAgICAgICAgICAgICAgICAg IG5vZGVUeXBlID0gbm9kZVR5cGUuc3Vic3RyKG5vZGVUeXBlLmluZGV4T2YoJ18nKSArMSk7Cisg ICAgICAgICAgICAgICAgICAgICAgICAgICAgJCh0aGlzKS5hdHRyKCdjbGFzcycsIG5vZGVUeXBl KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAKKyAg ICAgICAgICAgICAgICAgICAgfSk7CisgICAgICAgICAgICAgICAgICAgIHZhciBub2RlVHlwZSA9 ICQodGhpcykucGFyZW50KCkuYXR0cignY2xhc3MnKTsKKyAgICAgICAgICAgICAgICAgICAgJCh0 aGlzKS5wYXJlbnQoKS5hdHRyKCdjbGFzcycsICdjdXJyZW50XycgKyBub2RlVHlwZSk7CisgICAg ICAgICAgICAgICAgICAgICQuYWpheCh7CisgICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICQo dGhpcykuYXR0cignaHJlZicpLAorICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ0dFVCcs CisgICAgICAgICAgICAgICAgICAgICAgICBkYXRhOiB7YWpheDp0cnVlfSwKKyAgICAgICAgICAg ICAgICAgICAgICAgIGRhdGFUeXBlOiAnaHRtbCcsCisgICAgICAgICAgICAgICAgICAgICAgICBz dWNjZXNzOiBmdW5jdGlvbihkYXRhKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICQoJyNz aWRlLXRvb2xiYXInKS5odG1sKCQoZGF0YSkuZmluZCgnZGl2LnRvb2xiYXInKSk7CisgICAgICAg ICAgICAgICAgICAgICAgICAgICQoJyN0YWJzLWFuZC1jb250ZW50LWNvbnRhaW5lcicpLmh0bWwo JChkYXRhKS5ub3QoJ2RpdiNzaWRlLXRvb2xiYXInKSk7CisgICAgICAgICAgICAgICAgICAgICAg ICB9LAorICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGZ1bmN0aW9uKHhocikge2FsZXJ0 KHhoci5zdGF0dXMgKyAnICcgKyB4aHIuc3RhdHVzVGV4dCk7fQorICAgICAgICAgICAgICAgICAg ICB9KTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO30pfSxmdW5jdGlvbigpe30p OworICAgICAgICAgICAgJCgnLnRhYl9uYXYgYScpLmxpdmVxdWVyeShmdW5jdGlvbigpeworICAg ICAgICAgICAgICAgICQodGhpcykuYmluZCgnY2xpY2snLCBmdW5jdGlvbigpeworICAgICAgICAg ICAgICAgICAgICAkKCcudGFiX25hdiBsaScpLnJlbW92ZUNsYXNzKCdjdXJyZW50Jyk7CisgICAg ICAgICAgICAgICAgICAgICQodGhpcykucGFyZW50KCkuYWRkQ2xhc3MoJ2N1cnJlbnQnKTsKKyAg ICAgICAgICAgICAgICAgICAgJC5hamF4KHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHVybDog JCh0aGlzKS5hdHRyKCdocmVmJyksCisgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnR0VU JywKKyAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IHthamF4OnRydWV9LAorICAgICAgICAg ICAgICAgICAgICAgICAgZGF0YVR5cGU6ICdodG1sJywKKyAgICAgICAgICAgICAgICAgICAgICAg IHN1Y2Nlc3M6IGZ1bmN0aW9uKGRhdGEpIHsgCisgICAgICAgICAgICAgICAgICAgICAgICAgIHZh ciB3cmFwcGVkX2RhdGEgPSAkKGRhdGEpLmZpbmQoJ2RpdicpLmZpbHRlcignW2lkPWNvbnRlbnQt YXJlYV0nKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG15X3BhcmVudCA9ICQodGhp cykucGFyZW50KCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICQoJyNjb250ZW50LWFyZWEn KS5odG1sKCQoZGF0YSkuZmluZCgnZGl2JykuZmlsdGVyKCdbaWQ9Y29udGVudC1hcmVhXScpKTsK KyAgICAgICAgICAgICAgICAgICAgICAgIH0sCisgICAgICAgICAgICAgICAgICAgICAgICBlcnJv cjogZnVuY3Rpb24oeGhyKSB7YWxlcnQoeGhyLnN0YXR1cyArICcgJyArIHhoci5zdGF0dXNUZXh0 KTt9CisgICAgICAgICAgICAgICAgICAgIH0pOworICAgICAgICAgICAgICAgICAgICByZXR1cm4g ZmFsc2U7fSl9LGZ1bmN0aW9uKCl7fSk7CisgICAgICAgICAgICAKKwl9KTsKKyAgICAgIC8qJChk b2N1bWVudCkucmVhZHkoZnVuY3Rpb24oKXsgICAgICAgICAKICAgICAgICAgcmVmcmVzaF9mYWNl Ym94KCkKLSAgICAgIH0pCisgICAgICB9KSovCiAgICAgICA8L3NjcmlwdD4KICAgIDwlPSB5aWVs ZCA6c2NyaXB0cyAtJT4KICA8L2hlYWQ+CkBAIC02MywxMyArMTA4LDE1IEBACiAgICAgIDwlPSBy ZW5kZXIgOnBhcnRpYWwgPT4gJy9sYXlvdXRzL3NpZGVfdG9vbGJhcicgJT4KICAgIDwvZGl2Pgog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pKCk7ClwgTm8gbmV3bGluZSBhdCBlbmQgb2Yg ZmlsZQpkaWZmIC0tZ2l0IGEvd3VpL3NyYy9wdWJsaWMvamF2YXNjcmlwdHMvanF1ZXJ5LXRyZWV2 aWV3L2pxdWVyeS50cmVldmlldy5hc3luYy5qcyBiL3d1aS9zcmMvcHVibGljL2phdmFzY3JpcHRz L2pxdWVyeS10cmVldmlldy9qcXVlcnkudHJlZXZpZXcuYXN5bmMuanMKaW5kZXggZDI3N2EzMi4u N2Q1ZWIyZiAxMDA2NDQKLS0tIGEvd3VpL3NyYy9wdWJsaWMvamF2YXNjcmlwdHMvanF1ZXJ5LXRy ZWV2aWV3L2pxdWVyeS50cmVldmlldy5hc3luYy5qcworKysgYi93dWkvc3JjL3B1YmxpYy9qYXZh c2NyaXB0cy9qcXVlcnktdHJlZXZpZXcvanF1ZXJ5LnRyZWV2aWV3LmFzeW5jLmpzCkBAIC00OSwz MSArNDksMjcgQEAgZnVuY3Rpb24gbG9hZChzZXR0aW5ncywgcGFyYW1zLCBjaGlsZCwgY29udGFp bmVyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAg ICAgICAgICAgICBjdXJyZW50Lmh0bWwoIjxzcGFuIGNsYXNzPVwiIiArIHNldHRpbmdzLnNwYW5f Y2xhc3MgKyAiXCIiICsgc3Bhbl9vbmNsaWNrICsgIj4iICsgbGlua19vcGVuICsgdGhpcy50ZXh0 ICsgbGlua19jbG9zZSArICI8L3NwYW4+IikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAu YXBwZW5kVG8ocGFyZW50KTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgJCgnbGkgIycgKyB0 aGlzLmlkICsgJyBzcGFuID4gYScpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLmJpbmQo J2NsaWNrJywgZnVuY3Rpb24oKSB7ICAgICAgICAgICAgCisvLyAgICAgICAgICAgICAgICAgICAg ICAgICAgJCgnbGkgIycgKyB0aGlzLmlkICsgJyBzcGFuID4gYScpCisvLyAgICAgICAgICAgICAg ICAgICAgICAgICAgICAuYmluZCgnY2xpY2snLCBmdW5jdGlvbigpIHsgCiAvLyAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICQuYWpheCh7CiAvLyAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgdXJsOiB0aGlzLmhyZWYsCiAvLyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg dHlwZTogJ0dFVCcsCiAvLyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YToge2Fq YXg6dHJ1ZX0sCiAvLyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YVR5cGU6ICdo dG1sJywKLS8vICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdWNjZXNzOiBmdW5jdGlv bihkYXRhKSB7IGFsZXJ0KGRhdGEpO30sCisvLyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgc3VjY2VzczogZnVuY3Rpb24oZGF0YSkgeyAKKy8vICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIHZhciB3cmFwcGVkX2RhdGEgPSAkKGRhdGEpLm5vdCgnZGl2I3NpZGUtdG9vbGJh cicpOy8vLmZpbmQoJyNuYXZpZ2F0aW9uLXRhYnMnKTsKKy8vICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICQoJyNzaWRlLXRvb2xiYXInKS5odG1sKCQoZGF0YSkuZmluZCgnZGl2LnRv b2xiYXInKSk7CisvLyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkKCcjdGFicy1h bmQtY29udGVudC1jb250YWluZXInKS5odG1sKCQoZGF0YSkubm90KCdkaXYjc2lkZS10b29sYmFy JykpOworLy8gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAvLyAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGZ1bmN0aW9uKHhocikge2FsZXJ0KHhoci5zdGF0 dXMgKyAnICcgKyB4aHIuc3RhdHVzVGV4dCk7fQogLy8gICAgICAgICAgICAgICAgICAgICAgICAg ICAgICB9KQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJCgnI2NvbnRlbnQtYXJlYScp LmxvYWQodGhpcy5ocmVmLHthamF4OnRydWV9KTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIHZhciBuZXdfaWQgPSAkKHRoaXMpLnBhcmVudCgpLnBhcmVudCgpLmdldCgwKS5pZDsKLSAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICQoJ3VsW2NsYXNzPXRhYl9uYXZdIGEnKS5lYWNo KGZ1bmN0aW9uKCl7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaHJlZiA9 IHRoaXMuaHJlZi5zbGljZSgwLHRoaXMuaHJlZi5sYXN0SW5kZXhPZignLycrMSkpICsgbmV3X2lk OwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7Ci0gICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAkKCd1bFtjbGFzcz10YWJfbmF2XSBsaScpLmVhY2goZnVuY3Rpb24oKXsKLSAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJCh0aGlzKS5yZW1vdmVDbGFzcygnY3VycmVu dCcpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7Ci0gICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAkKCcjbmF2X3N1bW1hcnknKS5hZGRDbGFzcygnY3VycmVudCcpOworICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgLy92YXIgbmV3X2lkID0gJCh0aGlzKS5wYXJlbnQo KS5wYXJlbnQoKS5nZXQoMCkuaWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL3Zh ciBjdXJyZW50X2UgPSAkKCdzcGFuW2NsYXNzXj1jdXJyZW50X10nKTsKICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIC8vY3VycmVudF9lLnJlbW92ZUNsYXNzKGN1cnJlbnRfZS5hdHRyKCdj bGFzcycpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vJCh0aGlzKS5hZGRDbGFz cygnY3VycmVudF9mb2xkZXInKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vdmFy IG15X2NvbnRhaW5lciA9ICQoY29udGFpbmVyKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKKy8vICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworLy8gICAgICAgICAgICAg ICAgICAgICAgICAgICAgfSk7CiAKICAgICAgICAgICAgICAgICAgICAgICAgIH0KIAkJCWlmICh0 aGlzLmNsYXNzZXMpIHsKZGlmZiAtLWdpdCBhL3d1aS9zcmMvcHVibGljL2phdmFzY3JpcHRzL2px dWVyeS10cmVldmlldy9vdmlydC50cmVldmlldy5jc3MgYi93dWkvc3JjL3B1YmxpYy9qYXZhc2Ny aXB0cy9qcXVlcnktdHJlZXZpZXcvb3ZpcnQudHJlZXZpZXcuY3NzCmluZGV4IDJjNGQzODYuLjU4 YTc5MmUgMTAwNjQ0Ci0tLSBhL3d1aS9zcmMvcHVibGljL2phdmFzY3JpcHRzL2pxdWVyeS10cmVl dmlldy9vdmlydC50cmVldmlldy5jc3MKKysrIGIvd3VpL3NyYy9wdWJsaWMvamF2YXNjcmlwdHMv anF1ZXJ5LXRyZWV2aWV3L292aXJ0LnRyZWV2aWV3LmNzcwpAQCAtMzEsMTEgKzMxLDEzIEBACiAu dHJlZXZpZXcgYS5zZWxlY3RlZCB7CiAJYmFja2dyb3VuZC1jb2xvcjogI0RFRTdFQjsKIH0KKy50 cmVldmlldyBhIHt0ZXh0LWRlY29yYXRpb246bm9uZTt9CiAKKy50cmVldmlldyBhOnZpc2l0ZWR7 Y29sb3I6Iz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cnx8fHx8fHxj b250ZXh0fGVhY2h8fHF1ZXJpZXN8cXVldWV8cmV0dXJufHR5cGV8fGZuMnxwcm90b3R5cGV8fHxy dW58ZWxlbWVudHN8c3RvcHBlZHxmYWxzZXxlbHN8YXBwbHl8c3RvcHx1bmRlZmluZWR8cnVubmlu Z3xpbkFycmF5fGxlbmd0aHx0aW1lb3V0fGVsc2V8aWR8YXJndW1lbnRzfG5FbHN8Z3VpZHxpbml0 fHB1c2h8cmVnaXN0ZXJQbHVnaW58cGxheXxjaGVja1F1ZXVlfGlzRnVuY3Rpb258cmVtb3ZlfHRy dWV8ZXh0ZW5kfGRvY3VtZW50fGV4cGlyZXxwYXVzZXxzaGlmdHx3aGlsZXxudWxsfG5ld3xldmVu dHxiaW5kfG5vdHxqUXVlcnl8c3RyaW5nfHR5cGVvZnx0b2dnbGVDbGFzc3x1bmJpbmR8YWRkQ2xh c3N8cmVtb3ZlQXR0cnxhdHRyfHdyYXB8YmVmb3JlfHJlbW92ZUNsYXNzfGVtcHR5fGFmdGVyfHBy ZXBlbmR8YXBwZW5kfDIwfHNldFRpbWVvdXR8Y2xlYXJUaW1lb3V0Jy5zcGxpdCgnfCcpLDAse30p KQpcIE5vIG5ld2xpbmUgYXQgZW5kIG9mIGZpbGUKLS0gCjEuNS40LjEKCi= --=-FeeZJ3ybHM80BpIC4CGc Content-Disposition: attachment; filename=0003-facebox.close-not-needed-anywhere.patch Content-Type: application/mbox; name=0003-facebox.close-not-needed-anywhere.patch Content-Transfer-Encoding: 7bit