diff --git a/admin.py b/admin.py index ce655ac..fb7b755 100644 --- a/admin.py +++ b/admin.py @@ -26,7 +26,7 @@ class TaskAdmin(SimpleHistoryAdmin): class CommentAdmin(SimpleHistoryAdmin): - list_display = ('task', 'user', 'comment', ) + list_display = ('task', 'user', 'type', 'comment', ) history_list_display = ('comment', 'type', ) search_fields = ('comment', ) list_filter = ( diff --git a/forms.py b/forms.py index 3f1a710..492c140 100644 --- a/forms.py +++ b/forms.py @@ -103,7 +103,17 @@ class ProjectForm(forms.ModelForm): class CommentForm(forms.ModelForm): class Meta: model = Comment - fields = ['comment'] + fields = ['type', 'comment'] + + def __init__(self, *args, **kwargs): + try: + acc = kwargs.pop('acc') + except KeyError: + disable_type = True + else: + disable_type = not acc.modify_comment + super(forms.ModelForm, self).__init__(*args, **kwargs) + self.fields['type'].disabled = disable_type class TaskCommentForm(forms.ModelForm): diff --git a/models.py b/models.py index 7441d7e..a316650 100644 --- a/models.py +++ b/models.py @@ -136,7 +136,7 @@ class Project(models.Model): return (self.state, self.name) def __str__(self): - return 'Project: %s' % self.name + return 'Project #%d: %s' % (self.id, self.name) # TASK Model @@ -229,10 +229,7 @@ class Task(models.Model): return (100 - self.datafusion_state(), self.state, self.priority, td, self.progress, self.name) def __str__(self): - if self.project: - return 'Task: %s - %s' % (self.project.name, self.name) - else: - return 'Task: %s' % (self.name) + return 'Task #%d: %s' % (self.id, self.name) # COMMENT Model @@ -266,11 +263,25 @@ class Comment(models.Model): # REQ-19 and REQ else: return 'patt/comment/new' + @property + def style(self): + return { + COMMENTTYPE_APPRAISAL: 'taskappraisal', + }.get(self.type, 'taskcomment') + + @property + def is_comment(self): + return self.type == COMMENTTYPE_COMMENT + + @property + def is_appraisal(self): + return self.type == COMMENTTYPE_APPRAISAL + def sort_string(self): return (self.creation_date, self.type, self.comment) def __str__(self): - return 'Comment: %s - %d' % (self.task.name, self.id) + return 'Comment #%d: %s' % (self.id, self.task.name) # SEARCH Model diff --git a/templates/patt/patt.css b/templates/patt/patt.css index 990ddba..4524275 100644 --- a/templates/patt/patt.css +++ b/templates/patt/patt.css @@ -26,7 +26,7 @@ } .projectname { - padding-left: 40px; + padding-left: 40px; } .projectuserlabel { @@ -37,11 +37,18 @@ padding: 16px; } -.taskcomment { +.taskcomment, .taskappraisal { margin: 16px; border-left: 6px solid #323232; } +.taskappraisal { + border-left: 6px solid #005d7a; + color: #005d7a; + background-color: #eeeeee; +} + + .taskcomment-date { padding: 16px; font-size: 18px; @@ -50,7 +57,8 @@ } .taskcomment-description { - padding: 0 50px; + padding: 16px 50px; + padding-top: 8px; padding-right: 16px; } @@ -89,9 +97,9 @@ } .projecticon { - position: absolute; - top: 0; - left: 0; + position: absolute; + top: 0; + left: 0; } .taskicon:hover { @@ -100,32 +108,32 @@ /* When the screen is less than 700px wide, reduce content to be shown */ @media screen and (max-width: 700px) { - .prio_icons_hide { - display: none - } + .prio_icons_hide { + display: none + } } /* When the screen is less than 500px wide, reduce content to be shown */ @media screen and (max-width: 500px) { - .target_date_hide { - display: none - } + .target_date_hide { + display: none + } } /* When the screen is less than 375px wide, reduce content to be shown */ @media screen and (max-width: 375px) { - .state_icons_hide { - display: none - } + .state_icons_hide { + display: none + } } .preview { - background-image: url("{% static 'patt/draft.png' %}"); - padding: 40px; - padding-top: 75px; - min-height: 300px; + background-image: url("{% static 'patt/draft.png' %}"); + padding: 40px; + padding-top: 75px; + min-height: 300px; } .preview-spacer { - min-height: 35px; + min-height: 35px; } diff --git a/templates/patt/task/comment.html b/templates/patt/task/comment.html index a741978..d449238 100644 --- a/templates/patt/task/comment.html +++ b/templates/patt/task/comment.html @@ -2,8 +2,9 @@ {% load access %} {% may_modify_comment comment as user_may_modify_comment %} - -