Skip to content

Commit 6d1ff15

Browse files
committed
issue #134, use .min files, update translation
1 parent fb9a0bd commit 6d1ff15

File tree

11 files changed

+105
-99
lines changed

11 files changed

+105
-99
lines changed

martor/locale/en/LC_MESSAGES/django.po

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2020-09-16 06:22+0700\n"
11+
"POT-Creation-Date: 2020-09-16 08:34+0700\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <[email protected]>\n"
@@ -169,15 +169,15 @@ msgstr ""
169169
msgid "Markdown Guide (Help)"
170170
msgstr ""
171171

172-
#: views.py:23 views.py:37 views.py:38
172+
#: views.py:22 views.py:36 views.py:37
173173
msgid "Invalid request!"
174174
msgstr ""
175175

176-
#: views.py:80
176+
#: views.py:77
177177
#, python-format
178178
msgid "No users registered as `%(username)s` or user is unactived."
179179
msgstr ""
180180

181-
#: views.py:84
181+
#: views.py:81
182182
msgid "Validation Failed for field `username`"
183183
msgstr ""

martor/locale/id/LC_MESSAGES/django.po

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2020-09-16 06:22+0700\n"
11+
"POT-Creation-Date: 2020-09-16 08:34+0700\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <[email protected]>\n"
@@ -171,17 +171,17 @@ msgstr "Layar Penuh"
171171
msgid "Markdown Guide (Help)"
172172
msgstr "Bantuan Penggunaan Markdown"
173173

174-
#: views.py:23 views.py:37 views.py:38
174+
#: views.py:22 views.py:36 views.py:37
175175
msgid "Invalid request!"
176176
msgstr "Permintaan tidak valid"
177177

178-
#: views.py:80
178+
#: views.py:77
179179
#, python-format
180180
msgid "No users registered as `%(username)s` or user is unactived."
181181
msgstr ""
182182
"Tidak ada pengguna terdaftar sebagai `%(username)s` atau pengguna telah "
183183
"nonaktif."
184184

185-
#: views.py:84
185+
#: views.py:81
186186
msgid "Validation Failed for field `username`"
187187
msgstr "Validasi Gagal untuk field `username`"

martor/locale/tr/LC_MESSAGES/django.po

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2020-09-16 06:23+0700\n"
11+
"POT-Creation-Date: 2020-09-16 08:34+0700\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: Ozcan Yarimdunya <[email protected]>\n"
1414
"Language-Team: LANGUAGE <[email protected]>\n"
@@ -172,15 +172,15 @@ msgstr "Tam ekran"
172172
msgid "Markdown Guide (Help)"
173173
msgstr "Markdown Kılavuzu (Yardım)"
174174

175-
#: views.py:23 views.py:37 views.py:38
175+
#: views.py:22 views.py:36 views.py:37
176176
msgid "Invalid request!"
177177
msgstr "Geçersiz istek!"
178178

179-
#: views.py:80
179+
#: views.py:77
180180
#, python-format
181181
msgid "No users registered as `%(username)s` or user is unactived."
182182
msgstr "`%(username)s` kullanıcı kayıtlı değil veya aktif değil"
183183

184-
#: views.py:84
184+
#: views.py:81
185185
msgid "Validation Failed for field `username`"
186186
msgstr "`kullanıcı adı` alanı için doğrulama başarısız"

martor/static/martor/css/martor.bootstrap.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ body.overflow {
2727
width: 100%;
2828
height: 100%;
2929
padding-top: 5em;
30-
background: #00000012;
30+
background: rgba(0,0,0,.85);
31+
color: #fff;
3132
}
3233

