Commit ea1c0600 by Jonathan Piacenti

Further UI improvements.

parent 5efcf9ea
...@@ -59,6 +59,8 @@ ...@@ -59,6 +59,8 @@
.share-with-instructions { .share-with-instructions {
max-width: 14.5em; max-width: 14.5em;
margin-bottom: 0;
text-align: left;
} }
.mentoring-share-panel { .mentoring-share-panel {
...@@ -109,6 +111,8 @@ ...@@ -109,6 +111,8 @@
.new-share-container { .new-share-container {
margin-top: .5em; margin-top: .5em;
vertical-align: top; vertical-align: top;
width: 100%;
text-align: left;
} }
ul.shared-list { ul.shared-list {
......
...@@ -97,7 +97,9 @@ function MentoringTableBlock(runtime, element, initData) { ...@@ -97,7 +97,9 @@ function MentoringTableBlock(runtime, element, initData) {
sharedRefresh(data); sharedRefresh(data);
$element.find(".new-share-container").each(function(index, container) { $element.find(".new-share-container").each(function(index, container) {
if (index === 0) { if (index === 0) {
$(container).find('.add-share-username').val(''); var $container = $(container);
$container.find('.add-share-username').val('');
$container.find('.add-share-field').show();
return; return;
} }
$(container).remove() $(container).remove()
...@@ -166,6 +168,13 @@ function MentoringTableBlock(runtime, element, initData) { ...@@ -166,6 +168,13 @@ function MentoringTableBlock(runtime, element, initData) {
}); });
$displayDropdown.on('change', function () { $displayDropdown.on('change', function () {
if ($displayDropdown[0].selectedIndex !== 0) {
$shareButton.prop('disabled', true);
$element.find('.report-download-container').hide();
} else {
$shareButton.prop('disabled', false);
$element.find('.report-download-container').show();
}
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: tableLoadURL, url: tableLoadURL,
...@@ -174,11 +183,14 @@ function MentoringTableBlock(runtime, element, initData) { ...@@ -174,11 +183,14 @@ function MentoringTableBlock(runtime, element, initData) {
}) })
}); });
function addShare(event) { function addShare() {
var container = $newShareContainer.clone(); var container = $newShareContainer.clone();
container.find('.add-share-username').val(''); container.find('.add-share-username').val('');
container.insertAfter($element.find('.new-share-container').last()); container.insertAfter($element.find('.new-share-container').last());
container.find('.add-share-field').on('click', addShare) container.find('.add-share-field').on('click', addShare);
var buttons = $element.find('.new-share-container .add-share-field');
buttons.hide();
buttons.last().show();
} }
function deleteShare(event) { function deleteShare(event) {
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<div class="mentoring-share-with" style="display: none;"> <div class="mentoring-share-with" style="display: none;">
<div class="shared-with-container"></div> <div class="shared-with-container"></div>
<div class="share-with-instructions"> <div class="share-with-instructions">
<p>{% trans "Enter usernames:" %}</p> {% trans "Enter the username of another student you'd like to share this with:" %}
</div> </div>
<div class="new-share-container"><input class="add-share-username"><button class="add-share-field">+</button></div> <div class="new-share-container"><input class="add-share-username"><button class="add-share-field">+</button></div>
<div class="share-errors-container"> <div class="share-errors-container">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment