mirror of
				https://gitlab.crans.org/bde/nk20
				synced 2025-11-04 01:12:08 +01:00 
			
		
		
		
	Dynamic page
This commit is contained in:
		@@ -86,7 +86,8 @@ SPDX-License-Identifier: GPL-3.0-or-later
 | 
				
			|||||||
                {% if user.is_authenticated %}
 | 
					                {% if user.is_authenticated %}
 | 
				
			||||||
                    <li class="dropdown">
 | 
					                    <li class="dropdown">
 | 
				
			||||||
                        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
 | 
					                        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
 | 
				
			||||||
                            <i class="fa fa-user"></i> {{ user.username }} ({{ user.note.balance | pretty_money }})
 | 
					                            <i class="fa fa-user"></i>
 | 
				
			||||||
 | 
					                            <span id="user_balance">{{ user.username }} ({{ user.note.balance | pretty_money }})</span>
 | 
				
			||||||
                        </a>
 | 
					                        </a>
 | 
				
			||||||
                        <div class="dropdown-menu dropdown-menu-right"
 | 
					                        <div class="dropdown-menu dropdown-menu-right"
 | 
				
			||||||
                             aria-labelledby="navbarDropdownMenuLink">
 | 
					                             aria-labelledby="navbarDropdownMenuLink">
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -108,7 +108,7 @@
 | 
				
			|||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <div class="card shadow mb-4">
 | 
					    <div class="card shadow mb-4" id="history">
 | 
				
			||||||
        <div class="card-header">
 | 
					        <div class="card-header">
 | 
				
			||||||
            <p class="card-text font-weight-bold">
 | 
					            <p class="card-text font-weight-bold">
 | 
				
			||||||
                Historique des transactions récentes
 | 
					                Historique des transactions récentes
 | 
				
			||||||
@@ -279,31 +279,25 @@
 | 
				
			|||||||
                                "destination": {{ button.destination.pk }},
 | 
					                                "destination": {{ button.destination.pk }},
 | 
				
			||||||
                                "category": {{ button.category.id }},
 | 
					                                "category": {{ button.category.id }},
 | 
				
			||||||
                                "template": {{ button.id }}
 | 
					                                "template": {{ button.id }}
 | 
				
			||||||
                            }, reloadWithTurbolinks);
 | 
					                            }, function () {
 | 
				
			||||||
 | 
					                                consos = [];
 | 
				
			||||||
 | 
					                                $("#note_list").html("");
 | 
				
			||||||
 | 
					                                $("#alias_matched").html("");
 | 
				
			||||||
 | 
					                                refreshHistory();
 | 
				
			||||||
 | 
					                                refreshBalance();
 | 
				
			||||||
 | 
					                            });
 | 
				
			||||||
                        });
 | 
					                        });
 | 
				
			||||||
 | 
					 | 
				
			||||||
                        reloadWithTurbolinks();
 | 
					 | 
				
			||||||
                    });
 | 
					                    });
 | 
				
			||||||
                {% endif %}
 | 
					                {% endif %}
 | 
				
			||||||
            {% endfor %}
 | 
					            {% endfor %}
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        var reloadWithTurbolinks = (function () {
 | 
					        function refreshBalance() {
 | 
				
			||||||
            var scrollPosition;
 | 
					            $("#user_balance").load("/ #user_balance");
 | 
				
			||||||
 | 
					 | 
				
			||||||
            function reload () {
 | 
					 | 
				
			||||||
                scrollPosition = [window.scrollX, window.scrollY];
 | 
					 | 
				
			||||||
                Turbolinks.visit(window.location.toString(), { action: 'replace' })
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            document.addEventListener('turbolinks:load', function () {
 | 
					        function refreshHistory() {
 | 
				
			||||||
                if (scrollPosition) {
 | 
					            $("#history").load("/note/consos/ #history");
 | 
				
			||||||
                    window.scrollTo.apply(window, scrollPosition);
 | 
					 | 
				
			||||||
                    scrollPosition = null;
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
            });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            return reload;
 | 
					 | 
				
			||||||
        })();
 | 
					 | 
				
			||||||
    </script>
 | 
					    </script>
 | 
				
			||||||
{% endblock %}
 | 
					{% endblock %}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user