Skip to content

Commit

Permalink
added a note to indicate that section counts are students only; updat…
Browse files Browse the repository at this point in the history
…ed canvas_python_sdk version
  • Loading branch information
cmurtaugh committed Aug 4, 2023
1 parent 0076c81 commit 6bed5cc
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 30 deletions.
2 changes: 1 addition & 1 deletion canvas_manage_course/requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ django-watchman==1.3.0
splunk_handler==3.0.0
python-json-logger==2.0.2

canvas_python_sdk @ git+ssh://[email protected]/Harvard-University-iCommons/[email protected]-rc1
canvas_python_sdk @ git+ssh://[email protected]/Harvard-University-iCommons/[email protected]

django-auth-lti @ git+ssh://[email protected]/Harvard-University-iCommons/[email protected]
django-icommons-common @ git+ssh://[email protected]/Harvard-University-iCommons/[email protected]
Expand Down
55 changes: 28 additions & 27 deletions manage_sections/templates/manage_sections/create_section_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h3>
</div>

<div class="row row-lti col-md-8">

<h3>Registrar Enrollment(s):</h3>
<p><small>
These sections are fed from the Registrar's office.
Expand All @@ -36,31 +36,32 @@ <h3>Registrar Enrollment(s):</h3>
<button id="addSection" class="btn btn-primary"><i class="fa fa-plus"></i> Add A Section</button>
<h3>Section(s):</h3>
<ul id="sectionsMenu" class="listNav list-group list-unstyled">

{% for section in sections %}
{% include "manage_sections/section_list.html" with data=section %}
{% endfor %}
{% endfor %}
</ul>

<p><span style="font-size: larger;">*</span> does not include teaching staff enrollments</p>

<form class="hide" action="{% url 'manage_sections:create_section' %}" method="post" id="formId">
<label for="newSectionName" class="sr-only">Enter a section name</label>
<input type="text" id="newSectionName" placeholder="Enter Section Name" class="form-control " />
<input type="text" id="newSectionName" placeholder="Enter Section Name" class="form-control " />
<span class="closeInput closeAdd cancelAdd"><i class="fa fa-times cancelAdd"></i></span>
<div id="formErr" class="hide">
<p class="text-danger">We've encountered an error creating the requested section. Please try again.</p>
</div>
</form>

<form class="hide" action="#" method="post" id="editSection">
<input type="hidden" id="editSectionId"/>
<label for="editSectionName" class="sr-only">Edit section name</label>
<input type="text" id="editSectionName" class="form-control " />
<input type="text" id="editSectionName" class="form-control " />
<span class="closeInput closeEdit cancelEdit "><i class="fa fa-times cancelEdit"></i></span>
<div id="formEditErr" class="hide">
<p class="text-danger">We've encountered an error creating the requested section. Please try again.</p>
</div>
</form>


<div class="modal fade" id="confirmDelSection" tabindex="-1" role="dialog" aria-labelledby="confirmDelSectionLabel" aria-hidden="true">
<div class="modal-dialog">
Expand Down Expand Up @@ -90,17 +91,17 @@ <h4 class="modal-title" id="confirmDelSectionLabel">Confirm Delete</h4>
<script type="text/javascript">

$(document).ready(function(){
//tooltip for buttons (done this way because of dynamically created icons)
//tooltip for buttons (done this way because of dynamically created icons)
$('body').tooltip({
selector: '[rel=tooltip]'
});
$('[rel=tooltip]').tooltip({
container: 'body'
});


//the sections menu
var $menu = $('#sectionsMenu');
var $menu = $('#sectionsMenu');

//the input field
var $newSectionInput = $('#newSectionName');
Expand Down Expand Up @@ -133,7 +134,7 @@ <h4 class="modal-title" id="confirmDelSectionLabel">Confirm Delete</h4>

break;
}

$menu.trigger('insertSection');
e.preventDefault();
break;
Expand All @@ -142,14 +143,14 @@ <h4 class="modal-title" id="confirmDelSectionLabel">Confirm Delete</h4>
e.preventDefault();
break;
}

});


