v1.18.x
Baris Soner Usakli 11 years ago
parent 39ec9e9ecb
commit 4ff62f4e30

@ -30,7 +30,8 @@
"upload_picture": "Upload picture", "upload_picture": "Upload picture",
"upload_a_picture": "Upload a 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", "settings": "Settings",
"show_email": "Show My Email", "show_email": "Show My Email",

@ -113,7 +113,7 @@ define(['forum/accountheader', 'uploader'], function(header, uploader) {
$('#uploadPictureBtn').on('click', function() { $('#uploadPictureBtn').on('click', function() {
$('#change-picture-modal').modal('hide'); $('#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(); imageUrlOnServer = imageUrlOnServer + '?' + new Date().getTime();
$('#user-current-picture').attr('src', imageUrlOnServer); $('#user-current-picture').attr('src', imageUrlOnServer);

@ -187,7 +187,7 @@ define(['uploader'], function(uploader) {
$('.admin-categories').on('click', '.upload-button', function() { $('.admin-categories').on('click', '.upload-button', function() {
var inputEl = this; var inputEl = this;
var cid = $(this).parents('li[data-cid]').attr('data-cid'); 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; inputEl.value = imageUrlOnServer;
var previewBox = $(inputEl).parents('li[data-cid]').find('.preview-box'); var previewBox = $(inputEl).parents('li[data-cid]').find('.preview-box');
previewBox.css('background', 'url(' + imageUrlOnServer + '?' + new Date().getTime() + ')') previewBox.css('background', 'url(' + imageUrlOnServer + '?' + new Date().getTime() + ')')

@ -97,7 +97,7 @@ define(['uploader'], function(uploader) {
}); });
$('#uploadLogoBtn').on('click', function() { $('#uploadLogoBtn').on('click', function() {
uploader.open(RELATIVE_PATH + '/admin/uploadlogo', {}, function(image) { uploader.open(RELATIVE_PATH + '/admin/uploadlogo', {}, 0, function(image) {
$('#logoUrl').val(image); $('#logoUrl').val(image);
}); });
@ -105,7 +105,7 @@ define(['uploader'], function(uploader) {
}); });
$('#uploadFaviconBtn').on('click', function() { $('#uploadFaviconBtn').on('click', function() {
uploader.open(RELATIVE_PATH + '/admin/uploadfavicon', {}, function(icon) { uploader.open(RELATIVE_PATH + '/admin/uploadfavicon', {}, 0, function(icon) {
$('#faviconUrl').val(icon); $('#faviconUrl').val(icon);
}); });

@ -2,13 +2,20 @@ define(function() {
var module = {}; var module = {};
module.open = function(route, params, callback) { module.open = function(route, params, fileSize, callback) {
$('#upload-picture-modal').modal('show').removeClass('hide'); $('#upload-picture-modal').modal('show').removeClass('hide');
module.hideAlerts(); module.hideAlerts();
var uploadForm = $('#uploadForm');
$('#uploadForm')[0].reset(); uploadForm[0].reset();
$('#uploadForm').attr('action', route); uploadForm.attr('action', route);
$('#uploadForm').find('#params').val(JSON.stringify(params)); 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() { $('#pictureUploadSubmitBtn').off('click').on('click', function() {
$('#uploadForm').submit(); $('#uploadForm').submit();

@ -14,7 +14,7 @@
<div class="form-group"> <div class="form-group">
<label for="userPhoto">Upload a picture</label> <label for="userPhoto">Upload a picture</label>
<input type="file" id="userPhotoInput" name="userPhoto"> <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> </div>
<input id="imageUploadCsrf" type="hidden" name="_csrf" value="" /> <input id="imageUploadCsrf" type="hidden" name="_csrf" value="" />
<input type="hidden" id="params" name="params"> <input type="hidden" id="params" name="params">

@ -14,7 +14,7 @@
<div class="form-group"> <div class="form-group">
<label for="userPhoto">[[user:upload_a_picture]]</label> <label for="userPhoto">[[user:upload_a_picture]]</label>
<input type="file" id="userPhotoInput" name="userPhoto"> <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> </div>
<input id="imageUploadCsrf" type="hidden" name="_csrf" value="" /> <input id="imageUploadCsrf" type="hidden" name="_csrf" value="" />
<input type="hidden" id="params" name="params"> <input type="hidden" id="params" name="params">

@ -38,6 +38,7 @@ var path = require('path'),
config.maximumTitleLength = meta.config.maximumTitleLength; config.maximumTitleLength = meta.config.maximumTitleLength;
config.minimumPostLength = meta.config.minimumPostLength; config.minimumPostLength = meta.config.minimumPostLength;
config.hasImageUploadPlugin = Plugins.hasListeners('filter:uploadImage'); config.hasImageUploadPlugin = Plugins.hasListeners('filter:uploadImage');
config.maximumProfileImageSize = meta.config.maximumProfileImageSize;
config.minimumUsernameLength = meta.config.minimumUsernameLength; config.minimumUsernameLength = meta.config.minimumUsernameLength;
config.maximumUsernameLength = meta.config.maximumUsernameLength; config.maximumUsernameLength = meta.config.maximumUsernameLength;
config.minimumPasswordLength = meta.config.minimumPasswordLength; config.minimumPasswordLength = meta.config.minimumPasswordLength;

Loading…
Cancel
Save