mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-09 06:55:54 +01:00
add AdminLTE skin selection feature.
This commit is contained in:
@@ -63,7 +63,8 @@ trait SystemSettingsControllerBase extends AccountManagementControllerBase {
|
|||||||
"tls" -> trim(label("Enable TLS", optional(boolean()))),
|
"tls" -> trim(label("Enable TLS", optional(boolean()))),
|
||||||
"ssl" -> trim(label("Enable SSL", optional(boolean()))),
|
"ssl" -> trim(label("Enable SSL", optional(boolean()))),
|
||||||
"keystore" -> trim(label("Keystore", optional(text())))
|
"keystore" -> trim(label("Keystore", optional(text())))
|
||||||
)(Ldap.apply))
|
)(Ldap.apply)),
|
||||||
|
"skinName" -> trim(label("AdminLTE skin name", text(required)))
|
||||||
)(SystemSettings.apply).verifying { settings =>
|
)(SystemSettings.apply).verifying { settings =>
|
||||||
Vector(
|
Vector(
|
||||||
if(settings.ssh && settings.baseUrl.isEmpty){
|
if(settings.ssh && settings.baseUrl.isEmpty){
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ trait SystemSettingsService {
|
|||||||
ldap.keystore.foreach(x => props.setProperty(LdapKeystore, x))
|
ldap.keystore.foreach(x => props.setProperty(LdapKeystore, x))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
props.setProperty(SkinName, settings.skinName.toString)
|
||||||
using(new java.io.FileOutputStream(GitBucketConf)){ out =>
|
using(new java.io.FileOutputStream(GitBucketConf)){ out =>
|
||||||
props.store(out, null)
|
props.store(out, null)
|
||||||
}
|
}
|
||||||
@@ -111,7 +112,8 @@ trait SystemSettingsService {
|
|||||||
getOptionValue(props, LdapKeystore, None)))
|
getOptionValue(props, LdapKeystore, None)))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
},
|
||||||
|
getValue(props, SkinName, "skin-blue")
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,7 +138,8 @@ object SystemSettingsService {
|
|||||||
useSMTP: Boolean,
|
useSMTP: Boolean,
|
||||||
smtp: Option[Smtp],
|
smtp: Option[Smtp],
|
||||||
ldapAuthentication: Boolean,
|
ldapAuthentication: Boolean,
|
||||||
ldap: Option[Ldap]){
|
ldap: Option[Ldap],
|
||||||
|
skinName: String){
|
||||||
def baseUrl(request: HttpServletRequest): String = baseUrl.fold(request.baseUrl)(_.stripSuffix("/"))
|
def baseUrl(request: HttpServletRequest): String = baseUrl.fold(request.baseUrl)(_.stripSuffix("/"))
|
||||||
|
|
||||||
def sshAddress:Option[SshAddress] =
|
def sshAddress:Option[SshAddress] =
|
||||||
@@ -219,6 +222,7 @@ object SystemSettingsService {
|
|||||||
private val LdapTls = "ldap.tls"
|
private val LdapTls = "ldap.tls"
|
||||||
private val LdapSsl = "ldap.ssl"
|
private val LdapSsl = "ldap.ssl"
|
||||||
private val LdapKeystore = "ldap.keystore"
|
private val LdapKeystore = "ldap.keystore"
|
||||||
|
private val SkinName = "skinName"
|
||||||
|
|
||||||
private def getValue[A: ClassTag](props: java.util.Properties, key: String, default: A): A = {
|
private def getValue[A: ClassTag](props: java.util.Properties, key: String, default: A): A = {
|
||||||
getSystemProperty(key).getOrElse(getEnvironmentVariable(key).getOrElse {
|
getSystemProperty(key).getOrElse(getEnvironmentVariable(key).getOrElse {
|
||||||
|
|||||||
@@ -412,4 +412,10 @@ object helpers extends AvatarImageProvider with LinkConverter with RequestCache
|
|||||||
*/
|
*/
|
||||||
def readableSize(size: Option[Long]): String = FileUtil.readableSize(size.getOrElse(0))
|
def readableSize(size: Option[Long]): String = FileUtil.readableSize(size.getOrElse(0))
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns selected skin-name
|
||||||
|
*/
|
||||||
|
def skinName(implicit context: Context): String = context.settings.skinName
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
@(info: Option[Any])(implicit context: gitbucket.core.controller.Context)
|
@(info: Option[Any])(implicit context: gitbucket.core.controller.Context)
|
||||||
@import gitbucket.core.util.DatabaseConfig
|
@import gitbucket.core.util.DatabaseConfig
|
||||||
|
@import gitbucket.core.view.helpers
|
||||||
@gitbucket.core.html.main("System settings"){
|
@gitbucket.core.html.main("System settings"){
|
||||||
@gitbucket.core.admin.html.menu("system"){
|
@gitbucket.core.admin.html.menu("system"){
|
||||||
@gitbucket.core.helper.html.information(info)
|
@gitbucket.core.helper.html.information(info)
|
||||||
@@ -344,6 +345,36 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
*@
|
*@
|
||||||
|
<!--====================================================================-->
|
||||||
|
<!-- AdminLTE SkinName -->
|
||||||
|
<!--====================================================================-->
|
||||||
|
<hr>
|
||||||
|
<label class="strong">
|
||||||
|
AdminLTE skin name
|
||||||
|
</label>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-md-3" for="skinName">Skin name</label>
|
||||||
|
<div class="col-md-9">
|
||||||
|
<select id="skinName" name="skinName">
|
||||||
|
@Seq(
|
||||||
|
"skin-black",
|
||||||
|
"skin-black-light",
|
||||||
|
"skin-blue",
|
||||||
|
"skin-blue-light",
|
||||||
|
"skin-green",
|
||||||
|
"skin-green-light",
|
||||||
|
"skin-purple",
|
||||||
|
"skin-purple-light",
|
||||||
|
"skin-red",
|
||||||
|
"skin-red-light",
|
||||||
|
"skin-yellow",
|
||||||
|
"skin-yellow-light",
|
||||||
|
).map{ skin =>
|
||||||
|
<option @if(skin == helpers.skinName){selected}>@skin</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="align-right" style="margin-top: 20px;">
|
<div class="align-right" style="margin-top: 20px;">
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<link href="@helpers.assets("/vendors/google-code-prettify/prettify.css")" type="text/css" rel="stylesheet"/>
|
<link href="@helpers.assets("/vendors/google-code-prettify/prettify.css")" type="text/css" rel="stylesheet"/>
|
||||||
<link href="@helpers.assets("/vendors/facebox/facebox.css")" rel="stylesheet"/>
|
<link href="@helpers.assets("/vendors/facebox/facebox.css")" rel="stylesheet"/>
|
||||||
<link href="@helpers.assets("/vendors/AdminLTE-2.3.11/css/AdminLTE.min.css")" rel="stylesheet">
|
<link href="@helpers.assets("/vendors/AdminLTE-2.3.11/css/AdminLTE.min.css")" rel="stylesheet">
|
||||||
<link href="@helpers.assets("/vendors/AdminLTE-2.3.11/css/skins/skin-blue.min.css")" rel="stylesheet">
|
<link href="@helpers.assets(s"/vendors/AdminLTE-2.3.11/css/skins/${helpers.skinName}.min.css")" rel="stylesheet">
|
||||||
<link href="@helpers.assets("/vendors/font-awesome-4.6.3/css/font-awesome.min.css")" rel="stylesheet">
|
<link href="@helpers.assets("/vendors/font-awesome-4.6.3/css/font-awesome.min.css")" rel="stylesheet">
|
||||||
<link href="@helpers.assets("/vendors/jquery-ui/jquery-ui.min.css")" rel="stylesheet">
|
<link href="@helpers.assets("/vendors/jquery-ui/jquery-ui.min.css")" rel="stylesheet">
|
||||||
<link href="@helpers.assets("/vendors/jquery-ui/jquery-ui.structure.min.css")" rel="stylesheet">
|
<link href="@helpers.assets("/vendors/jquery-ui/jquery-ui.structure.min.css")" rel="stylesheet">
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
}
|
}
|
||||||
<script src="@helpers.assets("/vendors/AdminLTE-2.3.11/js/app.js")" type="text/javascript"></script>
|
<script src="@helpers.assets("/vendors/AdminLTE-2.3.11/js/app.js")" type="text/javascript"></script>
|
||||||
</head>
|
</head>
|
||||||
<body class="skin-blue page-load @if(body.toString.contains("menu-item-hover")){sidebar-mini} @if(context.sidebarCollapse){sidebar-collapse}">
|
<body class="@helpers.skinName page-load @if(body.toString.contains("menu-item-hover")){sidebar-mini} @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">
|
||||||
|
|||||||
Reference in New Issue
Block a user