Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

activity stream DRY & cleanup #5041

Merged
merged 6 commits into from
Aug 22, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions app/assets/v2/css/activity_stream.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#activity_stream .avatar {
.activity_stream .avatar {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yay

width: 50px;
height: 50px;
margin: 0px auto;
Expand All @@ -17,14 +17,21 @@
height: 80px;
}

.activity .secondary_avatar {
width: 3.125rem;
height: 3.125rem;
top: 1rem;
right: 0rem;
position: absolute;
}

.funder-avatar,
.activity-avatar {
text-align: center;
}

.funder-avatar,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be removed I think

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this is the reason why travis is complaining
34:15 ✖ Unexpected empty block block-no-empty

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just pushed up a fix

.activity div {
margin: auto;
}

.last-icon {
Expand All @@ -43,3 +50,16 @@
.activity.new_kudos .activity-tags .tag {
display: none;
}

@media (max-width: 767.98px) {

.activity-info {
text-align: center;
}

.activity_stream .activity .avatar.secondary_avatar {
position: unset;
margin-left: -20px;
margin-top: 20px;
}
}
21 changes: 19 additions & 2 deletions app/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1727,8 +1727,8 @@ class Activity(SuperModel):
('killed_bounty', 'Canceled Bounty'),
('new_tip', 'New Tip'),
('receive_tip', 'Tip Received'),
('bounty_abandonment_escalation_to_mods', 'Escalated for Abandonment of Bounty'),
('bounty_abandonment_warning', 'Warning for Abandonment of Bounty'),
('bounty_abandonment_escalation_to_mods', 'Escalated checkin from @gitcoinbot about bounty status'),
('bounty_abandonment_warning', 'Checkin from @gitcoinbot about bounty status'),
('bounty_removed_slashed_by_staff', 'Dinged and Removed from Bounty by Staff'),
('bounty_removed_by_staff', 'Removed from Bounty by Staff'),
('bounty_removed_by_funder', 'Removed from Bounty by Funder'),
Expand Down Expand Up @@ -1848,6 +1848,7 @@ def view_props(self):
if getattr(self, fk):
activity[fk] = getattr(self, fk).to_standard_dict(properties=properties)
print(activity['kudos'])
activity['secondary_avatar_url'] = self.secondary_avatar_url
# KO notes 2019/01/30
# this is a bunch of bespoke information that is computed for the views
# in a later release, it couild be refactored such that its just contained in the above code block ^^.
Expand Down Expand Up @@ -1878,6 +1879,22 @@ def view_props(self):

return activity

@property
def secondary_avatar_url(self):
if self.metadata.get('to_username'):
return f"/dynamic/avatar/{self.metadata['to_username']}"
if self.metadata.get('worker_handle'):
return f"/dynamic/avatar/{self.metadata['worker_handle']}"
if self.metadata.get('url'):
return self.metadata['url']
if self.bounty:
return self.bounty.avatar_url
if self.metadata.get('grant_logo'):
return self.metadata['grant_logo']
if self.grant:
return self.grant.logo.url
return None

@property
def token_name(self):
if self.bounty:
Expand Down
3 changes: 2 additions & 1 deletion app/dashboard/templates/profiles/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<link rel="stylesheet" href={% static "v2/css/tabs.css" %} />
<link rel="stylesheet" href={% static "v2/css/rating.css" %} />
<link rel="stylesheet" href={% static "v2/css/scroll-carousel.css" %} />
<link rel="stylesheet" href="{% static "v2/css/activity_stream.css" %}">
</head>
<body class="interior {{ active }} g-font-muli">
{% include 'shared/tag_manager_2.html' %}
Expand Down Expand Up @@ -263,7 +264,7 @@ <h1 class="profile-header__handle">
<div id="section-{{ tab.id }}" class="tab-section">
<div class="container">
<div class="row mb-3 p-2">
<div id="{{ tab.id }}" class="col-12 activities" count="{{ tab.count }}">
<div id="{{ tab.id }}" class="col-12 activities activity_stream" count="{{ tab.count }}">
{% if show_activity %}
{% if tab.type == 'activity' %}
{% include 'profiles/profile_activities.html' with activities=tab.objects %}
Expand Down
12 changes: 1 addition & 11 deletions app/dashboard/templates/profiles/profile_activities.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
{% for activity in activities %}
{% if activity.tip %}
{% include "shared/profile_activities_tip.html" with tip=activity.tip %}
{% elif activity.bounty %}
{% include "shared/profile_activities_bounty.html" %}
{% elif activity.grant %}
{% include "shared/profile_activities_grant.html" %}
{% elif activity.subscription %}
{% include "shared/profile_activities_subscription.html" %}
{% else %}
{% include "shared/profile_activities_misc.html" %}
{% endif %}
{% include 'shared/activity.html' with row=activity %}
{% endfor %}
110 changes: 0 additions & 110 deletions app/dashboard/templates/shared/profile_activities_bounty.html

This file was deleted.

63 changes: 0 additions & 63 deletions app/dashboard/templates/shared/profile_activities_grant.html

This file was deleted.

27 changes: 0 additions & 27 deletions app/dashboard/templates/shared/profile_activities_misc.html

This file was deleted.

This file was deleted.

Loading