# HG changeset patch # User neko259 # Date 2016-12-30 09:29:36 # Node ID 8d73e7634e15abaa59a61368c113d000c11da8dd # Parent 7a6a61e1c2eb3a4c049dad9a20fc6d79d7803bb6 Fixed sticker autocompletions. Localized 'too many files' message and added max file count there diff --git a/boards/forms/__init__.py b/boards/forms/__init__.py --- a/boards/forms/__init__.py +++ b/boards/forms/__init__.py @@ -49,7 +49,8 @@ LABEL_FILE = _('File') ERROR_SPEED = 'Please wait %(delay)d second before sending message' ERROR_SPEED_PLURAL = 'Please wait %(delay)d seconds before sending message' -ERROR_MANY_FILES = _('Too many files.') +ERROR_MANY_FILES = 'You can post no more than %(files)d file.' +ERROR_MANY_FILES_PLURAL = 'You can post no more than %(files)d files.' TAG_MAX_LENGTH = 20 @@ -297,7 +298,9 @@ class PostForm(NeboardForm): max_file_count = board_settings.get_int(SECTION_FORMS, 'MaxFileCount') if len(inputs) > max_file_count: - raise forms.ValidationError(ERROR_MANY_FILES) + raise forms.ValidationError( + ungettext_lazy(ERROR_MANY_FILES, ERROR_MANY_FILES, + max_file_count) % {'files': max_file_count}) for file_input in inputs: if isinstance(file_input, UploadedFile): files.append(self._clean_file_file(file_input)) diff --git a/boards/locale/ru/LC_MESSAGES/django.mo b/boards/locale/ru/LC_MESSAGES/django.mo index e0fe14ec3e48c89828f560bdd0eff7057d397f94..e6305537725c5e7c035cf3877fa9b5b738af21d7 GIT binary patch literal 11001 zc$~#pdvH|Oc|T5F$H53mh}yh40t5)Niv)IRuaS)afw3ilC1L7EOE21sbYb`2&Aqz< z95>}rY$p)QNlBZ!^@GHdbSCl4vPMV<5S^wS|Iwzs+v%j8X(p3&T>sH_I%)q%ns)m5 zecyNPKBV2^Y18(?)$iVOzVn^$eZITjTX^S}6s|M4m*d`ar&8|%x81Gy`r$mKFr@ww z*a7?za4T^AJxXcdbHKI07lGS=mw=7H?*WO$KLDG6KL#!Y-aTKbp9L-hVo0?bi~&Cm zd>D8aup9UZ;N$aU-2f0`{5V`MJpcMYAB@0B)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+ // Stickers autocomplete + function split( val ) { + return val.split(URL_DELIMITER); + } + + function extractLast( term ) { + return split(term).pop(); + } + + $('#id_file_1').autocomplete({ source: function( request, response ) { $.getJSON(URL_STICKERS, { - term: request.term + term: extractLast( request.term ) }, response); }, search: function() { // custom minLength - var term = this.value; + var term = extractLast( this.value ); if (term.length < MIN_INPUT_LENGTH) { return false; } @@ -161,7 +171,14 @@ function selectFileChoice() { return false; }, select: function( event, ui ) { - this.value = ui.item.alias; + var terms = split( this.value ); + // remove the current input + terms.pop(); + // add the selected item + terms.push( ui.item.alias ); + // add placeholder to get the comma-and-space at the end + terms.push(""); + this.value = terms.join(URL_DELIMITER); return false; } })