1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-02-07 01:57:59 +03:00

F #5139 Added posibility to add objects in custom tags (#293)

This commit is contained in:
Abel Coronado 2017-05-05 16:24:38 +02:00 committed by Tino Vázquez
parent b882f5f41e
commit 83a2d0e7c1
3 changed files with 34 additions and 8 deletions

View File

@ -40,6 +40,19 @@ define(function(require) {
tbody.append(VectorAttributeRowTemplateHTML());
});
context.off("click", ".change_to_vector_attribute");
context.on("click", ".change_to_vector_attribute", function(){
var td = $($(this).closest('table')).parent();
var tr = $(td).parent();
$('.change_to_vector_attribute', td).addClass('add_vector_attribute').removeClass('change_to_vector_attribute');
$('tbody.custom_body', td).addClass('custom_vector_attributes').removeClass('custom_body');
$('.custom_tag_key', tr).addClass('custom_vector_key').removeClass('custom_tag_key').css('margin-top', '5px');
$('tbody.custom_vector_attributes', td).append(VectorAttributeRowTemplateHTML({
key: $('textarea.custom_tag_value', td).val()
}));
$('textarea.custom_tag_value', td).remove();
});
$(".add_custom_tag", context).trigger("click");
context.on("click", "tbody.custom_tags i.remove-tab", function(){

View File

@ -15,15 +15,28 @@
{{! -------------------------------------------------------------------------- }}
<tr>
<td>
<td style="display: flex; justify-content: flex-start">
<input class="custom_tag_key" type="text" name="key" value="{{key}}">
</td>
<td>
<textarea class="custom_tag_value" name="value">
{{~value~}}
</textarea>
<table>
<tbody class="custom_body">
<textarea style="margin-left: 7px" class="custom_tag_value" name="value">
{{~value~}}
</textarea>
</tbody>
<tfoot>
<tr>
<td colspan="3">
<a type="button" class="change_to_vector_attribute button small small-12 secondary radius">
<i class="fa fa-plus"></i>
</a>
</td>
</tr>
</tfoot>
</table>
</td>
<td>
<td style="display: flex; justify-content: flex-start">
<a href="#"><i class="fa fa-times-circle remove-tab"></i></a>
</td>
</tr>

View File

@ -1,6 +1,6 @@
<tr>
<td>
<input class="custom_vector_key" type="text" name="key" value="{{key}}">
<td style="display: flex; justify-content: flex-start">
<input style="margin-top: 5px" class="custom_vector_key" type="text" name="key" value="{{key}}">
</td>
<td>
<table>
@ -32,7 +32,7 @@
</tfoot>
</table>
</td>
<td>
<td style="display: flex; justify-content: flex-start">
<a href="#"><i class="fa fa-times-circle remove-tab"></i></a>
</td>
</tr>