Skip to content

Commit

Permalink
Merge pull request #6246 from roed314/search_blue
Browse files Browse the repository at this point in the history
Change color of Search again button when inputs change
  • Loading branch information
AndrewVSutherland authored Nov 15, 2024
2 parents ef8afde + 1606d3e commit 99713dd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
12 changes: 11 additions & 1 deletion lmfdb/templates/refine_search_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ <h2 id='search_h2'>{{KNOWL('intro.search', search_header)}}
<input type="hidden" name="sort_dir" value="{{info.sort_dir}}" />
</form>

<script>
{% if info.search_array.has_advanced_inputs(info) %}
<script> show_advancedQ(); </script>
show_advancedQ();
{% endif %}

function set_fresh() {
$(".search_stale").removeClass("search_stale").addClass("search_fresh");
}

$("input").on("input", set_fresh);
$("select").on("change", set_fresh);
</script>

7 changes: 7 additions & 0 deletions lmfdb/templates/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2262,3 +2262,10 @@ div.upload_section {
.grecaptcha-badge {
visibility: hidden;
}

button.search_stale, button.search_stale:hover {
background: {{color.select_background}};
}
button.search_fresh {
background: {{color.button_background}};
}
7 changes: 6 additions & 1 deletion lmfdb/utils/search_boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,11 +610,16 @@ def _input(self, info):
onclick = ""
else:
onclick = " onclick='resetStart()'"
btext = "<button type='submit' name='search_type' value='{val}' style='width: {width}px;'{onclick}>{desc}</button>"
if self.description in ["Search again", "Generate statistics"]:
cls = " class='search_stale'"
else:
cls = " class='search_fresh'"
btext = "<button type='submit' name='search_type' value='{val}'{cls} style='width: {width}px;'{onclick}>{desc}</button>"
return btext.format(
width=self.width,
val=self.value,
desc=self.description,
cls=cls,
onclick=onclick)

class SearchButtonWithSelect(SearchButton):
Expand Down

0 comments on commit 99713dd

Please sign in to comment.