Skip to content

Commit

Permalink
Mock data for notes
Browse files Browse the repository at this point in the history
  • Loading branch information
dcramer committed Sep 21, 2013
1 parent 4a1a701 commit 3cc1f95
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/sentry/models.py
Expand Up @@ -1077,25 +1077,25 @@ def send_recover_mail(self):


class Activity(Model):
COMMENT = 0
SET_RESOLVED = 1
SET_UNRESOLVED = 2
SET_MUTED = 3
SET_PUBLIC = 4
SET_PRIVATE = 5
SET_REGRESSION = 6
CREATE_ISSUE = 7
NOTE = 8

TYPE = (
# (TYPE, verb-slug)
(COMMENT, 'comment'),
(SET_RESOLVED, 'set_resolved'),
(SET_UNRESOLVED, 'set_unresolved'),
(SET_MUTED, 'set_muted'),
(SET_PUBLIC, 'set_public'),
(SET_PRIVATE, 'set_private'),
(SET_REGRESSION, 'set_regression'),
(CREATE_ISSUE, 'create_issue'),
(NOTE, 'note'),
)

project = models.ForeignKey(Project)
Expand All @@ -1121,7 +1121,7 @@ def save(self, *args, **kwargs):
return

# HACK: support Group.num_comments
if self.type == Activity.COMMENT:
if self.type == Activity.NOTE:
self.group.update(num_comments=F('num_comments') + 1)

if self.event:
Expand Down
10 changes: 9 additions & 1 deletion src/sentry/static/sentry/styles/sentry.css
Expand Up @@ -6994,6 +6994,9 @@ h3 {
padding: 25px 30px 10px;
min-width: 786px;
}
#content section.body a {
word-break: break-all;
}
#content section.body .select2-drop {
-webkit-box-shadow: 0 0 0 2px #c3c8ce;
-moz-box-shadow: 0 0 0 2px #c3c8ce;
Expand Down Expand Up @@ -7330,7 +7333,7 @@ a.icon-share:hover {
.progressbar {
position: relative;
border: 1px solid #c7def5;
height: 1.5em;
min-height: 1.5em;
line-height: 1.5em;
}
.progressbar > a,
Expand All @@ -7344,6 +7347,10 @@ a.icon-share:hover {
}
.progressbar > a {
left: 5px;
position: relative;
z-index: 1;
padding-right: 60px;
display: block;
}
.progressbar > a span {
position: absolute;
Expand All @@ -7352,6 +7359,7 @@ a.icon-share:hover {
.progressbar > div {
background-color: #f2f8fd;
text-indent: -100000em;
z-index: 0;
}
.sparkline {
position: relative;
Expand Down
17 changes: 16 additions & 1 deletion src/sentry/templates/sentry/groups/details.html
Expand Up @@ -62,8 +62,23 @@ <h4>Event at {{ event.datetime }} {{ event.datetime.tzinfo }} [{{ event.size|fil

<div id="comments">
<div class="page-header">
<h2>{% trans "Comments" %}></h2>
<h2>{% trans "Notes" %}</h2>
</div>
<form style="width:460px">
<textarea style="height:70px;width:440px;" placeholder="add details about this event"></textarea>
<div style="text-align: right;">
<input type="submit" value="{% trans "Add Note" %}" class="btn btn-primary">
</div>
</form>

<ul class="note-list">
{% for note in note_list %}
<li class="note">
<strong>{{ note.user|user_display_name }}</strong> &mdash; <small>{{ note.datetime|timesince }}</small>
{{ note.data.text|urlize|linebreaks }}
</li>
{% endfor %}
</ul>
</div>
{% endwith %}
{% endblock %}
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/templates/sentry/partial/event_nav.html
Expand Up @@ -45,7 +45,7 @@
</li>
{% endif %}
<li>
<a href="#comments">{% trans "Comments (0)" %}</a>
<a href="#comments">{% blocktrans with num=note_list|length %}Notes ({{ num }}){% endblocktrans %}</a>
</li>
</ul>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/sentry/templatetags/sentry_activity.py
Expand Up @@ -17,7 +17,7 @@


ACTIVITY_ACTION_STRINGS = {
Activity.COMMENT: 'left a comment',
Activity.NOTE: 'left a comment',
Activity.SET_RESOLVED: 'marked this event as resolved',
Activity.SET_UNRESOLVED: 'marked this event as unresolved',
Activity.SET_MUTED: 'marked this event as muted',
Expand Down Expand Up @@ -52,7 +52,7 @@ def render_activity(item):

output += ' <span class="sep">&mdash;</span> <span class="time">%s</span>' % (timesince(item.datetime),)

if item.type == Activity.COMMENT:
if item.type == Activity.NOTE:
output += linebreaks(item.data['body'])

return mark_safe(output)
10 changes: 10 additions & 0 deletions src/sentry/web/frontend/groups.py
Expand Up @@ -428,12 +428,22 @@ def group(request, team, project, group, event_id=None):
seen_by_extra = 0
seen_by_faces = seen_by[:5]

note_list = [
Activity(project=project, group=group, type=Activity.NOTE,
user=request.user, data={'text': 'This is an example short note.'}),
Activity(project=project, group=group, type=Activity.NOTE,
user=request.user, data={'text': """Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam ornare mi id metus tempor facilisis. Nunc tellus risus, imperdiet quis purus at, facilisis viverra nunc. Sed tincidunt quis urna eget lacinia. Nullam iaculis sed odio vel semper. Nulla facilisi. Donec in volutpat ligula, at facilisis nulla. Pellentesque leo elit, mollis nec porttitor et, iaculis vitae lectus. Donec ultricies eu elit eget porttitor. Suspendisse at libero tempus mauris auctor aliquam vitae ac dui. Duis fringilla diam id turpis sagittis auctor.
Pellentesque nec pharetra ipsum. Cras lacus lectus, semper ut augue quis, dictum hendrerit ipsum. Etiam aliquet justo nec massa adipiscing, nec aliquam risus adipiscing. Cras eu dapibus eros. Vestibulum dapibus consequat dolor vitae facilisis. Integer pharetra euismod lobortis. Vestibulum nibh velit, consectetur non mauris vitae, consectetur consectetur tortor. Nunc eget purus leo. Integer nisi enim, scelerisque et dolor vitae, ornare semper leo."""}),
]

context = {
'page': 'details',
'activity': activity,
'seen_by': seen_by,
'seen_by_faces': seen_by_faces,
'seen_by_extra': seen_by_extra,
'note_list': note_list,
}

is_public = group_is_public(group, request.user)
Expand Down

0 comments on commit 3cc1f95

Please sign in to comment.