Improve murano modals js hooks

Use new addModalInitFunction horizon js function instead of pushing the
function to private array inside horizon.modals
Calls init functions in case element is found on the page and it's not
modal.

Fixes ':' placement in related form

Related-Bug: #1550822

Change-Id: I65c281dbe52ac6e9dc22722baca32a955397d771
This commit is contained in:
Kirill Zaitsev 2016-03-09 15:37:32 +03:00
parent 94b0c092ed
commit e44629a200
3 changed files with 11 additions and 7 deletions

View File

@ -16,10 +16,10 @@
$(function() {
"use strict";
horizon.modals._init_functions.push(muranoUploadBundle);
horizon.modals.addModalInitFunction(muranoUploadBundle);
function muranoUploadBundle() {
var uploadForm = $('#import_bundle');
function muranoUploadBundle(modal) {
var uploadForm = $(modal).find('#import_bundle');
var importType = uploadForm.find('[name=upload-import_type]');
uploadForm.find('input[name=upload-url]').closest('.form-group').addClass('required');
@ -37,4 +37,6 @@ $(function() {
});
importType.change();
}
muranoUploadBundle($('#import_bundle').parent());
});

View File

@ -16,10 +16,10 @@
$(function() {
"use strict";
horizon.modals._init_functions.push(muranoUploadPackage);
horizon.modals.addModalInitFunction(muranoUploadPackage);
function muranoUploadPackage() {
var uploadForm = $('#upload_package');
function muranoUploadPackage(modal) {
var uploadForm = $(modal).find('#upload_package');
var importType = uploadForm.find('[name=upload-import_type]');
uploadForm.find('input[name=upload-url]').closest('.form-group').addClass('required');
@ -48,4 +48,6 @@ $(function() {
location.reload();
});
}
muranoUploadPackage($('#upload_package').parent());
});

View File

@ -50,7 +50,7 @@
</div>
<div class='description-by_url'>
<h3>{% trans "Description" %}:</h3>
<p><strong>{% trans "Package URL" %} :</strong>{% trans "HTTP/HTTPS URL of the package file." %}</p>
<p><strong>{% trans "Package URL" %}: </strong>{% trans "HTTP/HTTPS URL of the package file." %}</p>
</div>
<div class='description-common'>
<p><strong><i>{% trans "Note" %}: </i></strong>