diff --git a/wotstats/static/js/jquery.tablesorter.min.js b/wotstats/static/js/jquery.tablesorter.min.js new file mode 100644 index 0000000..d3ff430 --- /dev/null +++ b/wotstats/static/js/jquery.tablesorter.min.js @@ -0,0 +1,4 @@ + +(function($){$.extend({tablesorter:new +function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:true,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'/\.|\,/g',onRenderHeader:null,selectorHeaders:'thead th',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}if(table.tBodies.length==0)return;var rows=table.tBodies[0].rows;if(rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function checkHeaderOptionsSortingLocked(table,i){if((table.config.headers[i])&&(table.config.headers[i].lockedOrder))return table.config.headers[i].lockedOrder;return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i b["+i+"]) ? 1 : 0));";};function makeSortTextDesc(i){return"((b["+i+"] < a["+i+"]) ? -1 : ((b["+i+"] > a["+i+"]) ? 1 : 0));";};function makeSortNumeric(i){return"a["+i+"]-b["+i+"];";};function makeSortNumericDesc(i){return"b["+i+"]-a["+i+"];";};function sortText(a,b){if(table.config.sortLocaleCompare)return a.localeCompare(b);return((ab)?1:0));};function sortTextDesc(a,b){if(table.config.sortLocaleCompare)return b.localeCompare(a);return((ba)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$.data(this,"tablesorter",config);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){$this.trigger("sortStart");var $cell=$(this);var i=this.column;this.order=this.count++%2;if(this.lockedOrder)this.order=this.lockedOrder;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;iMy Button --> + {% block js %}{% endblock %} diff --git a/wotstats/templates/pages/account/technic.html b/wotstats/templates/pages/account/technic.html index a7cac22..b408074 100644 --- a/wotstats/templates/pages/account/technic.html +++ b/wotstats/templates/pages/account/technic.html @@ -2,7 +2,21 @@ {% block content %}

Техника

- + Категории + Все + I + II + III + IV + V + VI + VII + VIII + IX + X + + +
@@ -14,17 +28,101 @@ - {% for x in account_technic %} - - - - - - - - - - - {% endfor %} + + +
 Кол-во побед
{{ x['details']['nation'] }}{{ x['details']['level'] }}{{ x['details']['type'] }}{{ x['details']['name'] }}{{ x['statistics']['battles'] }}{{ x['statistics']['wins'] }}
{% endblock %} + +{# + {% for x in account_technic %} + + + + {{ x['details']['nation'] }} + {{ x['details']['level'] }} + {{ x['details']['type'] }} + {{ x['details']['name'] }} + {{ x['statistics']['battles'] }} + {{ x['statistics']['wins'] }} + + {% endfor %} +#} + +{% block js %} + + + +{% endblock %} diff --git a/wotstats/views/technic.py b/wotstats/views/technic.py index b1004f8..e4b1259 100644 --- a/wotstats/views/technic.py +++ b/wotstats/views/technic.py @@ -47,3 +47,30 @@ def index(): 'pages/account/technic.html', account_technic=account_technic ) + + +@pages_technic.route('/list.json') +def list_json(): + if not g.user: + return redirect(url_for('pages_home.index')) + + list_levels = [] + if len(request.args.getlist('level[]')) > 0: + list_levels = [] + for i in request.args.getlist('level[]'): + list_levels.append(int(i)) + + # TODO: total accounts + # + account_technic = list() + + for x in __get_technic(): + if len(list_levels) == 0: + x['details'] = t.get(str(x['tank_id'])) + account_technic.append(x) + else: + if t.get(str(x['tank_id'])).get('level') in list_levels: + x['details'] = t.get(str(x['tank_id'])) + account_technic.append(x) + + return jsonify(technic=account_technic)