completed custom favicon upload, closes #643

v1.18.x
psychobunny 11 years ago
parent 1b843fba9c
commit a3734f2e15

@ -83,8 +83,8 @@ define(['uploader'], function(uploader) {
});
$('#uploadFaviconBtn').on('click', function() {
uploader.open(RELATIVE_PATH + '/admin/uploadfavicon', function() {
$('#favicon').attr('src', './../favicon.ico?v=' + new Date().getTime());
uploader.open(RELATIVE_PATH + '/admin/uploadfavicon', function(icon) {
$('#faviconUrl').val(icon);
});
uploader.hideAlerts();

@ -18,7 +18,7 @@
<label>Maximum User Image Size</label>
<input type="text" class="form-control" placeholder="Maximum size of uploaded user images in kilobytes" data-field="maximumProfileImageSize" /><br />
<label>Favicon</label><br />
<img id="favicon" src="./../favicon.ico" />&nbsp;
<input id="faviconUrl" type="text" class="form-control" placeholder="favicon.ico" data-field="brand:favicon" /><br />
<input id="uploadFaviconBtn" type="button" class="btn btn-default" value="Upload Favicon"></input> <br />
</form>
</div>

@ -25,8 +25,8 @@
}
});
</script>
<link rel="stylesheet" type="text/css" href="{relative_path}/css/theme.css" />
<link rel="icon" type="image/x-icon" href="{brand:favicon}" />
</head>
<body>

@ -169,7 +169,7 @@ var nconf = require('nconf'),
}
var filename = 'favicon.ico';
var uploadPath = path.join(nconf.get('base_dir'), 'public', filename);
var uploadPath = path.join(nconf.get('base_dir'), nconf.get('upload_path'), filename);
winston.info('Attempting upload to: ' + uploadPath);

@ -90,6 +90,7 @@ var path = require('path'),
description: meta.config.description || '',
'brand:logo': meta.config['brand:logo'] || '',
'brand:logo:display': meta.config['brand:logo']?'':'hide',
'brand:favicon': meta.config['brand:favicon'] || nconf.get('relative_path') + 'favicon.ico',
browserTitle: meta.config.title || 'NodeBB',
csrf: options.res.locals.csrf_token,
relative_path: nconf.get('relative_path'),

Loading…
Cancel
Save