# HG changeset patch # User Marcin Kuzminski # Date 2019-04-23 09:26:12 # Node ID ffe3283f27c351587c3285539fc1b4da4913fab1 # Parent a4f7a8dbfb686e302face4bdf40109aecfc40d16 diffs: store wide-diff mode in user sessions for saved state. diff --git a/rhodecode/apps/home/views.py b/rhodecode/apps/home/views.py --- a/rhodecode/apps/home/views.py +++ b/rhodecode/apps/home/views.py @@ -743,4 +743,4 @@ class HomeView(BaseAppView): if existing_value != val: self.request.session[key] = val - return 'stored:{}'.format(key) + return 'stored:{}:{}'.format(key, val) diff --git a/rhodecode/public/js/src/rhodecode/comments.js b/rhodecode/public/js/src/rhodecode/comments.js --- a/rhodecode/public/js/src/rhodecode/comments.js +++ b/rhodecode/public/js/src/rhodecode/comments.js @@ -587,12 +587,14 @@ var CommentsController = function() { $('#content').removeClass("wrapper"); $('#content').addClass("wide-mode-wrapper"); $(node).addClass('btn-success'); + return true } else { $('#content').removeClass("wide-mode-wrapper"); $('#content').addClass("wrapper"); $(node).removeClass('btn-success'); + return false } - return false; + }; this.toggleComments = function(node, show) { diff --git a/rhodecode/templates/codeblocks/diffs.mako b/rhodecode/templates/codeblocks/diffs.mako --- a/rhodecode/templates/codeblocks/diffs.mako +++ b/rhodecode/templates/codeblocks/diffs.mako @@ -959,7 +959,8 @@ def get_comments_for(diff_type, comments text: _gettext('Toggle Wide Mode diff'), action: function () { updateSticky(); - Rhodecode.comments.toggleWideMode(this); + var wide = Rhodecode.comments.toggleWideMode(this); + storeUserSessionAttr('rc_user_session_attr.wide_diff_mode', wide); return null; }, url: null, @@ -1002,6 +1003,11 @@ def get_comments_for(diff_type, comments ] }; + // get stored diff mode and pre-enable it + if (templateContext.session_attrs.wide_diff_mode === "true") { + Rhodecode.comments.toggleWideMode(null); + } + $("#diff_menu").select2({ minimumResultsForSearch: -1, containerCssClass: "drop-menu",