Provide hints in theme and language dropdowns

pull/1/head
yflory 8 years ago
parent 5d6a0dcc1b
commit 8471dab6b1

@ -133,6 +133,11 @@ define(function () {
out.slideOptionsTitle = "Personnaliser la présentation"; out.slideOptionsTitle = "Personnaliser la présentation";
out.slideOptionsButton = "Enregistrer (Entrée)"; out.slideOptionsButton = "Enregistrer (Entrée)";
out.languageButton = "Langage";
out.languageButtonTitle = "Sélectionner le langage à utiliser pour la coloration syntaxique";
out.themeButton = "Thème";
out.themeButtonTitle = "Sélectionner le thème de couleurs à utiliser pour les éditeurs de code et de présentations";
out.editShare = "Lien d'édition"; out.editShare = "Lien d'édition";
out.editShareTitle = "Copier le lien d'édition dans le presse-papiers"; out.editShareTitle = "Copier le lien d'édition dans le presse-papiers";
out.editOpen = "Éditer dans un nouvel onglet"; out.editOpen = "Éditer dans un nouvel onglet";

@ -135,6 +135,11 @@ define(function () {
out.slideOptionsTitle = "Customize your slides"; out.slideOptionsTitle = "Customize your slides";
out.slideOptionsButton = "Save (enter)"; out.slideOptionsButton = "Save (enter)";
out.languageButton = "Language";
out.languageButtonTitle = "Select the language to use for the syntax highlighting";
out.themeButton = "Theme";
out.themeButtonTitle = "Select the color theme to use for the code and slide editors";
out.editShare = "Editing link"; out.editShare = "Editing link";
out.editShareTitle = "Copy the editing link to clipboard"; out.editShareTitle = "Copy the editing link to clipboard";
out.editOpen = "Open editing link in a new tab"; out.editOpen = "Open editing link in a new tab";

@ -48,15 +48,11 @@ define([
var setMode = exp.setMode = function (mode, cb) { var setMode = exp.setMode = function (mode, cb) {
exp.highlightMode = mode; exp.highlightMode = mode;
if (mode === 'text') { if (mode !== "text") { CMeditor.autoLoadMode(editor, mode); }
editor.setOption('mode', 'text');
if (cb) { cb('text'); }
return;
}
CMeditor.autoLoadMode(editor, mode);
editor.setOption('mode', mode); editor.setOption('mode', mode);
if (exp.$language) { if (exp.$language) {
var name = exp.$language.find('a[data-value="' + mode + '"]').text() || 'Mode'; var name = exp.$language.find('a[data-value="' + mode + '"]').text() || undefined;
name = name ? Messages.languageButton + ' ('+name+')' : Messages.languageButton;
exp.$language.setValue(name); exp.$language.setValue(name);
} }
if(cb) { cb(mode); } if(cb) { cb(mode); }
@ -88,7 +84,9 @@ define([
editor.setOption('theme', theme); editor.setOption('theme', theme);
} }
if ($select) { if ($select) {
$select.setValue(theme || 'Theme'); var name = theme || undefined;
name = name ? Messages.themeButton + ' ('+theme+')' : Messages.themeButton;
$select.setValue(name);
} }
}; };
}()); }());
@ -152,6 +150,7 @@ define([
isSelect: true, isSelect: true,
}; };
var $block = exp.$language = Cryptpad.createDropdown(dropdownConfig); var $block = exp.$language = Cryptpad.createDropdown(dropdownConfig);
$block.find('button').attr('title', Messages.languageButtonTitle);
$block.find('a').click(function () { $block.find('a').click(function () {
setMode($(this).attr('data-value'), onModeChanged); setMode($(this).attr('data-value'), onModeChanged);
onLocal(); onLocal();
@ -185,6 +184,7 @@ define([
initialValue: lastTheme initialValue: lastTheme
}; };
var $block = exp.$theme = Cryptpad.createDropdown(dropdownConfig); var $block = exp.$theme = Cryptpad.createDropdown(dropdownConfig);
$block.find('button').attr('title', Messages.themeButtonTitle);
setTheme(lastTheme, $block); setTheme(lastTheme, $block);

Loading…
Cancel
Save