Merge remote-tracking branch 'upstream/master' into pr-handle-errors

# Conflicts:
#	src/main/scala/gitbucket/core/controller/SystemSettingsController.scala
#	src/main/scala/gitbucket/core/service/SystemSettingsService.scala
#	src/test/scala/gitbucket/core/view/AvatarImageProviderSpec.scala
This commit is contained in:
KOUNOIKE Yuusuke
2017-08-20 21:50:34 +09:00
7 changed files with 49 additions and 47 deletions

View File

@@ -1,5 +1,7 @@
language: scala language: scala
sudo: true sudo: true
jdk:
- oraclejdk8
script: script:
- sbt test - sbt test
before_script: before_script:
@@ -14,40 +16,3 @@ cache:
- $HOME/.coursier - $HOME/.coursier
- $HOME/.embedmysql - $HOME/.embedmysql
- $HOME/.embedpostgresql - $HOME/.embedpostgresql
matrix:
include:
- jdk: oraclejdk8
addons:
apt:
packages:
- libaio1
- dist: trusty
group: edge
sudo: required
jdk: oraclejdk9
addons:
apt:
packages:
- libaio1
before_install:
- cd ~
- JDK9_URL=`curl http://jdk.java.net/9/ | grep "lin64JDK" | grep "tar.gz\"" | sed -e "s/\"/ /g" | awk '{print $5}'`
- wget -O jdk-9_linux-x64_bin.tar.gz $JDK9_URL
- tar -xzf jdk-9_linux-x64_bin.tar.gz
- cd -
script:
# https://github.com/sbt/sbt/pull/2951
- git clone https://github.com/retronym/java9-rt-export
- cd java9-rt-export/
- git checkout 1019a2873d057dd7214f4135e84283695728395d
- jdk_switcher use oraclejdk8
- sbt package
# - jdk_switcher use oraclejdk9
- export JAVA_HOME=~/jdk-9
- PATH=$JAVA_HOME/bin:$PATH
- java -version
- mkdir -p $HOME/.sbt/0.13/java9-rt-ext; java -jar target/java9-rt-export-*.jar $HOME/.sbt/0.13/java9-rt-ext/rt.jar
- jar tf $HOME/.sbt/0.13/java9-rt-ext/rt.jar | grep java/lang/Object
- cd ..
- wget https://raw.githubusercontent.com/paulp/sbt-extras/9ade5fa54914ca8aded44105bf4b9a60966f3ccd/sbt && chmod +x ./sbt
- ./sbt -Dscala.ext.dirs=$HOME/.sbt/0.13/java9-rt-ext test

View File

@@ -62,8 +62,9 @@ trait SystemSettingsControllerBase extends AccountManagementControllerBase {
"mailAttribute" -> trim(label("Mail address attribute", optional(text()))), "mailAttribute" -> trim(label("Mail address attribute", optional(text()))),
"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))),
"debug" -> trim(label("Debug", boolean())) "debug" -> trim(label("Debug", boolean()))
)(SystemSettings.apply).verifying { settings => )(SystemSettings.apply).verifying { settings =>
Vector( Vector(

View File

@@ -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)
props.setProperty(Debug, settings.debug.toString) props.setProperty(Debug, settings.debug.toString)
using(new java.io.FileOutputStream(GitBucketConf)){ out => using(new java.io.FileOutputStream(GitBucketConf)){ out =>
props.store(out, null) props.store(out, null)
@@ -113,6 +114,7 @@ trait SystemSettingsService {
} else { } else {
None None
}, },
getValue(props, SkinName, "skin-blue"),
getValue(props, Debug, false) getValue(props, Debug, false)
) )
} }
@@ -139,6 +141,7 @@ object SystemSettingsService {
smtp: Option[Smtp], smtp: Option[Smtp],
ldapAuthentication: Boolean, ldapAuthentication: Boolean,
ldap: Option[Ldap], ldap: Option[Ldap],
skinName: String,
debug: Boolean){ debug: Boolean){
def baseUrl(request: HttpServletRequest): String = baseUrl.fold(request.baseUrl)(_.stripSuffix("/")) def baseUrl(request: HttpServletRequest): String = baseUrl.fold(request.baseUrl)(_.stripSuffix("/"))
@@ -222,6 +225,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 val Debug = "debug" private val Debug = "debug"
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 = {

View File

@@ -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 == context.settings.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;">

View File

@@ -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/${context.settings.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="@context.settings.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">

View File

@@ -70,19 +70,19 @@
val (summary, summaryText) = getSummary(statuses) val (summary, summaryText) = getSummary(statuses)
(statuses, summary, summaryText) (statuses, summary, summaryText)
}){ case (statuses, summaryState, summaryText) => }){ case (statuses, summaryState, summaryText) =>
@if(!statuses.isEmpty){ @if(statuses.nonEmpty){
@helpers.commitStateIcon(summaryState) @helpers.commitStateIcon(summaryState)
<strong class="text-@{summaryState.name}">@helpers.commitStateText(summaryState, commit.id)</strong> <strong class="text-@{summaryState.name}">@helpers.commitStateText(summaryState, commit.id)</strong>
<span class="text-@{summaryState.name}"> @summaryText checks</span> <span class="text-@{summaryState.name}">- @summaryText checks</span>
<a href="#" class="toggle-check">Show all checks</a> <a href="#" class="toggle-check">Show all checks</a>
<div style="display: none;"> <div style="display: none;">
@statuses.map{ status => @statuses.map{ status =>
<div class="build-status-item"> <div class="build-status-item">
<span class="build-status-icon text-@{status.state.name}">@helpers.commitStateIcon(status.state)</span> <span class="build-status-icon text-@{status.state.name}">@helpers.commitStateIcon(status.state)</span>
<strong>@status.context</strong> <strong>@status.context</strong>
@status.description.map { desc => <span class="muted"> @desc</span> } @status.description.map { desc => <span class="muted">- @desc</span> }
<span> <span>
@status.targetUrl.map { url => <a href="@url">Details</a> } @status.targetUrl.map { url => - <a href="@url">Details</a> }
</span> </span>
</div> </div>
} }
@@ -116,10 +116,9 @@
$(function () { $(function () {
$('.toggle-check').click(function(){ $('.toggle-check').click(function(){
var div = $(this).next('div'); var div = $(this).next('div');
console.log(div);
if(div.is(':visible')){ if(div.is(':visible')){
$(this).text('Show all checks'); $(this).text('Show all checks');
}else{ } else {
$(this).text('Hide all checks'); $(this).text('Hide all checks');
} }
div.toggle(); div.toggle();

View File

@@ -119,7 +119,9 @@ class AvatarImageProviderSpec extends FunSpec with MockitoSugar {
smtp = None, smtp = None,
ldapAuthentication = false, ldapAuthentication = false,
ldap = None, ldap = None,
debug = false) skinName = "skin-blue",
debug = false
)
/** /**
* Adapter to test AvatarImageProviderImpl. * Adapter to test AvatarImageProviderImpl.