renamed settings to options for consistency

This commit is contained in:
azivner
2018-04-01 17:41:28 -04:00
parent 96dab5d51e
commit 311952d4dd
12 changed files with 50 additions and 50 deletions
@@ -5,8 +5,8 @@ import utils from '../services/utils.js';
import server from '../services/server.js';
import infoService from "../services/info.js";
const $dialog = $("#settings-dialog");
const $tabs = $("#settings-tabs");
const $dialog = $("#options-dialog");
const $tabs = $("#options-tabs");
const tabHandlers = [];
@@ -17,7 +17,7 @@ function addTabHandler(handler) {
async function showDialog() {
glob.activeDialog = $dialog;
const settings = await server.get('settings');
const options = await server.get('options');
$dialog.dialog({
modal: true,
@@ -27,24 +27,24 @@ async function showDialog() {
$tabs.tabs();
for (const handler of tabHandlers) {
if (handler.settingsLoaded) {
handler.settingsLoaded(settings);
if (handler.optionsLoaded) {
handler.optionsLoaded(options);
}
}
}
async function saveSettings(settingName, settingValue) {
await server.post('settings', {
name: settingName,
value: settingValue
async function saveOptions(optionName, optionValue) {
await server.post('options', {
name: optionName,
value: optionValue
});
infoService.showMessage("Settings change have been saved.");
infoService.showMessage("Options change have been saved.");
}
export default {
showDialog,
saveSettings
saveOptions
};
addTabHandler((function() {
@@ -53,7 +53,7 @@ addTabHandler((function() {
const $newPassword1 = $("#new-password1");
const $newPassword2 = $("#new-password2");
function settingsLoaded(settings) {
function optionsLoaded(options) {
}
$form.submit(() => {
@@ -89,23 +89,23 @@ addTabHandler((function() {
});
return {
settingsLoaded
optionsLoaded
};
})());
addTabHandler((function() {
const $form = $("#protected-session-timeout-form");
const $protectedSessionTimeout = $("#protected-session-timeout-in-seconds");
const settingName = 'protected_session_timeout';
const optionName = 'protected_session_timeout';
function settingsLoaded(settings) {
$protectedSessionTimeout.val(settings[settingName]);
function optionsLoaded(options) {
$protectedSessionTimeout.val(options[optionName]);
}
$form.submit(() => {
const protectedSessionTimeout = $protectedSessionTimeout.val();
saveSettings(settingName, protectedSessionTimeout).then(() => {
saveOptions(optionName, protectedSessionTimeout).then(() => {
protectedSessionHolder.setProtectedSessionTimeout(protectedSessionTimeout);
});
@@ -113,27 +113,27 @@ addTabHandler((function() {
});
return {
settingsLoaded
optionsLoaded
};
})());
addTabHandler((function () {
const $form = $("#note-revision-snapshot-time-interval-form");
const $timeInterval = $("#note-revision-snapshot-time-interval-in-seconds");
const settingName = 'note_revision_snapshot_time_interval';
const optionName = 'note_revision_snapshot_time_interval';
function settingsLoaded(settings) {
$timeInterval.val(settings[settingName]);
function optionsLoaded(options) {
$timeInterval.val(options[optionName]);
}
$form.submit(() => {
saveSettings(settingName, $timeInterval.val());
saveOptions(optionName, $timeInterval.val());
return false;
});
return {
settingsLoaded
optionsLoaded
};
})());
+1 -1
View File
@@ -5,7 +5,7 @@ import noteRevisionsDialog from '../dialogs/note_revisions.js';
import noteSourceDialog from '../dialogs/note_source.js';
import recentChangesDialog from '../dialogs/recent_changes.js';
import recentNotesDialog from '../dialogs/recent_notes.js';
import settingsDialog from '../dialogs/settings.js';
import optionsDialog from '../dialogs/options.js';
import sqlConsoleDialog from '../dialogs/sql_console.js';
import cloning from './cloning.js';
@@ -76,7 +76,7 @@ function cut(nodes) {
infoService.showMessage("Note(s) have been cut into clipboard.");
}
const contextMenuSettings = {
const contextMenuOptions = {
delegate: "span.fancytree-title",
autoFocus: true,
menu: [
@@ -185,5 +185,5 @@ export default {
pasteInto,
cut,
copy,
contextMenuSettings
contextMenuOptions
};
@@ -3,7 +3,7 @@ import treeService from "./tree.js";
import linkService from "./link.js";
import fileService from "./file.js";
import noteRevisionsDialog from "../dialogs/note_revisions.js";
import settingsDialog from "../dialogs/settings.js";
import optionsDialog from "../dialogs/options.js";
import addLinkDialog from "../dialogs/add_link.js";
import recentNotesDialog from "../dialogs/recent_notes.js";
import jumpToNoteDialog from "../dialogs/jump_to_note.js";
@@ -40,7 +40,7 @@ function registerEntrypoints() {
$(".show-labels-button").click(labelsDialog.showDialog);
utils.bindShortcut('alt+l', labelsDialog.showDialog);
$("#settings-button").click(settingsDialog.showDialog);
$("#options-button").click(optionsDialog.showDialog);
utils.bindShortcut('alt+o', sqlConsoleDialog.showDialog);
+2 -2
View File
@@ -8,7 +8,7 @@ function showMessage(message) {
// options
message: message
}, {
// settings
// options
type: 'success',
delay: 3000
});
@@ -21,7 +21,7 @@ function showError(message, delay = 10000) {
// options
message: message
}, {
// settings
// options
type: 'danger',
delay: delay
});
+1 -1
View File
@@ -82,7 +82,7 @@ setTimeout(() => {
// options
message: "Lost connection to server"
},{
// settings
// options
type: 'danger',
delay: 100000000 // keep it until we explicitly close it
});
@@ -6,7 +6,7 @@ let protectedSessionTimeout = null;
let protectedSessionId = null;
$(document).ready(() => {
server.get('settings/all').then(settings => protectedSessionTimeout = settings.protected_session_timeout);
server.get('options/all').then(options => protectedSessionTimeout = options.protected_session_timeout);
});
setInterval(() => {
+1 -1
View File
@@ -349,7 +349,7 @@ function initFancyTree(branch) {
}
});
$tree.contextmenu(contextMenuService.contextMenuSettings);
$tree.contextmenu(contextMenuService.contextMenuOptions);
}
function getTree() {