Просмотр исходного кода

Add ability to select all projects in "Exclude Projects" table

Alan Lam 5 лет назад
Родитель
Сommit
3a07af09c7
2 измененных файлов с 11 добавлено и 2 удалено
  1. 5 1
      public/js/app-reports.js
  2. 6 1
      views/reports.php

+ 5 - 1
public/js/app-reports.js

@@ -9,7 +9,6 @@ $(function() {
 		columns: [
 			{
 				data: "id",
-				class: "text-right",
 				orderable: false,
 				render: function(data, type) {
 					if(type === "display") {
@@ -92,6 +91,11 @@ $(function() {
 		$("#date-end").val(endValue);
 	});
 
+	$("#exclude-projects-header-checkbox").on("change", event => {
+		const checked = event.currentTarget.checked;
+		$("#projects-table > tbody").find("input:checkbox").prop("checked", checked);
+	});
+
 });
 
 function testsByStageFormatter(value, context) {

+ 6 - 1
views/reports.php

@@ -167,7 +167,12 @@ let projectData = <?=json_encode($project_table_data)?>;
 						<table class="table table-sm table-sm-text table-hover table-pointer" id="projects-table">
 							<thead>
 								<tr>
-									<th></th>
+									<th>
+										<label for="exclude-projects-header-checkbox" class="sr-only">
+											<?=htmlspecialchars(__("Exclude All"))?>
+										</label>
+										<input id="exclude-projects-header-checkbox" type="checkbox" />
+									</th>
 									<th>ID</th>
 									<th>Name</th>
 									<th><span title="Time of Day" data-toggle="tooltip">TOD</span></th>