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
09ba0ac4
Commit
09ba0ac4
authored
Feb 09, 2016
by
Jitka Novotna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commponent list as default
parent
a639cb48
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
22 deletions
+53
-22
weblate/accounts/migrations/0016_auto_20160209_1127.py
weblate/accounts/migrations/0016_auto_20160209_1127.py
+19
-0
weblate/accounts/models.py
weblate/accounts/models.py
+6
-5
weblate/html/index.html
weblate/html/index.html
+9
-16
weblate/trans/context_processors.py
weblate/trans/context_processors.py
+11
-1
weblate/trans/models/componentlist.py
weblate/trans/models/componentlist.py
+3
-0
weblate/trans/templatetags/translations.py
weblate/trans/templatetags/translations.py
+5
-0
No files found.
weblate/accounts/migrations/0016_auto_20160209_1127.py
0 → 100644
View file @
09ba0ac4
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'accounts'
,
'0015_auto_20160208_1535'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'profile'
,
name
=
'dashboard_view'
,
field
=
models
.
CharField
(
default
=
'your-subscriptions'
,
max_length
=
100
,
verbose_name
=
'Default dashboard view'
,
choices
=
[(
'your-subscriptions'
,
'Your subscriptions'
),
(
'your-languages'
,
'Your languages'
),
(
'projects'
,
'All projects'
),
(
'list'
,
'Component list'
)]),
),
]
weblate/accounts/models.py
View file @
09ba0ac4
...
...
@@ -496,17 +496,18 @@ class Profile(models.Model):
default
=
False
)
DASHBOARD_SUBSCRIPTIONS
=
0
DASHBOARD_LANGUAGES
=
1
DASHBOARD_ALL
=
2
DASHBOARD_COMPONENT_LIST
=
3
DASHBOARD_SUBSCRIPTIONS
=
"your-subscriptions"
DASHBOARD_LANGUAGES
=
"your-languages"
DASHBOARD_ALL
=
"projects"
DASHBOARD_COMPONENT_LIST
=
"list"
DASHBOARD_CHOICES
=
(
(
DASHBOARD_SUBSCRIPTIONS
,
_
(
'Your subscriptions'
)),
(
DASHBOARD_LANGUAGES
,
_
(
'Your languages'
)),
(
DASHBOARD_ALL
,
_
(
'All projects'
)),
(
DASHBOARD_COMPONENT_LIST
,
_
(
'Component list'
)),
)
dashboard_view
=
models
.
IntegerField
(
dashboard_view
=
models
.
CharField
(
max_length
=
100
,
choices
=
DASHBOARD_CHOICES
,
verbose_name
=
_
(
'Default dashboard view'
),
default
=
DASHBOARD_SUBSCRIPTIONS
,
...
...
weblate/html/index.html
View file @
09ba0ac4
...
...
@@ -22,7 +22,7 @@
<ul
class=
"nav nav-pills"
>
<li
class=
"dropdown active"
>
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
id=
"views-title"
>
{{
dashboard_default_view}}
<span
class=
"caret"
></span>
{{
active_tab_label}}
<span
class=
"caret"
></span>
</a>
<ul
class=
"dropdown-menu"
id=
"views-menu"
>
<li><a
href=
"#projects"
data-toggle=
"tab"
>
{% trans "All projects" %}
</a></li>
...
...
@@ -31,7 +31,7 @@
<li><a
href=
"#your-subscriptions"
data-toggle=
"tab"
>
{% trans "Your subscriptions" %}
</a></li>
{% endif %}
{% for componentlist in componentlists %}
<li><a
href=
"#
list-{{ componentlist.
slug }}"
data-toggle=
"tab"
>
{{ componentlist.name }}
</a></li>
<li><a
href=
"#
{{ componentlist.tab_
slug }}"
data-toggle=
"tab"
>
{{ componentlist.name }}
</a></li>
{% endfor %}
</ul>
</li>
...
...
@@ -62,7 +62,7 @@ $("#views-menu li a").click(function(){
<div
class=
"tab-content"
>
{% if user.is_authenticated %}
<div
class=
"tab-pane active"
id=
"your-subscriptions"
>
<div
{%
active_tab
"
your-subscriptions
"
%}
>
{% if subscribed_projects %}
{% if usersubscriptions %}
{% with usersubscriptions as translations and 2 as show_language and user.profile.hide_completed as hide_completed %}
...
...
@@ -82,7 +82,7 @@ $("#views-menu li a").click(function(){
</p>
</div>
<div
class=
"tab-pane"
id=
"your-languages"
>
<div
{%
active_tab
"
your-languages
"
%}
>
{% if userlanguages %}
{% with userlanguages as translations and 2 as show_language and user.profile.hide_completed as hide_completed %}
{% include "list-translations.html" %}
...
...
@@ -92,27 +92,20 @@ $("#views-menu li a").click(function(){
{% endif %} {# userlanguages #}
<p><a
class=
"btn btn-default"
href=
"{% url 'profile' %}#languages"
>
{% trans "Manage your languages" %}
</a></p>
</div>
<div
class=
"tab-pane"
id=
"projects"
>
{% else %} {# user.is_authenticated #}
<div
class=
"tab-pane active"
id=
"projects"
>
{% endif %} {# user.is_authenticated #}
{# All projects#}
<div
{%
active_tab
"
projects
"
%}
>
{% include "list-projects.html" %}
<p>
{% include "legend.html" %}
</p>
<p>
{% include "legend.html" %}
</p>
{% if offer_hosting %}
<p><a
class=
"btn btn-default"
href=
"{% url 'hosting' %}"
>
{% trans "Ask for project hosting" %}
</a>
{% endif %}
</div>
{% for componentlist in componentlists %}
<div
class=
"tab-pane"
id=
"list-{{componentlist.slug}}"
>
<div
{%
active_tab
componentlist
.
tab_slug
%}
>
{% if userlanguages %}
{% with userlanguages as translations and 2 as show_language and user.profile.hide_completed as hide_completed %}
{% include "list-translations.html" %}
...
...
weblate/trans/context_processors.py
View file @
09ba0ac4
...
...
@@ -44,12 +44,21 @@ def weblate_context(request):
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
(
...
...
@@ -101,5 +110,6 @@ def weblate_context(request):
'userlanguages'
:
userlanguages
,
'componentlists'
:
componentlists
,
'dashboard_default_view'
:
dict
(
Profile
.
DASHBOARD_CHOICES
)[
request
.
user
.
profile
.
dashboard_view
],
'active_tab_slug'
:
active_tab_slug
,
'active_tab_label'
:
dashboard_choices
.
get
(
active_tab_slug
)
}
weblate/trans/models/componentlist.py
View file @
09ba0ac4
...
...
@@ -45,6 +45,9 @@ class ComponentList(models.Model):
components
=
models
.
ManyToManyField
(
'SubProject'
)
def
tab_slug
(
self
):
return
"list-"
+
self
.
slug
def
clean
(
self
):
if
not
self
.
name
:
raise
ValidationError
(
_
(
'Name must be specified'
))
...
...
weblate/trans/templatetags/translations.py
View file @
09ba0ac4
...
...
@@ -610,3 +610,8 @@ def whiteboard_messages(project=None, subproject=None, language=None):
)
return
mark_safe
(
'
\
n
'
.
join
(
ret
))
@
register
.
simple_tag
(
takes_context
=
True
)
def
active_tab
(
context
,
slug
):
active
=
"active"
if
slug
==
context
[
'active_tab_slug'
]
else
""
return
mark_safe
(
'class="tab-pane %s" id="%s"'
%
(
active
,
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