Skip to content

Commit

Permalink
Merge pull request #20 from meashish123/master
Browse files Browse the repository at this point in the history
Sorted Categories, Added page jumps
  • Loading branch information
dragonslayerx committed Feb 23, 2016
2 parents 6f8354f + 4305c79 commit 5d2f767
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea
*.pyc
/build
.dist

7 changes: 7 additions & 0 deletions codeforces_importer/classifier/classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,10 @@ def add_problem_tag(self, problem, tag):
"""Adds problem to category and increment category count by 1"""

self.category_total_count[tag] += 1;

def get_sorted_category(self):
sorted_category_list = []
for category in self.problem_tags:
sorted_category_list.append(category)
sorted_category_list.sort()
return sorted_category_list
1 change: 1 addition & 0 deletions codeforces_importer/classifier/html_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def generate_html(handle, classifier, dir_path):
context = {
'names': classifier.problem_list,
'links': classifier.problem_link,
'sorted_category': classifier.get_sorted_category(),
'category': classifier.problem_tags,
'submission': classifier.submission_link,
'local': classifier.local_path_link,
Expand Down
23 changes: 18 additions & 5 deletions codeforces_importer/classifier/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
<div class="tagDiv details">
<span>Total-Submissions: {{ submission_count }}</span>
{% set counter = 0 -%}
{% for tag in category -%}
{% for tag in sorted_category -%}
<div class="detailsRow">
<div style="float: left; width: 50px; height: 10px"></div>
<span class="sh1"> {{ tag.upper() }} </span>
<span class="sh2"> : &nbsp; {{ category_counter[tag] }} out of {{ category_total_counter[tag] }}</span>
<span class="sh1"> <a target="_blank" href="http://codeforces.com/problemset/tags/{{ tag }}"> {{ tag.upper() }} </a> </span>
<span class="sh2" tagName="{{ tag.replace(' ', '_') }}"> : &nbsp; {{ category_counter[tag] }} out of {{ category_total_counter[tag] }}</span>
<span class="sh3">
<div class="myProgress">
<div class="myBar" style="width: {{ ((category_counter[tag] * 100.0) / category_total_counter[tag]) }}%">
Expand All @@ -40,10 +40,10 @@
</div>

{% set counter = 0 -%}
{% for tag in category -%}
{% for tag in sorted_category -%}

<div class="tagDiv">
<div class="header">
<div class="header" id="{{ tag.replace(' ', '_') }}">
{{ tag.upper() }}
</div>
<div class="problemDiv">
Expand Down Expand Up @@ -113,10 +113,23 @@
};
})();


/*$(function () {
stickyHeaders.load($(".header"), $(window), 0);
});*/
$(window).bind("load", function() {
$.fn.scrollView = function () {
return this.each(function () {
$('html, body').animate({
scrollTop: $(this).offset().top
}, 1000);
});
};

$('.sh2').on('click', function() {
//alert('clicked' + $(this).attr('tagName'));
$('#' + $(this).attr('tagName')).scrollView();
});
stickyHeaders.load($(".header"), $(window), 0);
});

Expand Down
1 change: 1 addition & 0 deletions codeforces_importer/classifier/templates/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@
.detailsRow .sh2 {
text-align: left;
width: 20rem;
cursor: pointer;
}

.detailsRow .sh3 {
Expand Down

0 comments on commit 5d2f767

Please sign in to comment.