Add modal for new toot
This commit is contained in:
parent
0feb9013b4
commit
e5040b0bbd
|
@ -38,6 +38,7 @@
|
|||
{% if not preferences.no_javascript %}
|
||||
<script type="text/javascript" src="{% static 'js/jquery.min.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'js/intercooler.js' %}"></script>
|
||||
<script type="application/javascript" src="{% static 'js/mousetrap.min.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'js/jquery.photobox.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'js/brutaldon-enhancements.js' %}"></script>
|
||||
{% block page_scripts %}
|
||||
|
@ -53,6 +54,7 @@
|
|||
<body class="has-navbar-fixed-top"
|
||||
ic-global-include='{"csrfmiddlewaretoken": "{{ csrf_token }}"}'>
|
||||
<div id="page-load-indicator"> </div>
|
||||
<div id="new-toot-modal" class="modal"></div>
|
||||
{% block navbar %}
|
||||
<nav class="navbar is-fixed-top is-primary" role="navigation"
|
||||
aria-label="main navigation" id="main-nav-bar">
|
||||
|
@ -109,7 +111,10 @@
|
|||
<span class="fa fa-globe"></span>
|
||||
<span > Federated</span>
|
||||
</a>
|
||||
<a class="navbar-item" href="{% url "toot" %}">
|
||||
<a class="navbar-item" href="{% url "toot" %}"
|
||||
ic-get-from="{% url "toot" %}"
|
||||
ic-target="#new-toot-modal"
|
||||
ic-on-complete="$('#new-toot-modal').toggleClass('is-active');">
|
||||
<span class="fa fa-edit"> </span>
|
||||
<span > New Toot</span>
|
||||
</a>
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<div class="modal-background" ></div>
|
||||
<div class="modal-content">
|
||||
<div class="box">
|
||||
{% include "main/post_partial.html" %}
|
||||
</div>
|
||||
</div>
|
||||
<button id="toot-modal-close" class="modal-close is-large" aria-label="close"></button>
|
||||
|
||||
<script type="application/javascript">
|
||||
$("#toot-modal-close").on("click", function () { $("#new-toot-modal").toggleClass("is-active"); });
|
||||
$(".modal-background").on("click", function () { $("#new-toot-modal").toggleClass("is-active"); });
|
||||
|
||||
Mousetrap.bind('ctrl+enter', function(e) {
|
||||
var form = document.querySelector('#post-form');
|
||||
form.submit();
|
||||
return true;
|
||||
});
|
||||
Mousetrap.bind('esc', function(e) { $("#new-toot-modal").toggleClass("is-active"); });
|
||||
</script>
|
|
@ -3,10 +3,6 @@
|
|||
|
||||
{% block title %} Brutaldon ({{ own_acct.username }}) - toot {% endblock %}
|
||||
|
||||
{% block page_scripts %}
|
||||
<script src="{% static 'js/mousetrap.min.js' %}" type="application/javascript"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class="title" >Toot!</h1>
|
||||
<div class="box">
|
||||
|
|
|
@ -430,6 +430,12 @@ def toot(request, mention=None):
|
|||
else:
|
||||
form = PostForm(request.GET, request.FILES,
|
||||
initial={'visibility': request.session['user'].source.privacy})
|
||||
if request.GET.get('ic-request'):
|
||||
return render(request, 'intercooler/post.html',
|
||||
{'form': form,
|
||||
'own_acct': request.session['user'],
|
||||
'preferences': account.preferences})
|
||||
else:
|
||||
return render(request, 'main/post.html',
|
||||
{'form': form,
|
||||
'own_acct': request.session['user'],
|
||||
|
|
Loading…
Reference in New Issue