Skip to content

Commit 760ee90

Browse files
committed
Do not display the select across if single page #1524
Signed-off-by: tdruez <[email protected]>
1 parent 08bba22 commit 760ee90

File tree

4 files changed

+31
-25
lines changed

4 files changed

+31
-25
lines changed

scanpipe/templates/scanpipe/modals/projects_archive_modal.html

+10-8
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,16 @@
3333
{{ archive_form.remove_output.label }}
3434
</label>
3535
</div>
36-
<hr>
37-
<div class="field">
38-
<label class="checkbox" for="{{ archive_form.select_across.id_for_label }}">
39-
<input type="checkbox" name="{{ archive_form.select_across.name }}" id="{{ archive_form.select_across.id_for_label }}">
40-
Include all {{ paginator.count|intcomma }} projects
41-
</label>
42-
<p class="help">{{ outputs_download_form.select_across.help_text }}</p>
43-
</div>
36+
{% if page_obj.paginator.num_pages > 1 %}
37+
<hr>
38+
<div class="field">
39+
<label class="checkbox" for="{{ archive_form.select_across.id_for_label }}">
40+
<input type="checkbox" name="{{ archive_form.select_across.name }}" id="{{ archive_form.select_across.id_for_label }}">
41+
Include all {{ paginator.count|intcomma }} projects
42+
</label>
43+
<p class="help">{{ outputs_download_form.select_across.help_text }}</p>
44+
</div>
45+
{% endif %}
4446
</section>
4547
<input type="hidden" name="{{ archive_form.url_query.name }}" value="{{ request.GET.urlencode }}">
4648
<input type="hidden" name="action" value="archive">

scanpipe/templates/scanpipe/modals/projects_download_modal.html

+10-8
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,16 @@
1414
{{ outputs_download_form.output_format }}
1515
</div>
1616
</div>
17-
<hr>
18-
<div class="field">
19-
<label class="checkbox" for="{{ outputs_download_form.select_across.id_for_label }}">
20-
<input type="checkbox" name="{{ outputs_download_form.select_across.name }}" id="{{ outputs_download_form.select_across.id_for_label }}">
21-
Include all {{ paginator.count|intcomma }} projects
22-
</label>
23-
<p class="help">{{ outputs_download_form.select_across.help_text }}</p>
24-
</div>
17+
{% if page_obj.paginator.num_pages > 1 %}
18+
<hr>
19+
<div class="field">
20+
<label class="checkbox" for="{{ outputs_download_form.select_across.id_for_label }}">
21+
<input type="checkbox" name="{{ outputs_download_form.select_across.name }}" id="{{ outputs_download_form.select_across.id_for_label }}">
22+
Include all {{ paginator.count|intcomma }} projects
23+
</label>
24+
<p class="help">{{ outputs_download_form.select_across.help_text }}</p>
25+
</div>
26+
{% endif %}
2527
</section>
2628
<input type="hidden" name="{{ outputs_download_form.url_query.name }}" value="{{ request.GET.urlencode }}">
2729
<input type="hidden" name="action" value="download">

scanpipe/templates/scanpipe/modals/projects_report_modal.html

+10-8
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,16 @@
1414
{{ report_form.model_name }}
1515
</div>
1616
</div>
17-
<hr>
18-
<div class="field">
19-
<label class="checkbox" for="{{ report_form.select_across.id_for_label }}">
20-
<input type="checkbox" name="{{ report_form.select_across.name }}" id="{{ report_form.select_across.id_for_label }}">
21-
Include all {{ paginator.count|intcomma }} projects
22-
</label>
23-
<p class="help">{{ report_form.select_across.help_text }}</p>
24-
</div>
17+
{% if page_obj.paginator.num_pages > 1 %}
18+
<hr>
19+
<div class="field">
20+
<label class="checkbox" for="{{ report_form.select_across.id_for_label }}">
21+
<input type="checkbox" name="{{ report_form.select_across.name }}" id="{{ report_form.select_across.id_for_label }}">
22+
Include all {{ paginator.count|intcomma }} projects
23+
</label>
24+
<p class="help">{{ report_form.select_across.help_text }}</p>
25+
</div>
26+
{% endif %}
2527
</section>
2628
<input type="hidden" name="{{ report_form.url_query.name }}" value="{{ request.GET.urlencode }}">
2729
<input type="hidden" name="action" value="report">

scanpipe/views.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@ class ProjectListView(
556556
):
557557
model = Project
558558
filterset_class = ProjectFilterSet
559+
paginate_by = settings.SCANCODEIO_PAGINATE_BY.get("project", 20)
559560
template_name = "scanpipe/project_list.html"
560561
prefetch_related = [
561562
"labels",
@@ -572,7 +573,6 @@ class ProjectListView(
572573
),
573574
),
574575
]
575-
paginate_by = settings.SCANCODEIO_PAGINATE_BY.get("project", 20)
576576
table_columns = [
577577
"name",
578578
{

0 commit comments

Comments
 (0)