diff --git a/scipost_django/colleges/forms.py b/scipost_django/colleges/forms.py index 4ccc6f387cf68e35ac3689fd3701eb70df074eb4..fb9e5acb54d0d1b70f08098679c0cc5332980709 100644 --- a/scipost_django/colleges/forms.py +++ b/scipost_django/colleges/forms.py @@ -309,19 +309,16 @@ class FellowshipNominationForm(forms.ModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - #self.fields['profile'].widget.attrs['readonly'] = True - self.profile = None + self.fields['nominator_comments'].widget.attrs['rows'] = 4 self.helper = FormHelper() self.helper.layout = Layout( Field('profile_id', type='hidden'), Field('nominated_by', type='hidden'), Div( - Field('nominator_comments') - ), - Div( - Div(FloatingField('college'), css_class='col-lg-8'), + Div(Field('nominator_comments'), css_class='col-lg-8'), Div( - ButtonHolder(Submit('submit', 'Submit', css_class='btn btn-danger')), + FloatingField('college'), + ButtonHolder(Submit('submit', 'Submit', css_class='btn btn-primary')), css_class="col-lg-4" ), css_class='row' diff --git a/scipost_django/colleges/templates/colleges/_hx_nomination_form.html b/scipost_django/colleges/templates/colleges/_hx_nomination_form.html index 75cc8ac438ec583ffdafbb6bf4f39dc10d0d88e4..3c8657490700d1be1256b4f10f8e71fab63418e4 100644 --- a/scipost_django/colleges/templates/colleges/_hx_nomination_form.html +++ b/scipost_django/colleges/templates/colleges/_hx_nomination_form.html @@ -1,5 +1,5 @@ {% load crispy_forms_tags %} -<h3>Nomination to Fellowship for {{ profile }}</h3> +<h3>Nomination to Fellowship: <em>{{ profile }}</em></h3> <form hx-post="{% url 'colleges:_hx_nomination_form' profile_id=profile.pk %}" hx-target="#nomination_form_response" diff --git a/scipost_django/colleges/templates/colleges/nominations.html b/scipost_django/colleges/templates/colleges/nominations.html index 34d6f8758f128ee6d0dff8c82eef68d9071c4961..f4c6146758223a49b701f8b9bfac7861cd32fc22 100644 --- a/scipost_django/colleges/templates/colleges/nominations.html +++ b/scipost_django/colleges/templates/colleges/nominations.html @@ -22,21 +22,41 @@ <div class="card-body"> <div class="row"> <div class="col-lg-6"> + <h3>Procedure</h3> + <ul> + <li>Type your search query in the search form</li> + <li>When you see the name you're looking for in the list of matches, double-click on it</li> + <li>The nomination form will appear below</li> + <li>Fill it in and submit!</li> + </ul> <form hx-post="{% url 'profiles:_hx_profile_dynsel_list' %}" hx-trigger="keyup delay:200ms, change" hx-target="#profile_dynsel_results" + hx-indicator="#profile_dynsel_results-indicator" > {% csrf_token %} <div id="profile_dynsel_form">{% crispy profile_dynsel_form %}</div> </form> + <div id="profile_dynsel_results-indicator" class="htmx-indicator p-2"> + <button class="btn btn-warning" type="button" disabled> + <strong>Loading results...</strong> + <div class="spinner-grow spinner-grow-sm ms-2" role="status" aria-hidden="true"></div> + </button> + </div> + <div id="nomination_form_response-indicator" class="htmx-indicator p-2"> + <button class="btn btn-warning" type="button" disabled> + <strong>Loading form...</strong> + <div class="spinner-grow spinner-grow-sm ms-2" role="status" aria-hidden="true"></div> + </button> + </div> </div> <div class="col-lg-6"> + <h3>Matching profiles</h3> <div id="profile_dynsel_results" class="border border-light m-2 p-1"></div> </div> </div> - <div id="nomination_form_response"> - </div> + <div id="nomination_form_response"></div> </div> </div> diff --git a/scipost_django/colleges/views.py b/scipost_django/colleges/views.py index e1b349831c397d63747165b85bea00aeb3388539..e9c032567d99b3ef58c3bbcae6fa0ba728433545 100644 --- a/scipost_django/colleges/views.py +++ b/scipost_django/colleges/views.py @@ -583,12 +583,3 @@ def _hx_nominations(request): page_obj = paginator.get_page(page_nr) context = { 'page_obj': page_obj } return render(request, 'colleges/_hx_nominations.html', context) - - -# @login_required -# @user_passes_test(is_edadmin_or_active_regular_or_senior_fellow) -# def _hx_nominate(request): -# form = FellowshipNominationForm(request.POST or None) -# if form.is_valid(): -# nomination = form.save() -# return render(reverse('colleges/_hx_nominations.html diff --git a/scipost_django/profiles/templates/profiles/_hx_profile_dynsel_list.html b/scipost_django/profiles/templates/profiles/_hx_profile_dynsel_list.html index 2afed6cbc9debec207e2d1760679d7adb7e58525..1a850fd67a444afef387ccd5a0d68a9ba27cfb88 100644 --- a/scipost_django/profiles/templates/profiles/_hx_profile_dynsel_list.html +++ b/scipost_django/profiles/templates/profiles/_hx_profile_dynsel_list.html @@ -1,6 +1,6 @@ {% load profiles_extras %} -<ul class="list list-unstyled"> +<ul class="list list-unstyled dynsel-list"> {% for profile in profiles|slice:":11" %} {% if forloop.counter == 11 %} <li> ...</li> @@ -9,6 +9,7 @@ <a hx-get="{% profile_dynsel_action_url profile %}" hx-target="#{{ action_target_element_id }}" + hx-indicator="#{{ action_target_element_id }}-indicator" > {{ profile }} </a> diff --git a/scipost_django/scipost/static/scipost/assets/css/_dynsel.scss b/scipost_django/scipost/static/scipost/assets/css/_dynsel.scss new file mode 100644 index 0000000000000000000000000000000000000000..bca504b9c6ab904b43c64ff8a5cd03fdf03e1145 --- /dev/null +++ b/scipost_django/scipost/static/scipost/assets/css/_dynsel.scss @@ -0,0 +1,4 @@ + +.dynsel-list > li > a:hover { + background-color: #d0d0d0; +} diff --git a/scipost_django/scipost/static/scipost/assets/css/style.scss b/scipost_django/scipost/static/scipost/assets/css/style.scss index 0f6dcd2e6d0e3511447365b53a9f3de757750dd7..604b806a485b3fa758c8a34ea1a7669cff8e5669 100644 --- a/scipost_django/scipost/static/scipost/assets/css/style.scss +++ b/scipost_django/scipost/static/scipost/assets/css/style.scss @@ -48,6 +48,7 @@ @import "general"; @import "colleges"; @import "comments"; +@import "dynsel"; @import "icons"; @import "journals"; @import "personal_page";