diff --git a/render b/render index c046fe8..6206b0e 100755 --- a/render +++ b/render @@ -57,18 +57,37 @@ def chunk(iterable, chunksize, fillvalue=None): return result +def is_selected(i, page): + if i == page: + return "selected" + else: + return "" + def render_index(email_list, title, identifier): email_list = chunk(email_list, int(options['per_page'])) current_page = 0 for list_chunk in email_list: + if current_page == 0: + prevpage = "                             " + else: + prevpage = '<< previous page' % (identifier, current_page - 1) + + if current_page == len(email_list) - 1: + nextpage = "" + else: + nextpage = 'next page >>' % (identifier, current_page + 1) + variables = { 'page': title, 'pagenum': "Page %d of %d" % (current_page + 1, len(email_list)), 'title': options['title'], 'index': "../index.html", - 'items': "".join('%s...%s%s%s%s%s' % (message[10], message[0][:8], message[3], message[4], message[10], message[5], message[6], message[7]) for message in list_chunk) + 'items': "".join('%s...%s%s%s%s%s' % (message[10], message[0][:8], message[3], message[4], message[10], message[5], message[6], message[7]) for message in list_chunk), + 'prev': prevpage, + 'next': nextpage, + 'pages': "".join('' % (identifier, i, is_selected(i, current_page), i + 1) for i in xrange(0, len(email_list))) } filename = "%s/index_%s_%d.html" % (options['output_dir'], identifier, current_page) diff --git a/templates/index.html b/templates/index.html index 0b2c383..c1ab73f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -10,6 +10,13 @@ $('.clickable').click(function(){ window.location = $(this).data('url'); }); + + $('.jumplist').change(function(){ + console.log($(this).children('option:selected')); + $(this).children('option:selected').each(function(){ + window.location = $(this).val(); + }); + }); }); @@ -21,7 +28,11 @@

%(pagenum)s