moved admin css to its own file for LESS compilation, and adding in

options to update social keys for login
v1.18.x
Julian Lam 12 years ago
parent eb15bd5ac0
commit 111b9dcf0a

@ -3,11 +3,19 @@
<form>
<div class="alert alert-notify">
<p>Create a <strong>Facebook Application</strong> and then paste your application details here.</p><br />
<input type="text" class="" placeholder="App Key"><br />
<input type="text" class="" placeholder="App Secret"><br />
<p>
Create a <strong>Facebook Application</strong> via the
<a href="https://developers.facebook.com/">Facebook Developers Page</a> and
then paste your application details here.
</p>
<br />
<input type="text" data-field="social:facebook:app_id" title="Application ID" class="input-medium" placeholder="App Key"><br />
<input type="text" data-field="social:facebook:secret" title="Application Secret" class="input-large" placeholder="App Secret"><br />
</div>
</form>
<button class="btn btn-large btn-primary" type="submit">Save</button>
<button class="btn btn-large" type="submit" disabled>Delete</button>
<button class="btn btn-large btn-primary" id="save">Save</button>
<script>
nodebb_admin.prepare();
</script>

@ -6,26 +6,135 @@
</div>
<script type="text/javascript">
(function() {
jQuery('document').ready(function() {
// On menu click, change "active" state
var menuEl = document.querySelector('.sidebar-nav'),
liEls = menuEl.querySelectorAll('li')
parentEl = null;
menuEl.addEventListener('click', function(e) {
parentEl = e.target.parentNode;
if (parentEl.nodeName === 'LI') {
for(var x=0,numLis=liEls.length;x<numLis;x++) {
if (liEls[x] !== parentEl) jQuery(liEls[x]).removeClass('active');
else jQuery(parentEl).addClass('active');
}
var nodebb_admin = {
config: undefined,
prepare: function() {
// Come back in 500ms if the config isn't ready yet
if (nodebb_admin.config === undefined) {
console.log('Config not ready...');
setTimeout(function() {
nodebb_admin.prepare();
}, 500);
return;
}
}, false);
});
}())
// Populate the fields on the page from the config
var fields = document.querySelectorAll('#content [data-field]'),
numFields = fields.length,
saveBtn = document.getElementById('save'),
x, key, inputType;
for(x=0;x<numFields;x++) {
key = fields[x].getAttribute('data-field');
inputType = fields[x].getAttribute('type');
if (nodebb_admin.config[key]) {
switch(inputType) {
case 'text':
case 'textarea':
case 'number':
fields[x].value = nodebb_admin.config[key];
break;
case 'checkbox':
fields[x].checked = nodebb_admin.config[key] ? true : false;
break;
}
} /*else {
// Save defaults, if they're not found in the config
var defaultFields = [
'use_port', 'port', 'upload_url', 'mailer:host',
'mailer:port', 'privileges:manage_content',
'privileges:manage_topic'
],
defaultVal;
if (defaultFields.indexOf(key) !== -1) {
console.log('saving default value: ', key);
switch(inputType) {
case 'text':
case 'textarea':
case 'number':
defaultVal = fields[x].value;
break;
case 'checkbox':
defaultVal = fields[x].checked ? '1' : '0';
break;
}
socket.emit('api:config.set', {
key: key,
value: defaultVal
});
nodebb_admin.config[key] = defaultVal;
}
}*/
}
saveBtn.addEventListener('click', function(e) {
var key, value;
e.preventDefault();
for(x=0;x<numFields;x++) {
key = fields[x].getAttribute('data-field');
inputType = fields[x].getAttribute('type');
switch(inputType) {
case 'text':
case 'textarea':
case 'number':
value = fields[x].value;
break;
case 'checkbox':
value = fields[x].checked ? '1' : '0';
break;
}
socket.emit('api:config.set', { key: key, value: value });
}
});
}
};
(function() {
jQuery('document').ready(function() {
// On menu click, change "active" state
var menuEl = document.querySelector('.sidebar-nav'),
liEls = menuEl.querySelectorAll('li')
parentEl = null;
menuEl.addEventListener('click', function(e) {
parentEl = e.target.parentNode;
if (parentEl.nodeName === 'LI') {
for(var x=0,numLis=liEls.length;x<numLis;x++) {
if (liEls[x] !== parentEl) jQuery(liEls[x]).removeClass('active');
else jQuery(parentEl).addClass('active');
}
}
}, false);
});
socket.once('api:config.get', function(config) {
nodebb_admin.config = config;
});
socket.emit('api:config.get');
socket.on('api:config.set', function(data) {
if (data.status === 'ok') {
app.alert({
alert_id: 'config_status',
timeout: 2500,
title: 'Changes Saved',
message: 'Your changes to the NodeBB configuration have been saved',
type: 'success'
});
} else {
app.alert({
alert_id: 'config_status',
timeout: 2500,
title: 'Changes Not Saved',
message: 'NodeBB encountered a problem saving your changes',
type: 'error'
});
}
});
}())
</script>
</body>

@ -1,13 +1,21 @@
<h1>Google Plus Social Authentication</h1>
<h1>Google Accounts Social Authentication</h1>
<hr />
<form>
<div class="alert alert-notify">
<p>Create a <strong>Google+ Application</strong> and then paste your application details here.</p><br />
<input type="text" class="" placeholder="App ID"><br />
<input type="text" class="" placeholder="App Secret"><br />
<p>
Create a <strong>Google Application</strong> via the
<a href="https://code.google.com/apis/console/">API Console</a> and then paste
your application details here.
</p>
<br />
<input type="text" data-field="social:google:id" title="Client ID" class="input-xxlarge" placeholder="Client ID"><br />
<input type="text" data-field="social:google:secret" title="Client Secret" class="input-large" placeholder="Client Secret"><br />
</div>
</form>
<button class="btn btn-large btn-primary" type="submit">Save</button>
<button class="btn btn-large" type="submit" disabled>Delete</button>
<button class="btn btn-large btn-primary" id="save">Save</button>
<script>
nodebb_admin.prepare();
</script>

@ -15,44 +15,7 @@
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" type="text/css" href="/css/style.css" />
<style type="text/css">
.entry-row {
border-radius: 10px;
margin-bottom: 10px;
padding: 10px;
cursor: move;
width: 555px;
}
.admin-categories form {
margin: 0 0 0px;
}
.admin-categories input {
height: 20px;
padding: 5px;
margin-left: 10px;
width: 150px;
border: 0;
border-radius: 5px;
margin-top: -8px;
}
.admin-categories select {
border: 0;
margin-left: 10px;
padding: 5px;
margin-top: -8px;
}
.admin-categories button {
margin-top: -7px;
}
.admin-categories .icon{
width: 30px;
height: 30px;
text-align: center;
line-height: 35px;
display: inline-block;
}
</style>
<link rel="stylesheet" type="text/css" href="/css/admin.css" />
</head>
<body>
@ -81,6 +44,8 @@
</div>
</div>
</div>
<div id="alert_window"></div>
<div class="container-fluid">
<div class="row-fluid">

@ -3,12 +3,19 @@
<form>
<div class="alert alert-notify">
<p>Create a <strong>Twitter Application</strong> and then paste your application details here.</p><br />
<input type="text" class="" placeholder="App Key"><br />
<input type="text" class="" placeholder="App Secret"><br />
<p>
Create a <strong>Twitter Application</strong> via the
<a href="https://dev.twitter.com/">Twitter Developers Page</a> and then
paste your application details here.
</p>
<br />
<input type="text" data-field="social:twitter:key" title="Consumer Key" class="input-large" placeholder="Consumer Key"><br />
<input type="text" data-field="social:twitter:secret" title="Consumer Secret" class="input-xlarge" placeholder="Consumer Secret">
</div>
</form>
<button class="btn btn-large btn-primary" id="save">Save</button>
<button class="btn btn-large btn-primary" type="submit">Save</button>
<button class="btn btn-large" type="submit" disabled>Delete</button>
<script>
nodebb_admin.prepare();
</script>

@ -293,14 +293,6 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }),
}
});
socket.on('api:config.redisTest', function() {
meta.testRedis(function(success) {
socket.emit('api:config.redisTest', {
status: success ? 'ok' : 'error'
});
});
});
socket.on('api:config.get', function(data) {
meta.config.get(function(config) {
socket.emit('api:config.get', config);
@ -308,6 +300,7 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }),
});
socket.on('api:config.set', function(data) {
console.log('saving', data);
meta.config.set(data.key, data.value, function(err) {
if (!err) socket.emit('api:config.set', { status: 'ok' });
});

Loading…
Cancel
Save