Skip to content
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
34 changes: 20 additions & 14 deletions ietf/static/js/ipr-search.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
$(document)
.ready(function () {
// hack the "All States" check box
$("#id_state")
.addClass("list-inline");
$("#id_state .form-check")
.addClass("form-check-inline");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this not be done in the template?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These forms would need some serious work to better work with bs.


$("#id_state input[value!=all]")
.on("change", function (e) {
Expand All @@ -20,18 +20,24 @@ $(document)
}
});

$("form.ipr-search button[type=submit]")
.on("click", function (e) {
const value = $(e.target)
.attr("value");
$("form.ipr-search input[name=submit]")
.attr("value", value);
});

// make enter presses submit through the nearby button
// FIXME: this seems to be broken
$("form.ipr-search input,select")
.on("keyup", function (e) {
var submitButton = $(this)
.closest(".mb-3")
.find('button[type=submit]');
if (e.which == 13 && submitButton.length > 0) {
submitButton.trigger("click");
return false;
} else {
return true;
$("form.ipr-search input")
.on("keydown", function (e) {
if (e.key != "Enter") {
return;
}
e.preventDefault();
$(this)
.closest(".input-group")
.find('button[type=submit]')
.trigger("click");
});
});
});
14 changes: 7 additions & 7 deletions ietf/templates/ipr/search_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h2 class="mt-4">Document search</h2>
{% bootstrap_label form.draft.label label_for=form.draft.id_for_label label_class="form-label" %}
<div class="input-group">
{% render_field form.draft class="form-control" placeholder="draft-..." %}
<button class="btn btn-primary" type="submit" name="submit" value="draft">
<button class="btn btn-primary" type="submit" value="draft">
<i class="bi bi-search"></i> Search
</button>
</div>
Expand All @@ -22,7 +22,7 @@ <h2 class="mt-4">Document search</h2>
{% bootstrap_label form.rfc.label label_for=form.rfc.id_for_label label_class="form-label" %}
<div class="input-group">
{% render_field form.rfc class="form-control" placeholder="123..." %}
<button class="btn btn-primary" type="submit" name="submit" value="rfc">
<button class="btn btn-primary" type="submit" value="rfc">
<i class="bi bi-search"></i> Search
</button>
</div>
Expand All @@ -31,7 +31,7 @@ <h2 class="mt-4">Document search</h2>
{% bootstrap_label form.doctitle.label|cut:":" label_for=form.doctitle.id_for_label label_class="form-label" %}
<div class="input-group">
{% render_field form.doctitle class="form-control" placeholder="protocol..." %}
<button class="btn btn-primary" type="submit" name="submit" value="doctitle">
<button class="btn btn-primary" type="submit" value="doctitle">
<i class="bi bi-search"></i> Search
</button>
</div>
Expand All @@ -42,7 +42,6 @@ <h2 class="mt-4">Document search</h2>
{% render_field form.group class="form-select" %}
<button class="btn btn-primary btn-block"
type="submit"
name="submit"
value="group">
<i class="bi bi-search"></i> Search
</button>
Expand All @@ -53,7 +52,7 @@ <h2 class="mt-4">IPR search</h2>
{% bootstrap_label form.holder.label|cut:":" label_for=form.holder.id_for_label label_class="form-label" %}
<div class="input-group">
{% render_field form.holder class="form-control" placeholder="John Doe..." %}
<button class="btn btn-primary" type="submit" name="submit" value="holder">
<button class="btn btn-primary" type="submit" value="holder">
<i class="bi bi-search"></i> Search
</button>
</div>
Expand All @@ -62,7 +61,7 @@ <h2 class="mt-4">IPR search</h2>
{% bootstrap_label form.iprtitle.label|cut:":" label_for=form.iprtitle.id_for_label label_class="form-label" %}
<div class="input-group">
{% render_field form.iprtitle class="form-control" placeholder="protocol..." %}
<button class="btn btn-primary" type="submit" name="submit" value="iprtitle">
<button class="btn btn-primary" type="submit" value="iprtitle">
<i class="bi bi-search"></i> Search
</button>
</div>
Expand All @@ -71,7 +70,7 @@ <h2 class="mt-4">IPR search</h2>
{% bootstrap_label form.patent.label|cut:":" label_for=form.patent.id_for_label label_class="form-label" %}
<div class="input-group">
{% render_field form.patent class="form-control" %}
<button class="btn btn-primary" type="submit" name="submit" value="patent">
<button class="btn btn-primary" type="submit" value="patent">
<i class="bi bi-search"></i> Search
</button>
</div>
Expand All @@ -81,6 +80,7 @@ <h2 class="mt-4">IPR search</h2>
please enter the entire string, or as much of it as possible.
</div>
</div>
<input type="hidden" name="submit">
</form>
<p class="alert alert-info my-3">
The material posted as IPR disclosures should be viewed as originating
Expand Down