mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-08 14:35:52 +01:00
Priority description is now optional.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<column name="REPOSITORY_NAME" type="varchar(100)" nullable="false"/>
|
||||
<column name="PRIORITY_ID" type="int" nullable="false" autoIncrement="true" unique="true"/>
|
||||
<column name="PRIORITY_NAME" type="varchar(100)" nullable="false"/>
|
||||
<column name="DESCRIPTION" type="varchar(255)" nullable="false"/>
|
||||
<column name="DESCRIPTION" type="varchar(255)" nullable="true"/>
|
||||
<column name="ORDERING" type="int" nullable="false"/>
|
||||
<column name="IS_DEFAULT" type="boolean" nullable="false"/>
|
||||
<column name="COLOR" type="char(6)" nullable="false"/>
|
||||
|
||||
@@ -20,7 +20,7 @@ trait PrioritiesControllerBase extends ControllerBase {
|
||||
|
||||
val priorityForm = mapping(
|
||||
"priorityName" -> trim(label("Priority name", text(required, priorityName, uniquePriorityName, maxlength(100)))),
|
||||
"description" -> trim(label("Description", text(required, maxlength(255)))),
|
||||
"description" -> trim(label("Description", text(maxlength(255)))),
|
||||
"priorityColor" -> trim(label("Color", text(required, color)))
|
||||
)(PriorityForm.apply)
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ trait PriorityComponent extends TemplateComponent { self: Profile =>
|
||||
val ordering = column[Int]("ORDERING")
|
||||
val isDefault = column[Boolean]("IS_DEFAULT")
|
||||
val color = column[String]("COLOR")
|
||||
def * = (userName, repositoryName, priorityId, priorityName, description, isDefault, ordering, color) <> (Priority.tupled, Priority.unapply)
|
||||
def * = (userName, repositoryName, priorityId, priorityName, description.?, isDefault, ordering, color) <> (Priority.tupled, Priority.unapply)
|
||||
|
||||
def byPrimaryKey(owner: String, repository: String, priorityId: Int) = byPriority(owner, repository, priorityId)
|
||||
def byPrimaryKey(userName: Rep[String], repositoryName: Rep[String], priorityId: Rep[Int]) = byPriority(userName, repositoryName, priorityId)
|
||||
@@ -24,7 +24,7 @@ case class Priority (
|
||||
repositoryName: String,
|
||||
priorityId: Int = 0,
|
||||
priorityName: String,
|
||||
description: String,
|
||||
description: Option[String],
|
||||
isDefault: Boolean,
|
||||
ordering: Int = 0,
|
||||
color: String){
|
||||
|
||||
@@ -3,6 +3,7 @@ package gitbucket.core.service
|
||||
import gitbucket.core.model.Priority
|
||||
import gitbucket.core.model.Profile._
|
||||
import gitbucket.core.model.Profile.profile.blockingApi._
|
||||
import gitbucket.core.util.StringUtil
|
||||
|
||||
trait PrioritiesService {
|
||||
|
||||
@@ -29,7 +30,7 @@ trait PrioritiesService {
|
||||
userName = owner,
|
||||
repositoryName = repository,
|
||||
priorityName = priorityName,
|
||||
description = description,
|
||||
description = StringUtil.emptyToNone(description),
|
||||
isDefault = isDefault,
|
||||
ordering = ordering,
|
||||
color = color
|
||||
@@ -39,8 +40,8 @@ trait PrioritiesService {
|
||||
def updatePriority(owner: String, repository: String, priorityId: Int, priorityName: String, description: String, color: String)
|
||||
(implicit s: Session): Unit =
|
||||
Priorities.filter(_.byPrimaryKey(owner, repository, priorityId))
|
||||
.map(t => (t.priorityName, t.description, t.color))
|
||||
.update(priorityName, description, color)
|
||||
.map(t => (t.priorityName, t.description.?, t.color))
|
||||
.update(priorityName, StringUtil.emptyToNone(description), color)
|
||||
|
||||
def reorderPriorities(owner: String, repository: String, order: Map[Int, Int])
|
||||
(implicit s: Session): Unit = {
|
||||
|
||||
@@ -137,5 +137,5 @@ object StringUtil {
|
||||
// b.toString
|
||||
// }
|
||||
|
||||
|
||||
def emptyToNone(str: String): Option[String] = Option(str).map(_.trim).flatMap(s => if (s.isEmpty) None else Some(s));
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<li><a href="javascript:void(0);" class="priority" data-id=""><i class="octicon octicon-x"></i> Clear priority</a></li>
|
||||
@priorities.map { priority =>
|
||||
<li>
|
||||
<a href="javascript:void(0);" class="priority" data-id="@priority.priorityId" data-name="@priority.priorityName" data-color="#@priority.color" data-font-color="#@priority.fontColor" title="@priority.description">
|
||||
<a href="javascript:void(0);" class="priority" data-id="@priority.priorityId" data-name="@priority.priorityName" data-color="#@priority.color" data-font-color="#@priority.fontColor"@if(!priority.description.isEmpty) { title="@priority.description.get" }>
|
||||
@gitbucket.core.helper.html.checkicon(issue.flatMap(_.priorityId).orElse(defaultPriority.map(_.priorityId)).map(id => id == priority.priorityId).getOrElse(false))
|
||||
<span class="label" style="background-color: #@priority.color;"> </span>
|
||||
@priority.priorityName
|
||||
@@ -57,7 +57,7 @@
|
||||
<span id="label-priority">
|
||||
@issue.flatMap(_.priorityId).orElse(defaultPriority.map(_.priorityId)).map { priorityId =>
|
||||
@priorities.collect { case priority if(priority.priorityId == priorityId) =>
|
||||
<a class="issue-priority" style="background-color: #@priority.color; color: #@priority.fontColor;" href="@helpers.url(repository)/issues?priority=@helpers.urlEncode(priority.priorityName)&state=open" title="@priority.description">@priority.priorityName</a>
|
||||
<a class="issue-priority" style="background-color: #@priority.color; color: #@priority.fontColor;" href="@helpers.url(repository)/issues?priority=@helpers.urlEncode(priority.priorityName)&state=open"@if(!priority.description.isEmpty) { title="@priority.description.get" }>@priority.priorityName</a>
|
||||
}
|
||||
}.getOrElse {
|
||||
<span class="muted small">No priority</span>
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
</li>
|
||||
@priorities.map { priority =>
|
||||
<li>
|
||||
<a href="@condition.copy(priority = (if(condition.priority == Some(Some(priority.priorityName))) None else Some(Some(priority.priorityName)))).toURL" title="@priority.description">
|
||||
<a href="@condition.copy(priority = (if(condition.priority == Some(Some(priority.priorityName))) None else Some(Some(priority.priorityName)))).toURL"@if(!priority.description.isEmpty) { title="@priority.description.get" }>
|
||||
@gitbucket.core.helper.html.checkicon(condition.priority == Some(Some(priority.priorityName)))
|
||||
<span style="background-color: #@priority.color;" class="label-color"> </span>
|
||||
@priority.priorityName
|
||||
@@ -157,7 +157,7 @@
|
||||
@gitbucket.core.helper.html.dropdown("Priority", filter = ("priority", "Find Priority...")) {
|
||||
<li><a href="javascript:void(0);" class="toggle-priority" data-id="">No priority</a></li>
|
||||
@priorities.map { priority =>
|
||||
<li><a href="javascript:void(0);" class="toggle-priority" data-id="@priority.priorityId" title="@priority.description">
|
||||
<li><a href="javascript:void(0);" class="toggle-priority" data-id="@priority.priorityId"@if(!priority.description.isEmpty) { title="@priority.description.get" }>
|
||||
<span style="background-color: #@priority.color;" class="label"> </span>
|
||||
@priority.priorityName</a></li>
|
||||
}
|
||||
@@ -244,7 +244,7 @@
|
||||
<div class="small muted" style="margin-left: 12px; margin-top: 2px;">
|
||||
#@issue.issueId opened @gitbucket.core.helper.html.datetimeago(issue.registeredDate) by @helpers.user(issue.openedUserName, styleClass="username")
|
||||
@priority.map(priority => priorities.filter(p => p.priorityName == priority).head).map { priority =>
|
||||
<span style="margin: 20px;"><a href="@condition.copy(priority = Some(Some(priority.priorityName))).toURL" class="username" title="@priority.description"><i class="octicon octicon-flame"></i>
|
||||
<span style="margin: 20px;"><a href="@condition.copy(priority = Some(Some(priority.priorityName))).toURL" class="username"@if(!priority.description.isEmpty) { title="@priority.description.get" }><i class="octicon octicon-flame"></i>
|
||||
<span class="issue-priority issue-priority-inline" style="background-color: #@priority.color; color: #@priority.fontColor;">@priority.priorityName</span></a></span>
|
||||
}
|
||||
@milestone.map { milestone =>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<script>
|
||||
$('div#priority-color-@priorityId').colorpicker({format: "hex"});
|
||||
</script>
|
||||
<input type="text" id="description-@priorityId" style="width: 500px; float: left; margin-left: 4px;" class="form-control" value="@priority.map(_.description)" placeholder="Description..." />
|
||||
<input type="text" id="description-@priorityId" style="width: 500px; float: left; margin-left: 4px;" class="form-control" value="@priority.flatMap(_.description).getOrElse("")" placeholder="Description..." />
|
||||
<span class="pull-right">
|
||||
<span id="priority-error-@priorityId" class="error"></span>
|
||||
<input type="button" id="cancel-@priorityId" class="btn btn-default priority-edit-cancel" value="Cancel">
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="@if(hasWritePermission){col-md-6} else {col-md-8}">
|
||||
<span>@priority.description</span>
|
||||
<span>@priority.description.getOrElse("")</span>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="pull-right">
|
||||
|
||||
Reference in New Issue
Block a user