//listen when the user has click away from the text input
$(document).bind('mousedown',function(e){
//checks to see the form input is visible
if ( !($newSectionInput.is(':hidden')) )
if ( !($newSectionInput.is(':hidden')) )
{
//closing the input text field when clicking on the x
if ($(e.target).hasClass('cancelAdd')){
Expand Down Expand Up @@ -179,7 +180,7 @@ <h4 class="modal-title" id="confirmDelSectionLabel">Confirm Delete</h4>
//cancel the edit operation by hiding form and restoring
//to previous section name
if ( $(e.target).hasClass('cancelEdit') )
cancelEditing();
cancelEditing();

//1 listens for mouse click and if the input is empty
//keep the input open with error class
Expand All @@ -191,7 +192,7 @@ <h4 class="modal-title" id="confirmDelSectionLabel">Confirm Delete</h4>
$newSectionInput.focus();
$('#editSectionName').parent().addClass('has-error');
$('#editSectionName').attr('placeholder', 'You must provide a name');

}
//allow them to click on the input field but once they click
//outside then continue with the update
Expand Down Expand Up @@ -238,7 +239,7 @@ <h4 class="modal-title" id="confirmDelSectionLabel">Confirm Delete</h4>
if ( $('#formErr').hasClass('showSection') )
$('#formErr').removeClass('showSection').addClass('hide');
});

//AJAX custom event
$menu.bind('insertSection',function(){
var posting = $.post( "{% url 'manage_sections:create_section' %}", { "section_name_input" : $("input#newSectionName").val()} );
Expand All @@ -248,13 +249,13 @@ <h4 class="modal-title" id="confirmDelSectionLabel">Confirm Delete</h4>
$newSectionInput.val('');
//toggle the text box after success
$newSectionInput.trigger('toggle');

}).fail(function(xhr,textStatus) {
$newSectionInput.val('');
$newSectionInput.parent().addClass('has-error');
$('#formErr').removeClass('hide').addClass('showSection');
});

});

//$editSectionForm holds the form that does the editing
Expand All @@ -271,7 +272,7 @@ <h4 class="modal-title" id="confirmDelSectionLabel">Confirm Delete</h4>
//the height of the li at the moment that is been edited
var $liToEditHeight;

//using .on method so that we can can click on dynamically
//using .on method so that we can can click on dynamically
//generated HTML elements
$(document).on('click', '.editSection', function(){
var url = this.href;
Expand Down Expand Up @@ -308,13 +309,13 @@ <h4 class="modal-title" id="confirmDelSectionLabel">Confirm Delete</h4>
return false;
});

//store the elements that are inside the <li> before the
//store the elements that are inside the <li> before the
//edit icon get's clicked
function cancelEditing(){
$liToEditChildren.appendTo($liToEdit);
$editSectionForm.removeClass('showSection').addClass('hide');
$editSectionForm.removeClass('showSection').addClass('hide');
};

//listening to tab and enter. If the text input is empty then
//throw an error else continue adding the section
$(document).on('keydown', '#editSectionName', function(e){
Expand Down Expand Up @@ -353,7 +354,7 @@ <h4 class="modal-title" id="confirmDelSectionLabel">Confirm Delete</h4>
//call the AJAX update
editSection($('#editSectionName').val(), $editSectionForm.attr('action'), $sectionCount);
}

e.preventDefault();
break;
case 27:
Expand All @@ -368,7 +369,7 @@ <h4 class="modal-title" id="confirmDelSectionLabel">Confirm Delete</h4>
}
});


//removes the error styles for the input element
//takes in a jquery object
function removeHasError(ele) {
Expand All @@ -387,7 +388,7 @@ <h4 class="modal-title" id="confirmDelSectionLabel">Confirm Delete</h4>
var formData = {"section_name_input" : sectionName, "enrollment_count" : sectionCount};

$.ajax({
url : url,
url : url,
type : "POST",
data : formData,
success : function(json) {
Expand All @@ -407,7 +408,7 @@ <h4 class="modal-title" id="confirmDelSectionLabel">Confirm Delete</h4>
else{
$('#editSectionName').val($sectionName);
}

$editSectionForm.removeClass('hide').addClass('showSection');
$('#editSectionName').parent().addClass('has-error');
$('#editSectionName').focus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{% if section.enrollment_count == 'n/a' %}
(enrollee count not available)
{% else %}
(<span class="sectionCount">{{section.enrollment_count}}</span> student{{ section.enrollment_count|pluralize }})
(<span class="sectionCount">{{section.enrollment_count}}</span> student{{ section.enrollment_count|pluralize }}<span style="font-size: larger;">*</span>)
{% endif %}
</a>
<div class="editMenu">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{% if section.enrollment_count == 'n/a' %}
(enrollee count not available)
{% else %}
({{section.enrollment_count}} student{{section.enrollment_count|pluralize}})
({{section.enrollment_count}} student{{section.enrollment_count|pluralize}}<span style="font-size: larger;">*</span>)
{% endif %}
</a>
</li>

0 comments on commit 6bed5cc

Please sign in to comment.