mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-10 23:45:50 +01:00
(refs #80) Add options to turn-off Wiki and Issues
This commit is contained in:
9
src/main/resources/update/gitbucket-core_4.2.xml
Normal file
9
src/main/resources/update/gitbucket-core_4.2.xml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<changeSet>
|
||||||
|
<addColumn tableName="REPOSITORY">
|
||||||
|
<column name="ENABLE_WIKI" type="boolean" nullable="false" defaultValueBoolean="true"/>
|
||||||
|
<column name="ENABLE_ISSUES" type="boolean" nullable="false" defaultValueBoolean="true"/>
|
||||||
|
<column name="EXTERNAL_WIKI_URL" type="varchar(200)" nullable="true"/>
|
||||||
|
<column name="EXTERNAL_ISSUES_URL" type="varchar(200)" nullable="true"/>
|
||||||
|
</addColumn>
|
||||||
|
</changeSet>
|
||||||
@@ -4,9 +4,12 @@ import io.github.gitbucket.solidbase.migration.{SqlMigration, LiquibaseMigration
|
|||||||
import io.github.gitbucket.solidbase.model.{Version, Module}
|
import io.github.gitbucket.solidbase.model.{Version, Module}
|
||||||
|
|
||||||
object GitBucketCoreModule extends Module("gitbucket-core",
|
object GitBucketCoreModule extends Module("gitbucket-core",
|
||||||
new Version("4.1.0"),
|
|
||||||
new Version("4.0.0",
|
new Version("4.0.0",
|
||||||
new LiquibaseMigration("update/gitbucket-core_4.0.xml"),
|
new LiquibaseMigration("update/gitbucket-core_4.0.xml"),
|
||||||
new SqlMigration("update/gitbucket-core_4.0.sql")
|
new SqlMigration("update/gitbucket-core_4.0.sql")
|
||||||
|
),
|
||||||
|
new Version("4.1.0"),
|
||||||
|
new Version("4.2.0",
|
||||||
|
new LiquibaseMigration("update/gitbucket-core_4.2.xml")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -27,12 +27,24 @@ trait RepositorySettingsControllerBase extends ControllerBase {
|
|||||||
with OwnerAuthenticator with UsersAuthenticator =>
|
with OwnerAuthenticator with UsersAuthenticator =>
|
||||||
|
|
||||||
// for repository options
|
// for repository options
|
||||||
case class OptionsForm(repositoryName: String, description: Option[String], isPrivate: Boolean)
|
case class OptionsForm(
|
||||||
|
repositoryName: String,
|
||||||
|
description: Option[String],
|
||||||
|
isPrivate: Boolean,
|
||||||
|
enableIssues: Boolean,
|
||||||
|
enableWiki: Boolean,
|
||||||
|
externalIssuesUrl: Option[String],
|
||||||
|
externalWikiUrl: Option[String]
|
||||||
|
)
|
||||||
|
|
||||||
val optionsForm = mapping(
|
val optionsForm = mapping(
|
||||||
"repositoryName" -> trim(label("Repository Name", text(required, maxlength(40), identifier, renameRepositoryName))),
|
"repositoryName" -> trim(label("Repository Name" , text(required, maxlength(40), identifier, renameRepositoryName))),
|
||||||
"description" -> trim(label("Description" , optional(text()))),
|
"description" -> trim(label("Description" , optional(text()))),
|
||||||
"isPrivate" -> trim(label("Repository Type", boolean()))
|
"isPrivate" -> trim(label("Repository Type" , boolean())),
|
||||||
|
"enableIssues" -> trim(label("Enable Issues" , boolean())),
|
||||||
|
"enableWiki" -> trim(label("Enable Wiki" , boolean())),
|
||||||
|
"externalIssuesUrl" -> trim(label("External Issues URL", optional(text(maxlength(200))))),
|
||||||
|
"externalWikiUrl" -> trim(label("External Wiki URL" , optional(text(maxlength(200)))))
|
||||||
)(OptionsForm.apply)
|
)(OptionsForm.apply)
|
||||||
|
|
||||||
// for default branch
|
// for default branch
|
||||||
@@ -92,7 +104,11 @@ trait RepositorySettingsControllerBase extends ControllerBase {
|
|||||||
form.description,
|
form.description,
|
||||||
repository.repository.parentUserName.map { _ =>
|
repository.repository.parentUserName.map { _ =>
|
||||||
repository.repository.isPrivate
|
repository.repository.isPrivate
|
||||||
} getOrElse form.isPrivate
|
} getOrElse form.isPrivate,
|
||||||
|
form.enableIssues,
|
||||||
|
form.enableWiki,
|
||||||
|
form.externalIssuesUrl,
|
||||||
|
form.externalWikiUrl
|
||||||
)
|
)
|
||||||
// Change repository name
|
// Change repository name
|
||||||
if(repository.name != form.repositoryName){
|
if(repository.name != form.repositoryName){
|
||||||
|
|||||||
@@ -17,7 +17,11 @@ trait RepositoryComponent extends TemplateComponent { self: Profile =>
|
|||||||
val originRepositoryName = column[String]("ORIGIN_REPOSITORY_NAME")
|
val originRepositoryName = column[String]("ORIGIN_REPOSITORY_NAME")
|
||||||
val parentUserName = column[String]("PARENT_USER_NAME")
|
val parentUserName = column[String]("PARENT_USER_NAME")
|
||||||
val parentRepositoryName = column[String]("PARENT_REPOSITORY_NAME")
|
val parentRepositoryName = column[String]("PARENT_REPOSITORY_NAME")
|
||||||
def * = (userName, repositoryName, isPrivate, description.?, defaultBranch, registeredDate, updatedDate, lastActivityDate, originUserName.?, originRepositoryName.?, parentUserName.?, parentRepositoryName.?) <> (Repository.tupled, Repository.unapply)
|
val enableWiki = column[Boolean]("ENABLE_WIKI")
|
||||||
|
val enableIssues = column[Boolean]("ENABLE_ISSUES")
|
||||||
|
val externalWikiUrl = column[String]("EXTERNAL_WIKI_URL")
|
||||||
|
val externalIssuesUrl = column[String]("EXTERNAL_ISSUES_URL")
|
||||||
|
def * = (userName, repositoryName, isPrivate, description.?, defaultBranch, registeredDate, updatedDate, lastActivityDate, originUserName.?, originRepositoryName.?, parentUserName.?, parentRepositoryName.?, enableWiki, enableIssues, externalWikiUrl.?, externalIssuesUrl.?) <> (Repository.tupled, Repository.unapply)
|
||||||
|
|
||||||
def byPrimaryKey(owner: String, repository: String) = byRepository(owner, repository)
|
def byPrimaryKey(owner: String, repository: String) = byRepository(owner, repository)
|
||||||
}
|
}
|
||||||
@@ -35,5 +39,9 @@ case class Repository(
|
|||||||
originUserName: Option[String],
|
originUserName: Option[String],
|
||||||
originRepositoryName: Option[String],
|
originRepositoryName: Option[String],
|
||||||
parentUserName: Option[String],
|
parentUserName: Option[String],
|
||||||
parentRepositoryName: Option[String]
|
parentRepositoryName: Option[String],
|
||||||
|
enableWiki: Boolean,
|
||||||
|
enableIssues: Boolean,
|
||||||
|
externalWikiUrl: Option[String],
|
||||||
|
externalIssuesUrl: Option[String]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -36,7 +36,12 @@ trait RepositoryService { self: AccountService =>
|
|||||||
originUserName = originUserName,
|
originUserName = originUserName,
|
||||||
originRepositoryName = originRepositoryName,
|
originRepositoryName = originRepositoryName,
|
||||||
parentUserName = parentUserName,
|
parentUserName = parentUserName,
|
||||||
parentRepositoryName = parentRepositoryName)
|
parentRepositoryName = parentRepositoryName,
|
||||||
|
enableWiki = true,
|
||||||
|
enableIssues = true,
|
||||||
|
externalWikiUrl = None,
|
||||||
|
externalIssuesUrl = None
|
||||||
|
)
|
||||||
|
|
||||||
IssueId insert (userName, repositoryName, 0)
|
IssueId insert (userName, repositoryName, 0)
|
||||||
}
|
}
|
||||||
@@ -222,7 +227,7 @@ trait RepositoryService { self: AccountService =>
|
|||||||
* Include public repository, private own repository and private but collaborator repository.
|
* Include public repository, private own repository and private but collaborator repository.
|
||||||
*
|
*
|
||||||
* @param userName the user name of collaborator
|
* @param userName the user name of collaborator
|
||||||
* @return the repository infomation list
|
* @return the repository information list
|
||||||
*/
|
*/
|
||||||
def getAllRepositories(userName: String)(implicit s: Session): List[(String, String)] = {
|
def getAllRepositories(userName: String)(implicit s: Session): List[(String, String)] = {
|
||||||
Repositories.filter { t1 =>
|
Repositories.filter { t1 =>
|
||||||
@@ -313,10 +318,11 @@ trait RepositoryService { self: AccountService =>
|
|||||||
* Save repository options.
|
* Save repository options.
|
||||||
*/
|
*/
|
||||||
def saveRepositoryOptions(userName: String, repositoryName: String,
|
def saveRepositoryOptions(userName: String, repositoryName: String,
|
||||||
description: Option[String], isPrivate: Boolean)(implicit s: Session): Unit =
|
description: Option[String], isPrivate: Boolean, enableIssues: Boolean,
|
||||||
|
enableWiki: Boolean, externalIssuesUrl: Option[String], externalWikiUrl: Option[String])(implicit s: Session): Unit =
|
||||||
Repositories.filter(_.byRepository(userName, repositoryName))
|
Repositories.filter(_.byRepository(userName, repositoryName))
|
||||||
.map { r => (r.description.?, r.isPrivate, r.updatedDate) }
|
.map { r => (r.description.?, r.isPrivate, r.enableIssues, r.enableWiki, r.externalIssuesUrl.?, r.externalWikiUrl.?, r.updatedDate) }
|
||||||
.update (description, isPrivate, currentDate)
|
.update (description, isPrivate, enableIssues, enableWiki, externalIssuesUrl, externalWikiUrl, currentDate)
|
||||||
|
|
||||||
def saveRepositoryDefaultBranch(userName: String, repositoryName: String,
|
def saveRepositoryDefaultBranch(userName: String, repositoryName: String,
|
||||||
defaultBranch: String)(implicit s: Session): Unit =
|
defaultBranch: String)(implicit s: Session): Unit =
|
||||||
|
|||||||
@@ -8,15 +8,15 @@
|
|||||||
|
|
||||||
@menuitem(path: String, name: String, label: String, icon: String, count: Int = 0) = {
|
@menuitem(path: String, name: String, label: String, icon: String, count: Int = 0) = {
|
||||||
<li @if(active == name){class="active"}>
|
<li @if(active == name){class="active"}>
|
||||||
<a href="@url(repository)@path">
|
@if(path.startsWith("http")){
|
||||||
<i class="menu-icon octicon octicon-@icon"></i>
|
<a href="@path" target="_blank">
|
||||||
<span class="pc">
|
<i class="menu-icon octicon octicon-@icon"></i> <span class="pc">@label @if(count > 0) { <span class="badge">@count</span> }</span>
|
||||||
@label
|
|
||||||
@if(count > 0){
|
|
||||||
<span class="badge">@count</span>
|
|
||||||
}
|
|
||||||
</span>
|
|
||||||
</a>
|
</a>
|
||||||
|
} else {
|
||||||
|
<a href="@url(repository)@path">
|
||||||
|
<i class="menu-icon octicon octicon-@icon"></i> <span class="pc">@label @if(count > 0) { <span class="badge">@count</span> }</span>
|
||||||
|
</a>
|
||||||
|
}
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,19 +44,31 @@
|
|||||||
<div class="container body">
|
<div class="container body">
|
||||||
<div class="main-sidebar">
|
<div class="main-sidebar">
|
||||||
<ul class="nav nav-pills nav-stacked">
|
<ul class="nav nav-pills nav-stacked">
|
||||||
@menuitem("" ,"files" ,"Files", "code")
|
@menuitem("", "files", "Files", "code")
|
||||||
@if(repository.commitCount != 0) {
|
@if(repository.commitCount != 0) {
|
||||||
@menuitem("/branches" ,"branches" ,"Branches", "git-branch", repository.branchList.length)
|
@menuitem("/branches", "branches", "Branches", "git-branch", repository.branchList.length)
|
||||||
@menuitem("/tags" ,"tags" ,"Tags", "tag", repository.tags.length)
|
@menuitem("/tags", "tags", "Tags", "tag", repository.tags.length)
|
||||||
|
}
|
||||||
|
@if(repository.repository.enableIssues) {
|
||||||
|
@menuitem("/issues", "issues", "Issues", "issue-opened", repository.issueCount)
|
||||||
|
@menuitem("/pulls", "pulls", "Pull Requests", "git-pull-request", repository.pullCount)
|
||||||
|
@menuitem("/issues/labels", "labels", "Labels", "tag")
|
||||||
|
@menuitem("/issues/milestones", "milestones", "Milestones", "milestone")
|
||||||
|
} else {
|
||||||
|
@repository.repository.externalIssuesUrl.map { externalIssuesUrl =>
|
||||||
|
@menuitem(externalIssuesUrl, "issues", "Issues", "issue-opened")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@if(repository.repository.enableWiki) {
|
||||||
|
@menuitem("/wiki", "wiki", "Wiki", "book")
|
||||||
|
} else {
|
||||||
|
@repository.repository.externalWikiUrl.map { externalWikiUrl =>
|
||||||
|
@menuitem(externalWikiUrl, "wiki", "Wiki", "book")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@menuitem("/issues" ,"issues" ,"Issues", "issue-opened", repository.issueCount)
|
|
||||||
@menuitem("/pulls" ,"pulls" ,"Pull Requests", "git-pull-request", repository.pullCount)
|
|
||||||
@menuitem("/issues/labels" ,"labels" ,"Labels", "tag")
|
|
||||||
@menuitem("/issues/milestones" ,"milestones" ,"Milestones", "milestone")
|
|
||||||
@menuitem("/wiki" ,"wiki" ,"Wiki", "book")
|
|
||||||
@menuitem("/network/members", "fork", "Forks", "repo-forked", repository.forkedCount)
|
@menuitem("/network/members", "fork", "Forks", "repo-forked", repository.forkedCount)
|
||||||
@if(loginAccount.isDefined && (loginAccount.get.isAdmin || repository.managers.contains(loginAccount.get.userName))){
|
@if(loginAccount.isDefined && (loginAccount.get.isAdmin || repository.managers.contains(loginAccount.get.userName))){
|
||||||
@menuitem("/settings" , "settings" , "Settings", "tools")
|
@menuitem("/settings", "settings", "Settings", "tools")
|
||||||
}
|
}
|
||||||
@gitbucket.core.plugin.PluginRegistry().getRepositoryMenus.map { menu =>
|
@gitbucket.core.plugin.PluginRegistry().getRepositoryMenus.map { menu =>
|
||||||
@menu(repository, context).map { link =>
|
@menu(repository, context).map { link =>
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
@html.menu("settings", repository){
|
@html.menu("settings", repository){
|
||||||
@menu("options", repository){
|
@menu("options", repository){
|
||||||
@helper.html.information(info)
|
@helper.html.information(info)
|
||||||
<form id="form" method="post" action="@url(repository)/settings/options" validate="true">
|
<form id="form" method="post" action="@url(repository)/settings/options" validate="true" style="overflow: hidden;">
|
||||||
<div class="panel panel-default" style="overflow: hidden;">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading strong">Settings</div>
|
<div class="panel-heading strong">Settings</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<fieldset class="form-group">
|
<fieldset class="form-group">
|
||||||
@@ -42,6 +42,35 @@
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading strong">Features</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<fieldset class="form-group">
|
||||||
|
<label class="checkbox" for="enableIssues">
|
||||||
|
<input type="checkbox" id="enableIssues" name="enableIssues"@if(repository.repository.enableIssues){ checked}/>
|
||||||
|
Issues<br>
|
||||||
|
<div class="normal muted">
|
||||||
|
Provides Lightweight issue tracking integrated with this repository. Add issues to milestones, label issues, and close & reference issues from commit messages.
|
||||||
|
If you use external issue tracking system, turn off the checkbox above and put that URL into the following box:
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
<label for="externalIssuesUrl" class="strong">External URL:</label>
|
||||||
|
<input type="text" class="form-control" id="externalIssuesUrl" name="externalIssuesUrl" value="@repository.repository.externalIssuesUrl"/>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset class="form-group margin">
|
||||||
|
<label class="checkbox" for="enableWiki">
|
||||||
|
<input type="checkbox" id="enableWiki" name="enableWiki"@if(repository.repository.enableWiki){ checked}/>
|
||||||
|
Wiki<br>
|
||||||
|
<div class="normal muted">
|
||||||
|
Provides a simple solution to manage documents. All users who can look this repository can read and collaborators can edit pages.
|
||||||
|
If you have documents at the outside of GitBucket, turn off the checkbox above and put that URL into the following box:
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
<label for="externalWikiUrl" class="strong">External URL:</label>
|
||||||
|
<input type="text" class="form-control" id="externalWikiUrl" name="externalWikiUrl" value="@repository.repository.externalWikiUrl"/>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="align-right" style="margin-top: 20px;">
|
<div class="align-right" style="margin-top: 20px;">
|
||||||
<input type="submit" class="btn btn-success" value="Apply changes"/>
|
<input type="submit" class="btn btn-success" value="Apply changes"/>
|
||||||
</div>
|
</div>
|
||||||
@@ -49,3 +78,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
<script>
|
||||||
|
$(function(){
|
||||||
|
updateFeatures();
|
||||||
|
|
||||||
|
$('#enableIssues, #enableWiki').click(function(){
|
||||||
|
updateFeatures();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function updateFeatures() {
|
||||||
|
$('#externalIssuesUrl').prop('disabled', $('#enableIssues').prop('checked'));
|
||||||
|
$('#externalWikiUrl').prop('disabled', $('#enableWiki').prop('checked'));
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user