mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 12:05:57 +01:00
completed custom favicon upload, closes #643
This commit is contained in:
@@ -83,8 +83,8 @@ define(['uploader'], function(uploader) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#uploadFaviconBtn').on('click', function() {
|
$('#uploadFaviconBtn').on('click', function() {
|
||||||
uploader.open(RELATIVE_PATH + '/admin/uploadfavicon', function() {
|
uploader.open(RELATIVE_PATH + '/admin/uploadfavicon', function(icon) {
|
||||||
$('#favicon').attr('src', './../favicon.ico?v=' + new Date().getTime());
|
$('#faviconUrl').val(icon);
|
||||||
});
|
});
|
||||||
|
|
||||||
uploader.hideAlerts();
|
uploader.hideAlerts();
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<label>Maximum User Image Size</label>
|
<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 />
|
<input type="text" class="form-control" placeholder="Maximum size of uploaded user images in kilobytes" data-field="maximumProfileImageSize" /><br />
|
||||||
<label>Favicon</label><br />
|
<label>Favicon</label><br />
|
||||||
<img id="favicon" src="./../favicon.ico" />
|
<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 />
|
<input id="uploadFaviconBtn" type="button" class="btn btn-default" value="Upload Favicon"></input> <br />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -25,8 +25,8 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="{relative_path}/css/theme.css" />
|
<link rel="stylesheet" type="text/css" href="{relative_path}/css/theme.css" />
|
||||||
|
<link rel="icon" type="image/x-icon" href="{brand:favicon}" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ var nconf = require('nconf'),
|
|||||||
}
|
}
|
||||||
|
|
||||||
var filename = 'favicon.ico';
|
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);
|
winston.info('Attempting upload to: ' + uploadPath);
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ var path = require('path'),
|
|||||||
description: meta.config.description || '',
|
description: meta.config.description || '',
|
||||||
'brand:logo': meta.config['brand:logo'] || '',
|
'brand:logo': meta.config['brand:logo'] || '',
|
||||||
'brand:logo:display': meta.config['brand:logo']?'':'hide',
|
'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',
|
browserTitle: meta.config.title || 'NodeBB',
|
||||||
csrf: options.res.locals.csrf_token,
|
csrf: options.res.locals.csrf_token,
|
||||||
relative_path: nconf.get('relative_path'),
|
relative_path: nconf.get('relative_path'),
|
||||||
|
|||||||
Reference in New Issue
Block a user