-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix/back-button
- Loading branch information
Showing
11 changed files
with
336 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
djangocms_versioning/static/djangocms_versioning/css/object-tools.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.object-tools a.accent { | ||
background-color: var(--accent) !important; | ||
} | ||
.object-tools a.accent:hover, | ||
.object-tools a.accent:active, | ||
.object-tools a.accent:hover:active { | ||
background-color: color-mix(in srgb, var(--accent) 90%, var(--dca-black)) !important; | ||
} |
13 changes: 13 additions & 0 deletions
13
djangocms_versioning/static/djangocms_versioning/js/object-tools.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
(function($) { | ||
$(document).ready(function() { | ||
$('.cms-form-post-method').on('click', function(e) { | ||
e.preventDefault(); | ||
var csrf_token = document.querySelector('form input[name="csrfmiddlewaretoken"]').value; | ||
var url = this.href; | ||
var $form = $('<form method="post" action="' + url + '"></form>'); | ||
var $csrf = $(`<input type="hidden" name="csrfmiddlewaretoken" value="${csrf_token}">`); | ||
$form.append($csrf); | ||
$form.appendTo('body').submit(); | ||
}); | ||
}); | ||
})(django.jQuery); |
100 changes: 100 additions & 0 deletions
100
djangocms_versioning/templates/admin/djangocms_versioning/page/change_form.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
{% extends "admin/cms/page/change_form.html" %} | ||
{% load static admin_urls admin_modify djangocms_versioning i18n cms_admin %} | ||
|
||
{% block extrahead %} | ||
{{ block.super }} | ||
<script src="{% static "djangocms_versioning/js/object-tools.js" %}"></script> | ||
{% endblock %} | ||
{% block extrastyle %} | ||
{{ block.super }} | ||
<link rel="stylesheet" href="{% static "djangocms_versioning/css/object-tools.css" %}"> | ||
{% endblock %} | ||
|
||
{% block content_title %} | ||
{% if title %}<h1>{{ title }}{% if original %} - {{ original.versions.first.short_name }}{% endif %}</h1>{% endif %} | ||
{% block object-tools %} | ||
{% if not popup and not add %} | ||
<ul class="object-tools hide-in-modal"> | ||
{% block object-tools-items %} | ||
{% include "admin/djangocms_versioning/versioning_buttons.html" %} | ||
<li> | ||
{% get_preview_url original as admin_url %} | ||
<a href="{{ admin_url }}" target="_parent">{% trans "Preview" %}</a> | ||
</li> | ||
{% endblock %} | ||
</ul> | ||
{% endif %} | ||
{% endblock %} | ||
{% endblock %} | ||
|
||
{% block content %} | ||
<div id="content-main"> | ||
|
||
|
||
|
||
<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="?language={{ language }}{%if request.GET.parent_node %}&parent_node={{ request.GET.parent_node }}{% endif %}{%if request.GET.source %}&source={{ request.GET.source }}{% endif %}" method="post" id="{{ opts.model_name }}_form"> | ||
{% csrf_token %} | ||
{% block form_top %}{% endblock %} | ||
|
||
{% if show_language_tabs and not show_permissions %} | ||
<div id="page_form_lang_tabs"> | ||
{% for lang_code, lang_name in language_tabs %} | ||
<input type="button" onclick="CMS.API.changeLanguage('{% get_admin_url_for_language cms_page lang_code %}');" | ||
class="language_button {% if lang_code == language %}selected{% else %}{% if not lang_code in filled_languages %} notfilled{% endif %}{% endif %}" | ||
id="{{lang_code}}button" name="{{lang_code}}" value="{{lang_name}}" /> | ||
{% endfor %} | ||
<div class="lang_tabs_line"></div> | ||
</div> | ||
{% endif %} | ||
|
||
<div id="lang_tab_content"> | ||
{% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %} | ||
{% if save_on_top %}{% submit_row %}{% endif %} | ||
{% if errors %} | ||
<p class="errornote"> | ||
{% blocktrans count errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %} | ||
</p> | ||
<ul class="errorlist">{% for error in adminform.form.non_field_errors %}<li>{{ error }}</li>{% endfor %}</ul> | ||
{% endif %} | ||
|
||
{% for fieldset in adminform %} | ||
{% include "admin/cms/page/includes/fieldset.html" %} | ||
{% endfor %} | ||
|
||
{% for inline_admin_formset in inline_admin_formsets %} | ||
{% include inline_admin_formset.opts.template %} | ||
{% endfor %} | ||
|
||
{% if show_permissions %} | ||
<div class="inline-group"> | ||
<div class="tabular inline-related"> | ||
<fieldset id="inherited_permissions" class="module aligned collapse"> | ||
<h2>{% trans 'All permissions' %}</h2> | ||
<div class="loading" rel="../permissions/">{% trans 'Loading...' %}</div> | ||
</fieldset> | ||
</div> | ||
</div> | ||
{% endif %} | ||
|
||
{% block after_related_objects %}{% endblock %} | ||
|
||
{% if add %} | ||
<div class="submit-row"{% if is_popup %} style="overflow: auto;"{% endif %}> | ||
<input type="submit" name="_save" class="default" value="{% trans 'Save' %}" {{ onclick_attrib }}/> | ||
<input type="submit" name="_continue" value="{% trans 'Save and continue editing' %}" {{ onclick_attrib }}/> | ||
</div> | ||
{% else %} | ||
{% page_submit_row %} | ||
{% endif %} | ||
</div> | ||
</form> | ||
</div> | ||
|
||
{% block admin_change_form_document_ready %} | ||
{{ block.super }} | ||
{% endblock %} | ||
|
||
{# JavaScript for prepopulated fields #} | ||
{% prepopulated_fields_js %} | ||
|
||
{% endblock %} |
30 changes: 30 additions & 0 deletions
30
djangocms_versioning/templates/admin/djangocms_versioning/versioning_buttons.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{% load djangocms_versioning i18n %} | ||
{% with url=original|url_publish_version:request.user %} | ||
{% if url %} | ||
<li> | ||
<a class="accent cms-form-post-method" href="{{ url }}?next={{ request.path }}">{% trans "Publish" %}</a> | ||
</li> | ||
{% endif %} | ||
{% endwith %} | ||
{% with url=original|url_new_draft:request.user %} | ||
{% if url %} | ||
<li> | ||
<a class="accent cms-form-post-method" href="{{ url }}?force_admin=1">{% trans "New Draft" %}</a> | ||
</li> | ||
{% endif %} | ||
{% endwith %} | ||
{% with url=original|url_revert_version:request.user %} | ||
{% if url %} | ||
<li> | ||
<a href="{{ url }}?next={{ request.path }}">{% trans "Revert" %}</a> | ||
</li> | ||
{% endif %} | ||
{% endwith %} | ||
|
||
{% with url=original|url_version_list %} | ||
{% if url %} | ||
<li> | ||
<a href="{{ url }}">{% trans "Versions" %}</a> | ||
</li> | ||
{% endif %} | ||
{% endwith %} |
18 changes: 12 additions & 6 deletions
18
djangocms_versioning/templates/djangocms_versioning/admin/mixin/change_form.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
{% extends versioning_fallback_change_form_template|default:"admin/change_form.html" %} | ||
{% load i18n admin_urls djangocms_versioning %} | ||
{% load static %} | ||
|
||
{% block extrahead %} | ||
{{ block.super }} | ||
<script src="{% static "djangocms_versioning/js/object-tools.js" %}"></script> | ||
{% endblock %} | ||
|
||
{% block extrastyle %} | ||
{{ block.super }} | ||
<link rel="stylesheet" href="{% static "djangocms_versioning/css/object-tools.css" %}"> | ||
{% endblock %} | ||
|
||
{% block object-tools-items %} | ||
<li> | ||
<a href="{{ original|url_version_list }}"> | ||
{% translate "Versions" %} | ||
</a> | ||
</li> | ||
{% include "admin/djangocms_versioning/versioning_buttons.html" %} | ||
{{ block.super }} | ||
{% endblock %} | ||
|
Oops, something went wrong.