Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
1ce80769
Commit
1ce80769
authored
Feb 15, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HTML views for activity charts (issue #176)
parent
998828fe
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
2 deletions
+82
-2
weblate/html/index.html
weblate/html/index.html
+1
-0
weblate/html/js/activity.html
weblate/html/js/activity.html
+7
-0
weblate/trans/charts.py
weblate/trans/charts.py
+69
-2
weblate/urls.py
weblate/urls.py
+5
-0
No files found.
weblate/html/index.html
View file @
1ce80769
...
...
@@ -64,6 +64,7 @@
<li><a
href=
"#changes"
>
{% trans "Recent changes" %}
</a></li>
<li><a
href=
"#translators"
>
{% trans "Most active translators" %}
</a></li>
<li><a
href=
"#suggesters"
>
{% trans "Most active suggesters" %}
</a></li>
<li><a
href=
"{% url 'view_activity' %}"
>
{% trans "Activity" %}
</a></li>
<li><a
href=
"#others"
>
{% trans "Others" %}
</a></li>
</ul>
...
...
weblate/html/js/activity.html
0 → 100644
View file @
1ce80769
{% load i18n %}
<h3>
{% trans "Activity in last 30 days" %}
</h3>
<img
src=
"{{ monthly_url }}"
>
<h3>
{% trans "Activity in last year" %}
</h3>
<img
src=
"{{ yearly_url }}"
>
weblate/trans/charts.py
View file @
1ce80769
...
...
@@ -23,9 +23,11 @@ Charting library for Weblate.
from
weblate.trans.models
import
Change
,
Project
,
SubProject
,
Translation
from
django.shortcuts
import
render_to_response
,
get_object_or_404
from
django.template
import
RequestContext
from
django.http
import
HttpResponse
from
cStringIO
import
StringIO
from
django.utils.translation
import
ugettext
as
_
from
django.core.urlresolvers
import
reverse
import
cairo
import
pycha.bar
...
...
@@ -36,7 +38,7 @@ def render_activity(ticks, line):
'''
# Prepare cairo surface
surface
=
cairo
.
ImageSurface
(
cairo
.
FORMAT_ARGB32
,
800
,
4
00
)
surface
=
cairo
.
ImageSurface
(
cairo
.
FORMAT_ARGB32
,
800
,
1
00
)
# Data set
data
=
(
...
...
@@ -50,7 +52,7 @@ def render_activity(ticks, line):
'ticks'
:
ticks
,
},
'y'
:
{
'tickCount'
:
4
,
'tickCount'
:
1
,
}
},
'background'
:
{
...
...
@@ -169,3 +171,68 @@ def yearly_activity(request, project=None, subproject=None, lang=None):
# Render chart
return
render_activity
(
ticks
,
line
)
def
view_activity
(
request
,
project
=
None
,
subproject
=
None
,
lang
=
None
):
'''
Show html with activity charts.
'''
# Process parameters
project
,
subproject
,
translation
=
get_translation
(
project
,
subproject
,
lang
)
if
translation
is
not
None
:
kwargs
=
{
'project'
:
project
.
slug
,
'subproject'
:
subproject
.
slug
,
'lang'
:
translation
.
language
.
code
,
}
monthly_url
=
reverse
(
'monthly_activity_translation'
,
kwargs
=
kwargs
)
yearly_url
=
reverse
(
'yearly_activity_translation'
,
kwargs
=
kwargs
)
elif
subproject
is
not
None
:
kwargs
=
{
'project'
:
project
.
slug
,
'subproject'
:
subproject
.
slug
,
}
monthly_url
=
reverse
(
'monthly_activity_subproject'
,
kwargs
=
kwargs
)
yearly_url
=
reverse
(
'yearly_activity_subproject'
,
kwargs
=
kwargs
)
elif
project
is
not
None
:
kwargs
=
{
'project'
:
project
.
slug
,
}
monthly_url
=
reverse
(
'monthly_activity_project'
,
kwargs
=
kwargs
)
yearly_url
=
reverse
(
'yearly_activity_project'
,
kwargs
=
kwargs
)
else
:
monthly_url
=
reverse
(
'monthly_activity'
,
)
yearly_url
=
reverse
(
'yearly_activity'
,
)
return
render_to_response
(
'js/activity.html'
,
RequestContext
(
request
,
{
'yearly_url'
:
yearly_url
,
'monthly_url'
:
monthly_url
,
}))
weblate/urls.py
View file @
1ce80769
...
...
@@ -147,6 +147,11 @@ urlpatterns = patterns('',
url
(
r'^projects/(?P<project>[^/]*)/(?P<subproject>[^/]*)/(?P<lang>[^/]*)/upload/$'
,
'weblate.trans.views.upload_translation'
),
url
(
r'^projects/(?P<project>[^/]*)/(?P<subproject>[^/]*)/(?P<lang>[^/]*)/auto/$'
,
'weblate.trans.views.auto_translation'
),
url
(
r'^activity/html/$'
,
'weblate.trans.charts.view_activity'
,
name
=
'view_activity'
),
url
(
r'^activity/html/(?P<project>[^/]*)/$'
,
'weblate.trans.charts.view_activity'
,
name
=
'view_activity_project'
),
url
(
r'^activity/html/(?P<project>[^/]*)/(?P<subproject>[^/]*)/$'
,
'weblate.trans.charts.view_activity'
,
name
=
'view_activity_subproject'
),
url
(
r'^activity/html/(?P<project>[^/]*)/(?P<subproject>[^/]*)/(?P<lang>[^/]*)/$'
,
'weblate.trans.charts.view_activity'
,
name
=
'view_activity_translation'
),
url
(
r'^activity/month/$'
,
'weblate.trans.charts.monthly_activity'
,
name
=
'monthly_activity'
),
url
(
r'^activity/month/(?P<project>[^/]*)/$'
,
'weblate.trans.charts.monthly_activity'
,
name
=
'monthly_activity_project'
),
url
(
r'^activity/month/(?P<project>[^/]*)/(?P<subproject>[^/]*)/$'
,
'weblate.trans.charts.monthly_activity'
,
name
=
'monthly_activity_subproject'
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment