mirror of
https://github.com/gogs/gogs.git
synced 2025-12-20 07:09:58 +01:00
repo: update repository description field to contain more than 256 symbols (#5219)
* Update repository description field to contain more than 256 symbols - update repository model - description field now is `TEXT` and limited by 4000 symbols - new migration - add description to html forms - repo creation and repo settings - add translation for description * Update for description field, new features - add autosize (height) for description textarea, new plugin - set max description length to 512 symbols - update locales * Fix migration - typo in var * Update repo description behaviour - add textarea autosize for /repo/create - add symbols counter under description testarea (create/edit) * Fix function definition - it a var * Revert ru-RU locale * Update by review - Use type `varchar(512)` in migration - Remove unused files from autosize plugin * Fix migration - new project paths * Fixes after review 2 - copyright year - format includes - use switch instead of multi-if * Remove unused `default:` option.
This commit is contained in:
@@ -1443,3 +1443,24 @@ $(function () {
|
||||
if ($('.user.signin').length > 0) return;
|
||||
$('form').areYouSure();
|
||||
});
|
||||
|
||||
function showMessageMaxLength(maxLen, textElemId, counterId) {
|
||||
var $msg = $('#'+textElemId); //text message
|
||||
$('#'+counterId).html(maxLen - $msg.val().length); //symbols count
|
||||
|
||||
var onMessageKey = function (e) {
|
||||
var $msg = $(this);
|
||||
var text = $msg.val();
|
||||
var len = text.length;
|
||||
var remainder = maxLen - len;
|
||||
|
||||
if (len >= maxLen) {
|
||||
$msg.val($msg.val().substr(0, maxLen));
|
||||
remainder = 0;
|
||||
}
|
||||
|
||||
$('#'+counterId).html(remainder);
|
||||
};
|
||||
|
||||
$msg.keyup(onMessageKey).keydown(onMessageKey);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user