3334
.martor-toolbar {

martor/static/martor/css/martor.bootstrap.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

martor/static/martor/js/martor.bootstrap.js

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -62,50 +62,54 @@
6262
getCompletions: function(editor, session, pos, prefix, callback) {
6363
var wordList = typeof(emojis) != "undefined" ? emojis : []; // from `atwho/emojis.min.js`
6464
var obj = editor.getSession().getTokenAt(pos.row, pos.column.count);
65-
var curTokens = obj.value.split(/\s+/);
66-
var lastToken = curTokens[curTokens.length-1];
67-
68-
if (lastToken[0] == ':') {
69-
callback(null, wordList.map(function(word) {
70-
return {
71-
caption: word,
72-
value: word.replace(':', '') + ' ',
73-
meta: 'emoji' // this should return as text only.
74-
};
75-
}));
65+
if(typeof(obj.value) != "undefined") {
66+
var curTokens = obj.value.split(/\s+/);
67+
var lastToken = curTokens[curTokens.length-1];
68+
69+
if (lastToken[0] == ':') {
70+
callback(null, wordList.map(function(word) {
71+
return {
72+
caption: word,
73+
value: word.replace(':', '') + ' ',
74+
meta: 'emoji' // this should return as text only.
75+
};
76+
}));
77+
}
7678
}
7779
}
7880
}
7981
var mentionWordCompleter = {
8082
getCompletions: function(editor, session, pos, prefix, callback) {
8183
var obj = editor.getSession().getTokenAt(pos.row, pos.column.count);
82-
var curTokens = obj.value.split(/\s+/);
83-
var lastToken = curTokens[curTokens.length-1];
84-
85-
if (lastToken[0] == '@' && lastToken[1] == '[') {
86-
username = lastToken.replace(/([\@\[/\]/])/g, '');
87-
$.ajax({
88-
url: textareaId.data('search-users-url'),
89-
data: {
90-
'username': username,
91-
'csrfmiddlewaretoken': getCookie('csrftoken')
92-
},
93-
success: function(data) {
94-
if (data['status'] == 200) {
95-
var wordList = [];
96-
for (var i = 0; i < data['data'].length; i++) {
97-
wordList.push(data['data'][i].username)
84+
if(typeof(obj.value) != "undefined") {
85+
var curTokens = obj.value.split(/\s+/);
86+
var lastToken = curTokens[curTokens.length-1];
87+
88+
if (lastToken[0] == '@' && lastToken[1] == '[') {
89+
username = lastToken.replace(/([\@\[/\]/])/g, '');
90+
$.ajax({
91+
url: textareaId.data('search-users-url'),
92+
data: {
93+
'username': username,
94+
'csrfmiddlewaretoken': getCookie('csrftoken')
95+
},
96+
success: function(data) {
97+
if (data['status'] == 200) {
98+
var wordList = [];
99+
for (var i = 0; i < data['data'].length; i++) {
100+
wordList.push(data['data'][i].username)
101+
}
102+
callback(null, wordList.map(function(word) {
103+
return {
104+
caption: word,
105+
value: word,
106+
meta: 'username' // this should return as text only.
107+
};
108+
}));
98109
}
99-
callback(null, wordList.map(function(word) {
100-
return {
101-
caption: word,
102-
value: word,
103-
meta: 'username' // this should return as text only.
104-
};
105-
}));
106-
}
107-
}// end success
108-
});
110+
}// end success
111+
});
112+
}
109113
}
110114
}
111115
}

martor/static/martor/js/martor.bootstrap.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

martor/static/martor/js/martor.semantic.js

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -62,50 +62,54 @@
6262
getCompletions: function(editor, session, pos, prefix, callback) {
6363
var wordList = typeof(emojis) != "undefined" ? emojis : []; // from `atwho/emojis.min.js`
6464
var obj = editor.getSession().getTokenAt(pos.row, pos.column.count);
65-
var curTokens = obj.value.split(/\s+/);
66-
var lastToken = curTokens[curTokens.length-1];
67-
68-
if (lastToken[0] == ':') {
69-
callback(null, wordList.map(function(word) {
70-
return {
71-
caption: word,
72-
value: word.replace(':', '') + ' ',
73-
meta: 'emoji' // this should return as text only.
74-
};
75-
}));
65+
if(typeof(obj.value) != "undefined") {
66+
var curTokens = obj.value.split(/\s+/);
67+
var lastToken = curTokens[curTokens.length-1];
68+
69+
if (lastToken[0] == ':') {
70+
callback(null, wordList.map(function(word) {
71+
return {
72+
caption: word,
73+
value: word.replace(':', '') + ' ',
74+
meta: 'emoji' // this should return as text only.
75+
};
76+
}));
77+
}
7678
}
7779
}
7880
}
7981
var mentionWordCompleter = {
8082
getCompletions: function(editor, session, pos, prefix, callback) {
8183
var obj = editor.getSession().getTokenAt(pos.row, pos.column.count);
82-
var curTokens = obj.value.split(/\s+/);
83-
var lastToken = curTokens[curTokens.length-1];
84-
85-
if (lastToken[0] == '@' && lastToken[1] == '[') {
86-
username = lastToken.replace(/([\@\[/\]/])/g, '');
87-
$.ajax({
88-
url: textareaId.data('search-users-url'),
89-
data: {
90-
'username': username,
91-
'csrfmiddlewaretoken': getCookie('csrftoken')
92-
},
93-
success: function(data) {
94-
if (data['status'] == 200) {
95-
var wordList = [];
96-
for (var i = 0; i < data['data'].length; i++) {
97-
wordList.push(data['data'][i].username)
84+
if(typeof(obj.value) != "undefined") {
85+
var curTokens = obj.value.split(/\s+/);
86+
var lastToken = curTokens[curTokens.length-1];
87+
88+
if (lastToken[0] == '@' && lastToken[1] == '[') {
89+
username = lastToken.replace(/([\@\[/\]/])/g, '');
90+
$.ajax({
91+
url: textareaId.data('search-users-url'),
92+
data: {
93+
'username': username,
94+
'csrfmiddlewaretoken': getCookie('csrftoken')
95+
},
96+
success: function(data) {
97+
if (data['status'] == 200) {
98+
var wordList = [];
99+
for (var i = 0; i < data['data'].length; i++) {
100+
wordList.push(data['data'][i].username)
101+
}
102+
callback(null, wordList.map(function(word) {
103+
return {
104+
caption: word,
105+
value: word,
106+
meta: 'username' // this should return as text only.
107+
};
108+
}));
98109
}
99-
callback(null, wordList.map(function(word) {
100-
return {
101-
caption: word,
102-
value: word,
103-
meta: 'username' // this should return as text only.
104-
};
105-
}));
106-
}
107-
}// end success
108-
});
110+
}// end success
111+
});
112+
}
109113
}
110114
}
111115
}

martor/static/martor/js/martor.semantic.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

martor/views.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from django.utils.translation import ugettext_lazy as _
77
from django.contrib.auth.decorators import login_required
88
from django.contrib.auth import get_user_model
9-
from django.db.models import Q
109

1110
from .api import imgur_uploader
1211
from .settings import MARTOR_MARKDOWNIFY_FUNCTION
@@ -66,11 +65,9 @@ def markdown_search_user(request):
6665
and username != '' \
6766
and ' ' not in username:
6867

69-
users = User.objects.filter(
70-
Q(username__iexact=username) |
71-
Q(username__icontains=username)
72-
).filter(is_active=True)
73-
68+
queries = {'%s__iexact' % User.USERNAME_FIELD: username,
69+
'%s__icontains' % User.USERNAME_FIELD: username}
70+
users = User.objects.filter(**queries).filter(is_active=True)
7471
if users.exists():
7572
response_data.update({'status': 200,
7673
'data': [{'username': u.username} for u in users]})

0 commit comments

Comments
 (0)