|
|
|
@ -14,15 +14,43 @@
|
|
|
|
|
{% csrf_token %} |
|
|
|
|
{% bootstrap_form new_article_form %} |
|
|
|
|
{% buttons %} |
|
|
|
|
<button |
|
|
|
|
class="btn btn-primary" |
|
|
|
|
type="submit" |
|
|
|
|
> |
|
|
|
|
Продвинуть |
|
|
|
|
</button> |
|
|
|
|
<div class="row"> |
|
|
|
|
<div class="col"> |
|
|
|
|
<button |
|
|
|
|
class="btn btn-primary" |
|
|
|
|
type="submit" |
|
|
|
|
> |
|
|
|
|
Продвинуть |
|
|
|
|
</button> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div id="vkShare" class="col"></div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
{% endbuttons %} |
|
|
|
|
</form> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
{% endblock content %} |
|
|
|
|
{% endblock content %} |
|
|
|
|
{% block extra_scripts %} |
|
|
|
|
<script type="text/javascript"> |
|
|
|
|
const main = () => { |
|
|
|
|
const appendShare = (e) => { |
|
|
|
|
const articleLink = e.target.value; |
|
|
|
|
const gen = { |
|
|
|
|
url: articleLink |
|
|
|
|
} |
|
|
|
|
const buttonType = { |
|
|
|
|
type: "custom", |
|
|
|
|
text: '<img src="https://vk.com/images/share_32_2x.png" width="32" height="32" alt="share icon" />' |
|
|
|
|
} |
|
|
|
|
document.getElementById('vkShare').innerHTML = VK.Share.button(gen, buttonType) |
|
|
|
|
} |
|
|
|
|
const linkInput = document.querySelector('[name="link"]'); |
|
|
|
|
linkInput.addEventListener('input', appendShare) |
|
|
|
|
linkInput.addEventListener('paste', appendShare) |
|
|
|
|
} |
|
|
|
|
window.addEventListener('DOMContentLoaded', main) |
|
|
|
|
</script> |
|
|
|
|
{% endblock %} |