Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/maintainance/remove-submission-t…
Browse files Browse the repository at this point in the history
…ooltip-js' into test
  • Loading branch information
frjo committed Jul 13, 2023
2 parents 2d90b52 + 28cddec commit 911c629
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,3 @@ <h3>{% trans "Project history" %}</h3>
{% endif %}

{% endblock %}

{% block extra_js %}
<script src="{% static 'js/apply/submission-tooltips.js' %}"></script>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,5 @@ <h4 class="heading heading--normal">{% trans "PAF waiting for assignee" %}</h4>
{% block extra_js %}
<script src="{% static 'js/apply/url-search-params.js' %}"></script>
<script src="{% static 'js/apply/submission-filters.js' %}"></script>
<script src="{% static 'js/apply/submission-tooltips.js' %}"></script>
<script src="{% static 'js/apply/tabs.js' %}"></script>
{% endblock %}
1 change: 0 additions & 1 deletion hypha/apply/dashboard/templates/dashboard/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ <h4 class="heading heading--normal">{% trans "Active Invoices" %}</h4>
{{ my_reviewed.filterset.form.media.js }}
<script src="{% static 'js/apply/url-search-params.js' %}"></script>
<script src="{% static 'js/apply/submission-filters.js' %}"></script>
<script src="{% static 'js/apply/submission-tooltips.js' %}"></script>
<script src="{% static 'js/apply/tabs.js' %}"></script>
<script src="{% static 'js/apply/flag.js' %}"></script>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,4 @@ <h4 class="heading heading--normal">{% trans "PAF waiting for assignee" %}</h4>
{{ my_reviewed.filterset.form.media.js }}
<script src="{% static 'js/apply/url-search-params.js' %}"></script>
<script src="{% static 'js/apply/submission-filters.js' %}"></script>
<script src="{% static 'js/apply/submission-tooltips.js' %}"></script>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,5 @@ <h4 class="heading heading--normal">{% trans "Submission history" %}</h4>
{{ filter.form.media.js }}
<script src="{% static 'js/apply/url-search-params.js' %}"></script>
<script src="{% static 'js/apply/submission-filters.js' %}"></script>
<script src="{% static 'js/apply/submission-tooltips.js' %}"></script>
<script src="{% static 'js/apply/flag.js' %}"></script>
{% endblock %}
45 changes: 41 additions & 4 deletions hypha/apply/funds/tables.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import json
import re
import textwrap

import django_filters as filters
import django_tables2 as tables
Expand Down Expand Up @@ -59,7 +58,7 @@ def render_title(record):
title = record.title
except AttributeError:
title = record.submission.title
return textwrap.shorten(title, width=30, placeholder="...")
return title


def render_reviewer_link(record):
Expand All @@ -68,7 +67,26 @@ def render_reviewer_link(record):

class SubmissionsTable(tables.Table):
"""Base table for listing submissions, do not include admin data to this table"""
title = tables.LinkColumn('funds:submissions:detail', text=render_title, args=[A('pk')], orderable=True, attrs={'td': {'data-title-tooltip': lambda record: record.title, 'class': 'js-title'}})

title = tables.LinkColumn(
'funds:submissions:detail',
text=render_title,
args=[A('pk')],
orderable=True,
attrs={
'td': {
'class': 'js-title',
},
'a': {
'data-tippy-content': lambda record: record.title,
'data-tippy-placement': 'top',

# Use after:content-[''] after:block to hide the default browser tooltip on Safari
# https://stackoverflow.com/a/43915246
'class': "truncate inline-block w-[calc(100%-2rem)] after:content-[''] after:block",
}
},
)
submit_time = tables.DateColumn(verbose_name=_('Submitted'))
phase = tables.Column(verbose_name=_('Status'), order_by=('status',), attrs={'td': {'data-actions': render_actions, 'class': 'js-actions'}})
stage = tables.Column(verbose_name=_('Type'), order_by=('status',))
Expand Down Expand Up @@ -544,7 +562,26 @@ class Meta:


class ReviewerLeaderboardDetailTable(tables.Table):
title = tables.LinkColumn('funds:submissions:reviews:review', text=render_title, args=[A('submission_id'), A('pk')], orderable=True, verbose_name=_('Submission'), attrs={'td': {'data-title-tooltip': lambda record: record.submission.title, 'class': 'title js-title'}})
title = tables.LinkColumn(
'funds:submissions:reviews:review',
text=render_title,
args=[A('submission_id'), A('pk')],
orderable=True,
verbose_name=_('Submission'),
attrs={
'td': {
'class': 'js-title',
},
'a': {
'data-tippy-content': lambda record: record.submission.title,
'data-tippy-placement': 'top',

# Use after:content-[''] after:block to hide the default browser tooltip on Safari
# https://stackoverflow.com/a/43915246
'class': 'truncate inline-block w-[calc(100%-2rem)] after:content-[''] after:block',
}
},
)

