Browse Source

Merge pull request 'preview' (#30) from preview into master

Reviewed-on: ZakonVremeni/crossposting#30
pull/32/head
parent
commit
e808b41b3b
  1. 42
      cms/templates/articles/new.html
  2. 3
      cms/templates/base.html

42
cms/templates/articles/new.html

@ -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 %}

3
cms/templates/base.html

@ -7,9 +7,12 @@
{% bootstrap_css %}
{% bootstrap_javascript %}
{% bootstrap_messages %}
<script type="text/javascript" src="https://vk.com/js/api/share.js?93" charset="windows-1251"></script>
</head>
<body>
{% block content %}
{% endblock content %}
{% block extra_scripts %}
{% endblock %}
</body>
</html>
Loading…
Cancel
Save