diff options
Diffstat (limited to '')
-rw-r--r-- | accounts/templates/accounts/index.html | 27 | ||||
-rw-r--r-- | accounts/views.py | 6 | ||||
-rw-r--r-- | client/templatetags/app_filter.py | 16 | ||||
-rw-r--r-- | templates/registration/base_admin.html | 4 | ||||
-rw-r--r-- | templates/registration/base_client.html | 4 | ||||
-rw-r--r-- | version.txt | 2 |
6 files changed, 52 insertions, 7 deletions
diff --git a/accounts/templates/accounts/index.html b/accounts/templates/accounts/index.html index 921cc81..aaba6a8 100644 --- a/accounts/templates/accounts/index.html +++ b/accounts/templates/accounts/index.html @@ -59,6 +59,33 @@ </div> </div> </div> + <div class="card-panel"> + <form action="{% url 'personal'%}" id="form3" method="post"> + {% csrf_token %} + <input type="hidden" name="action" id="action" value="css"> + <div class="row"> + <div class="col s12"> + <h5>Opzioni di visualizzazione</h5> + </div> + </div> + <div class="row"> + <div class="switch col s12"> + Stile + <label> + Vecchio + <input name="css" type="checkbox" {{css_check}}> + <span class="lever"></span> + Nuovo (beta, potrebbero esserci problemi di visualizzazione) + </label> + </div> + </div> + <div class="row"> + <div class="col s12"> + <button onclick="document.getElementById(form3).submit()" class="btn waves-effect waves-light {{color}}">Applica</button> + </div> + </div> + </form> + </div> </div> </div> {% endblock %} diff --git a/accounts/views.py b/accounts/views.py index 3cffa09..f00cfe9 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -419,7 +419,10 @@ def personal_wrapper(request, errors): errors.append("La password deve contenere lettere") elif err.code == "password_incorrect": errors.append("La password attuale รจ incorretta") - + elif request.POST['action'] == "css": + print("setting new_css", "css" in request.POST) + request.session["new_css"] = "css" in request.POST + usable_password = request.user.has_usable_password() # fill context @@ -428,6 +431,7 @@ def personal_wrapper(request, errors): 'errors': errors, 'ok_message': ok_message, 'usable_password': usable_password, + 'css_check': "checked='checked'" if request.session.get("new_css", False) else "", } return render(request, 'accounts/index.html', context) diff --git a/client/templatetags/app_filter.py b/client/templatetags/app_filter.py index 9fbcff0..2b75822 100644 --- a/client/templatetags/app_filter.py +++ b/client/templatetags/app_filter.py @@ -95,4 +95,18 @@ def su_color(status): if status: return "green" else: - return "red lighten-1"
\ No newline at end of file + return "red lighten-1" + +@register.filter(name="materialize_css") +def materialize_css(new_version): + if new_version: + return "materialize_new.min.css" + else: + return "materialize.min.css" + +@register.filter(name="materialize_js") +def materialize_js(new_version): + if new_version: + return "materialize_new.min.js" + else: + return "materialize.min.js"
\ No newline at end of file diff --git a/templates/registration/base_admin.html b/templates/registration/base_admin.html index 9643e35..e7c56df 100644 --- a/templates/registration/base_admin.html +++ b/templates/registration/base_admin.html @@ -7,7 +7,7 @@ <head> {% load static %} <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> - <link rel="stylesheet" type="text/css" href="{% static 'materialize.min.css' %}"> + <link rel="stylesheet" type="text/css" href="{% static request.session.new_css|materialize_css %}"> <link rel="stylesheet" type="text/css" href="{% static 'tabulator/css/tabulator.min.css' %}"> <style> input[type=text]:focus + label, .materialize-textarea:focus:not([readonly]) + label { @@ -178,7 +178,7 @@ {% endblock %} </main> <script type="text/javascript" src="{% static 'jquery-3.5.1.min.js' %}"></script> - <script type="text/javascript" src="{% static 'materialize.min.js' %}"></script> + <script type="text/javascript" src="{% static request.session.new_css|materialize_js %}"></script> <script type="text/javascript" src="{% static 'lazyload.js' %}"></script> <script type="text/javascript" src="{% static 'tabulator/js/tabulator.min.js' %}"></script> {% block script_import %} diff --git a/templates/registration/base_client.html b/templates/registration/base_client.html index e23482a..104b006 100644 --- a/templates/registration/base_client.html +++ b/templates/registration/base_client.html @@ -7,7 +7,7 @@ {% load static %} {% load app_filter %} <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> - <link rel="stylesheet" type="text/css" href="{% static 'materialize.min.css' %}"> + <link rel="stylesheet" type="text/css" href="{% static request.session.new_css|materialize_css %}"> <style> input[type=text]:focus + label, .materialize-textarea:focus:not([readonly]) + label { color: {{hexcolor}} !important; @@ -177,7 +177,7 @@ {% endblock %} </main> <script type="text/javascript" src="{% static 'jquery-3.5.1.min.js' %}"></script> - <script type="text/javascript" src="{% static 'materialize.min.js' %}"></script> + <script type="text/javascript" src="{% static request.session.new_css|materialize_js %}"></script> <script type="text/javascript" src="{% static 'lazyload.js' %}"></script> <script> $(document).ready(function(){ diff --git a/version.txt b/version.txt index c0053a4..153f555 100644 --- a/version.txt +++ b/version.txt @@ -1,2 +1,2 @@ version=0.7 -rev=26 +rev=27 |