mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-18 05:51:26 +02:00
Merge branch '1.1.x'
This commit is contained in:
@@ -7,7 +7,8 @@ Stats.prototype = {
|
||||
|
||||
defaults: {
|
||||
deflocation: "graphs/",
|
||||
language: "en"
|
||||
language: "en",
|
||||
domain_list_url: null
|
||||
},
|
||||
|
||||
initialize: function(options) {
|
||||
@@ -52,7 +53,7 @@ Stats.prototype = {
|
||||
language: this.options.language
|
||||
});
|
||||
$("#searchquery").autocompleter({
|
||||
choices: get_domains_list,
|
||||
choices: $.proxy(this.get_domain_list, this),
|
||||
choice_selected: $.proxy(this.search_domain, this),
|
||||
empty_choice: $.proxy(this.reset_search, this)
|
||||
});
|
||||
@@ -72,6 +73,21 @@ Stats.prototype = {
|
||||
$.proxy(this.charts_cb, this));
|
||||
},
|
||||
|
||||
/**
|
||||
* Retrieve a list of domain from the server.
|
||||
*/
|
||||
get_domain_list: function() {
|
||||
var result;
|
||||
$.ajax({
|
||||
url: this.options.domain_list_url,
|
||||
dataType: "json",
|
||||
async: false
|
||||
}).done(function(data) {
|
||||
result = data;
|
||||
});
|
||||
return result;
|
||||
},
|
||||
|
||||
change_period: function(e) {
|
||||
e.preventDefault();
|
||||
var $link = $(e.target);
|
||||
|
||||
@@ -9,15 +9,10 @@
|
||||
<script type="text/javascript" src="{{ STATIC_URL }}stats/js/graphic.js"></script>
|
||||
<script type="text/javascript" src="{{ STATIC_URL }}stats/js/stats.js"></script>
|
||||
<script type="text/javascript">
|
||||
function get_domains_list(container) {
|
||||
$.getJSON("{% url 'modoboa.extensions.admin.views.domain.domains_list' %}", function(data) {
|
||||
container.value = data;
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
var stats = new Stats({
|
||||
graphurl: "{% url 'modoboa.extensions.stats.views.graphs' %}",
|
||||
domain_list_url: "{% url 'modoboa.extensions.admin.views.domain.domains_list' %}",
|
||||
deflocation: "{{ deflocation|safe }}",
|
||||
language: "{{ LANGUAGE_CODE }}"
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user