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
07862201
Commit
07862201
authored
Feb 09, 2016
by
Jitka Novotna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lots of things from context_processors->basic.py
parent
89fb9370
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
47 deletions
+48
-47
weblate/html/base.html
weblate/html/base.html
+3
-3
weblate/trans/context_processors.py
weblate/trans/context_processors.py
+0
-43
weblate/trans/views/basic.py
weblate/trans/views/basic.py
+45
-1
No files found.
weblate/html/base.html
View file @
07862201
...
...
@@ -83,11 +83,11 @@
<div
class=
"collapse navbar-collapse"
id=
"wl-navbar-main"
>
<ul
class=
"nav navbar-nav"
>
<li><a
href=
"{% url 'home' %}"
>
{% trans "Dashboard" %}
</a></li>
{% if
usertranslation
s %}
{% if
subscribed_project
s %}
<li
class=
"dropdown"
>
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
>
{% trans "Your
transla
tions" %}
<b
class=
"caret"
></b></a>
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
>
{% trans "Your
subscrip
tions" %}
<b
class=
"caret"
></b></a>
<ul
class=
"dropdown-menu"
>
{% for project in
usertranslation
s %}
{% for project in
subscribed_project
s %}
<li><a
href=
"{{ project.get_absolute_url }}"
>
{{ project }}
</a></li>
{% endfor %}
</ul>
...
...
weblate/trans/context_processors.py
View file @
07862201
...
...
@@ -23,7 +23,6 @@ from datetime import datetime
import
weblate
from
weblate
import
appsettings
from
weblate.trans.site
import
get_site_url
from
weblate.trans.models.componentlist
import
ComponentList
from
weblate.trans.models.project
import
Project
from
weblate.trans.models.translation
import
Translation
from
weblate.accounts.models
import
Profile
...
...
@@ -42,48 +41,12 @@ def weblate_context(request):
login_redirect_url
=
request
.
get_full_path
()
projects
=
Project
.
objects
.
all_acl
(
request
.
user
)
componentlists
=
ComponentList
.
objects
.
all
()
dashboard_choices
=
dict
(
Profile
.
DASHBOARD_CHOICES
)
# Load user translations if user is authenticated
subscribed_projects
=
None
usersubscriptions
=
None
userlanguages
=
None
active_tab_slug
=
Profile
.
DASHBOARD_ALL
if
request
.
user
.
is_authenticated
():
active_tab_slug
=
request
.
user
.
profile
.
dashboard_view
if
active_tab_slug
==
Profile
.
DASHBOARD_COMPONENT_LIST
:
clist
=
request
.
user
.
profile
.
dashboard_component_list
active_tab_slug
=
clist
.
tab_slug
()
dashboard_choices
[
active_tab_slug
]
=
clist
.
name
subscribed_projects
=
request
.
user
.
profile
.
subscriptions
.
all
()
usersubscriptions
=
Translation
.
objects
.
filter
(
language__in
=
request
.
user
.
profile
.
languages
.
all
(),
subproject__project__in
=
subscribed_projects
).
order_by
(
'subproject__project__name'
,
'subproject__name'
).
select_related
()
userlanguages
=
Translation
.
objects
.
filter
(
language__in
=
request
.
user
.
profile
.
languages
.
all
(),
subproject__project__in
=
projects
,
).
order_by
(
'subproject__project__name'
,
'subproject__name'
).
select_related
()
for
componentlist
in
componentlists
:
componentlist
.
translations
=
Translation
.
objects
.
filter
(
language__in
=
request
.
user
.
profile
.
languages
.
all
(),
subproject__in
=
componentlist
.
components
.
all
()
).
order_by
(
'subproject__project__name'
,
'subproject__name'
).
select_related
()
return
{
'version'
:
weblate
.
VERSION
,
...
...
@@ -113,10 +76,4 @@ def weblate_context(request):
'registration_open'
:
appsettings
.
REGISTRATION_OPEN
,
'acl_projects'
:
projects
,
'subscribed_projects'
:
subscribed_projects
,
'usersubscriptions'
:
usersubscriptions
,
'userlanguages'
:
userlanguages
,
'componentlists'
:
componentlists
,
'active_tab_slug'
:
active_tab_slug
,
'active_tab_label'
:
dashboard_choices
.
get
(
active_tab_slug
)
}
weblate/trans/views/basic.py
View file @
07862201
...
...
@@ -33,7 +33,7 @@ from django.utils import timezone
import
django.views.defaults
from
weblate.trans.models
import
(
Project
,
SubProject
,
Translation
,
Check
,
Project
,
SubProject
,
Translation
,
Check
,
ComponentList
,
Dictionary
,
Change
,
Unit
,
WhiteboardMessage
)
from
weblate.requirements
import
get_versions
,
get_optional_versions
...
...
@@ -89,6 +89,45 @@ def home(request):
top_suggestions
=
Profile
.
objects
.
order_by
(
'-suggested'
)[:
10
]
last_changes
=
Change
.
objects
.
last_changes
(
request
.
user
)[:
10
]
# Dashboard project/subproject view
componentlists
=
ComponentList
.
objects
.
all
()
dashboard_choices
=
dict
(
Profile
.
DASHBOARD_CHOICES
)
usersubscriptions
=
None
userlanguages
=
None
active_tab_slug
=
Profile
.
DASHBOARD_ALL
if
request
.
user
.
is_authenticated
():
active_tab_slug
=
request
.
user
.
profile
.
dashboard_view
if
active_tab_slug
==
Profile
.
DASHBOARD_COMPONENT_LIST
:
clist
=
request
.
user
.
profile
.
dashboard_component_list
active_tab_slug
=
clist
.
tab_slug
()
dashboard_choices
[
active_tab_slug
]
=
clist
.
name
subscribed_projects
=
request
.
user
.
profile
.
subscriptions
.
all
()
usersubscriptions
=
Translation
.
objects
.
filter
(
language__in
=
request
.
user
.
profile
.
languages
.
all
(),
subproject__project__in
=
subscribed_projects
).
order_by
(
'subproject__project__name'
,
'subproject__name'
).
select_related
()
userlanguages
=
Translation
.
objects
.
filter
(
language__in
=
request
.
user
.
profile
.
languages
.
all
(),
subproject__project__in
=
projects
,
).
order_by
(
'subproject__project__name'
,
'subproject__name'
).
select_related
()
for
componentlist
in
componentlists
:
componentlist
.
translations
=
Translation
.
objects
.
filter
(
language__in
=
request
.
user
.
profile
.
languages
.
all
(),
subproject__in
=
componentlist
.
components
.
all
()
).
order_by
(
'subproject__project__name'
,
'subproject__name'
).
select_related
()
return
render
(
request
,
'index.html'
,
...
...
@@ -100,6 +139,11 @@ def home(request):
'last_changes_url'
:
''
,
'search_form'
:
SiteSearchForm
(),
'whiteboard_messages'
:
wb_messages
,
'usersubscriptions'
:
usersubscriptions
,
'userlanguages'
:
userlanguages
,
'componentlists'
:
componentlists
,
'active_tab_slug'
:
active_tab_slug
,
'active_tab_label'
:
dashboard_choices
.
get
(
active_tab_slug
)
}
)
...
...
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