Skip to content

Make committer select box easier to use #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions media/commitfest/js/commitfest.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,4 +379,26 @@ $(document).ready(() => {
return false;
});
});

$(".enable-selectize").selectize({
plugins: ["remove_button"],
valueField: "id",
labelField: "value",
searchField: "value",
onFocus: function () {
if (this.$input.is("[multiple]")) {
return;
}
this.lastValue = this.getValue();
this.clear(false);
},
onBlur: function () {
if (this.$input.is("[multiple]")) {
return;
}
if (this.getValue() === "") {
this.setValue(this.lastValue);
}
},
});
});
3 changes: 3 additions & 0 deletions pgcommitfest/commitfest/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<link rel="stylesheet" href="/media/commitfest/css/jquery-ui.css" type="text/css">
<link rel="stylesheet" href="/media/commitfest/css/bootstrap.css" />
<link rel="stylesheet" href="/media/commitfest/css/bootstrap-theme.min.css" />
<link rel="stylesheet" href="/media/commitfest/css/selectize.css" />
<link rel="stylesheet" href="/media/commitfest/css/selectize.default.css" />
<link rel="stylesheet" href="/media/commitfest/css/commitfest.css?{% static_file_param %}" />
<link rel="shortcut icon" href="/media/commitfest/favicon.ico" />
{%block extrahead%}{%endblock%}
Expand Down Expand Up @@ -49,6 +51,7 @@ <h1>{{title}}</h1>
<script src="/media/commitfest/js/jquery.js"></script>
<script src="/media/commitfest/js/jquery-ui.js"></script>
<script src="/media/commitfest/js/bootstrap.js"></script>
<script src="/media/commitfest/js/selectize.min.js"></script>
<script src="/media/commitfest/js/commitfest.js?{% static_file_param %}"></script>
{%block morescript%}{%endblock%}
</html>
3 changes: 0 additions & 3 deletions pgcommitfest/commitfest/templates/base_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ <h3>Search user</h3>
{%endif%}
{%endblock%}

{%block extrahead%}
{%include "selectize_css.html" %}
{%endblock%}
{%block morescript%}

{%include "selectize_js.html" %}
Expand Down
3 changes: 0 additions & 3 deletions pgcommitfest/commitfest/templates/commitfest.html
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ <h3>{{p.is_open|yesno:"Active patches,Closed patches"}}</h3>
</div>
{%endblock%}

{%block extrahead%}
{%include "selectize_css.html" %}
{%endblock%}
{%block morescript%}
{%include "selectize_js.html" %}
<script>
Expand Down
3 changes: 0 additions & 3 deletions pgcommitfest/commitfest/templates/me.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ <h3>{%if user.is_authenticated%}Open patches you are subscribed to{%elif p.is_op
{%endif%}
{%endfor%}
{%endblock%}
{%block extrahead%}
{%include "selectize_css.html" %}
{%endblock%}
{%block morescript%}
{%include "selectize_js.html" %}
{%endblock%}
2 changes: 1 addition & 1 deletion pgcommitfest/commitfest/templates/patch.html
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ <h3>Flag as committed</h3>
<form class="form" style="margin-bottom: 5px;">
<div class="form-group">
<label for="committerlist">Committer</label>
<select id="committerSelect" class="form-control">
<select id="committerSelect" class="enable-selectize">
<option value="" style="display:none;"></option>
{%for c in committers%}
<option value="{{c.user.username}}">{{c.user.first_name}} {{c.user.last_name}}</option>
Expand Down
3 changes: 0 additions & 3 deletions pgcommitfest/commitfest/templates/selectize_css.html

This file was deleted.

1 change: 0 additions & 1 deletion pgcommitfest/commitfest/templates/selectize_js.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<script src="/media/commitfest/js/selectize.min.js"></script>
<script>
{% for f, url in form.selectize_fields.items %}
$('#id_{{f}}').selectize({
Expand Down
2 changes: 1 addition & 1 deletion pgcommitfest/commitfest/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ def patch(request, patchid):
cf = patch_commitfests[0].commitfest

committers = Committer.objects.filter(active=True).order_by(
"user__last_name", "user__first_name"
"user__first_name", "user__last_name"
)

cfbot_branch = getattr(patch, "cfbot_branch", None)
Expand Down