* Minor bug fixes

* Display the domain name in graphic titles

fixes #333
This commit is contained in:
Antoine Nguyen
2012-11-28 09:34:42 +01:00
parent 41cb99097a
commit 89ea4a64b5
5 changed files with 24 additions and 7 deletions
+1 -1
View File
@@ -71,7 +71,7 @@ class Grapher(object):
"--lower-limit", "0",
"--slope-mode",
"--units-exponent", "0",
"--title", graph_tpl.title.encode("utf-8"),
"--title", str("%s: %s" % (target, graph_tpl.title.encode("utf-8"))),
*params)
if not os.path.exists(path):
@@ -21,6 +21,9 @@ Stats.prototype = {
}
$("#searchquery").focus(function() {
var $this = $(this);
if ($this.attr("value") == undefined) {
return;
}
$this.data("oldvalue", $this.attr("value"));
$this.attr("value", "");
}).blur(function() {
@@ -45,7 +48,8 @@ Stats.prototype = {
});
$("#searchquery").autocompleter({
choices: get_domains_list,
choice_selected: $.proxy(this.search_domain, this)
choice_selected: $.proxy(this.search_domain, this),
empty_choice: $.proxy(this.reset_search, this)
});
this.register_nav_callbacks();
@@ -84,6 +88,11 @@ Stats.prototype = {
this.navobj.setparam("searchquery", value).update();
},
reset_search: function() {
$("#searchquery").data("oldvalue", null);
this.navobj.delparam("searchquery").update();
},
customgraphs: function(e) {
e.preventDefault();
var $fromdate = $("#id_from");
@@ -28,7 +28,7 @@ $(document).ready(function() {
</li>
<div class="input-prepend input-append">
<span class="add-on"><i class="icon-search"></i></span>
<input class="input-medium" id="searchquery" type="text" value="{% trans 'Search a domain' %}">
<input class="span10" id="searchquery" type="text" value="{% trans 'Search a domain' %}">
</div>
<li class="nav-header">
{% trans "Predefined time ranges" %}
@@ -44,10 +44,10 @@ $(document).ready(function() {
<form class="form-inline">
<span id="custom-period">
<div class="input-prepend">
<span class="add-on"><i class="icon-indent-left"></i></span><input id="id_from" class="input-medium" name="date_from" value="{{ start }}" type="text" />
<span class="add-on"><i class="icon-indent-left"></i></span><input id="id_from" class="span10" name="date_from" value="{{ start }}" type="text" />
</div>
<div class="input-prepend">
<span class="add-on"><i class="icon-indent-right"></i></span><input id="id_to" class="input-medium" name="date_to" value="{{ end }}" type="text" />
<span class="add-on"><i class="icon-indent-right"></i></span><input id="id_to" class="span10" name="date_to" value="{{ end }}" type="text" />
</div>
<button class="btn" id="customsend">{% trans "Apply" %}</button>
</span>
+1 -1
View File
@@ -43,7 +43,7 @@ def graphs(request):
gset = request.GET.get("gset", None)
gsets = events.raiseDictEvent("GetGraphSets")
if not gset in gsets:
raise ModoboaException(_("Unknown graphic sets"))
raise ModoboaException(_("Unknown graphic set"))
searchq = request.GET.get("searchquery", None)
period = request.GET.get("period", "day")
tplvars = dict(graphs=[], period=period)
+9 -1
View File
@@ -91,6 +91,13 @@
}
var curvalue = this.$element.attr("value");
if (curvalue == undefined || curvalue == "") {
if (this.options.empty_choice) {
this.options.empty_choice();
}
return;
}
this.$element.attr("value", curvalue.substr(
0, curvalue.indexOf(this.options.from_character) + 1
) + $link.attr("name"));
@@ -180,7 +187,8 @@
};
$.fn.autocompleter.defaults = {
'choice_selected': null
'choice_selected' : null,
'empty_choice' : null
};
})(jQuery);