diff --git a/compiled_ejs.txt b/compiled_ejs.txt new file mode 100644 index 00000000000..3779381ebfc --- /dev/null +++ b/compiled_ejs.txt @@ -0,0 +1,10 @@ +function anonymous(data) { + var include = function (path, includeData) { + var d = utils_js_1.default.shallowCopy(utils_js_1.default.createNullProtoObjWherePossible(), data); + if (includeData) { + d = utils_js_1.default.shallowCopy(d, includeData); + } + return includeFile(path, opts)(d); + }; + return fn.apply(opts.context, [data || utils_js_1.default.createNullProtoObjWherePossible(), escapeFn, include, rethrow]); + } \ No newline at end of file diff --git a/src/all_tests.log b/src/all_tests.log new file mode 100644 index 00000000000..274aa5fc595 Binary files /dev/null and b/src/all_tests.log differ diff --git a/src/ejs_test_results.log b/src/ejs_test_results.log new file mode 100644 index 00000000000..560563ccddc Binary files /dev/null and b/src/ejs_test_results.log differ diff --git a/src/locales/en.json b/src/locales/en.json index 51e07f3021a..69e358ef1b0 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -94,6 +94,9 @@ "pad.settings.fontType.normal": "Normal", "pad.settings.language": "Language:", "pad.settings.deletePad": "Delete Pad", + "pad.settings.logout": "Logout", + "pad.settings.exit": "Exit to Home", + "pad.logout.confirm": "Are you sure you want to logout? This will clear your session.", "pad.delete.confirm": "Do you really want to delete this pad?", "pad.settings.about": "About", "pad.settings.poweredBy": "Powered by", diff --git a/src/static/js/pad_editor.ts b/src/static/js/pad_editor.ts index 3b1b11498f3..ecadcf3a624 100644 --- a/src/static/js/pad_editor.ts +++ b/src/static/js/pad_editor.ts @@ -22,7 +22,7 @@ * limitations under the License. */ -import padutils,{Cookies} from "./pad_utils"; +import padutils, { Cookies } from "./pad_utils"; const padcookie = require('./pad_cookie').padcookie; const Ace2Editor = require('./ace').Ace2Editor; import html10n from '../js/vendors/html10n' @@ -86,21 +86,35 @@ const padeditor = (() => { // delete pad $('#delete-pad').on('click', () => { if (window.confirm(html10n.get('pad.delete.confirm'))) { - pad.collabClient.sendMessage({type: 'PAD_DELETE', data:{padId: pad.getPadId()}}); + pad.collabClient.sendMessage({ type: 'PAD_DELETE', data: { padId: pad.getPadId() } }); // redirect to home page after deletion window.location.href = '/'; } }) + // exit button - redirect to home without clearing cookies + $('#exit-pad').on('click', () => { + window.location.href = '/'; + }); + + // logout button - clear cookies and redirect to home + $('#logout-pad').on('click', () => { + if (window.confirm(html10n.get('pad.logout.confirm'))) { + Cookies.remove('token'); + Cookies.remove('language'); + window.location.href = '/'; + } + }); + // theme switch - $('#theme-switcher').on('click',()=>{ - if (skinVariants.isDarkMode()) { - skinVariants.setDarkModeInLocalStorage(false); - skinVariants.updateSkinVariantsClasses(['super-light-toolbar super-light-editor light-background']); - } else { - skinVariants.setDarkModeInLocalStorage(true); - skinVariants.updateSkinVariantsClasses(['super-dark-editor', 'dark-background', 'super-dark-toolbar']); - } + $('#theme-switcher').on('click', () => { + if (skinVariants.isDarkMode()) { + skinVariants.setDarkModeInLocalStorage(false); + skinVariants.updateSkinVariantsClasses(['super-light-toolbar super-light-editor light-background']); + } else { + skinVariants.setDarkModeInLocalStorage(true); + skinVariants.updateSkinVariantsClasses(['super-dark-editor', 'dark-background', 'super-dark-toolbar']); + } }) // Language @@ -194,7 +208,7 @@ exports.focusOnLine = (ace) => { const lineNumberInt = parseInt(lineNumber.substr(1)); if (lineNumberInt) { const $inner = $('iframe[name="ace_outer"]').contents().find('iframe') - .contents().find('#innerdocbody'); + .contents().find('#innerdocbody'); const line = $inner.find(`div:nth-child(${lineNumberInt})`); if (line.length !== 0) { let offsetTop = line.offset().top; @@ -204,9 +218,9 @@ exports.focusOnLine = (ace) => { offsetTop += parseInt($inner.css('padding-top').replace('px', '')); } const $outerdocHTML = $('iframe[name="ace_outer"]').contents() - .find('#outerdocbody').parent(); - $outerdoc.css({top: `${offsetTop}px`}); // Chrome - $outerdocHTML.animate({scrollTop: offsetTop}); // needed for FF + .find('#outerdocbody').parent(); + $outerdoc.css({ top: `${offsetTop}px` }); // Chrome + $outerdocHTML.animate({ scrollTop: offsetTop }); // needed for FF const node = line[0]; ace.callWithAce((ace) => { const selection = { diff --git a/src/static/skins/colibris/src/components/popup.css b/src/static/skins/colibris/src/components/popup.css index db664743101..dd2c91aa0cf 100644 --- a/src/static/skins/colibris/src/components/popup.css +++ b/src/static/skins/colibris/src/components/popup.css @@ -86,6 +86,16 @@ background-color: #ff7b72; } +#exit-pad { + background-color: #58a6ff; + margin-left: 8px; +} + +#logout-pad { + background-color: #f85149; + margin-left: 8px; +} + #theme-switcher div { position: relative; width: 30px; diff --git a/src/templates/pad.html b/src/templates/pad.html index eb93196e266..48a547c345c 100644 --- a/src/templates/pad.html +++ b/src/templates/pad.html @@ -164,6 +164,8 @@

<% e.end_block(); %> + +