Changeset - 9f19d1fa1474
[Not reviewed]
default
0 1 0
domruf - 8 years ago 2017-08-22 21:10:14
dominikruf@gmail.com
statistics: hide checkboxes, instead click on user names directly

This look much better.

The now hidden checkboxes are still used to store the status.

TODO: maybe we'll find a better cleaner way to do this in the future
1 file changed with 14 insertions and 4 deletions:
0 comments (0 inline, 0 general)
kallithea/templates/summary/statistics.html
Show inline comments
 
@@ -155,13 +155,19 @@ function SummaryPlot(from,to,dataset,ove
 
    var plotContainer = $('#commit_history')[0];
 
    var $overviewContainer = $('#overview');
 
    var overviewContainer = $('#overview')[0];
 

	
 
    var plot_options = {
 
        bars: {show:true, align: 'center', lineWidth: 4},
 
        legend: {show:true, container: "#legend_container"},
 
        legend: {show:true,
 
                container: "#legend_container",
 
                labelFormatter: function(label, series) {
 
                        // series is the series object for the label
 
                        return '<a href="javascript:void(0)"> ' + label + '</a>';
 
                    }
 
        },
 
        points: {show:true, radius: 0, fill: false},
 
        yaxis: {tickDecimals: 0},
 
        xaxis: {
 
            mode: "time",
 
            timeformat: "%d/%m",
 
            min: from,
 
@@ -213,13 +219,13 @@ function SummaryPlot(from,to,dataset,ove
 
        for(var pos in data) {
 

	
 
            data[pos].color = i;
 
            i++;
 
            if(data[pos].label != ''){
 
                choiceContainerTable.innerHTML +=
 
                    '<tr><td><label><input type="checkbox" id="id_user_{0}" name="{0}" checked="checked" /> \
 
                    '<tr style="display:none"><td><label><input type="checkbox" id="id_user_{0}" name="{0}" checked="checked" /> \
 
                     {0}</label></td></tr>'.format(data[pos].label);
 
            }
 
        }
 
    }
 

	
 
    /**
 
@@ -289,12 +295,13 @@ function SummaryPlot(from,to,dataset,ove
 
        args = e.data;
 
        var cur_data = args[0];
 
        var cur_ranges = args[1];
 

	
 
        var new_data = [];
 
        var inputs = choiceContainer.getElementsByTagName("input");
 
        inputs[$(e.target).parents('tr').index()].click();
 

	
 
        //show only checked labels
 
        for(var i=0; i<inputs.length; i++) {
 
            var checkbox_key = inputs[i].name;
 

	
 
            if(inputs[i].checked){
 
@@ -326,12 +333,15 @@ function SummaryPlot(from,to,dataset,ove
 

	
 
       $plotContainer.on("plotselected", plotselected);
 

	
 
       //resubscribe plothover
 
       $plotContainer.on("plothover", plothover);
 

	
 
       //resubscribe this function after plot update
 
       $('#legend_container tr a').on("click", [cur_data, cur_ranges], plotchoiced);
 

	
 
       // don't fire event on the overview to prevent eternal loop
 
       overview.setSelection(cur_ranges, true);
 

	
 
    }
 

	
 
    /**
 
@@ -361,13 +371,13 @@ function SummaryPlot(from,to,dataset,ove
 
        $plotContainer.on("plothover", plothover);
 

	
 
        // don't fire event on the overview to prevent eternal loop
 
        overview.setSelection(ranges, true);
 

	
 
        //resubscribe choiced
 
        $(choiceContainer.getElementsByTagName("input")).on("click", [data, ranges], plotchoiced);
 
        $('#legend_container tr a').on("click", [data, ranges], plotchoiced);
 
    }
 

	
 
    var previousPoint = null;
 

	
 
    function plothover(e, pos, item) {
 
        if (item) {
 
@@ -441,13 +451,13 @@ function SummaryPlot(from,to,dataset,ove
 

	
 
    $overviewContainer.on("plotselected", function (e, ranges) {
 
        plot.setSelection(ranges);
 
    });
 

	
 
    // user choices on overview
 
    $(choiceContainer.getElementsByTagName("input")).on("click", [data, initial_ranges], plotchoiced);
 
    $('#legend_container tr a').on("click", [data, initial_ranges], plotchoiced);
 
}
 

	
 
SummaryPlot(${h.js(c.ts_min)}, ${h.js(c.ts_max)}, ${h.js(c.commit_data)}, ${h.js(c.overview_data)});
 
</script>
 

	
 
</%def>
0 comments (0 inline, 0 general)