mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 04:25:55 +01:00
closes #1005
This commit is contained in:
@@ -30,7 +30,8 @@
|
||||
|
||||
"upload_picture": "Upload picture",
|
||||
"upload_a_picture": "Upload a picture",
|
||||
"image_spec": "You may only upload PNG, JPG, or GIF files under 256kb.",
|
||||
"image_spec": "You may only upload PNG, JPG, or GIF files",
|
||||
"max": "max.",
|
||||
|
||||
"settings": "Settings",
|
||||
"show_email": "Show My Email",
|
||||
|
||||
@@ -113,7 +113,7 @@ define(['forum/accountheader', 'uploader'], function(header, uploader) {
|
||||
$('#uploadPictureBtn').on('click', function() {
|
||||
|
||||
$('#change-picture-modal').modal('hide');
|
||||
uploader.open(RELATIVE_PATH + '/user/uploadpicture', {}, function(imageUrlOnServer) {
|
||||
uploader.open(RELATIVE_PATH + '/user/uploadpicture', {}, config.maximumProfileImageSize, function(imageUrlOnServer) {
|
||||
imageUrlOnServer = imageUrlOnServer + '?' + new Date().getTime();
|
||||
|
||||
$('#user-current-picture').attr('src', imageUrlOnServer);
|
||||
|
||||
@@ -187,7 +187,7 @@ define(['uploader'], function(uploader) {
|
||||
$('.admin-categories').on('click', '.upload-button', function() {
|
||||
var inputEl = this;
|
||||
var cid = $(this).parents('li[data-cid]').attr('data-cid');
|
||||
uploader.open(RELATIVE_PATH + '/admin/category/uploadpicture', {cid:cid}, function(imageUrlOnServer) {
|
||||
uploader.open(RELATIVE_PATH + '/admin/category/uploadpicture', {cid:cid}, 0, function(imageUrlOnServer) {
|
||||
inputEl.value = imageUrlOnServer;
|
||||
var previewBox = $(inputEl).parents('li[data-cid]').find('.preview-box');
|
||||
previewBox.css('background', 'url(' + imageUrlOnServer + '?' + new Date().getTime() + ')')
|
||||
|
||||
@@ -97,7 +97,7 @@ define(['uploader'], function(uploader) {
|
||||
});
|
||||
|
||||
$('#uploadLogoBtn').on('click', function() {
|
||||
uploader.open(RELATIVE_PATH + '/admin/uploadlogo', {}, function(image) {
|
||||
uploader.open(RELATIVE_PATH + '/admin/uploadlogo', {}, 0, function(image) {
|
||||
$('#logoUrl').val(image);
|
||||
});
|
||||
|
||||
@@ -105,7 +105,7 @@ define(['uploader'], function(uploader) {
|
||||
});
|
||||
|
||||
$('#uploadFaviconBtn').on('click', function() {
|
||||
uploader.open(RELATIVE_PATH + '/admin/uploadfavicon', {}, function(icon) {
|
||||
uploader.open(RELATIVE_PATH + '/admin/uploadfavicon', {}, 0, function(icon) {
|
||||
$('#faviconUrl').val(icon);
|
||||
});
|
||||
|
||||
|
||||
@@ -2,13 +2,20 @@ define(function() {
|
||||
|
||||
var module = {};
|
||||
|
||||
module.open = function(route, params, callback) {
|
||||
module.open = function(route, params, fileSize, callback) {
|
||||
$('#upload-picture-modal').modal('show').removeClass('hide');
|
||||
module.hideAlerts();
|
||||
var uploadForm = $('#uploadForm');
|
||||
uploadForm[0].reset();
|
||||
uploadForm.attr('action', route);
|
||||
uploadForm.find('#params').val(JSON.stringify(params));
|
||||
|
||||
$('#uploadForm')[0].reset();
|
||||
$('#uploadForm').attr('action', route);
|
||||
$('#uploadForm').find('#params').val(JSON.stringify(params));
|
||||
if(fileSize) {
|
||||
uploadForm.find('#upload-file-size').html(fileSize);
|
||||
uploadForm.find('#file-size-block').removeClass('hide');
|
||||
} else {
|
||||
uploadForm.find('#file-size-block').addClass('hide');
|
||||
}
|
||||
|
||||
$('#pictureUploadSubmitBtn').off('click').on('click', function() {
|
||||
$('#uploadForm').submit();
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<div class="form-group">
|
||||
<label for="userPhoto">Upload a picture</label>
|
||||
<input type="file" id="userPhotoInput" name="userPhoto">
|
||||
<p class="help-block">You may only upload PNG, JPG, or GIF files under 256kb.</p>
|
||||
<p class="help-block"></p>
|
||||
</div>
|
||||
<input id="imageUploadCsrf" type="hidden" name="_csrf" value="" />
|
||||
<input type="hidden" id="params" name="params">
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<div class="form-group">
|
||||
<label for="userPhoto">[[user:upload_a_picture]]</label>
|
||||
<input type="file" id="userPhotoInput" name="userPhoto">
|
||||
<p class="help-block">[[user:image_spec]]</p>
|
||||
<p class="help-block">[[user:image_spec]] <span id="file-size-block" class="hide"> ([[user:max]] <span id="upload-file-size"></span> kbs.)</span></p>
|
||||
</div>
|
||||
<input id="imageUploadCsrf" type="hidden" name="_csrf" value="" />
|
||||
<input type="hidden" id="params" name="params">
|
||||
|
||||
@@ -38,6 +38,7 @@ var path = require('path'),
|
||||
config.maximumTitleLength = meta.config.maximumTitleLength;
|
||||
config.minimumPostLength = meta.config.minimumPostLength;
|
||||
config.hasImageUploadPlugin = Plugins.hasListeners('filter:uploadImage');
|
||||
config.maximumProfileImageSize = meta.config.maximumProfileImageSize;
|
||||
config.minimumUsernameLength = meta.config.minimumUsernameLength;
|
||||
config.maximumUsernameLength = meta.config.maximumUsernameLength;
|
||||
config.minimumPasswordLength = meta.config.minimumPasswordLength;
|
||||
|
||||
Reference in New Issue
Block a user