Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 38 additions & 5 deletions problem_builder/public/css/mentoring-table.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,22 @@

.share-with-instructions {
max-width: 14.5em;
margin-bottom: 0;
text-align: left;
}

.mentoring-share-panel {
float: right;
margin-bottom: .5em;
}

.mentoring-share-panel .mentoring-share-with {
position: absolute;
right: 0;
right: 3.15em;
background-color: rgb(255, 255, 255);
border: 1px solid rgb(221, 221, 221);
border: 2px solid rgb(221, 221, 221);
padding: 1em;
font-size: .8em;
}

.mentoring-share-with .share-header {
Expand All @@ -86,20 +90,46 @@
margin-right: 1em;
}

.mentoring-share-with .remove-share {
color: black;
margin-right: 1.45em;
}

.mentoring-share-with .add-share-field {
line-height: normal;
padding-top: .40em;
padding-bottom: .40em;
}

.mentoring-share-with .share-errors {
color: darkred;
font-size: .75em;
text-align: center;
display: table-caption;
}

.new-share-container {
margin-top: .5em;
vertical-align: top;
width: 100%;
text-align: left;
}

ul.shared-list {
padding-left: 0;
padding-right: 0;
margin: 0 0 .25em 0;
}

.share-errors-container {
display: table;
margin: 0 auto;
}

.shared-list li {
list-style-type: none;
display: block;
padding: .25em;
padding: .25em 0 .25em 0;
margin: 0;
}

Expand All @@ -118,16 +148,19 @@
padding: 1em;
background-color: rgb(255, 255, 255);
position: absolute;
right: 0;
right: 3.15em;
font-size: .8em;
}

.share-notification .notification-close {
float: right;
font-size: 1.2em;
color: black;
cursor: pointer;
}

.report-download-container {
float: left;
text-align: right;
}

.mentoring .identification {
Expand Down
21 changes: 17 additions & 4 deletions problem_builder/public/js/review_blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ function MentoringTableBlock(runtime, element, initData) {
sharedRefresh(data);
$element.find(".new-share-container").each(function(index, container) {
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;
}
$(container).remove()
Expand Down Expand Up @@ -166,6 +168,13 @@ function MentoringTableBlock(runtime, element, initData) {
});

$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({
type: "POST",
url: tableLoadURL,
Expand All @@ -178,16 +187,20 @@ function MentoringTableBlock(runtime, element, initData) {
var container = $newShareContainer.clone();
container.find('.add-share-username').val('');
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) {
event.preventDefault();
$.ajax({
type: "POST",
url: deleteShareUrl,
data: JSON.stringify({'username': $(event.target).prev()[0].innerHTML}),
data: JSON.stringify({'username': $(event.target).parent().prev()[0].innerHTML}),
success: function () {
$(event.target).parent().remove();
$(event.target).parent().parent().remove();
$errorHolder.html('');
},
error: errorMessage
Expand Down
2 changes: 1 addition & 1 deletion problem_builder/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def share_results(self, data, suffix=''):
raise JsonHandlerError(
400,
_('Some users could not be shared with. Please check these usernames: {}').format(
','.join(failed_users)
', '.join(failed_users)
)
)
return {}
Expand Down
18 changes: 10 additions & 8 deletions problem_builder/templates/html/mentoring-table-container.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{% load i18n %}
{% if allow_sharing %}
<div class="share-panel-container">
{% if allow_download %}
<div class="report-download-container"><a class="report-download-link" href="#report_download" download="report.html">{% trans "Download report" %}</a></div>
{% endif %}
<div class="mentoring-share-panel">
{% if view_options %}
<span>{% trans "Display Map from:" %}</span>
Expand All @@ -15,22 +12,24 @@
</select>
{% endif %}
<button class="mentoring-share-button">
<i class="fa fa-share"></i>Share
<i class="fa fa-share-alt"></i> Share
</button>
<div class="mentoring-share-with" style="display: none;">
<div class="shared-with-container"></div>
<div class="share-with-instructions">
<p>{% trans "Enter the username of another student you'd like to share this with." %}</p>
{% trans "Enter the username of another student you'd like to share this with:" %}
</div>
<div class="shared-with-container"></div>
<div class="new-share-container"><input class="add-share-username"><button class="add-share-field">+</button></div>
<div class="share-errors"></div>
<div class="share-errors-container">
<div class="share-errors"></div>
</div>
<div class="share-action-buttons">
<button class="do-share-button">Share</button>
</div>
</div>
{% if share_notifications %}
<div class="share-notification" data-shared="{{share_notifications}}">
<button class="notification-close"><i class="fa fa-close"></i></button>
<a class="notification-close"><i class="fa fa-close"></i></a>
<p><strong>{% trans "Map added!" %}</strong></p>
<p>
{% blocktrans %}
Expand All @@ -52,3 +51,6 @@
<div class="mentoring-table-target"></div>
</div>
</div>
{% if allow_download %}
<div class="report-download-container"><a class="report-download-link" href="#report_download" download="report.html">{% trans "Download report" %}</a></div>
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
{% endif %}
<ul class="shared-list">
{% for username in shared_with %}
<li><span class="username">{{username}}</span><button class="remove-share"><i class="fa fa-trash"></i></button></li>
<li><span class="username">{{username}}</span><a class="remove-share" href="#"><i class="fa fa-trash"></i></a></li>
{% endfor %}
</ul>