v1.18.x
barisusakli 9 years ago
parent 268aa12cc2
commit df9558f1fa

@ -111,5 +111,8 @@
"map": "Map",
"sessions": "Login Sessions",
"ip_address": "IP Address",
"enter_page_number": "Enter page number"
"enter_page_number": "Enter page number",
"upload_file": "Upload file",
"upload": "Upload",
"allowed-file-types": "Allowed file types are %1"
}

@ -57,5 +57,6 @@
"membership.leave-group": "Leave Group",
"membership.reject": "Reject",
"new-group.group_name": "Group Name:"
"new-group.group_name": "Group Name:",
"upload-group-cover": "Upload group cover"
}

@ -63,7 +63,7 @@
"upload_picture": "Upload picture",
"upload_a_picture": "Upload a picture",
"remove_uploaded_picture" : "Remove Uploaded Picture",
"image_spec": "You may only upload PNG, JPG, or BMP files",
"upload_cover_picture": "Upload cover picture",
"settings": "Settings",
"show_email": "Show My Email",

@ -1,5 +1,5 @@
"use strict";
/*global define, app, socket, ajaxify, RELATIVE_PATH, bootbox, templates, Chart */
/*global config, define, app, socket, ajaxify, bootbox, templates, Chart, utils */
define('admin/manage/category', [
'uploader',
@ -75,7 +75,7 @@ define('admin/manage/category', [
}
});
$('[data-name="imageClass"]').on('change', function(ev) {
$('[data-name="imageClass"]').on('change', function() {
$('.category-preview').css('background-size', $(this).val());
});
@ -103,7 +103,11 @@ define('admin/manage/category', [
var inputEl = $(this),
cid = inputEl.attr('data-cid');
uploader.open(RELATIVE_PATH + '/api/admin/category/uploadpicture', { cid: cid }, 0, function(imageUrlOnServer) {
uploader.show({
title: 'Upload category image',
route: config.relative_path + '/api/admin/category/uploadpicture',
params: {cid: cid}
}, function(imageUrlOnServer) {
inputEl.val(imageUrlOnServer);
var previewBox = inputEl.parent().parent().siblings('.category-preview');
previewBox.css('background', 'url(' + imageUrlOnServer + '?' + new Date().getTime() + ')');
@ -123,7 +127,7 @@ define('admin/manage/category', [
$(this).parent().addClass('hide').hide();
});
$('.category-preview').on('click', function(ev) {
$('.category-preview').on('click', function() {
iconSelect.init($(this).find('i'), modified);
});
@ -145,7 +149,7 @@ define('admin/manage/category', [
});
Category.setupPrivilegeTable();
if (window.location.hash === '#analytics') {
Category.setupGraphs();
} else {

@ -111,10 +111,12 @@ define('admin/settings', ['uploader', 'sounds'], function(uploader, sounds) {
var uploadBtn = $(this);
uploadBtn.on('click', function() {
uploader.show({
title: uploadBtn.attr('data-title'),
description: uploadBtn.attr('data-description'),
route: uploadBtn.attr('data-route'),
params: {},
fileSize: 0,
showHelp: uploadBtn.attr('data-help') ? uploadBtn.attr('data-help') === 1 : undefined
showHelp: uploadBtn.attr('data-help') ? uploadBtn.attr('data-help') === 1 : undefined,
accept: uploadBtn.attr('data-accept')
}, function(image) {
// need to move these into template, ex data-callback
if (ajaxify.currentPage === 'admin/general/sounds') {

@ -4,8 +4,7 @@
define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'], function(header, uploader, translator) {
var AccountEdit = {},
uploadedPicture = '',
selectedImageType = '';
uploadedPicture = '';
AccountEdit.init = function() {
uploadedPicture = ajaxify.data.uploadedpicture;
@ -81,9 +80,9 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
// boolean to signify whether an uploaded picture is present in the pictures list
var uploaded = pictures.reduce(function(memo, cur) {
return memo || cur.type === 'uploaded'
return memo || cur.type === 'uploaded';
}, false);
templates.parse('partials/modals/change_picture_modal', {
pictures: pictures,
uploaded: uploaded,
@ -109,12 +108,15 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
});
modal.on('shown.bs.modal', updateImages);
modal.on('click', '.list-group-item', selectImageType);
modal.on('click', '.list-group-item', function selectImageType() {
modal.find('.list-group-item').removeClass('active');
$(this).addClass('active');
});
handleImageUpload(modal);
function updateImages() {
var currentPicture = $('#user-current-picture').attr('src'),
userIcon = modal.find('.user-icon');
var userIcon = modal.find('.user-icon');
userIcon
.css('background-color', ajaxify.data['icon:bgColor'])
@ -128,15 +130,10 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
if (this.getAttribute('src') === ajaxify.data.picture) {
$(this).parents('.list-group-item').addClass('active');
}
})
});
}
}
function selectImageType() {
modal.find('.list-group-item').removeClass('active');
$(this).addClass('active');
}
function saveSelection() {
var type = modal.find('.list-group-item.active').attr('data-type'),
src = modal.find('.list-group-item.active img').attr('src');
@ -213,7 +210,15 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
modal.find('[data-action="upload"]').on('click', function() {
modal.modal('hide');
uploader.open(config.relative_path + '/api/user/' + ajaxify.data.userslug + '/uploadpicture', {}, ajaxify.data.maximumProfileImageSize, function(imageUrlOnServer) {
uploader.show({
route: config.relative_path + '/api/user/' + ajaxify.data.userslug + '/uploadpicture',
params: {},
fileSize: ajaxify.data.maximumProfileImageSize,
title: '[[user:upload_picture]]',
description: '[[user:upload_a_picture]]',
accept: '.png,.jpg,.bmp'
}, function(imageUrlOnServer) {
onUploadComplete(imageUrlOnServer);
});

@ -74,7 +74,12 @@ define('forum/account/header', [
}, callback);
},
function() {
uploader.open(config.relative_path + '/api/user/' + ajaxify.data.userslug + '/uploadcover', { uid: yourid }, 0, function(imageUrlOnServer) {
uploader.show({
title: '[[user:upload_cover_picture]]',
route: config.relative_path + '/api/user/' + ajaxify.data.userslug + '/uploadcover',
params: {uid: yourid },
accept: '.png,.jpg,.bmp'
}, function(imageUrlOnServer) {
components.get('account/cover').css('background-image', 'url(' + imageUrlOnServer + '?v=' + Date.now() + ')');
});
},

@ -30,7 +30,11 @@ define('forum/groups/details', [
}, callback);
},
function() {
uploader.open(RELATIVE_PATH + '/api/groups/uploadpicture', { groupName: groupName }, 0, function(imageUrlOnServer) {
uploader.show({
title: '[[groups:upload-group-cover]]',
route: config.relative_path + '/api/groups/uploadpicture',
params: {groupname: groupName}
}, function(imageUrlOnServer) {
components.get('groups/cover').css('background-image', 'url(' + imageUrlOnServer + ')');
});
},

@ -18,7 +18,11 @@ define('uploader', ['csrf', 'translator'], function(csrf, translator) {
module.show = function(data, callback) {
parseModal({
showHelp: data.hasOwnProperty('showHelp') && data.showHelp !== undefined ? data.showHelp : true,
fileSize: data.hasOwnProperty('fileSize') && data.fileSize !== undefined ? parseInt(data.fileSize, 10) : false
fileSize: data.hasOwnProperty('fileSize') && data.fileSize !== undefined ? parseInt(data.fileSize, 10) : false,
title: data.title || '[[global:upload_file]]',
description: data.description || '',
button: data.button || '[[global:upload]]',
accept: data.accept ? data.accept.replace(/,/g, ',') : ''
}, function(uploadModal) {
uploadModal = $(uploadModal);
@ -31,7 +35,7 @@ define('uploader', ['csrf', 'translator'], function(csrf, translator) {
uploadForm.attr('action', data.route);
uploadForm.find('#params').val(JSON.stringify(data.params));
uploadModal.find('#pictureUploadSubmitBtn').off('click').on('click', function() {
uploadModal.find('#fileUploadSubmitBtn').off('click').on('click', function() {
uploadForm.submit();
});
@ -47,7 +51,7 @@ define('uploader', ['csrf', 'translator'], function(csrf, translator) {
uploadModal.find('#upload-progress-bar').css('width', '0%');
uploadModal.find('#upload-progress-box').show().removeClass('hide');
if (!uploadModal.find('#userPhotoInput').val()) {
if (!uploadModal.find('#fileInput').val()) {
showAlert('error', '[[uploads:select-file-to-upload]]');
return false;
}

@ -2,40 +2,6 @@
</div>
</div>
<div id="upload-picture-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="Upload Picture" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Upload Picture</h3>
</div>
<div class="modal-body">
<form id="uploadForm" action="" method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="userPhoto">Upload a picture</label>
<input type="file" id="userPhotoInput" name="files[]">
<p class="help-block"></p>
</div>
<input type="hidden" id="params" name="params">
</form>
<div id="upload-progress-box" class="progress progress-striped">
<div id="upload-progress-bar" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0">
<span class="sr-only"> success</span>
</div>
</div>
<div id="alert-status" class="alert alert-info hide"></div>
<div id="alert-success" class="alert alert-success hide"></div>
<div id="alert-error" class="alert alert-danger hide"></div>
</div>
<div class="modal-footer">
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
<button id="pictureUploadSubmitBtn" class="btn btn-primary">Upload Picture</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div class="alert-window alert-left-top"></div>
<div class="alert-window alert-left-bottom"></div>

@ -63,7 +63,7 @@
<div class="panel-body">
<div class="input-group">
<span class="input-group-btn">
<input data-action="upload" data-target="logoUrl" data-route="{config.relative_path}/api/admin/upload/sound" type="button" class="btn btn-primary btn-block" value="Upload New Sound"></input>
<input data-action="upload" data-title="Upload Sound" data-route="{config.relative_path}/api/admin/upload/sound" type="button" class="btn btn-primary btn-block" value="Upload New Sound"></input>
</span>
</div>
</div>

Loading…
Cancel
Save