1
0
mirror of https://gitlab.com/brutaldon/brutaldon.git synced 2024-12-04 14:46:24 -05:00

Add modal for new toot

This commit is contained in:
Jason McBrayer 2018-11-01 09:53:07 -04:00
parent 0feb9013b4
commit e5040b0bbd
4 changed files with 35 additions and 9 deletions

View File

@ -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">&nbsp</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 >&nbsp;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 >&nbsp; New Toot</span>
</a>

View File

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

View File

@ -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">

View File

@ -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'],