diff --git a/storyboard/projects/templates/projects.list_tasks.html b/storyboard/projects/templates/projects.list_tasks.html index b6ef0b3b..41c05df1 100644 --- a/storyboard/projects/templates/projects.list_tasks.html +++ b/storyboard/projects/templates/projects.list_tasks.html @@ -7,11 +7,11 @@ + - - +{% if is_bug %}{% endif %} @@ -19,12 +19,12 @@ {% for task in tasks %} - - + + - +{% if is_bug %}{% endif %} diff --git a/storyboard/projects/templates/projects.project.html b/storyboard/projects/templates/projects.project.html index b84dbd12..230ac777 100644 --- a/storyboard/projects/templates/projects.project.html +++ b/storyboard/projects/templates/projects.project.html @@ -7,16 +7,17 @@
  • List bug tasks
  • Triage bugs -{% if triagecount > 0 %} -{{ triagecount }}{% endif %}
  • -
  • Report new bug
  • +{% if bugtriagecount > 0 %} +{{ bugtriagecount }}{% endif %} +
  • Report new bug
  • -
  • List feature tasks
  • -
  • Propose new feature
  • +
  • List feature tasks
  • +
  • Propose new feature
  • {% endblock %} {% block modals %} -{% include "stories.modal_addstory.html" with project=project.name %} +{% include "stories.modal_addstory.html" with project=project.name story_type='bug' %} +{% include "stories.modal_addstory.html" with project=project.name story_type='feature' %} {% endblock %} diff --git a/storyboard/projects/urls.py b/storyboard/projects/urls.py index db72bfea..3d37cb61 100644 --- a/storyboard/projects/urls.py +++ b/storyboard/projects/urls.py @@ -20,5 +20,6 @@ urlpatterns = patterns('storyboard.projects.views', (r'^$', 'default_list'), (r'^(\S+)/bugs/triage$', 'list_bugtriage'), (r'^(\S+)/bugs$', 'list_bugtasks'), + (r'^(\S+)/features$', 'list_featuretasks'), (r'^(\S+)$', 'dashboard'), ) diff --git a/storyboard/projects/views.py b/storyboard/projects/views.py index 1b3a75c9..8c35af9a 100644 --- a/storyboard/projects/views.py +++ b/storyboard/projects/views.py @@ -27,31 +27,59 @@ def default_list(request): def dashboard(request, projectname): project = Project.objects.get(name=projectname) - count = Task.objects.filter(project=project, story__priority=0).count() + bugcount = Task.objects.filter(project=project, + story__is_bug=True, + story__priority=0).count() return render(request, "projects.dashboard.html", { 'project': project, - 'triagecount': count, + 'bugtriagecount': bugcount, + }) + + +def list_featuretasks(request, projectname): + project = Project.objects.get(name=projectname) + bugcount = Task.objects.filter(project=project, + story__is_bug=True, + story__priority=0).count() + featuretasks = Task.objects.filter(project=project, + story__is_bug=False, + status__in=['T', 'R']) + return render(request, "projects.list_tasks.html", { + 'title': "Active feature tasks", + 'project': project, + 'bugtriagecount': bugcount, + 'tasks': featuretasks, + 'is_bug': False, }) def list_bugtasks(request, projectname): project = Project.objects.get(name=projectname) - count = Task.objects.filter(project=project, story__priority=0).count() + bugcount = Task.objects.filter(project=project, + story__is_bug=True, + story__priority=0).count() + bugtasks = Task.objects.filter(project=project, + story__is_bug=True, + status__in=['T', 'R']) return render(request, "projects.list_tasks.html", { 'title': "Active bug tasks", 'project': project, - 'triagecount': count, - 'tasks': Task.objects.filter(project=project, status__in=['T', 'R']), + 'bugtriagecount': bugcount, + 'tasks': bugtasks, + 'is_bug': True, }) def list_bugtriage(request, projectname): project = Project.objects.get(name=projectname) - tasks = Task.objects.filter(project=project, story__priority=0) - count = tasks.count() + tasks = Task.objects.filter(project=project, + story__is_bug=True, + story__priority=0) + bugcount = tasks.count() return render(request, "projects.list_tasks.html", { 'title': "Bugs needing triage", 'project': project, - 'triagecount': count, - 'tasks': Task.objects.filter(project=project, story__priority=0), + 'bugtriagecount': bugcount, + 'tasks': tasks, + 'is_bug': True, }) diff --git a/storyboard/stories/models.py b/storyboard/stories/models.py index e4537c62..2e09c3e5 100644 --- a/storyboard/stories/models.py +++ b/storyboard/stories/models.py @@ -21,10 +21,6 @@ from storyboard.projects.models import Project class Story(models.Model): - STORY_TYPES = ( - ('B', 'Bug'), - ('F', 'Feature'), - ) STORY_PRIORITIES = ( (4, 'Critical'), (3, 'High'), @@ -35,7 +31,7 @@ class Story(models.Model): creator = models.ForeignKey(User) title = models.CharField(max_length=100) description = models.TextField() - story_type = models.CharField(max_length=1, choices=STORY_TYPES) + is_bug = models.BooleanField(default=True) priority = models.IntegerField(choices=STORY_PRIORITIES) def __unicode__(self): diff --git a/storyboard/stories/templates/stories.base.html b/storyboard/stories/templates/stories.base.html index 9439df3c..be8abbfe 100644 --- a/storyboard/stories/templates/stories.base.html +++ b/storyboard/stories/templates/stories.base.html @@ -5,8 +5,8 @@ - + - @@ -21,9 +20,26 @@ - + +{% endfor %} + +
    Priority # StoryPriority TaskBranchBranchAssignee Milestone
    {{ task.story.id }}{{ task.story.title }} {{ task.story.get_priority_display }}{{ task.story.id }}{{ task.story.title }} {{ task.title }}{{ task.milestone.branch.name }}{{ task.milestone.branch.name }}{{ task.assignee.username }} {% if not task.milestone.undefined %}{{ task.milestone.name }}{% endif %}
    #StoryBug PriorityAffects
    {{ story.title }} {{ story.get_priority_display }} - {% for task in story.task_set.all %}{% if not forloop.first %}, {% endif %}{{ task.project.name }}{% endfor %} -
    +
    Recent features
    + + + + + + + + + +{% for story in recent_features %} + + + + {% endfor %} diff --git a/storyboard/stories/templates/stories.modal_addstory.html b/storyboard/stories/templates/stories.modal_addstory.html index c2bea91d..db99759f 100644 --- a/storyboard/stories/templates/stories.modal_addstory.html +++ b/storyboard/stories/templates/stories.modal_addstory.html @@ -1,8 +1,8 @@ {% csrf_token %} - diff --git a/storyboard/stories/templates/stories.modal_addtask.html b/storyboard/stories/templates/stories.modal_addtask.html index c4d8cd83..eaf535ee 100644 --- a/storyboard/stories/templates/stories.modal_addtask.html +++ b/storyboard/stories/templates/stories.modal_addtask.html @@ -14,8 +14,9 @@ +{% if story.is_bug %} -{% regroup milestones by branch as branch_list %} + {% regroup milestones by branch as branch_list %}
    {% for branch in branch_list %}
    @@ -33,7 +34,23 @@
    {% endfor %}
    - +{% else %} + +
    + {% for milestone in milestones %} + {% if milestone.branch.status == 'M' %} + {% if milestone.undefined %} + + {% else %} + + {% endif %} + {% endif %} + {% endfor %} +
    +{% endif %} + diff --git a/storyboard/stories/templates/stories.modal_edittask.html b/storyboard/stories/templates/stories.modal_edittask.html index 96cf5633..51d024ab 100644 --- a/storyboard/stories/templates/stories.modal_edittask.html +++ b/storyboard/stories/templates/stories.modal_edittask.html @@ -4,8 +4,9 @@ {% csrf_token %} +{% if story.is_bug %} +{% endif %} @@ -44,7 +47,9 @@ +{% if story.is_bug %} +{% endif %} diff --git a/storyboard/stories/utils.py b/storyboard/stories/utils.py new file mode 100644 index 00000000..83dcd8d3 --- /dev/null +++ b/storyboard/stories/utils.py @@ -0,0 +1,22 @@ +# Copyright 2013 Thierry Carrez +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +def format_taskname(task): + if not task.story.is_bug: + if not task.title: + return task.project.name + return "%s (%s)" % (task.project.name, task.title) + return "%s (%s)" % (task.project.name, task.milestone.branch.short_name) diff --git a/storyboard/stories/views.py b/storyboard/stories/views.py index 67fbd28a..1c328f54 100644 --- a/storyboard/stories/views.py +++ b/storyboard/stories/views.py @@ -25,12 +25,15 @@ from storyboard.stories.models import Comment from storyboard.stories.models import Story from storyboard.stories.models import StoryTag from storyboard.stories.models import Task +from storyboard.stories.utils import format_taskname def dashboard(request): - recent_bugs = Story.objects.order_by("-id")[:5] + recent_bugs = Story.objects.filter(is_bug=True).order_by("-id")[:5] + recent_features = Story.objects.filter(is_bug=False).order_by("-id")[:5] return render(request, "stories.dashboard.html", { 'recent_bugs': recent_bugs, + 'recent_features': recent_features, }) @@ -89,6 +92,7 @@ def add_story(request): title=request.POST['title'], description=request.POST['description'], creator=request.user, + is_bug=bool(request.POST['story_type']), priority=0, ) newstory.save() @@ -128,9 +132,10 @@ def add_task(request, storyid): story = Story.objects.get(id=storyid) try: if request.POST['project']: + milestone = None if request.POST['milestone']: milestone = Milestone.objects.get(id=request.POST['milestone']) - else: + if not milestone or milestone.branch.status != 'M': milestone = Milestone.objects.get(branch__status='M', undefined=True) newtask = Task( @@ -140,8 +145,7 @@ def add_task(request, storyid): milestone=milestone, ) newtask.save() - msg = "Added %s/%s task " % ( - newtask.project.name, newtask.milestone.branch.short_name) + msg = "Added %s task " % format_taskname(newtask) newcomment = Comment(story=story, action=msg, author=request.user, @@ -181,8 +185,7 @@ def edit_task(request, taskid): actions.append("assignee -> %s" % assigneename) task.assignee = assignee if actions: - msg = "Updated %s/%s task " % (task.project.name, - task.milestone.branch.short_name) + msg = "Updated %s task " % format_taskname(task) msg += ", ".join(actions) task.save() newcomment = Comment(story=task.story, @@ -201,8 +204,7 @@ def edit_task(request, taskid): def delete_task(request, taskid): task = Task.objects.get(id=taskid) task.delete() - msg = "Deleted %s/%s task" % (task.project.name, - task.milestone.branch.short_name) + msg = "Deleted %s task" % format_taskname(task) newcomment = Comment(story=task.story, action=msg, author=request.user,
    #FeaturePriority
    {{ story.id }}{{ story.title }} + {{ story.get_priority_display }}
    Task ProjectBranchAssignee Status Milestone
    {{ task.title }} {{ task.project.title }}{{ task.milestone.branch.name }}{{ task.assignee.username }} {{ task.get_status_display }} {% if not task.milestone.undefined %}{{ task.milestone.name }}{% endif %}