Update actionbar share and comment
This commit is contained in:
parent
a5c045986b
commit
b6a09c9ebb
10 changed files with 35 additions and 27 deletions
|
@ -1,5 +1,5 @@
|
|||
function showTooltip(elem, msg) {
|
||||
elem.setAttribute('class', 'btn-clipboard tooltipped tooltipped-s');
|
||||
function showTooltip(elem, msg, direction='s') {
|
||||
$(elem).addClass('tooltipped tooltipped-' + direction);
|
||||
elem.setAttribute('aria-label', msg);
|
||||
}
|
||||
function fallbackMessage(action) {
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
</span>
|
||||
</span>
|
||||
{% if not hide_actionbar_comment %}
|
||||
<span class="actionbar-block" id="comment-button">
|
||||
<span class="actionbar-button">
|
||||
<span class="actionbar-block">
|
||||
<span class="actionbar-button actionbar-comment">
|
||||
<i class="fa fa-comment-o" style="font-size: large;"></i>
|
||||
<span class="actionbar-text">{{_("Comment")}}</span>
|
||||
</span>
|
||||
|
@ -33,8 +33,8 @@
|
|||
<span class="actionbar-text">{{_("Bookmark")}}</span>
|
||||
</span>
|
||||
</span>
|
||||
<span class="actionbar-block" id="share-button" >
|
||||
<span class="actionbar-button">
|
||||
<span class="actionbar-block" >
|
||||
<span class="actionbar-button actionbar-share" style="position: relative" {{"share-url=" + share_url if share_url else ""}}>
|
||||
<i class="fa fa-share" style="font-size: large;"></i>
|
||||
<span class="actionbar-text">{{_("Share")}}</span>
|
||||
</span>
|
||||
|
|
|
@ -104,7 +104,21 @@
|
|||
}
|
||||
}
|
||||
};
|
||||
$(".actionbar-share").click( function() {
|
||||
link = $(this).attr("share-url") || window.location.href;
|
||||
navigator.clipboard
|
||||
.writeText(link)
|
||||
.then(() => {
|
||||
showTooltip(this, "Copied link", 'n');
|
||||
});
|
||||
});
|
||||
|
||||
$('.actionbar-comment').on('click', function() {
|
||||
if ($('#comment-announcement').length) {
|
||||
$('#comment-announcement').click();
|
||||
}
|
||||
$('#write-comment').click();
|
||||
})
|
||||
});
|
||||
</script>
|
||||
{% endcompress %}
|
|
@ -91,6 +91,7 @@
|
|||
<script src="{{ static('libs/select2/select2.js') }}"></script>
|
||||
{% include "extra_js.html" %}
|
||||
<script src="{{ static('common.js') }}"></script>
|
||||
<script src="{{ static('libs/clipboard/tooltip.js') }}"></script>
|
||||
<script>
|
||||
moment.locale('{{ LANGUAGE_CODE }}');
|
||||
$(function () {
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
{% set bookmark = post.bookmark %}
|
||||
{% set hide_actionbar_comment = True %}
|
||||
{% set include_hr = True %}
|
||||
{% set share_url = request.build_absolute_uri(post.get_absolute_url()) %}
|
||||
{% include "actionbar/list.html" %}
|
||||
</div>
|
||||
</section>
|
|
@ -1,7 +1,12 @@
|
|||
{% set can_comment = request.user.is_authenticated and comment_form and not comment_lock %}
|
||||
<div id="comments" class="comment-area">
|
||||
<h2 id="comment-header"><i style="padding-right: 0.3em" class="fa fa-comments"></i>{{ _('Comments') }}</h2>
|
||||
<p> <a href="" id="write-comments" > Write comments </a> </p>
|
||||
{% if request.user.is_authenticated and comment_form and not comment_lock %}
|
||||
<h2 id="comment-header">
|
||||
<i style="padding-right: 0.3em" class="fa fa-comments"></i>{{ _('Comments') }}
|
||||
{% if can_comment %}
|
||||
<a href="" id="write-comment" style="float: right; font-size: 0.6em; margin-right: -26px;"> {{ _('Write comment') }} </a>
|
||||
{% endif %}
|
||||
</h2>
|
||||
{% if can_comment %}
|
||||
<div id="new-comment" class="form-area comment-submit" style="display: none;" >
|
||||
{% block comment_submit_title %}
|
||||
<h3>{{ _('New comment') }}</h3>
|
||||
|
|
|
@ -212,25 +212,12 @@
|
|||
$comment.find('.bad-comment-body').hide();
|
||||
};
|
||||
|
||||
$("#share-button").click( function() {
|
||||
navigator.clipboard
|
||||
.writeText(window.location.href)
|
||||
.then( () => {
|
||||
alert("Copied link to this post");
|
||||
});
|
||||
});
|
||||
|
||||
$("#write-comments").click( function(event) {
|
||||
$("#write-comment").click( function(event) {
|
||||
event.preventDefault();
|
||||
$("#new-comment").show("slow");
|
||||
$("#write-comments").hide();
|
||||
$("#write-comment").hide();
|
||||
});
|
||||
|
||||
$('#comment-button').click( function() {
|
||||
$('#comment-section').show();
|
||||
$('#comment-announcement').hide();
|
||||
})
|
||||
|
||||
});
|
||||
</script>
|
||||
{% endcompress %}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
{% block js_media %}
|
||||
{% compress js %}
|
||||
<script src="{{ static('libs/clipboard/clipboard.js') }}"></script>
|
||||
<script src="{{ static('libs/clipboard/tooltip.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var info_float = $('.info-float');
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
{% set hide_actionbar_comment = True %}
|
||||
{% set pagevote = problem.pagevote %}
|
||||
{% set bookmark = problem.bookmark %}
|
||||
{% set share_url = request.build_absolute_uri(problem.get_absolute_url()) %}
|
||||
{% include "actionbar/list.html" %}
|
||||
|
||||
{% if feed_type=='volunteer' and request.user.has_perm('judge.suggest_problem_changes') %}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
{% for batch in batches %}
|
||||
<div style="margin-top: 0.5em;">
|
||||
{% if batch.id %}
|
||||
<b>{{ _('Batch ') }}#{{ loop.index }}: </b>
|
||||
<b>{{ _('Batch ') }}#{{ batch.id }}: </b>
|
||||
{% endif %}
|
||||
{% for case in batch.cases %}
|
||||
<span class="case-{{ case.status }} case-icons">
|
||||
|
@ -86,7 +86,7 @@
|
|||
{% set batch_AC = (batch.points == batch.total) %}
|
||||
<tr class="case-row" style="background-color: {{ '#d6e8f7' if batch.points == batch.total else 'bisque'}}">
|
||||
<td>
|
||||
<b>{{ _('Batch ') }}#{{ loop.index }}</b>
|
||||
<b>{{ _('Batch ') }}#{{ batch.id }}</b>
|
||||
</td>
|
||||
<td>
|
||||
{% if batch_AC %}
|
||||
|
|
Loading…
Reference in a new issue