}
};
+
+ window.addEventListener("message", (event) => {
+ event.source.close()
+
+ $.ajax("/editor/editor-user-area/", {
+ success: function(d) {
+ $("#user-area")[0].innerHTML = d;
+ }
+ });
+ }, false);
+
+ $("#login").click(function (e) {
+ e.preventDefault();
+ let h = 600;
+ let w = 500;
+ let x = window.screenX + (window.innerWidth - w) / 2;
+ let y = window.screenY + (window.innerHeight - h) / 2;
+ window.open(
+ "/accounts/login/?next=/editor/back",
+ "login-window",
+ "width=" + w + " height=" + h + " top=" + y + " left=" + x
+ );
+ });
+
})(jQuery);
{% else %}
{% url "cas_ng_login" as login_url %}
{% if login_url != request.path %}
- <a class="nav-item nav-link" href='{{ login_url }}'>{% trans "Log In" %}</a>
+ <a id="login" class="nav-item nav-link" href='{{ login_url }}'>{% trans "Log In" %}</a>
{% endif %}
{% endif %}
--- /dev/null
+<script>
+ window.opener.postMessage('login');
+</script>
<div class='navbar-nav'>
<a class='nav-item nav-link' href="{{ REDMINE_URL }}projects/wl-publikacje/wiki/Pomoc" target="_blank">
{% trans "Help" %}</a>
- {% include "registration/head_login.html" %}
+
+
+ <div id="user-area">
+ {% include "registration/head_login.html" %}
+ {% block dialogs %} {% endblock %}
+ </div>
+
+
+
+
<span class="navbar-text">{% trans "Version" %}: <span id="document-revision">{% trans "Unknown" %}</span></span>
{% if not readonly %}
<button class='ml-2 nav-item btn btn-primary' id="save-button">{% trans "Save" %}</button>
{% block splitter-extra %} {% endblock %}
</div>
- {% block dialogs %} {% endblock %}
{% endblock %}
--- /dev/null
+{% include "registration/head_login.html" %}
+{% include "wiki/save_dialog.html" %}
+{% include "wiki/revert_dialog.html" %}
+{% if can_pubmark %}
+ {% include "wiki/pubmark_dialog.html" %}
+{% endif %}
url(r'^pubmark/(?P<chunk_id>\d+)/$', views.pubmark, name="wiki_pubmark"),
url(r'^themes$', views.themes, name="themes"),
+
+ url(r'^back/$', views.back),
+ url(r'^editor-user-area/$', views.editor_user_area),
]
})
+def editor_user_area(request):
+ return render(request, 'wiki/editor-user-area.html', {
+ 'forms': {
+ "text_save": forms.DocumentTextSaveForm(user=request.user, prefix="textsave"),
+ "text_revert": forms.DocumentTextRevertForm(prefix="textrevert"),
+ "pubmark": forms.DocumentPubmarkForm(prefix="pubmark"),
+ },
+ 'can_pubmark': request.user.has_perm('documents.can_pubmark'),
+ })
+
+
@require_GET
def editor_readonly(request, slug, chunk=None, template_name='wiki/document_details_readonly.html'):
try:
def themes(request):
prefix = request.GET.get('q', '')
return http.HttpResponse('\n'.join([str(t) for t in Theme.objects.filter(name__istartswith=prefix)]))
+
+
+def back(request):
+ return render(request, 'wiki/back.html')