diff --git a/horizon/horizon/dashboards/nova/floating_ips/views.py b/horizon/horizon/dashboards/nova/floating_ips/views.py index 439b020a904..be9935fca2b 100644 --- a/horizon/horizon/dashboards/nova/floating_ips/views.py +++ b/horizon/horizon/dashboards/nova/floating_ips/views.py @@ -74,10 +74,16 @@ def associate(request, ip_id): if handled: return handled - return shortcuts.render(request, - 'nova/floating_ips/associate.html', { - 'floating_ip_id': ip_id, - 'associate_form': form}) + context = {'floating_ip_id': ip_id, + 'form': form} + + if request.is_ajax(): + template = 'nova/floating_ips/_associate.html' + context['hide'] = True + else: + template = 'nova/floating_ips/associate.html' + + return shortcuts.render(request, template, context) @login_required diff --git a/horizon/horizon/dashboards/nova/templates/nova/floating_ips/_list.html b/horizon/horizon/dashboards/nova/templates/nova/floating_ips/_list.html index b55696c3a17..78da3681364 100644 --- a/horizon/horizon/dashboards/nova/templates/nova/floating_ips/_list.html +++ b/horizon/horizon/dashboards/nova/templates/nova/floating_ips/_list.html @@ -11,8 +11,8 @@ {% if ip.fixed_ip %} {% else %} None @@ -25,7 +25,7 @@ {% if ip.fixed_ip %}
  • {% include "nova/floating_ips/_disassociate.html" with form=disassociate_form %}
  • {% else %} -
  • {%trans "Associate to instance"%}
  • +
  • {%trans "Associate to instance"%}
  • {% endif %} diff --git a/horizon/horizon/dashboards/nova/templates/nova/floating_ips/associate.html b/horizon/horizon/dashboards/nova/templates/nova/floating_ips/associate.html index 1f34e721810..896f8197f03 100644 --- a/horizon/horizon/dashboards/nova/templates/nova/floating_ips/associate.html +++ b/horizon/horizon/dashboards/nova/templates/nova/floating_ips/associate.html @@ -7,5 +7,5 @@ {% endblock page_header %} {% block dash_main %} - {% include 'nova/floating_ips/_associate.html' with form=associate_form %} + {% include 'nova/floating_ips/_associate.html' %} {% endblock %} diff --git a/openstack-dashboard/dashboard/static/dashboard/js/application.js b/openstack-dashboard/dashboard/static/dashboard/js/application.js index 4d40f78fbbe..44596959631 100644 --- a/openstack-dashboard/dashboard/static/dashboard/js/application.js +++ b/openstack-dashboard/dashboard/static/dashboard/js/application.js @@ -1,5 +1,5 @@ (function($, window, document, undefined) { - $.fn.columnar = function (target, opt) { + $.fn.columnar = function (target, opt) { var options = $.extend({ trigger: 'change', retrieve: 'name', @@ -16,9 +16,20 @@ $(function(){ - $('.cancel').click(function(){ + $('.modal:not(.static_page) .cancel').live('click', function (evt) { + $(this).closest('.modal').remove(); + }); - }) + $('.ajax-modal').click(function (evt) { + var $this = $(this); + $.ajax($this.attr('href'), { + complete: function (jqXHR, status) { + $('body').append(jqXHR.responseText); + $('body .modal:last').modal({'show':true, 'backdrop': true, 'keyboard': true}); + } + }); + return false; + }); $('.table_search input').quicksearch('tr.odd, tr.even', { 'delay': 300, @@ -43,7 +54,6 @@ $(function(){ $('#keypair_filter form input[type=checkbox]').columnar({}); - // show+hide image details $(".details").hide() $("#images td:not(#actions)").click(function(e){