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
f5878b60
Commit
f5878b60
authored
Dec 22, 2015
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement displaying of whiteboard messages
Issue #159 Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
81062dd5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
75 additions
and
4 deletions
+75
-4
weblate/html/index.html
weblate/html/index.html
+1
-3
weblate/html/language.html
weblate/html/language.html
+2
-0
weblate/html/project.html
weblate/html/project.html
+2
-0
weblate/html/subproject.html
weblate/html/subproject.html
+4
-0
weblate/html/translation.html
weblate/html/translation.html
+3
-0
weblate/trans/models/whiteboard.py
weblate/trans/models/whiteboard.py
+36
-0
weblate/trans/templatetags/translations.py
weblate/trans/templatetags/translations.py
+27
-1
No files found.
weblate/html/index.html
View file @
f5878b60
...
@@ -16,9 +16,7 @@
...
@@ -16,9 +16,7 @@
</p>
</p>
{% endif %}
{% endif %}
{% for msg in whiteboard_messages %}
{% whiteboard_messages %}
{% show_message 'info whiteboard' msg.message %}
{% endfor %}
<ul
class=
"nav nav-pills"
>
<ul
class=
"nav nav-pills"
>
{% if user.is_authenticated %}
{% if user.is_authenticated %}
...
...
weblate/html/language.html
View file @
f5878b60
...
@@ -9,6 +9,8 @@
...
@@ -9,6 +9,8 @@
{% block content %}
{% block content %}
{% whiteboard_messages language=object %}
<ul
class=
"nav nav-pills"
>
<ul
class=
"nav nav-pills"
>
<li
class=
"active"
><a
href=
"#overview"
data-toggle=
"tab"
>
{% trans "Overview" %}
</a></li>
<li
class=
"active"
><a
href=
"#overview"
data-toggle=
"tab"
>
{% trans "Overview" %}
</a></li>
<li><a
href=
"#history"
data-toggle=
"tab"
>
{% trans "History" %}
</a></li>
<li><a
href=
"#history"
data-toggle=
"tab"
>
{% trans "History" %}
</a></li>
...
...
weblate/html/project.html
View file @
f5878b60
...
@@ -14,6 +14,8 @@
...
@@ -14,6 +14,8 @@
{% block content %}
{% block content %}
{% whiteboard_messages project=object %}
{% can_see_repository_status user object as user_can_see_repository_status %}
{% can_see_repository_status user object as user_can_see_repository_status %}
{% can_commit_translation user object as user_can_commit_translation %}
{% can_commit_translation user object as user_can_commit_translation %}
{% can_manage_acl user object as user_can_manage_acl %}
{% can_manage_acl user object as user_can_manage_acl %}
...
...
weblate/html/subproject.html
View file @
f5878b60
{% extends "base.html" %}
{% extends "base.html" %}
{% load i18n %}
{% load i18n %}
{% load permissions %}
{% load permissions %}
{% load translations %}
{% load crispy_forms_tags %}
{% load crispy_forms_tags %}
{% block breadcrumbs %}
{% block breadcrumbs %}
...
@@ -13,6 +14,9 @@
...
@@ -13,6 +14,9 @@
{% endblock %}
{% endblock %}
{% block content %}
{% block content %}
{% whiteboard_messages subproject=object %}
{% can_see_repository_status user object.project as user_can_see_repository_status %}
{% can_see_repository_status user object.project as user_can_see_repository_status %}
{% can_commit_translation user object.project as user_can_commit_translation %}
{% can_commit_translation user object.project as user_can_commit_translation %}
{% can_manage_acl user object.project as user_can_manage_acl %}
{% can_manage_acl user object.project as user_can_manage_acl %}
...
...
weblate/html/translation.html
View file @
f5878b60
...
@@ -14,6 +14,9 @@
...
@@ -14,6 +14,9 @@
{% endblock %}
{% endblock %}
{% block content %}
{% block content %}
{% whiteboard_messages subproject=object.subproject language=object.language %}
{% can_see_repository_status user object.subproject.project as user_can_see_repository_status %}
{% can_see_repository_status user object.subproject.project as user_can_see_repository_status %}
{% can_commit_translation user object.subproject.project as user_can_commit_translation %}
{% can_commit_translation user object.subproject.project as user_can_commit_translation %}
...
...
weblate/trans/models/whiteboard.py
View file @
f5878b60
...
@@ -21,11 +21,45 @@
...
@@ -21,11 +21,45 @@
"""Whiteboard model."""
"""Whiteboard model."""
from
django.db
import
models
from
django.db
import
models
from
django.db.models
import
Q
from
django.utils.translation
import
ugettext_lazy
,
ugettext
as
_
from
django.utils.translation
import
ugettext_lazy
,
ugettext
as
_
from
django.core.exceptions
import
ValidationError
from
django.core.exceptions
import
ValidationError
from
weblate.lang.models
import
Language
from
weblate.lang.models
import
Language
class
WhiteboardManager
(
models
.
Manager
):
def
context_filter
(
self
,
project
=
None
,
subproject
=
None
,
language
=
None
):
"""Filters whiteboard messages by context."""
base
=
self
.
all
()
if
language
is
None
and
project
is
None
and
subproject
is
None
:
return
base
.
filter
(
project
=
None
,
subproject
=
None
,
language
=
None
)
if
language
and
project
is
None
and
subproject
is
None
:
return
base
.
filter
(
project
=
None
,
subproject
=
None
,
language
=
language
)
if
project
:
return
base
.
filter
(
project
=
project
)
if
subproject
:
if
language
:
return
base
.
filter
(
Q
(
language
=
language
)
|
Q
(
subproject
=
subproject
)
|
Q
(
project
=
subproject
.
project
)
)
return
base
.
filter
(
Q
(
subproject
=
subproject
)
|
Q
(
project
=
subproject
.
project
)
)
return
base
class
WhiteboardMessage
(
models
.
Model
):
class
WhiteboardMessage
(
models
.
Model
):
message
=
models
.
TextField
(
message
=
models
.
TextField
(
verbose_name
=
ugettext_lazy
(
'Message'
),
verbose_name
=
ugettext_lazy
(
'Message'
),
...
@@ -35,6 +69,8 @@ class WhiteboardMessage(models.Model):
...
@@ -35,6 +69,8 @@ class WhiteboardMessage(models.Model):
subproject
=
models
.
ForeignKey
(
'SubProject'
,
null
=
True
,
blank
=
True
)
subproject
=
models
.
ForeignKey
(
'SubProject'
,
null
=
True
,
blank
=
True
)
language
=
models
.
ForeignKey
(
Language
,
null
=
True
,
blank
=
True
)
language
=
models
.
ForeignKey
(
Language
,
null
=
True
,
blank
=
True
)
objects
=
WhiteboardManager
()
class
Meta
(
object
):
class
Meta
(
object
):
app_label
=
'trans'
app_label
=
'trans'
verbose_name
=
ugettext_lazy
(
'Whiteboard message'
)
verbose_name
=
ugettext_lazy
(
'Whiteboard message'
)
...
...
weblate/trans/templatetags/translations.py
View file @
f5878b60
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
from
django.utils.html
import
escape
from
django.utils.html
import
escape
from
django.contrib.admin.templatetags.admin_static
import
static
from
django.contrib.admin.templatetags.admin_static
import
static
from
django.template.loader
import
render_to_string
from
django.utils.safestring
import
mark_safe
from
django.utils.safestring
import
mark_safe
from
django.utils.encoding
import
force_unicode
from
django.utils.encoding
import
force_unicode
from
django.utils.translation
import
ugettext
as
_
,
ungettext
,
ugettext_lazy
from
django.utils.translation
import
ugettext
as
_
,
ungettext
,
ugettext_lazy
...
@@ -36,7 +37,9 @@ import weblate
...
@@ -36,7 +37,9 @@ import weblate
from
weblate.trans.simplediff
import
html_diff
from
weblate.trans.simplediff
import
html_diff
from
weblate.trans.util
import
split_plural
from
weblate.trans.util
import
split_plural
from
weblate.lang.models
import
Language
from
weblate.lang.models
import
Language
from
weblate.trans.models
import
Project
,
SubProject
,
Dictionary
,
Advertisement
from
weblate.trans.models
import
(
Project
,
SubProject
,
Dictionary
,
Advertisement
,
WhiteboardMessage
)
from
weblate.trans.checks
import
CHECKS
from
weblate.trans.checks
import
CHECKS
register
=
template
.
Library
()
register
=
template
.
Library
()
...
@@ -544,3 +547,26 @@ def get_location_links(unit):
...
@@ -544,3 +547,26 @@ def get_location_links(unit):
else
:
else
:
ret
.
append
(
'<a href="%s">%s</a>'
%
(
link
,
location
))
ret
.
append
(
'<a href="%s">%s</a>'
%
(
link
,
location
))
return
mark_safe
(
'
\
n
'
.
join
(
ret
))
return
mark_safe
(
'
\
n
'
.
join
(
ret
))
@
register
.
simple_tag
def
whiteboard_messages
(
project
=
None
,
subproject
=
None
,
language
=
None
):
"""Displays whiteboard messages for given context"""
ret
=
[]
whiteboards
=
WhiteboardMessage
.
objects
.
context_filter
(
project
,
subproject
,
language
)
for
whiteboard
in
whiteboards
:
ret
.
append
(
render_to_string
(
'message.html'
,
{
'tags'
:
'info whiteboard'
,
'message'
:
whiteboard
.
message
}
)
)
return
mark_safe
(
'
\
n
'
.
join
(
ret
))
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