From fb176e435ebd688113b5b938a8941c5202f4e8db Mon Sep 17 00:00:00 2001 From: Wesley B <62723358+wesleyboar@users.noreply.github.com> Date: Fri, 26 Apr 2024 11:20:59 -0500 Subject: [PATCH 1/3] fix: des-2738 do not show empty releated apps list (#1215) --- .../designsafe/apps/workspace/related_apps_plugin.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designsafe/apps/workspace/templates/designsafe/apps/workspace/related_apps_plugin.html b/designsafe/apps/workspace/templates/designsafe/apps/workspace/related_apps_plugin.html index 8e1c778649..ef3cdd48cf 100644 --- a/designsafe/apps/workspace/templates/designsafe/apps/workspace/related_apps_plugin.html +++ b/designsafe/apps/workspace/templates/designsafe/apps/workspace/related_apps_plugin.html @@ -1,6 +1,10 @@ +{% if listing|length > 0 %}

Related Applications

{% for app in listing %} {% include "designsafe/apps/workspace/app_card.html" with app=app %} {% endfor %}
+{% else %} + +{% endif %} From fa9f2a5a8dbce3103f90770291c6c107d0186060 Mon Sep 17 00:00:00 2001 From: Wesley B <62723358+wesleyboar@users.noreply.github.com> Date: Fri, 26 Apr 2024 11:27:35 -0500 Subject: [PATCH 2/3] fix: collectstatic warning blocks css dev work (#1211) * fix: collectstatic warning blocks css dev work * fix: add missing file (not ignore it) * Revert "fix: add missing file (not ignore it)" This reverts commit 8df6b00dc71fb8516d9c1189b134cd1eb6165228. --------- Co-authored-by: Jake Rosenberg --- .../static/vendor/httpi/example/vendor/angular-1.2.16.min.js | 1 - 1 file changed, 1 deletion(-) diff --git a/designsafe/static/vendor/httpi/example/vendor/angular-1.2.16.min.js b/designsafe/static/vendor/httpi/example/vendor/angular-1.2.16.min.js index 43f31f6708..5d7840b038 100644 --- a/designsafe/static/vendor/httpi/example/vendor/angular-1.2.16.min.js +++ b/designsafe/static/vendor/httpi/example/vendor/angular-1.2.16.min.js @@ -207,4 +207,3 @@ c(k[2]?k[1]:m),y=c(k[7]),w=k[8]?c(k[8]):null,x=[[{element:f,label:""}]];u&&(a(u) c[u],w(e,d)==h){k=q(e,d);break}}else d[m]=c[h],n&&(d[n]=h),k=q(e,d);1@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide{display:none !important;}ng\\:form{display:block;}.ng-animate-block-transitions{transition:0s all!important;-webkit-transition:0s all!important;}'); -//# sourceMappingURL=angular.min.js.map From 465b2ba03d22fb8ca8bd250cb99f48f57176f0ba Mon Sep 17 00:00:00 2001 From: Sal Tijerina Date: Sat, 27 Apr 2024 03:11:21 -0500 Subject: [PATCH 3/3] Quick/alpha order apps plugin (#1216) * order apps plugin listings alphabetically * add priority field to app variant; add ordering to applistingentry item meta * add priority to admin view * fix ordering * add change to model --- designsafe/apps/workspace/admin.py | 3 +- designsafe/apps/workspace/cms_plugins.py | 4 +- ..._alter_applistingentry_options_and_more.py | 37 +++++++++++++++++++ .../apps/workspace/models/app_entries.py | 10 +++++ 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 designsafe/apps/workspace/migrations/0010_alter_applistingentry_options_and_more.py diff --git a/designsafe/apps/workspace/admin.py b/designsafe/apps/workspace/admin.py index 125fdbbed3..01b3cda683 100644 --- a/designsafe/apps/workspace/admin.py +++ b/designsafe/apps/workspace/admin.py @@ -9,7 +9,7 @@ AppListingEntry, AppVariant, AppTrayCategory, - AppTag + AppTag, ) admin.site.register(AppDescription) @@ -43,6 +43,7 @@ def get_fieldsets(self, request, obj=None): "label", "description", "enabled", + "priority", ) }, ), diff --git a/designsafe/apps/workspace/cms_plugins.py b/designsafe/apps/workspace/cms_plugins.py index 9d344e56fd..232dfd3f23 100644 --- a/designsafe/apps/workspace/cms_plugins.py +++ b/designsafe/apps/workspace/cms_plugins.py @@ -62,7 +62,9 @@ class RelatedApps(CMSPluginBase): def render(self, context, instance: AppListingEntry, placeholder): context = super().render(context, instance, placeholder) - listing_entries = instance.app.related_apps.filter(enabled=True) + listing_entries = instance.app.related_apps.filter(enabled=True).order_by( + "label" + ) serialized_listing = [ { "label": entry.label, diff --git a/designsafe/apps/workspace/migrations/0010_alter_applistingentry_options_and_more.py b/designsafe/apps/workspace/migrations/0010_alter_applistingentry_options_and_more.py new file mode 100644 index 0000000000..fa86a6582c --- /dev/null +++ b/designsafe/apps/workspace/migrations/0010_alter_applistingentry_options_and_more.py @@ -0,0 +1,37 @@ +# Generated by Django 4.2.11 on 2024-04-26 19:18 + +from django.db import migrations, models +import django.db.models.functions.comparison + + +class Migration(migrations.Migration): + dependencies = [ + ("workspace", "0009_alter_applistingentry_icon"), + ] + + operations = [ + migrations.AlterModelOptions( + name="applistingentry", + options={ + "ordering": ["is_popular", "label"], + "verbose_name_plural": "App Listing Entries", + }, + ), + migrations.AlterModelOptions( + name="appvariant", + options={ + "ordering": [ + "priority", + django.db.models.functions.comparison.Coalesce("label", "app_id"), + ] + }, + ), + migrations.AddField( + model_name="appvariant", + name="priority", + field=models.IntegerField( + default=0, + help_text="App variant priority, rendered in ascending order.", + ), + ), + ] diff --git a/designsafe/apps/workspace/models/app_entries.py b/designsafe/apps/workspace/models/app_entries.py index a756d3fded..337db3eed5 100644 --- a/designsafe/apps/workspace/models/app_entries.py +++ b/designsafe/apps/workspace/models/app_entries.py @@ -2,6 +2,7 @@ """ from django.db import models +from django.db.models.functions import Coalesce APP_ICONS = [ ("Generic-App", "Generic: Application"), @@ -146,6 +147,8 @@ class Meta: ) ] + ordering = ["is_popular", "label"] + class AppVariant(models.Model): """Model to represent a variant of an app, e.g. a software version or execution environment""" @@ -181,6 +184,11 @@ class AppVariant(models.Model): null=True, ) + priority = models.IntegerField( + help_text="App variant priority, rendered in ascending order.", + default=0, + ) + # HTML Apps html = models.TextField( help_text="HTML definition to display when app is loaded.", @@ -223,3 +231,5 @@ class Meta: name="unique_apps_per_bundle", ) ] + + ordering = ["priority", Coalesce("label", "app_id")]