Skip to content

Commit 0a2f538

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 coala#288
1 parent 8f01987 commit 0a2f538

File tree

10 files changed

+87
-79
lines changed

10 files changed

+87
-79
lines changed

.moban.yaml

-1
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

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ nocover_file_globs:
1313
- openhub/*.py
1414
- twitter/*.py
1515
# Optional coverage. Once off scripts.
16-
- inactive_issues/inactive_issues_scraper.py
1716
- unassigned_issues/unassigned_issues_scraper.py
1817
# The following rules can remain here
1918
# django db

community/urls.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
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
@@ -18,7 +18,6 @@
1818
from data.views import ContributorsListView
1919
from gamification.views import GamificationResults
2020
from meta_review.views import ContributorsMetaReview
21-
from inactive_issues.inactive_issues_scraper import inactive_issues_json
2221
from unassigned_issues.unassigned_issues_scraper import (
2322
unassigned_issues_activity_json,
2423
)
@@ -86,10 +85,10 @@ def get_index():
8685
distill_file='meta-review/index.html',
8786
),
8887
distill_url(
89-
r'static/inactive-issues.json', inactive_issues_json,
90-
name='inactive_issues_json',
88+
r'inactive-issues/', InactiveIssuesList.as_view(),
89+
name='inactive-issues',
9190
distill_func=get_index,
92-
distill_file='static/inactive-issues.json',
91+
distill_file='inactive-issues/index.html',
9392
),
9493
distill_url(
9594
r'static/unassigned-issues.json', unassigned_issues_activity_json,

community/views.py

+14-1
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

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

data/migrations/0009_inactiveissue.py

+24
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

+8
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

-67
This file was deleted.

setup.cfg

-3
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
@@ -64,7 +63,6 @@ plugins =
6463
source =
6564
community
6665
activity
67-
inactive_issues
6866
data
6967
gci
7068
gsoc
@@ -84,7 +82,6 @@ omit =
8482
meta_review/handler.py
8583
openhub/*.py
8684
twitter/*.py
87-
inactive_issues/inactive_issues_scraper.py
8885
unassigned_issues/unassigned_issues_scraper.py
8986
*/migrations/*.py
9087
*/management/commands/*.py

templates/base.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
<li><a href="{% url 'community-data' %}">Contributors Information</a></li>
7979
<li><a href="#">Mentors</a></li>
8080
<li><a href="{% url 'community-gci' %}">Google Code-in Students</a></li>
81-
<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>
81+
<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>
8282
<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>
8383
<li><a href="{% url 'ci_build' %}">Project CI Build</a></li>
8484
{% if isTravis %}

templates/issues.html

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
<table class="highlight centered">
15+
<thead>
16+
<tr class="custom-green-color-font">
17+
<th><h5>Hoster</h5></th>
18+
<th><h5>Title</h5></th>
19+
<th><h5>Issue</h5></th>
20+
</tr>
21+
</thead>
22+
<tbody>
23+
{% for issue in object_list %}
24+
<tr>
25+
<td>{{ issue.hoster }}</td>
26+
<td>{{ issue.title }}</td>
27+
<td class="bold-text">
28+
<a href="{{ issue.url }}">{{ issue.repository }}#{{ issue.number }}</a>
29+
</td>
30+
</tr>
31+
{% endfor %}
32+
</tbody>
33+
</table>
34+
</div>
35+
36+
{% endblock %}

0 commit comments

Comments
 (0)