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
db71fe45
Commit
db71fe45
authored
Mar 30, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prepare infrastructure for dictionaries (issue #3)
parent
a458691a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
0 deletions
+34
-0
html/project.html
html/project.html
+10
-0
trans/views.py
trans/views.py
+20
-0
urls.py
urls.py
+4
-0
No files found.
html/project.html
View file @
db71fe45
{% extends "base.html" %}
{% load i18n %}
{% load url from future %}
{% block breadcums %}
<li><a
href=
"{{ object.get_absolute_url }}"
>
{{ object }}
</a></li>
...
...
@@ -35,6 +36,15 @@
<h2>
{% trans "Tools" %}
</h2>
<div
class=
"accordion"
>
<h3><a
href=
"#"
>
{% trans "Dictionaries" %}
</a></h3>
<div>
<ul>
{% for dict in dicts %}
<li><a
href=
"{% url 'trans.views.show_dictionary' project=object.slug lang=dict.code %}"
>
{{ dict }}
</a></li>
{% endfor %}
<li><a
href=
"{% url 'trans.views.show_dictionaries' project=object.slug %}"
>
Manage all dictionaries
</a></li>
</ul>
</div>
{% include "git-tools.html" %}
</div>
...
...
trans/views.py
View file @
db71fe45
...
...
@@ -123,11 +123,31 @@ def show_language(request, lang):
'object'
:
obj
,
}))
def
show_dictionaries
(
request
,
project
):
obj
=
get_object_or_404
(
Project
,
slug
=
project
)
dicts
=
Dictionary
.
objects
.
filter
(
project
=
obj
).
values_list
(
'language'
,
flat
=
True
).
distinct
()
return
render_to_response
(
'dictionaries.html'
,
RequestContext
(
request
,
{
'title'
:
_
(
'Dictionaries'
),
'dicts'
:
Language
.
objects
.
filter
(
id__in
=
dicts
),
}))
def
show_dictionary
(
request
,
project
,
lang
):
prj
=
get_object_or_404
(
Project
,
slug
=
project
)
lang
=
get_object_or_404
(
Language
,
code
=
lang
)
return
render_to_response
(
'dictionary.html'
,
RequestContext
(
request
,
{
'project'
:
prj
,
'language'
:
lang
,
}))
def
show_project
(
request
,
project
):
obj
=
get_object_or_404
(
Project
,
slug
=
project
)
dicts
=
Dictionary
.
objects
.
filter
(
project
=
obj
).
values_list
(
'language'
,
flat
=
True
).
distinct
()
return
render_to_response
(
'project.html'
,
RequestContext
(
request
,
{
'object'
:
obj
,
'dicts'
:
Language
.
objects
.
filter
(
id__in
=
dicts
),
}))
def
show_subproject
(
request
,
project
,
subproject
):
...
...
urls.py
View file @
db71fe45
...
...
@@ -23,6 +23,10 @@ urlpatterns = patterns('',
url
(
r'^$'
,
'trans.views.home'
),
url
(
r'^projects/$'
,
'django.views.generic.simple.redirect_to'
,
{
'url'
:
'/'
}),
url
(
r'^projects/(?P<project>[^/]*)/$'
,
'trans.views.show_project'
),
url
(
r'^projects/(?P<project>[^/]*)/dictionary/$'
,
'trans.views.show_dictionaries'
),
url
(
r'^projects/(?P<project>[^/]*)/dictionary/(?P<lang>[^/]*)/$'
,
'trans.views.show_dictionary'
),
url
(
r'^projects/(?P<project>[^/]*)/(?P<subproject>[^/]*)/$'
,
'trans.views.show_subproject'
),
url
(
r'^projects/(?P<project>[^/]*)/(?P<subproject>[^/]*)/(?P<lang>[^/]*)/$'
,
'trans.views.show_translation'
),
url
(
r'^projects/(?P<project>[^/]*)/(?P<subproject>[^/]*)/(?P<lang>[^/]*)/translate/$'
,
'trans.views.translate'
),
...
...
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