Skip to content

Commit 9922faf

Browse files
committed
community/: Add a webpage for Listing Issues
This commit adds a general view for listing all the issue objects for any model which stores issue related details. The details which are compulsory needed are Hoster, Repository name, Issue title, Number and the URl of it. using this, the commit adds a webpage for displaying all the inactive issues. Closes #288
1 parent 6fe3e7f commit 9922faf

File tree

10 files changed

+99
-79
lines changed

10 files changed

+99
-79
lines changed

.moban.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ package_module: community
44
packages:
55
- community
66
- activity
7-
- inactive_issues
87
- data
98
- gci
109
- gsoc

.nocover.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ nocover_file_globs:
1111
- ci_build/*.py
1212
- meta_review/handler.py
1313
# Optional coverage. Once off scripts.
14-
- inactive_issues/inactive_issues_scraper.py
1514
- unassigned_issues/unassigned_issues_scraper.py
1615
# The following rules can remain here
1716
# django db

community/urls.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@
99

1010
from community.views import (
1111
HomePageView, JoinCommunityView,
12-
OrganizationTeams
12+
OrganizationTeams, InactiveIssuesList
1313
)
1414
from gci.views import GCIStudentsList
1515
from gci.feeds import LatestTasksFeed as gci_tasks_rss
1616
from ci_build.view_log import BuildLogsView
1717
from data.views import ContributorsListView
1818
from gamification.views import GamificationResults
1919
from meta_review.views import ContributorsMetaReview
20-
from inactive_issues.inactive_issues_scraper import inactive_issues_json
2120
from unassigned_issues.unassigned_issues_scraper import (
2221
unassigned_issues_activity_json,
2322
)
@@ -79,10 +78,10 @@ def get_index():
7978
distill_file='meta-review/index.html',
8079
),
8180
distill_url(
82-
r'static/inactive-issues.json', inactive_issues_json,
83-
name='inactive_issues_json',
81+
r'inactive-issues/', InactiveIssuesList.as_view(),
82+
name='inactive-issues',
8483
distill_func=get_index,
85-
distill_file='static/inactive-issues.json',
84+
distill_file='inactive-issues/index.html',
8685
),
8786
distill_url(
8887
r'static/unassigned-issues.json', unassigned_issues_activity_json,

community/views.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
NewcomerPromotion,
2424
Feedback
2525
)
26-
from data.models import Team
26+
from data.models import Team, InactiveIssue
2727
from gamification.models import Participant as GamificationParticipant
2828
from meta_review.models import Participant as MetaReviewer
2929

@@ -221,3 +221,16 @@ def get_context_data(self, **kwargs):
221221
context = super().get_context_data(**kwargs)
222222
context = get_header_and_footer(context)
223223
return context
224+
225+
226+
class InactiveIssuesList(ListView):
227+
228+
template_name = 'issues.html'
229+
model = InactiveIssue
230+
ordering = 'hoster'
231+
232+
def get_context_data(self, **kwargs):
233+
context = super().get_context_data(**kwargs)
234+
context = get_header_and_footer(context)
235+
context['page_name'] = 'Inactive Issues List'
236+
return context

data/migrations/0009_inactiveissue.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Generated by Django 2.1.7 on 2019-08-02 11:39
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('data', '0008_auto_20190802_0745'),
10+
]
11+
12+
operations = [
13+
migrations.CreateModel(
14+
name='InactiveIssue',
15+
fields=[
16+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
17+
('hoster', models.CharField(max_length=30)),
18+
('title', models.CharField(max_length=500)),
19+
('repository', models.CharField(max_length=100)),
20+
('number', models.SmallIntegerField()),
21+
('url', models.URLField()),
22+
],
23+
),
24+
]

data/models.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,11 @@ def get_closes_issues_object(self):
116116
issue_object = issue_number.get_issue()
117117
issues_object_list.append(issue_object)
118118
return issues_object_list
119+
120+
121+
class InactiveIssue(models.Model):
122+
hoster = models.CharField(max_length=30)
123+
title = models.CharField(max_length=500)
124+
repository = models.CharField(max_length=100)
125+
number = models.SmallIntegerField()
126+
url = models.URLField()

inactive_issues/inactive_issues_scraper.py

Lines changed: 0 additions & 67 deletions
This file was deleted.

setup.cfg

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ DJANGO_SETTINGS_MODULE = community.settings
99
testpaths =
1010
community
1111
activity
12-
inactive_issues
1312
data
1413
gci
1514
gsoc
@@ -63,7 +62,6 @@ plugins =
6362
source =
6463
community
6564
activity
66-
inactive_issues
6765
data
6866
gci
6967
gsoc
@@ -80,7 +78,6 @@ omit =
8078
gsoc/*.py
8179
ci_build/*.py
8280
meta_review/handler.py
83-
inactive_issues/inactive_issues_scraper.py
8481
unassigned_issues/unassigned_issues_scraper.py
8582
*/migrations/*.py
8683
*/management/commands/*.py

templates/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
<li><a href="{% url 'community-data' %}">Contributors Information</a></li>
7272
<li><a href="#">Mentors</a></li>
7373
<li><a href="{% url 'community-gci' %}">Google Code-in Students</a></li>
74-
<li><a href="{% url 'inactive_issues_json' %}" title="List of all the issues on organization's main repository on which assignee has not shown any activity for more than 2 months.">Inactive issues</a></li>
74+
<li><a href="{% url 'inactive-issues' %}" title="List of all the issues on organization's main repository on which assignee has not shown any activity for more than 2 months.">Inactive issues</a></li>
7575
<li><a href="{% url 'unassigned_issues_activity_json' %}" title="List of all the issues on organization main repository on which someone has opened a pull request without getting assigned to it.">Unassigned issues activity</a></li>
7676
<li><a href="{% url 'ci_build' %}">Project CI Build</a></li>
7777
{% if isTravis %}

templates/issues.html

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{% extends 'base.html' %}
2+
{% load staticfiles %}
3+
4+
{% block main-content %}
5+
<div class="web-page-details apply-flex center-content">
6+
<h3 style="padding-right: 15px">~</h3>
7+
<h3 class="page-name">
8+
{{ page_name }}
9+
</h3>
10+
<h3 style="padding-left: 15px">~</h3>
11+
</div>
12+
<div class="issues-list" style="margin: auto; width: 60%; min-width: 350px;
13+
padding-bottom: 30px;">
14+
{% if object_list.count > 0 %}
15+
<table class="highlight centered">
16+
<thead>
17+
<tr class="custom-green-color-font">
18+
<th>
19+
<h5>Hoster</h5>
20+
</th>
21+
<th>
22+
<h5>Title</h5>
23+
</th>
24+
<th>
25+
<h5>Issue</h5>
26+
</th>
27+
</tr>
28+
</thead>
29+
<tbody>
30+
{% for issue in object_list %}
31+
<tr>
32+
<td>{{ issue.hoster }}</td>
33+
<td>{{ issue.title }}</td>
34+
<td class="bold-text">
35+
<a href="{{ issue.url }}">{{ issue.repository }}#{{ issue.number }}</a>
36+
</td>
37+
</tr>
38+
{% endfor %}
39+
</tbody>
40+
</table>
41+
{% else %}
42+
<h5 class="empty-list apply-flex center-content" style="min-height: 124px">
43+
No Issues Found! <i class="fa fa-smile-o"></i>
44+
</h5>
45+
{% endif %}
46+
</div>
47+
48+
{% endblock %}

0 commit comments

Comments
 (0)