Moves the bulky JSON objects for shortcuts to show in the shortcut overviews into helper service so can be reused a bit easier
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
function templateHelperService() {
|
||||
function templateHelperService(localizationService) {
|
||||
|
||||
//crappy hack due to dictionary items not in umbracoNode table
|
||||
function getInsertDictionarySnippet(nodeName) {
|
||||
@@ -36,6 +36,94 @@
|
||||
return "@section " + sectionName + "\r\n{\r\n\r\n\t{0}\r\n\r\n}\r\n";
|
||||
}
|
||||
|
||||
function getGeneralShortcuts(){
|
||||
return {
|
||||
"name": localizationService.localize("shortcuts_generalHeader"),
|
||||
"shortcuts": [
|
||||
{
|
||||
"description": localizationService.localize("buttons_undo"),
|
||||
"keys": [{ "key": "ctrl" }, { "key": "z" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("buttons_redo"),
|
||||
"keys": [{ "key": "ctrl" }, { "key": "y" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("buttons_save"),
|
||||
"keys": [{ "key": "ctrl" }, { "key": "s" }]
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
function getEditorShortcuts(){
|
||||
return {
|
||||
"name": localizationService.localize("shortcuts_editorHeader"),
|
||||
"shortcuts": [
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_commentLine"),
|
||||
"keys": [{ "key": "ctrl" }, { "key": "/" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_removeLine"),
|
||||
"keys": [{ "key": "ctrl" }, { "key": "d" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_copyLineUp"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "up" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_copyLineDown"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "down" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_moveLineUp"),
|
||||
"keys": [{ "key": "alt" }, { "key": "up" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_moveLineDown"),
|
||||
"keys": [{ "key": "alt" }, { "key": "down" }]
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
function getTemplateEditorShortcuts(){
|
||||
return {
|
||||
"name": "Umbraco", //No need to localise Umbraco is the same in all languages :)
|
||||
"shortcuts": [
|
||||
{
|
||||
"description": localizationService.format(["template_insert", "template_insertPageField"], "%0% %1%"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "v" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.format(["template_insert", "template_insertPartialView"], "%0% %1%"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "p" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.format(["template_insert", "template_insertDictionaryItem"], "%0% %1%"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "d" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.format(["template_insert", "template_insertMacro"], "%0% %1%"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "m" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("template_queryBuilder"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "q" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.format(["template_insert", "template_insertSections"], "%0% %1%"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "s" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("template_mastertemplate"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "t" }]
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
////////////
|
||||
|
||||
var service = {
|
||||
@@ -44,7 +132,10 @@
|
||||
getQuerySnippet: getQuerySnippet,
|
||||
getRenderBodySnippet: getRenderBodySnippet,
|
||||
getRenderSectionSnippet: getRenderSectionSnippet,
|
||||
getAddSectionSnippet: getAddSectionSnippet
|
||||
getAddSectionSnippet: getAddSectionSnippet,
|
||||
getGeneralShortcuts: getGeneralShortcuts,
|
||||
getEditorShortcuts: getEditorShortcuts,
|
||||
getTemplateEditorShortcuts: getTemplateEditorShortcuts
|
||||
};
|
||||
|
||||
return service;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
function ScriptsEditController($scope, $routeParams, $timeout, appState, editorState, navigationService, assetsService, codefileResource, contentEditingHelper, notificationsService, localizationService) {
|
||||
function ScriptsEditController($scope, $routeParams, $timeout, appState, editorState, navigationService, assetsService, codefileResource, contentEditingHelper, notificationsService, localizationService, templateHelper) {
|
||||
|
||||
var vm = this;
|
||||
var currentPosition = null;
|
||||
@@ -19,54 +19,10 @@
|
||||
vm.showKeyboardShortcut = false;
|
||||
|
||||
//Keyboard shortcuts for help dialog
|
||||
vm.page.keyboardShortcutsOverview = [
|
||||
{
|
||||
"name": localizationService.localize("shortcuts_generalHeader"),
|
||||
"shortcuts": [
|
||||
{
|
||||
"description": localizationService.localize("buttons_undo"),
|
||||
"keys": [{ "key": "ctrl" }, { "key": "z" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("buttons_redo"),
|
||||
"keys": [{ "key": "ctrl" }, { "key": "y" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("buttons_save"),
|
||||
"keys": [{ "key": "ctrl" }, { "key": "s" }]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": localizationService.localize("shortcuts_editorHeader"),
|
||||
"shortcuts": [
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_commentLine"),
|
||||
"keys": [{ "key": "ctrl" }, { "key": "/" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_removeLine"),
|
||||
"keys": [{ "key": "ctrl" }, { "key": "d" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_copyLineUp"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "up" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_copyLineDown"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "down" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_moveLineUp"),
|
||||
"keys": [{ "key": "alt" }, { "key": "up" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_moveLineDown"),
|
||||
"keys": [{ "key": "alt" }, { "key": "down" }]
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
vm.page.keyboardShortcutsOverview = [];
|
||||
vm.page.keyboardShortcutsOverview.push(templateHelper.getGeneralShortcuts());
|
||||
vm.page.keyboardShortcutsOverview.push(templateHelper.getEditorShortcuts());
|
||||
|
||||
|
||||
vm.script = {};
|
||||
|
||||
|
||||
@@ -21,88 +21,10 @@
|
||||
vm.showKeyboardShortcut = false;
|
||||
|
||||
//Keyboard shortcuts for help dialog
|
||||
vm.page.keyboardShortcutsOverview = [
|
||||
{
|
||||
"name": localizationService.localize("shortcuts_generalHeader"),
|
||||
"shortcuts": [
|
||||
{
|
||||
"description": localizationService.localize("buttons_undo"),
|
||||
"keys": [{ "key": "ctrl" }, { "key": "z" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("buttons_redo"),
|
||||
"keys": [{ "key": "ctrl" }, { "key": "y" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("buttons_save"),
|
||||
"keys": [{ "key": "ctrl" }, { "key": "s" }]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": localizationService.localize("shortcuts_editorHeader"),
|
||||
"shortcuts": [
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_commentLine"),
|
||||
"keys": [{ "key": "ctrl" }, { "key": "/" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_removeLine"),
|
||||
"keys": [{ "key": "ctrl" }, { "key": "d" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_copyLineUp"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "up" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_copyLineDown"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "down" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_moveLineUp"),
|
||||
"keys": [{ "key": "alt" }, { "key": "up" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_moveLineDown"),
|
||||
"keys": [{ "key": "alt" }, { "key": "down" }]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Umbraco", //No need to localise Umbraco is the same in all languages :)
|
||||
"shortcuts": [
|
||||
{
|
||||
"description": localizationService.format(["template_insert", "template_insertPageField"], "%0% %1%"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "v" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.format(["template_insert", "template_insertPartialView"], "%0% %1%"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "p" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.format(["template_insert", "template_insertDictionaryItem"], "%0% %1%"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "d" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.format(["template_insert", "template_insertMacro"], "%0% %1%"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "m" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("template_queryBuilder"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "q" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.format(["template_insert", "template_insertSections"], "%0% %1%"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "s" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("template_mastertemplate"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "t" }]
|
||||
},
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
vm.page.keyboardShortcutsOverview = [];
|
||||
vm.page.keyboardShortcutsOverview.push(templateHelper.getGeneralShortcuts());
|
||||
vm.page.keyboardShortcutsOverview.push(templateHelper.getEditorShortcuts());
|
||||
vm.page.keyboardShortcutsOverview.push(templateHelper.getTemplateEditorShortcuts());
|
||||
|
||||
|
||||
vm.save = function () {
|
||||
|
||||
Reference in New Issue
Block a user