diff --git a/src/apps/profiles/views.py b/src/apps/profiles/views.py index 39db7f614..6a20ef535 100644 --- a/src/apps/profiles/views.py +++ b/src/apps/profiles/views.py @@ -19,6 +19,7 @@ from api.serializers.profiles import UserSerializer, OrganizationDetailSerializer, OrganizationEditSerializer, \ UserNotificationSerializer +from api.serializers.competitions import CompetitionSerializerSimple from .forms import SignUpForm, LoginForm, ActivationForm from .models import User, DeletedUser, Organization, Membership from oidc_configurations.models import Auth_Organization @@ -67,7 +68,19 @@ class UserDetailView(LoginRequiredMixin, DetailView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - context['serialized_user'] = json.dumps(UserSerializer(self.get_object()).data) + user = self.get_object() + user_data = UserSerializer(user).data + # Fetch competitions organized by this user + organized_qs = ( + Competition.objects + .filter(created_by=user, published=True) + .order_by("-created_when") + ) + # Serialize into the same shape your public-list cards expect + user_data["competitions_organized"] = CompetitionSerializerSimple( + organized_qs, many=True, context={"request": self.request} + ).data + context["serialized_user"] = json.dumps(user_data).replace(" @@ -253,5 +295,90 @@ .value font-size 15px margin-left 10px + + /* Competition cards (from public-list.tag) */ + .link-no-deco + all unset + text-decoration none + cursor pointer + width 100% + + .tile-wrapper + border solid 1px gainsboro + display inline-flex + background-color #fff + transition all 75ms ease-in-out + color #909090 + width 100% + margin-bottom 6px + + .tile-wrapper:hover + box-shadow 0 3px 4px -1px #cac9c9ff + transition all 75ms ease-in-out + background-color #e6edf2 + border solid 1px #a5b7c5 + + .comp-stats + background-color #344d5e + transition background-color 75ms ease-in-out + + .img-wrapper + padding 5px + align-self center + + .img-wrapper img + max-height 60px !important + max-width 60px !important + margin 0 auto + + .comp-info + flex 1 + padding 0 10px + + .comp-info .heading + text-align left + padding 5px + color #1b1b1b + margin-bottom 0 + + .comp-info .comp-description + text-align left + font-size 13px + line-height 1.15em + margin 0.35em + + .organizer + font-size 13px + text-align left + margin 0.35em + + .comp-stats + background #405e73 + color #e8e8e8 + padding 10px + text-align center + font-size 12px + width 140px + + .loading-indicator + display flex + align-items center + padding 10px 0 + width 100% + margin 0 auto + + .spinner + border 4px solid rgba(0,0,0,.1) + width 28px + height 28px + border-radius 50% + border-top-color #3498db + animation spin 1s ease-in-out infinite + + @keyframes spin + 0% + transform rotate(0deg) + 100% + transform rotate(360deg) diff --git a/src/static/riot/profiles/profile_edit.tag b/src/static/riot/profiles/profile_edit.tag index 7d3dd1bd3..8b3f76d70 100644 --- a/src/static/riot/profiles/profile_edit.tag +++ b/src/static/riot/profiles/profile_edit.tag @@ -73,7 +73,7 @@