Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
{% extends "saas/base_dashboard.html" %}
{% block saas_title %}
{% trans %}Themes{% endtrans %}
{% endblock %}
{% block saas_page_layout %}
<theme-update inline-template class="container">
<div class="row">
<div class="col-md-6 mt-3">
<div>
<div class="mb-3">
<form method="post">
<input type="hidden" name="csrfmiddlewaretoken" value="{{csrf_token}}">
<div class="form-group form-check">
<input id="show_edit_tools" class="form-check-input" type="checkbox"
name="show_edit_tools"
v-model="showEditTools" @change="save">
<label class="form-check-label" for="show_edit_tools">
{% trans %}Show inline template editor tools{% endtrans %}
</label>
</div>
</form>
</div>
<hr />
<!-- File Upload -->
<div>
<div id="theme-upload"
class="pages-upload"
data-complete-url="{{urls.pages.api_themes}}"
djupload-success >
<div class="dropzone-previews previewsContainer">
<span class="dz-default dz-message"><i class="fa fa-cloud"></i> {% trans %}Upload theme package (.zip){% endtrans %}</span>
</div>
</div>
<div class="text-center">
<a id="download-theme" class="btn btn-secondary" href="{{urls.pages.theme_download}}" target="_blank"><i class="fa fa-cloud-download mr-2"></i> {% trans %}Download .ZIP{% endtrans %}</a>
<button id="reset-theme"
class="btn btn-danger"
@click.prevent="reset">
{% trans %}Restore to default{% endtrans %}
</button>
</div>
</div>
</div>
</div>
<div class="col-md-6 mt-3">
{% block saas_help %}
<p>
{% trans %}When you are modifying root templates (ex: <filename>base.html</filename>), you may inadvertently break the dashboard and become unable to access this page to upload a fix.{% endtrans %}
</p>
<p>
{% trans profile_url=urls.profile_redirect %}You can reset to the default theme, but you will need an <a href="{{profile_url}}">API key</a> to trigger the <a href="https://djaodjin.com/docs/djaoapp-api/#themes_delete">API end point</a> from the command line.{% endtrans %}
</p>
<pre class="code p-3"><code>curl -i -u *api_key*: -X DELETE https://{{site_available_at_url}}/api/themes/</code></pre>
<p>
<a target="_blank" href="https://djaodjin.com/docs/themes/">{% trans %}Read more about theme customization ...{% endtrans %} &raquo;</a>
</p>
{% endblock %}
</div>
</div>
</theme-update>
<!-- Notifications -->
<section id="notifications" class="mt-5">
<div class="container">
<div class="row">
<div class="col-md-12">
<h3 class="mb-4">{% trans %}Notifications{% endtrans %}</h3>
<!-- Sub-Container -->
<div class="container px-0">
<div class="row d-flex flex-wrap">
<!-- Primary Notifications -->
{% for key, vals in notifications.items() %}
<div class="col-md-6 mb-3">
<div id="{{key}}" class="card h-100 mb-3">
<div class="card-body h-100">
<h5 class="card-title"><a href="{{urls.notifications}}{{key}}/">{{vals.title}}</a></h5>
<p class="card-text">
{{vals.descr}}
</p>
<a href="{{urls.notifications}}{{key}}/" class="btn btn-primary">{% trans %}Edit{% endtrans %}</a>
<button class="btn btn-outline-secondary send-test-email">{% trans %}Send Test Email{% endtrans %}</button>
</div>
</div>
</div>
{% endfor %}
<!-- Subsequent Notifications -->
{% for role_descr in role_descriptions %}
<div class="col-md-6 mb-3">
<div id="{{role_descr.slug}}_role_added" class="card h-100 mb-3">
<div class="card-body h-100">
<h5 class="card-title"><a href="{{urls.notifications}}{{role_descr.slug}}_role_grant_created/">{% trans role_descr=role_descr.title %}{{role_descr}} added{% endtrans %}</a></h5>
<p class="card-text">
</p>
<a href="{{urls.notifications}}{{key}}/" class="btn btn-primary">{% trans %}Edit{% endtrans %}</a>
<button class="btn btn-outline-secondary send-test-email">{% trans %}Send Test Email{% endtrans %}</button>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
</div>
</div>
</section>
{% endblock %}
{% block dashboard_bodyscripts %}
<script type="text/javascript">
jQuery(document).ready(function($) {
{% if urls.pages and urls.pages.api_themes %}
$("#theme-upload").djupload({
uploadUrl: "{{urls.pages.api_themes}}",
uploadSuccess: function(file, resp) {
showMessages(['{% trans %}"${filename}" uploaded sucessfully{% endtrans %}'.replace('${filename}', file.name)], 'success');
}
});
{% endif %}
$(".send-test-email").click(function(event) {
var self = this;
var id = $(self).closest(".card").attr("id");
$.ajax({
type: "POST",
url: "{{urls.send_test_email}}" + id + "/",
beforeSend: function(xhr) {
xhr.setRequestHeader("X-CSRFToken", getMetaCSRFToken());
},
data: null,
datatype: "json",
contentType: "application/json; charset=utf-8",
success: function(data) { showMessages([data.detail], "info"); },
error: function(resp) { showErrorMessages(resp); },
});
});
});
</script>
{% endblock %}