diff --git a/src/main/resources/update/gitbucket-core_4.14.xml b/src/main/resources/update/gitbucket-core_4.14.xml index 3a6d785..9ccdd7f 100644 --- a/src/main/resources/update/gitbucket-core_4.14.xml +++ b/src/main/resources/update/gitbucket-core_4.14.xml @@ -5,6 +5,7 @@ + diff --git a/src/main/scala/gitbucket/core/controller/PrioritiesController.scala b/src/main/scala/gitbucket/core/controller/PrioritiesController.scala index 4e11f59..efda0d4 100644 --- a/src/main/scala/gitbucket/core/controller/PrioritiesController.scala +++ b/src/main/scala/gitbucket/core/controller/PrioritiesController.scala @@ -16,10 +16,11 @@ self: PrioritiesService with IssuesService with RepositoryService with ReferrerAuthenticator with WritableUsersAuthenticator => - case class PriorityForm(priorityName: String, color: String) + case class PriorityForm(priorityName: String, description: String, color: String) val priorityForm = mapping( "priorityName" -> trim(label("Priority name", text(required, priorityName, uniquePriorityName, maxlength(100)))), + "description" -> trim(label("Description", text(required, maxlength(255)))), "priorityColor" -> trim(label("Color", text(required, color))) )(PriorityForm.apply) @@ -37,7 +38,7 @@ }) ajaxPost("/:owner/:repository/issues/priorities/new", priorityForm)(writableUsersOnly { (form, repository) => - val priorityId = createPriority(repository.owner, repository.name, form.priorityName, form.color.substring(1)) + val priorityId = createPriority(repository.owner, repository.name, form.priorityName, form.description, form.color.substring(1)) html.priority( getPriority(repository.owner, repository.name, priorityId).get, countIssueGroupByPriorities(repository.owner, repository.name, IssuesService.IssueSearchCondition(), Map.empty), @@ -52,7 +53,7 @@ }) ajaxPost("/:owner/:repository/issues/priorities/:priorityId/edit", priorityForm)(writableUsersOnly { (form, repository) => - updatePriority(repository.owner, repository.name, params("priorityId").toInt, form.priorityName, form.color.substring(1)) + updatePriority(repository.owner, repository.name, params("priorityId").toInt, form.priorityName, form.description, form.color.substring(1)) html.priority( getPriority(repository.owner, repository.name, params("priorityId").toInt).get, countIssueGroupByPriorities(repository.owner, repository.name, IssuesService.IssueSearchCondition(), Map.empty), diff --git a/src/main/scala/gitbucket/core/model/Priorities.scala b/src/main/scala/gitbucket/core/model/Priorities.scala index a585079..8735f86 100644 --- a/src/main/scala/gitbucket/core/model/Priorities.scala +++ b/src/main/scala/gitbucket/core/model/Priorities.scala @@ -8,9 +8,10 @@ class Priorities(tag: Tag) extends Table[Priority](tag, "PRIORITY") with PriorityTemplate { override val priorityId = column[Int]("PRIORITY_ID", O AutoInc) override val priorityName = column[String]("PRIORITY_NAME") + val description = column[String]("DESCRIPTION") val ordering = column[Int]("ORDERING") val color = column[String]("COLOR") - def * = (userName, repositoryName, priorityId, priorityName, ordering, color) <> (Priority.tupled, Priority.unapply) + def * = (userName, repositoryName, priorityId, priorityName, description, 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) @@ -22,6 +23,7 @@ repositoryName: String, priorityId: Int = 0, priorityName: String, + description: String, ordering: Int = 0, color: String){ diff --git a/src/main/scala/gitbucket/core/service/PrioritiesService.scala b/src/main/scala/gitbucket/core/service/PrioritiesService.scala index 7752adf..f0a7738 100644 --- a/src/main/scala/gitbucket/core/service/PrioritiesService.scala +++ b/src/main/scala/gitbucket/core/service/PrioritiesService.scala @@ -15,7 +15,7 @@ def getPriority(owner: String, repository: String, priorityName: String)(implicit s: Session): Option[Priority] = Priorities.filter(_.byPriority(owner, repository, priorityName)).firstOption - def createPriority(owner: String, repository: String, priorityName: String, color: String)(implicit s: Session): Int = { + def createPriority(owner: String, repository: String, priorityName: String, description: String, color: String)(implicit s: Session): Int = { val ordering = Priorities.filter(_.byRepository(owner, repository)) .list .map(p => p.ordering) @@ -27,16 +27,17 @@ userName = owner, repositoryName = repository, priorityName = priorityName, + description = description, ordering = ordering, color = color ) } - def updatePriority(owner: String, repository: String, priorityId: Int, priorityName: String, color: String) + 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.color)) - .update(priorityName, color) + .map(t => (t.priorityName, t.description, t.color)) + .update(priorityName, description, color) def reorderPriorities(owner: String, repository: String, order: Map[Int, Int]) (implicit s: Session): Unit = { diff --git a/src/main/scala/gitbucket/core/service/RepositoryCreationService.scala b/src/main/scala/gitbucket/core/service/RepositoryCreationService.scala index ef426f8..d744aee 100644 --- a/src/main/scala/gitbucket/core/service/RepositoryCreationService.scala +++ b/src/main/scala/gitbucket/core/service/RepositoryCreationService.scala @@ -78,8 +78,8 @@ } def insertDefaultPriorities(userName: String, repositoryName: String)(implicit s: Session): Unit = { - createPriority(userName, repositoryName, "high", "fc2929") - createPriority(userName, repositoryName, "medium", "fcc629") - createPriority(userName, repositoryName, "low", "acacac") + createPriority(userName, repositoryName, "high", "high", "fc2929") + createPriority(userName, repositoryName, "medium", "medium", "fcc629") + createPriority(userName, repositoryName, "low", "low", "acacac") } } diff --git a/src/main/twirl/gitbucket/core/issues/issueinfo.scala.html b/src/main/twirl/gitbucket/core/issues/issueinfo.scala.html index 5bc9507..27ff12b 100644 --- a/src/main/twirl/gitbucket/core/issues/issueinfo.scala.html +++ b/src/main/twirl/gitbucket/core/issues/issueinfo.scala.html @@ -42,7 +42,7 @@
  • Clear priority
  • @priorities.map { priority =>
  • - + @gitbucket.core.helper.html.checkicon(issue.flatMap(is => is.priorityId).map(id => id == priority.priorityId).getOrElse(false))   @priority.priorityName @@ -56,7 +56,7 @@ @issue.flatMap(_.priorityId).map { priorityId => @priorities.collect { case priority if(priority.priorityId == priorityId) => - @priority.priorityName + @priority.priorityName } }.getOrElse { No priority @@ -190,12 +190,13 @@ $('a.priority').click(function(){ var priorityName = $(this).data('name'); var priorityId = $(this).data('id'); + var description = $(this).attr('title'); var color = $(this).data('color'); var fontColor = $(this).data('font-color'); $.post('@helpers.url(repository)/issues/@issue.issueId/priority', { priorityId: priorityId }, function(data){ - displayPriority(priorityName, priorityId, color, fontColor); + displayPriority(priorityName, priorityId, description, color, fontColor); } ); }); @@ -239,9 +240,10 @@ $('a.priority').click(function(){ var priorityName = $(this).data('name'); var priorityId = $(this).data('id'); + var description = $(this).attr('title'); var color = $(this).data('color'); var fontColor = $(this).data('font-color'); - displayPriority(priorityName, priorityId, color, fontColor); + displayPriority(priorityName, priorityId, description, color, fontColor); $('input[name=priorityId]').val(priorityId); }); @@ -279,13 +281,14 @@ } } - function displayPriority(priorityName, priorityId, color, fontColor){ + function displayPriority(priorityName, priorityId, description, color, fontColor){ $('a.priority i.octicon-check').removeClass('octicon-check'); if(priorityId == ''){ $('#label-priority').html($('').text('No priority')); } else { $('#label-priority').html($('').text(priorityName) .attr('href', '@helpers.url(repository)/issues?priority=' + encodeURIComponent(priorityName) + '&state=open') + .attr('title', description) .css({ "background-color": color, "color": fontColor diff --git a/src/main/twirl/gitbucket/core/issues/listparts.scala.html b/src/main/twirl/gitbucket/core/issues/listparts.scala.html index df2affa..f083189 100644 --- a/src/main/twirl/gitbucket/core/issues/listparts.scala.html +++ b/src/main/twirl/gitbucket/core/issues/listparts.scala.html @@ -57,7 +57,7 @@
  • @priorities.map { priority =>
  • - + @gitbucket.core.helper.html.checkicon(condition.priority == Some(Some(priority.priorityName)))    @priority.priorityName @@ -157,7 +157,7 @@ @gitbucket.core.helper.html.dropdown("Priority", filter = ("priority", "Find Priority...")) {
  • No priority
  • @priorities.map { priority => -
  • +
  •   @priority.priorityName
  • } @@ -244,7 +244,7 @@
    #@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 => - + @priority.priorityName } @milestone.map { milestone => diff --git a/src/main/twirl/gitbucket/core/issues/priorities/edit.scala.html b/src/main/twirl/gitbucket/core/issues/priorities/edit.scala.html index d3c49b7..b3dd075 100644 --- a/src/main/twirl/gitbucket/core/issues/priorities/edit.scala.html +++ b/src/main/twirl/gitbucket/core/issues/priorities/edit.scala.html @@ -12,6 +12,7 @@ + @@ -24,6 +25,7 @@ $('#submit-@priorityId').click(function(e){ $.post('@helpers.url(repository)/issues/priorities/@{if(priorityId == "new") "new" else priorityId + "/edit"}', { 'priorityName' : $('#priorityName-@priorityId').val(), + 'description' : $('#description-@priorityId').val(), 'priorityColor': $('#priorityColor-@priorityId').val() }, function(data, status){ $('div#edit-priority-area-@priorityId').remove(); diff --git a/src/main/twirl/gitbucket/core/issues/priorities/priority.scala.html b/src/main/twirl/gitbucket/core/issues/priorities/priority.scala.html index ea71bee..905f369 100644 --- a/src/main/twirl/gitbucket/core/issues/priorities/priority.scala.html +++ b/src/main/twirl/gitbucket/core/issues/priorities/priority.scala.html @@ -6,19 +6,21 @@
    -
    + +
    + @priority.description +
    @counts.get(priority.priorityName).getOrElse(0) open issues