Simple application to manage `what's new` screen.
Project description
Django What's New
==================
Simple application to manage "what's new" welcome screen based on package version.
.. note:: Package must contains valid PEP386 entry in the __init__ of the main module.
How to use
----------
- put ``whatsnew`` in your INSTALLED_APPS::
INTALLED_APPS=(
...
'whatsnew'
)
- modify your base template as
.. code-block:: html
<link href="{% static 'whatsnew/whatsnew.min.css' %}" rel="stylesheet" media="screen">
<script language="JavaScript" src="{% static 'whatsnew/js/whatsnew.min.js' %}"></script>
{% load whatsnew %}
<body>
{% whatsnew '<your_main_package_name>' %}
- create your :file:`whatsnew/whatsnew.html` like:
.. code-block:: html
<style>
#django-whatsnew .button.b-close {
background-color: #2B91AF;
border-radius: 7px;
box-shadow: none;
font: bold 131% sans-serif;
cursor: pointer;
padding: 0 6px 2px;
position: absolute;
right: -7px;
top: -7px;
text-align: center;
text-decoration: none;
}
#django-whatsnew {
font-size: 200%;
background-color: #FFFFFF;
border-radius: 10px;
box-shadow: 0 0 25px 5px #999999;
color: #111111;
display: none;
min-width: 450px;
padding: 0px 5px 5px 15px;
}
</style>
<script>
{% if display %}
function setCookie(name, value, days) {
var expires;
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toGMTString();
} else {
expires = "";
}
document.cookie = name + "=" + value + expires + "; path=/";
}
setCookie('{{ name }}', '{{ news.version }}');
$(function () {
$('#django-whatsnew').bPopup({
speed: 450,
transition: 'slideDown'
});
$('#whatsnew-seen').click(function () {
setCookie('{{ name }}', '{{ news.version }}', 365);
});
});
{% endif %}
</script>
<div id="django-whatsnew" style="display: none">
<span class="button b-close"><span>X</span></span>
{{ news.content|safe }}
<span><input type="checkbox" id="whatsnew-seen">do not show again</span>
</div>
- and your :file:`whatsnew/test.html` like:
.. code-block:: html
{% extends "base.html" %}{% load whatsnew %}
{% block body %}
{% whatsnew 'whatsnew' 1 %}
<script>
$('.b-close').click(function () {
window.history.go(-1);
})
</script>
{% endblock body %}
{% block jira %}{% endblock jira %}
How version are checked
------------------------
- try to get version number using setuptools
- check the main package name for 'version', 'VERSION' or '__version__'
- try to call package.get_version()
- raise DistributionNotFound
==================
Simple application to manage "what's new" welcome screen based on package version.
.. note:: Package must contains valid PEP386 entry in the __init__ of the main module.
How to use
----------
- put ``whatsnew`` in your INSTALLED_APPS::
INTALLED_APPS=(
...
'whatsnew'
)
- modify your base template as
.. code-block:: html
<link href="{% static 'whatsnew/whatsnew.min.css' %}" rel="stylesheet" media="screen">
<script language="JavaScript" src="{% static 'whatsnew/js/whatsnew.min.js' %}"></script>
{% load whatsnew %}
<body>
{% whatsnew '<your_main_package_name>' %}
- create your :file:`whatsnew/whatsnew.html` like:
.. code-block:: html
<style>
#django-whatsnew .button.b-close {
background-color: #2B91AF;
border-radius: 7px;
box-shadow: none;
font: bold 131% sans-serif;
cursor: pointer;
padding: 0 6px 2px;
position: absolute;
right: -7px;
top: -7px;
text-align: center;
text-decoration: none;
}
#django-whatsnew {
font-size: 200%;
background-color: #FFFFFF;
border-radius: 10px;
box-shadow: 0 0 25px 5px #999999;
color: #111111;
display: none;
min-width: 450px;
padding: 0px 5px 5px 15px;
}
</style>
<script>
{% if display %}
function setCookie(name, value, days) {
var expires;
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toGMTString();
} else {
expires = "";
}
document.cookie = name + "=" + value + expires + "; path=/";
}
setCookie('{{ name }}', '{{ news.version }}');
$(function () {
$('#django-whatsnew').bPopup({
speed: 450,
transition: 'slideDown'
});
$('#whatsnew-seen').click(function () {
setCookie('{{ name }}', '{{ news.version }}', 365);
});
});
{% endif %}
</script>
<div id="django-whatsnew" style="display: none">
<span class="button b-close"><span>X</span></span>
{{ news.content|safe }}
<span><input type="checkbox" id="whatsnew-seen">do not show again</span>
</div>
- and your :file:`whatsnew/test.html` like:
.. code-block:: html
{% extends "base.html" %}{% load whatsnew %}
{% block body %}
{% whatsnew 'whatsnew' 1 %}
<script>
$('.b-close').click(function () {
window.history.go(-1);
})
</script>
{% endblock body %}
{% block jira %}{% endblock jira %}
How version are checked
------------------------
- try to get version number using setuptools
- check the main package name for 'version', 'VERSION' or '__version__'
- try to call package.get_version()
- raise DistributionNotFound
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django-whatsnew-1.0.tar.gz
(11.9 kB
view details)
File details
Details for the file django-whatsnew-1.0.tar.gz
.
File metadata
- Download URL: django-whatsnew-1.0.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95f3e8223dab7a1598721484d8c0960a09b25d5ff1ae90da6fab8818a3ccca3d |
|
MD5 | 4b2f504703ce40ccf40c6076fa20031d |
|
BLAKE2b-256 | c60ddf28538e8d89a690fa01f511359bcebff94fb804a64f89b2a8e3f9768cfb |