Skip to content

Commit

Permalink
added loading gif on home page for better visualisation
Browse files Browse the repository at this point in the history
  • Loading branch information
jarvisdev committed Oct 22, 2018
1 parent 2738822 commit e699038
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 25 deletions.
40 changes: 20 additions & 20 deletions ContriHub/settings.py
Expand Up @@ -122,12 +122,12 @@
else:
#this is for local you need not to make any changes here,
# it'll work unless you are sure about how to setup postgres/mysql etc
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# }
# }
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
#An example how you can setup postgres sql in local, create a postgres db and provide relevant details in this format
# DB_PASS = os.environ.get('CONTRIHUB_PASS', "")
# DATABASES = {
Expand All @@ -140,20 +140,20 @@
# 'PORT': '',
# }
# }
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'OPTIONS': {
# 'read_default_file': '/path/to/my.cnf',
},
# 'NAME': os.path.join(BASE_DIR, 'testdb'),
'NAME': 'contrihub_db',
'USER': 'user',
'PASSWORD': '1234',
'HOST': '127.0.0.1',
'PORT': '',
}
}
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.mysql',
# 'OPTIONS': {
# # 'read_default_file': '/path/to/my.cnf',
# },
# # 'NAME': os.path.join(BASE_DIR, 'testdb'),
# 'NAME': 'contrihub_db',
# 'USER': 'user',
# 'PASSWORD': '1234',
# 'HOST': '127.0.0.1',
# 'PORT': '',
# }
# }


# Password validation
Expand Down
Binary file modified Projects/static/Projects/img/loader.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 8 additions & 2 deletions Projects/templates/Projects/home.html
Expand Up @@ -185,8 +185,14 @@ <h4>
var infiniteScroll = new Waypoint.Infinite({
element: $('.issues-container')[0],
items: '.issue-list-item',
loadingClass: 'more-issues-loading',
more: '.more-issues-link'
//loadingClass: 'more-issues-loading',
more: '.more-issues-link',
onBeforePageLoad: function(){
$('.more-issues-loading').show();
},
onAfterPageLoad: function(){
$('.more-issues-loading').hide();
}
});
});
</script>
Expand Down
6 changes: 5 additions & 1 deletion Projects/templates/Projects/leaderboard.html
Expand Up @@ -15,6 +15,7 @@
<div class="card" style="margin-top: 100px">

<div class="card-body" style="margin-bottom:20px">

<table class="table table-hover">
<thead class="thead-dark">
<tr>
Expand All @@ -24,22 +25,25 @@
</tr>
</thead>
<tbody>

{% for user in users %}
<tr>
<th scope="row">{{forloop.counter}}</th>
<td><a href="https://github.com/{{user.username}}">{{user.username}}</a></td>
<td>{{user.profile.points}}</td>
</tr>
{% endfor %}

</tbody>
</table>
</div>
</div>
</div>


{% endblock body_content %}



{% block js_extra %}
{% endblock js_extra %}
{% endblock js_extra %}
6 changes: 4 additions & 2 deletions Projects/views.py
Expand Up @@ -30,6 +30,7 @@ def home(request):
issues = issues.order_by('points')
paginator = Paginator(issues, 15) # Show 15 issues per page
page = request.GET.get('page', 1)

try:
issues = paginator.get_page(page)
except PageNotAnInteger:
Expand All @@ -42,8 +43,9 @@ def home(request):
#all filter attributes or you can also send a list of all such attrs

def leaderboard(request):
users = User.objects.all().filter(profile__role='student').order_by('-profile__points')
return render(request, 'Projects/leaderboard.html', {'users': users})
if request.method == 'GET':
users = User.objects.all().filter(profile__role='student').order_by('-profile__points')
return render(request, 'Projects/leaderboard.html', {'users': users})

@login_required(login_url='signin')
def profile(request, username):
Expand Down

0 comments on commit e699038

Please sign in to comment.