mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-09 23:15:49 +01:00
(refs #1275)Keep sidebar status during same session
This commit is contained in:
@@ -191,6 +191,7 @@ case class Context(settings: SystemSettingsService.SystemSettings, loginAccount:
|
|||||||
case agent if agent.contains("Win") => "windows"
|
case agent if agent.contains("Win") => "windows"
|
||||||
case _ => null
|
case _ => null
|
||||||
}
|
}
|
||||||
|
val sidebarCollapse = request.getSession.getAttribute("sidebar-collapse") != null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get object from cache.
|
* Get object from cache.
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import gitbucket.core.model.Account
|
|||||||
import gitbucket.core.service._
|
import gitbucket.core.service._
|
||||||
import gitbucket.core.util.Implicits._
|
import gitbucket.core.util.Implicits._
|
||||||
import gitbucket.core.util.ControlUtil._
|
import gitbucket.core.util.ControlUtil._
|
||||||
import gitbucket.core.util.{LDAPUtil, Keys, UsersAuthenticator, ReferrerAuthenticator, StringUtil}
|
import gitbucket.core.util.{Keys, LDAPUtil, ReferrerAuthenticator, StringUtil, UsersAuthenticator}
|
||||||
|
|
||||||
import io.github.gitbucket.scalatra.forms._
|
import io.github.gitbucket.scalatra.forms._
|
||||||
|
import org.scalatra.Ok
|
||||||
|
|
||||||
|
|
||||||
class IndexController extends IndexControllerBase
|
class IndexController extends IndexControllerBase
|
||||||
@@ -81,6 +81,15 @@ trait IndexControllerBase extends ControllerBase {
|
|||||||
xml.feed(getRecentActivities())
|
xml.feed(getRecentActivities())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get("/sidebar-collapse"){
|
||||||
|
if(params("collapse") == "true"){
|
||||||
|
session.setAttribute("sidebar-collapse", "true")
|
||||||
|
} else {
|
||||||
|
session.setAttribute("sidebar-collapse", null)
|
||||||
|
}
|
||||||
|
Ok()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set account information into HttpSession and redirect.
|
* Set account information into HttpSession and redirect.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
}
|
}
|
||||||
<script src="@helpers.assets/vendors/AdminLTE-2.3.6/js/app.js" type="text/javascript"></script>
|
<script src="@helpers.assets/vendors/AdminLTE-2.3.6/js/app.js" type="text/javascript"></script>
|
||||||
</head>
|
</head>
|
||||||
<body class="skin-blue page-load">
|
<body class="skin-blue page-load @if(context.sidebarCollapse){sidebar-collapse}">
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<header class="main-header">
|
<header class="main-header">
|
||||||
<a href="@context.path/" class="logo">
|
<a href="@context.path/" class="logo">
|
||||||
@@ -115,6 +115,9 @@
|
|||||||
$('#search').submit(function(){
|
$('#search').submit(function(){
|
||||||
return $.trim($(this).find('input[name=query]').val()) != '';
|
return $.trim($(this).find('input[name=query]').val()) != '';
|
||||||
});
|
});
|
||||||
|
$(".sidebar-toggle").on('click', function(e){
|
||||||
|
$.get('@context.path/sidebar-collapse', { collapse: !$('body').hasClass('sidebar-collapse') });
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@PluginRegistry().getJavaScript(context.request.getRequestURI).map { script =>
|
@PluginRegistry().getJavaScript(context.request.getRequestURI).map { script =>
|
||||||
|
|||||||
Reference in New Issue
Block a user