Commit 5efcf9ea by Jonathan Piacenti

Visual improvements to Table block.

parent f5953e35
...@@ -63,14 +63,16 @@ ...@@ -63,14 +63,16 @@
.mentoring-share-panel { .mentoring-share-panel {
float: right; float: right;
margin-bottom: .5em;
} }
.mentoring-share-panel .mentoring-share-with { .mentoring-share-panel .mentoring-share-with {
position: absolute; position: absolute;
right: 0; right: 3.15em;
background-color: rgb(255, 255, 255); background-color: rgb(255, 255, 255);
border: 1px solid rgb(221, 221, 221); border: 2px solid rgb(221, 221, 221);
padding: 1em; padding: 1em;
font-size: .8em;
} }
.mentoring-share-with .share-header { .mentoring-share-with .share-header {
...@@ -86,20 +88,44 @@ ...@@ -86,20 +88,44 @@
margin-right: 1em; 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 { .mentoring-share-with .share-errors {
color: darkred; color: darkred;
font-size: .75em; font-size: .75em;
text-align: center; text-align: center;
display: table-caption;
} }
.new-share-container { .new-share-container {
margin-top: .5em; margin-top: .5em;
vertical-align: top;
}
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 { .shared-list li {
list-style-type: none; list-style-type: none;
display: block; display: block;
padding: .25em; padding: .25em 0 .25em 0;
margin: 0; margin: 0;
} }
...@@ -118,16 +144,19 @@ ...@@ -118,16 +144,19 @@
padding: 1em; padding: 1em;
background-color: rgb(255, 255, 255); background-color: rgb(255, 255, 255);
position: absolute; position: absolute;
right: 0; right: 3.15em;
font-size: .8em; font-size: .8em;
} }
.share-notification .notification-close { .share-notification .notification-close {
float: right; float: right;
font-size: 1.2em;
color: black;
cursor: pointer;
} }
.report-download-container { .report-download-container {
float: left; text-align: right;
} }
.mentoring .identification { .mentoring .identification {
......
...@@ -174,7 +174,7 @@ function MentoringTableBlock(runtime, element, initData) { ...@@ -174,7 +174,7 @@ function MentoringTableBlock(runtime, element, initData) {
}) })
}); });
function addShare() { function addShare(event) {
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());
...@@ -182,12 +182,13 @@ function MentoringTableBlock(runtime, element, initData) { ...@@ -182,12 +182,13 @@ function MentoringTableBlock(runtime, element, initData) {
} }
function deleteShare(event) { function deleteShare(event) {
event.preventDefault();
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: deleteShareUrl, url: deleteShareUrl,
data: JSON.stringify({'username': $(event.target).prev()[0].innerHTML}), data: JSON.stringify({'username': $(event.target).parent().prev()[0].innerHTML}),
success: function () { success: function () {
$(event.target).parent().remove(); $(event.target).parent().parent().remove();
$errorHolder.html(''); $errorHolder.html('');
}, },
error: errorMessage error: errorMessage
......
...@@ -200,7 +200,7 @@ class MentoringTableBlock( ...@@ -200,7 +200,7 @@ class MentoringTableBlock(
raise JsonHandlerError( raise JsonHandlerError(
400, 400,
_('Some users could not be shared with. Please check these usernames: {}').format( _('Some users could not be shared with. Please check these usernames: {}').format(
','.join(failed_users) ', '.join(failed_users)
) )
) )
return {} return {}
......
{% load i18n %} {% load i18n %}
{% if allow_sharing %} {% if allow_sharing %}
<div class="share-panel-container"> <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"> <div class="mentoring-share-panel">
{% if view_options %} {% if view_options %}
<span>{% trans "Display Map from:" %}</span> <span>{% trans "Display Map from:" %}</span>
...@@ -15,22 +12,24 @@ ...@@ -15,22 +12,24 @@
</select> </select>
{% endif %} {% endif %}
<button class="mentoring-share-button"> <button class="mentoring-share-button">
<i class="fa fa-share"></i>Share <i class="fa fa-share-alt"></i> Share
</button> </button>
<div class="mentoring-share-with" style="display: none;"> <div class="mentoring-share-with" style="display: none;">
<div class="shared-with-container"></div>
<div class="share-with-instructions"> <div class="share-with-instructions">
<p>{% trans "Enter the username of another student you'd like to share this with." %}</p> <p>{% trans "Enter usernames:" %}</p>
</div> </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="new-share-container"><input class="add-share-username"><button class="add-share-field">+</button></div>
<div class="share-errors-container">
<div class="share-errors"></div> <div class="share-errors"></div>
</div>
<div class="share-action-buttons"> <div class="share-action-buttons">
<button class="do-share-button">Share</button> <button class="do-share-button">Share</button>
</div> </div>
</div> </div>
{% if share_notifications %} {% if share_notifications %}
<div class="share-notification" data-shared="{{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><strong>{% trans "Map added!" %}</strong></p>
<p> <p>
{% blocktrans %} {% blocktrans %}
...@@ -52,3 +51,6 @@ ...@@ -52,3 +51,6 @@
<div class="mentoring-table-target"></div> <div class="mentoring-table-target"></div>
</div> </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 %}
\ No newline at end of file
...@@ -4,6 +4,6 @@ ...@@ -4,6 +4,6 @@
{% endif %} {% endif %}
<ul class="shared-list"> <ul class="shared-list">
{% for username in shared_with %} {% 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 %} {% endfor %}
</ul> </ul>
\ No newline at end of file
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