Commit 3d0fe1ea authored by Christian Wulf's avatar Christian Wulf

added different colors for assigned and unassigned user stories

parent 939a6966
......@@ -10,6 +10,7 @@ modules = {
resource url:'/less/main.less'
resource url:'/less/elements.less'
resource url: '/less/backlogs.less'
resource url:'/css/dummy.css'
}
......
......@@ -38,7 +38,7 @@ class BootStrap {
fmcockpit.setProductBacklog(createBacklog(ffi))
fmcockpit.addToSprints(createSprint(ffi))
fmcockpit.addToSprints(createSprint(ffi, fmcockpit.productBacklog))
fmcockpit.save(failOnError: true)
}
......@@ -53,14 +53,12 @@ class BootStrap {
userStoryInBacklog.points = 3
userStoryInBacklog.color = new Color(250,60,0)
userStoryInBacklog.save(failOnError: true)
productBacklog.addToUserstories(userStoryInBacklog)
productBacklog
}
private Sprint createSprint(User ffi) {
private Sprint createSprint(User ffi, productBacklog) {
def sprintOne = new Sprint("Sprint 1")
sprintOne.due_date = new Date()
......@@ -73,7 +71,9 @@ class BootStrap {
userStoryInSprint.status = UserStoryStatus.OPEN
userStoryInSprint.color = new Color(250,180,0)
userStoryInSprint.save(failOnError: true)
productBacklog.addToUserstories(userStoryInSprint)
// def userStoryInSprint = productBacklog.userstories.find { it.shortId == "V-2" }
sprintOne.addToUserstories(userStoryInSprint)
......
......@@ -4,7 +4,13 @@ class UserStoryController {
def show(int id) {
def userStory = UserStory.get(id)
render ( template:"showUserStory", model: [userStory : userStory])
def storyPointMapping = userStory.project.storyPointMapping.entrySet()
render ( template:"showUserStory", model: [userStory : userStory, storyPointMapping: storyPointMapping])
}
def create(id) {
def userStory = new UserStory(params)
userStory.save()
}
def move(int id, String to) {
......@@ -17,11 +23,13 @@ class UserStoryController {
backlog.removeFromUserstories(userStory)
sprint.addToUserstories(userStory)
userStory.status = UserStoryStatus.OPEN
userStory.assignedToSprint = sprint
}
if (to == "backlog") {
sprint.removeFromUserstories(userStory)
backlog.addToUserstories(userStory)
userStory.status = UserStoryStatus.IN_BACKLOG
userStory.assignedToSprint = null
}
if (to == "opensprint") {
......
......@@ -3,6 +3,7 @@ package scrumboard
class Project {
String name
ProductBacklog productBacklog
List storyPointMapping = ["1 Tag", "2-3 Tage", "1 Woche", "2 Wochen", "Mehr als 2 Wochen"]
static hasMany = [ sprints: Sprint ]
......
......@@ -18,7 +18,11 @@ class UserStory implements Comparable {
User author
User editor
Sprint assignedToSprint
static belongsTo = [productBacklog: ProductBacklog]
static constraints = {
assignedToSprint nullable: true
}
UserStory(String shortId, String title) {
......
package scrumboard
import scrumboard.UserStoryStatus
class NoteTagLib {
def note = { attrs ->
def userStories = attrs["userStories"]
def productBacklog = attrs["productBacklog"] ?: false
if (attrs["status"]) {
userStories = userStories.findAll {
......@@ -10,14 +13,33 @@ class NoteTagLib {
}
}
userStories.eachWithIndex { item, index ->
userStories.eachWithIndex { UserStory item, index ->
if (index % attrs["columnlength"].toInteger() == attrs["columnindex"].toInteger()) {
def colorClass = determineColor(item, productBacklog)
out << """<div class='ui-widget ui-corner-all'>
<div class='hidden'>${item.id}</div>
<div class='ui-widget-header ui-corner-top'>${item}</div>
<div class='ui-widget-header ui-corner-top ${colorClass}'>${item}</div>
<div class='ui-widget-content ui-corner-bottom' >${item.getShortDescription()}</div>
</div> """
}
}
}
private determineColor(UserStory userStory, productBacklog) {
if (productBacklog) {
if (!userStory.assignedToSprint) {
return "notAssignedToSprint"
} else {
return "assignedToSprint"
}
} else {
switch (userStory.status) {
case UserStoryStatus.IN_BACKLOG: return "";
case UserStoryStatus.OPEN: return "";
case UserStoryStatus.IN_PROGRESS: return "";
case UserStoryStatus.DONE: return "";
default: return "";
}
}
}
}
......@@ -21,19 +21,19 @@
<div id="backlog">
<div id="columnbacklogone" class="column">
<g:note userStories="${backlogUserStories}" columnindex="0" columnlength="4" />
<g:note userStories="${backlogUserStories}" columnindex="0" columnlength="4" productBacklog="true" />
</div>
<div id="columnbacklogtwo" class="column">
<g:note userStories="${backlogUserStories}" columnindex="1" columnlength="4" />
<g:note userStories="${backlogUserStories}" columnindex="1" columnlength="4" productBacklog="true" />
</div>
<div id="columnbacklogthree" class="column">
<g:note userStories="${backlogUserStories}" columnindex="2" columnlength="4" />
<g:note userStories="${backlogUserStories}" columnindex="2" columnlength="4" productBacklog="true" />
</div>
<div id="columnbacklogfour" class="column">
<g:note userStories="${backlogUserStories}" columnindex="3" columnlength="4" />
<g:note userStories="${backlogUserStories}" columnindex="3" columnlength="4" productBacklog="true" />
</div>
</div>
......@@ -112,6 +112,10 @@ $(function() {
$( "#dialog-addSprint" ).dialog( "open" );
});
$( "#AddUserStory" ).click(function() {
$( "#dialog-addSprint" ).dialog( "open" );
});
});
</script>
......
<table>
<tbody>
<tr>
<td>Title:</td>
<td><input name="title"></td>
</tr>
<tr>
<td>Description:</td>
<td><input name="description"></td>
</tr>
<tr>
<td>Points:</td>
<td><g:select name="points" from="${storyPointMapping }" optionKey="key" optionValue="value" value="${storyPointMapping.1 }" /></td>
</tr>
<tr>
<td>Status:</td>
<td>${UserStoryStatus.IN_BACKLOG}</td>
</tr>
<tr>
<td>Author:</td>
<td>
<input name="author" value="${SecurityUtils.subject.name }">
</td>
</tr>
<tr>
<td>Editor:</td>
<td>
<input name="editor" value="${SecurityUtils.subject.name }">
</td>
</tr>
<tbody>
</table>
\ No newline at end of file
.assignedToSprint {
background-color: #90F790;
}
.notAssignedToSprint {
background-color: grey;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment