mirror of https://gitlab.com/brutaldon/brutaldon
Add modal for new toot
This commit is contained in:
parent
0feb9013b4
commit
e5040b0bbd
|
@ -38,6 +38,7 @@
|
||||||
{% if not preferences.no_javascript %}
|
{% if not preferences.no_javascript %}
|
||||||
<script type="text/javascript" src="{% static 'js/jquery.min.js' %}"></script>
|
<script type="text/javascript" src="{% static 'js/jquery.min.js' %}"></script>
|
||||||
<script type="text/javascript" src="{% static 'js/intercooler.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/jquery.photobox.js' %}"></script>
|
||||||
<script type="text/javascript" src="{% static 'js/brutaldon-enhancements.js' %}"></script>
|
<script type="text/javascript" src="{% static 'js/brutaldon-enhancements.js' %}"></script>
|
||||||
{% block page_scripts %}
|
{% block page_scripts %}
|
||||||
|
@ -53,6 +54,7 @@
|
||||||
<body class="has-navbar-fixed-top"
|
<body class="has-navbar-fixed-top"
|
||||||
ic-global-include='{"csrfmiddlewaretoken": "{{ csrf_token }}"}'>
|
ic-global-include='{"csrfmiddlewaretoken": "{{ csrf_token }}"}'>
|
||||||
<div id="page-load-indicator"> </div>
|
<div id="page-load-indicator"> </div>
|
||||||
|
<div id="new-toot-modal" class="modal"></div>
|
||||||
{% block navbar %}
|
{% block navbar %}
|
||||||
<nav class="navbar is-fixed-top is-primary" role="navigation"
|
<nav class="navbar is-fixed-top is-primary" role="navigation"
|
||||||
aria-label="main navigation" id="main-nav-bar">
|
aria-label="main navigation" id="main-nav-bar">
|
||||||
|
@ -109,7 +111,10 @@
|
||||||
<span class="fa fa-globe"></span>
|
<span class="fa fa-globe"></span>
|
||||||
<span > Federated</span>
|
<span > Federated</span>
|
||||||
</a>
|
</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 class="fa fa-edit"> </span>
|
||||||
<span > New Toot</span>
|
<span > New Toot</span>
|
||||||
</a>
|
</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 title %} Brutaldon ({{ own_acct.username }}) - toot {% endblock %}
|
||||||
|
|
||||||
{% block page_scripts %}
|
|
||||||
<script src="{% static 'js/mousetrap.min.js' %}" type="application/javascript"></script>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1 class="title" >Toot!</h1>
|
<h1 class="title" >Toot!</h1>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
|
|
|
@ -430,6 +430,12 @@ def toot(request, mention=None):
|
||||||
else:
|
else:
|
||||||
form = PostForm(request.GET, request.FILES,
|
form = PostForm(request.GET, request.FILES,
|
||||||
initial={'visibility': request.session['user'].source.privacy})
|
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',
|
return render(request, 'main/post.html',
|
||||||
{'form': form,
|
{'form': form,
|
||||||
'own_acct': request.session['user'],
|
'own_acct': request.session['user'],
|
||||||
|
|
Loading…
Reference in New Issue