class Meta:
model = Review
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<script src="{% static 'js/apply/symbol-es6.min.js' %}"></script>
<script src="{% static 'js/apply/url-search-params.js' %}"></script>
<script src="{% static 'js/apply/submission-filters.js' %}"></script>
<script src="{% static 'js/apply/submission-tooltips.js' %}"></script>
<script src="{% static 'js/apply/tabs.js' %}"></script>
<script src="{% static 'js/apply/batch-actions.js' %}"></script>
<script src="{% static 'js/apply/flag.js' %}"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<script src="{% static 'js/apply/symbol-es6.min.js' %}"></script>
<script src="{% static 'js/apply/url-search-params.js' %}"></script>
<script src="{% static 'js/apply/submission-filters.js' %}"></script>
<script src="{% static 'js/apply/submission-tooltips.js' %}"></script>
<script src="{% static 'js/apply/tabs.js' %}"></script>
<script src="{% static 'js/apply/batch-actions.js' %}"></script>
<script src="{% static 'js/apply/flag.js' %}"></script>
Expand Down
1 change: 0 additions & 1 deletion hypha/apply/funds/templates/funds/rounds.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@
{{ filter.form.media.js }}
<script src="{% static 'js/apply/url-search-params.js' %}"></script>
<script src="{% static 'js/apply/submission-filters.js' %}"></script>
<script src="{% static 'js/apply/submission-tooltips.js' %}"></script>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
<script src="{% static 'js/apply/symbol-es6.min.js' %}"></script>
<script src="{% static 'js/apply/url-search-params.js' %}"></script>
<script src="{% static 'js/apply/submission-filters.js' %}"></script>
<script src="{% static 'js/apply/submission-tooltips.js' %}"></script>
<script src="{% static 'js/apply/tabs.js' %}"></script>
<script src="{% static 'js/apply/batch-actions.js' %}"></script>
{% endblock %}
2 changes: 1 addition & 1 deletion hypha/public/partner/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def make_row_class(record):

class InvestmentTable(tables.Table):
"""Table for listing investments."""
partner = tables.Column(verbose_name=_('Partner'), linkify=True, attrs={'td': {'data-title-tooltip': lambda record: record.partner, 'class': 'js-title title'}})
partner = tables.Column(verbose_name=_('Partner'), linkify=True, attrs={'td': {'class': 'js-title title'}})
year = tables.Column(verbose_name=_('Year'))
status = tables.Column(accessor='partner__status', verbose_name=_('Status'))
amount_committed = tables.Column(verbose_name=_('Amount Committed'))
Expand Down
5 changes: 3 additions & 2 deletions hypha/static_src/src/javascript/apply/batch-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@
let selectedIDs = [];

$checkbox.filter(':checked').each(function () {
const href = $(this).parents('tr').find('.js-title').find('a').attr('href');
const title = $(this).parents('tr').find('.js-title').data('title-tooltip');
const link = $(this).parents('tr').find('.js-title').find('a');
const href = link.attr('href');
const title = link.data('tippy-content');

$batchTitlesList.append(`
<a href="${href}" class="list-reveal__item" target="_blank" rel="noopener noreferrer" title="${title}">
Expand Down
26 changes: 0 additions & 26 deletions hypha/static_src/src/javascript/apply/submission-tooltips.js

This file was deleted.

28 changes: 0 additions & 28 deletions hypha/static_src/src/sass/apply/components/_all-reviews-table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,34 +37,6 @@
display: table-cell;
}

&.has-tooltip {
@include media-query($table-breakpoint) {
&::before {
position: absolute;
top: 50px;
left: 45px;
z-index: -1;
width: 200px;
padding: 5px;
font-size: 12px;
font-weight: $weight--normal;
white-space: normal;
background: $color--sky-blue;
border: 1px solid $color--marine;
content: attr(data-title-tooltip);
opacity: 0;
transition: opacity $transition;
}

&:hover {
&::before {
z-index: 10;
opacity: 1;
}
}
}
}

a {
color: $color--primary;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,34 +84,6 @@
@include media-query(desktop) {
display: table-cell;
}

&.has-tooltip {
@include media-query($table-breakpoint) {
&::before {
position: absolute;
top: 75px;
left: 45px;
z-index: -1;
width: 200px;
padding: 5px;
font-size: 12px;
font-weight: $weight--normal;
white-space: normal;
background: $color--sky-blue;
border: 1px solid $color--marine;
content: attr(data-title-tooltip);
opacity: 0;
transition: opacity $transition;
}

&:hover {
&::before {
z-index: 10;
opacity: 1;
}
}
}
}
}

// project status label
Expand Down Expand Up @@ -178,7 +150,7 @@
@include triangle(right, $color--primary, 6px);
position: relative;
display: inline-block;
margin-right: 15px;
margin-right: 10px;
transform: rotate(0);
transition: transform $transition;

Expand Down

0 comments on commit 911c629

Please sign in to comment.