Instructor Dash: Display message when there are no tasks running

This commit adds a message to the instructor dashboard that is displayed when
no instructor tasks are currently running. This message is displayed where the
instructor pending tasks table would normally be placed, and is replaced
with the table when there are running tasks.
This commit is contained in:
njdup
2014-08-14 13:46:22 -07:00
parent ccf85a9431
commit 93d088505f
6 changed files with 44 additions and 12 deletions

View File

@@ -268,7 +268,9 @@ class PendingInstructorTasks
### Pending Instructor Tasks Section ####
constructor: (@$section) ->
# Currently running tasks
@$running_tasks_section = find_and_assert @$section, ".running-tasks-section"
@$table_running_tasks = find_and_assert @$section, ".running-tasks-table"
@$no_tasks_message = find_and_assert @$section, ".no-pending-tasks-message"
# start polling for task list
# if the list is in the DOM
@@ -287,8 +289,14 @@ class PendingInstructorTasks
success: (data) =>
if data.tasks.length
create_task_list_table @$table_running_tasks, data.tasks
@$no_tasks_message.hide()
@$running_tasks_section.show()
else
console.log "No pending instructor tasks to display"
@$running_tasks_section.hide()
@$no_tasks_message.empty()
@$no_tasks_message.append $('<p>').text gettext("No tasks currently running.")
@$no_tasks_message.show()
error: std_ajax_err => console.error "Error finding pending instructor tasks to display"
### /Pending Instructor Tasks Section ####

View File

@@ -224,6 +224,18 @@ section.instructor-dashboard-content-2 {
.basic-data {
padding: 6px;
}
.running-tasks-section {
display: none;
}
.no-pending-tasks-message {
display: none;
p {
color: #a2a2a2;
font-style: italic;
}
}
}
}

View File

@@ -76,10 +76,13 @@
<div class="running-tasks-container action-type-container">
<hr>
<h2> ${_("Pending Instructor Tasks")} </h2>
<p>${_("The status for any active tasks appears in a table below.")} </p>
<br />
<div class="running-tasks-section">
<p>${_("The status for any active tasks appears in a table below.")} </p>
<br />
<div class="running-tasks-table" data-endpoint="${ section_data['list_instructor_tasks_url'] }"></div>
<div class="running-tasks-table" data-endpoint="${ section_data['list_instructor_tasks_url'] }"></div>
</div>
<div class="no-pending-tasks-message"></div>
</div>
%endif

View File

@@ -69,8 +69,11 @@
<div class="running-tasks-container action-type-container">
<hr>
<h2> ${_("Pending Instructor Tasks")} </h2>
<p>${_("The status for any active tasks appears in a table below.")} </p>
<br />
<div class="running-tasks-table" data-endpoint="${ section_data['list_instructor_tasks_url'] }"></div>
<div class="running-tasks-section">
<p>${_("The status for any active tasks appears in a table below.")} </p>
<br />
<div class="running-tasks-table" data-endpoint="${ section_data['list_instructor_tasks_url'] }"></div>
</div>
<div class="no-pending-tasks-message"></div>
</div>
%endif

View File

@@ -59,10 +59,13 @@
<div class="running-tasks-container action-type-container">
<hr>
<h2> ${_("Pending Instructor Tasks")} </h2>
<p>${_("Email actions run in the background. The status for any active tasks - including email tasks - appears in a table below.")} </p>
<br />
<div class="running-tasks-section">
<p>${_("Email actions run in the background. The status for any active tasks - including email tasks - appears in a table below.")} </p>
<br />
<div class="running-tasks-table" data-endpoint="${ section_data['list_instructor_tasks_url'] }"></div>
<div class="running-tasks-table" data-endpoint="${ section_data['list_instructor_tasks_url'] }"></div>
</div>
<div class="no-pending-tasks-message"></div>
</div>

View File

@@ -117,10 +117,13 @@
<div class="running-tasks-container action-type-container">
<hr>
<h2> ${_("Pending Instructor Tasks")} </h2>
<p>${_("The status for any active tasks appears in a table below.")} </p>
<br />
<div class="running-tasks-section">
<p>${_("The status for any active tasks appears in a table below.")} </p>
<br />
<div class="running-tasks-table" data-endpoint="${ section_data['list_instructor_tasks_url'] }"></div>
<div class="running-tasks-table" data-endpoint="${ section_data['list_instructor_tasks_url'] }"></div>
</div>
<div class="no-pending-tasks-message"></div>
</div>
%endif