Skip to content

Commit

Permalink
Merge pull request #663 from WHOIGit/mario_dev_1.7.0
Browse files Browse the repository at this point in the history
add scrolling to build and assemblypart details, update django and related packages
  • Loading branch information
ethanandrews authored Jun 20, 2024
2 parents 199b398 + 1b8b0a1 commit 92ff357
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 11 deletions.
20 changes: 10 additions & 10 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
pytz==2020.1 # https://github.com/stub42/pytz
python-slugify==3.0.6 # https://github.com/un33k/python-slugify
Pillow==7.2.0 # https://github.com/python-pillow/Pillow
argon2-cffi==20.1.0 # https://github.com/hynek/argon2_cffi
pytz==2021.3 # https://github.com/stub42/pytz
python-slugify==5.0.2 # https://github.com/un33k/python-slugify
Pillow==9.0.0 # https://github.com/python-pillow/Pillow
argon2-cffi==21.3.0 # https://github.com/hynek/argon2_cffi
whitenoise==5.2.0
redis==3.5.3 # https://github.com/andymccurdy/redis-py
hiredis==1.1.0 # https://github.com/redis/hiredis-py
celery==4.4.6 # pyup: < 5.0,!=4.4.7 # https://github.com/celery/celery
django-celery-beat==2.0.0
flower==0.9.5 # https://github.com/mher/flower
redis==4.1.1 # https://github.com/andymccurdy/redis-py
hiredis==2.0.0 # https://github.com/redis/hiredis-py
celery==5.2.3 # pyup: < 5.0,!=4.4.7 # https://github.com/celery/celery
django-celery-beat==2.6.0
flower==1.0.0 # https://github.com/mher/flower

# Django
# ------------------------------------------------------------------------------
django==3.1.3 # # https://www.djangoproject.com/
django==4.2.13 # # https://www.djangoproject.com/
django-environ==0.4.5 # https://github.com/joke2k/django-environ
django-model-utils==4.0.0 # https://github.com/jazzband/django-model-utils
django-allauth==0.42.0 # https://github.com/pennersr/django-allauth
Expand Down
23 changes: 23 additions & 0 deletions roundabout/templates/assemblies/ajax_assemblypart_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,29 @@ <h5>Current {{ label_inventory_app_plural }} for this {{ label_assemblies_app_si
{# Show first tab #}
$(document).ready(function() {
$('#inventory-tabs-nav a:first').tab('show')

$('#jstree-navtree').on('loaded.jstree', function() {
// Open the tree to the selected item

setTimeout(function() { // Adding a slight delay to ensure the node is open and rendered
var selectedItem = $('#jstree-navtree').find('.jstree-clicked')
console.log(selectedItem)
if (selectedItem.length) {
var container = $('#jstree-navtree').parent();
var selectedItemOffsetFromTop = selectedItem.offset().top;
var containerScrollTop = container.scrollTop();
var containerHeight = container.height();
var selectedItemHeight = selectedItem.outerHeight(true); // Include margin

// Calculate the top scroll position to center the item
var scrollTopToCenterItem = containerScrollTop + selectedItemOffsetFromTop - container.offset().top - (containerHeight / 2) + (selectedItemHeight / 2);

container.animate({
scrollTop: scrollTopToCenterItem
}, 'slow');
}
}, 300); // Adjust delay as necessary
});
});
</script>
{% include "configs_constants/config_default_detail.html" with js_only='true' %}
Expand Down
27 changes: 27 additions & 0 deletions roundabout/templates/assemblies/assemblypart_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,32 @@ <h2>{{ label_assemblies_app_plural }}</h2>
{% endblock content %}

{% block javascript %}
<script>
$(document).ready(function() {
$('#jstree-navtree').on('loaded.jstree', function() {
// Open the tree to the selected item

setTimeout(function() { // Adding a slight delay to ensure the node is open and rendered
var selectedItem = $('#jstree-navtree').find('.jstree-clicked')
console.log(selectedItem)
if (selectedItem.length) {
var container = $('#jstree-navtree').parent();
var selectedItemOffsetFromTop = selectedItem.offset().top;
var containerScrollTop = container.scrollTop();
var containerHeight = container.height();
var selectedItemHeight = selectedItem.outerHeight(true); // Include margin

// Calculate the top scroll position to center the item
var scrollTopToCenterItem = containerScrollTop + selectedItemOffsetFromTop - container.offset().top - (containerHeight / 2) + (selectedItemHeight / 2);

container.animate({
scrollTop: scrollTopToCenterItem
}, 'slow');
}
}, 300); // Adjust delay as necessary
});

});
</script>

{% endblock javascript %}
25 changes: 24 additions & 1 deletion roundabout/templates/builds/ajax_build_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,30 @@ <h6>Snapshot Inventory:</h6>
var buildID = 'builds_' + '{{ build.id }}';

var _buildID = '{{ build.id }}'
handleReviewBadges('#deployments', 'button[id^=deploy_expander]', '{{ user.id }}', '{{ user.username }}', _buildID)
handleReviewBadges('#deployments', 'button[id^=deploy_expander]', '{{ user.id }}', '{{ user.username }}', _buildID)

$('#jstree-navtree').on('loaded.jstree', function() {
// Open the tree to the selected item

setTimeout(function() { // Adding a slight delay to ensure the node is open and rendered
var selectedItem = $('#jstree-navtree').find('.jstree-clicked')
console.log(selectedItem)
if (selectedItem.length) {
var container = $('#jstree-navtree').parent();
var selectedItemOffsetFromTop = selectedItem.offset().top;
var containerScrollTop = container.scrollTop();
var containerHeight = container.height();
var selectedItemHeight = selectedItem.outerHeight(true); // Include margin

// Calculate the top scroll position to center the item
var scrollTopToCenterItem = containerScrollTop + selectedItemOffsetFromTop - container.offset().top - (containerHeight / 2) + (selectedItemHeight / 2);

container.animate({
scrollTop: scrollTopToCenterItem
}, 'slow');
}
}, 300); // Adjust delay as necessary
});

});
</script>
Expand Down
28 changes: 28 additions & 0 deletions roundabout/templates/builds/build_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,32 @@ <h2>{{ label_builds_app_plural }}</h2>

{% block javascript %}

<script>
$(document).ready(function() {
$('#jstree-navtree').on('loaded.jstree', function() {
// Open the tree to the selected item

setTimeout(function() { // Adding a slight delay to ensure the node is open and rendered
var selectedItem = $('#jstree-navtree').find('.jstree-clicked')
console.log(selectedItem)
if (selectedItem.length) {
var container = $('#jstree-navtree').parent();
var selectedItemOffsetFromTop = selectedItem.offset().top;
var containerScrollTop = container.scrollTop();
var containerHeight = container.height();
var selectedItemHeight = selectedItem.outerHeight(true); // Include margin

// Calculate the top scroll position to center the item
var scrollTopToCenterItem = containerScrollTop + selectedItemOffsetFromTop - container.offset().top - (containerHeight / 2) + (selectedItemHeight / 2);

container.animate({
scrollTop: scrollTopToCenterItem
}, 'slow');
}
}, 300); // Adjust delay as necessary
});

});
</script>

{% endblock javascript %}

0 comments on commit 92ff357

Please sign in to comment.