diff --git a/hypha/apply/dashboard/templates/dashboard/dashboard.html b/hypha/apply/dashboard/templates/dashboard/dashboard.html index 4b5d0350e86ac0d239a03e72bfc94b6d095d5687..517b4af328d6026a07f4631e7597149c11f80f9f 100644 --- a/hypha/apply/dashboard/templates/dashboard/dashboard.html +++ b/hypha/apply/dashboard/templates/dashboard/dashboard.html @@ -129,5 +129,4 @@ <script src="{% static 'js/all-submissions-table.js' %}"></script> <script src="{% static 'js/submission-filters.js' %}"></script> <script src="{% static 'js/tabs.js' %}"></script> - <script src="{% static 'js/flag.js' %}"></script> {% endblock %} diff --git a/hypha/apply/dashboard/templates/dashboard/includes/flagged.html b/hypha/apply/dashboard/templates/dashboard/includes/flagged.html index ef096a47f64f326176afc4df5012adc8ea81bbf5..0f7c4c68f61d7364153b9897634506e53b708cfe 100644 --- a/hypha/apply/dashboard/templates/dashboard/includes/flagged.html +++ b/hypha/apply/dashboard/templates/dashboard/includes/flagged.html @@ -6,10 +6,12 @@ </h2> {% if my_flagged.data %} + {% render_table my_flagged %} + {% if display_more %} <div class="all-submissions-table__more"> - <a href="{% url 'apply:submissions:flagged' %}">{% trans "Show all" %}</a> + <a href="{% url 'apply:submissions:list-alt' %}?query=flagged:@me">{% trans "Show all" %}</a> </div> {% endif %} {% endif %} diff --git a/hypha/apply/dashboard/templates/dashboard/reviewer_dashboard.html b/hypha/apply/dashboard/templates/dashboard/reviewer_dashboard.html index 462fc2c47da8ac85846c7a5511a88dd5871290d5..5825aaccd6a2e3ede80638b39655ec11721911b3 100644 --- a/hypha/apply/dashboard/templates/dashboard/reviewer_dashboard.html +++ b/hypha/apply/dashboard/templates/dashboard/reviewer_dashboard.html @@ -82,5 +82,4 @@ {{ filter.form.media.js }} <script src="{% static 'js/url-search-params.js' %}"></script> <script src="{% static 'js/submission-filters.js' %}"></script> - <script src="{% static 'js/flag.js' %}"></script> {% endblock %} diff --git a/hypha/apply/flags/templates/flags/flags.html b/hypha/apply/flags/templates/flags/flags.html index ef79dcc588dda821d64979a9301275ff6c46813a..00f1d92de1dcedeff16ba0667be7bdf50973a032 100644 --- a/hypha/apply/flags/templates/flags/flags.html +++ b/hypha/apply/flags/templates/flags/flags.html @@ -1,11 +1,54 @@ -{% load i18n flag_tags %} -<div class="sidebar__inner"> - <h5>{% trans "Flags" %}</h5> - <div class="wrapper wrapper--sidebar-buttons"> - <button class="button button--primary button--half-width button--flag {% if submission.is_archive %}is-disabled{% endif %} {% if submission|flagged_by:user %} flagged{% endif %}" data-id="{{ submission.id }}" data-type="user">{% trans "Flag" %}</button> +{% load i18n flag_tags heroicons %} +<form class="wrapper wrapper--sidebar-buttons flex gap-4" id="submission-flags"> + {% with submission|flagged_by:user as is_flagged %} + <button + class="button button--secondary flex items-center gap-4 !px-2 !py-3 w-full" + {% if submission.is_archive %} + disabled=true + {% else %} + hx-post="{% url 'apply:submissions:flags:create_submission_flag' submission.id "user" %}" + hx-swap="outerHTML" + hx-target="#submission-flags" + {% if is_flagged %} + data-tippy-content="Remove from your flagged submissions" + {% else %} + data-tippy-content="Add to your flagged submissions" + {% endif %} + {% endif %} + > + {% if is_flagged %} + {% heroicon_solid "flag" class="inline-block align-text-bottom fill-amber-400" size=18 %} + <span>{% trans "Flagged" %}</span> + {% else %} + {% trans "Flag" %} + {% endif %} + </button> + {% endwith %} - {% if request.user.is_apply_staff %} - <button class="button button--primary button--half-width button--flag {% if submission.is_archive %}is-disabled{% endif %} {% if submission|flagged_staff %} flagged{% endif %}" data-id="{{ submission.id }}" data-type="staff">{% trans "Staff flag" %}</button> - {% endif %} - </div> -</div> + {% if request.user.is_apply_staff %} + {% with submission|flagged_staff as is_flagged %} + <button + class="button button--secondary flex items-center gap-4 !px-2 !py-3 w-full whitespace-nowrap" + {% if submission.is_archive %} + disabled=true + {% else %} + hx-post="{% url 'apply:submissions:flags:create_submission_flag' submission.id "staff" %}" + hx-swap="outerHTML" + hx-target="#submission-flags" + {% if is_flagged %} + data-tippy-content="Remove staff flag" + {% else %} + data-tippy-content="Flag for staff review" + {% endif %} + {% endif %} + > + {% if is_flagged %} + {% heroicon_solid "flag" class="inline-block align-text-bottom fill-amber-500" size=18 %} + <span>{% trans "Staff Flagged" %}</span> + {% else %} + {% trans "Staff Flag" %} + {% endif %} + </button> + {% endwith %} + {% endif %} +</form> diff --git a/hypha/apply/flags/views.py b/hypha/apply/flags/views.py index 2de2db491a5376b43e24a8f2d530488cdbb4af0e..34f2139224003c8e0b855282b4a2c10599bdc1ac 100644 --- a/hypha/apply/flags/views.py +++ b/hypha/apply/flags/views.py @@ -1,7 +1,8 @@ from django.contrib.auth.decorators import login_required from django.contrib.auth.mixins import UserPassesTestMixin from django.contrib.contenttypes.models import ContentType -from django.http import HttpResponseNotAllowed, JsonResponse +from django.http import HttpResponseNotAllowed +from django.shortcuts import render from django.utils.decorators import method_decorator from django.views import View @@ -15,13 +16,11 @@ class FlagSubmissionCreateView(UserPassesTestMixin, View): model = Flag def post(self, request, type, submission_pk): - if request.headers.get("x-requested-with") != "XMLHttpRequest": - return HttpResponseNotAllowed() - # Only staff can create staff flags. if type == self.model.STAFF and not self.request.user.is_apply_staff: return HttpResponseNotAllowed() + submission = ApplicationSubmission.objects.get(pk=submission_pk) submission_type = ContentType.objects.get_for_model(ApplicationSubmission) # Trying to get a flag from the table, or create a new one flag, created = self.model.objects.get_or_create( @@ -35,7 +34,9 @@ class FlagSubmissionCreateView(UserPassesTestMixin, View): if not created: flag.delete() - return JsonResponse({"result": created}) + return render( + request, "flags/flags.html", {"flag": flag, "submission": submission} + ) def test_func(self): return self.request.user.is_apply_staff or self.request.user.is_reviewer diff --git a/hypha/apply/funds/tables.py b/hypha/apply/funds/tables.py index eb3323938047331c75595618845281c3f090ce3a..6500b16b4cf04637c804caddc083abca8d33478a 100644 --- a/hypha/apply/funds/tables.py +++ b/hypha/apply/funds/tables.py @@ -247,14 +247,6 @@ class SummarySubmissionsTableWithRole(BaseAdminSubmissionsTable): return "" -class StaffFlaggedSubmissionsTable(SummarySubmissionsTable): - class Meta(SummarySubmissionsTable.Meta): - row_attrs = dict( - {"data-flag-type": "staff"}, **SummarySubmissionsTable._meta.row_attrs - ) - attrs = {"class": "all-submissions-table flagged-table"} - - class UserFlaggedSubmissionsTable(SummarySubmissionsTable): class Meta(SummarySubmissionsTable.Meta): row_attrs = dict( diff --git a/hypha/apply/funds/templates/funds/applicationsubmission_admin_detail.html b/hypha/apply/funds/templates/funds/applicationsubmission_admin_detail.html index 934d7fc75d5af1c027277b6a121f34a52062d3ae..c97edac9570bf785867462a664bb6e2b1b1bd76e 100644 --- a/hypha/apply/funds/templates/funds/applicationsubmission_admin_detail.html +++ b/hypha/apply/funds/templates/funds/applicationsubmission_admin_detail.html @@ -36,7 +36,11 @@ {% endblock %} {% block flags %} - {% include 'flags/flags.html' with submission=object user=request.user %} + <div class="sidebar__inner"> + <h5>{% trans "Flags" %}</h5> + + {% include 'flags/flags.html' with submission=object user=request.user %} + </div> {% endblock %} {% block reviews %} diff --git a/hypha/apply/funds/templates/funds/applicationsubmission_detail.html b/hypha/apply/funds/templates/funds/applicationsubmission_detail.html index b569642b5d82e3a8586c7463b7f91042d8c3e89b..098fb102b982ad8f4606569f3bc5683e7beaa8b7 100644 --- a/hypha/apply/funds/templates/funds/applicationsubmission_detail.html +++ b/hypha/apply/funds/templates/funds/applicationsubmission_detail.html @@ -223,5 +223,4 @@ <script src="{% static 'js/tabs.js' %}"></script> <script src="{% static 'js/submission-text-cleanup.js' %}"></script> <script src="{% static 'js/edit-comment.js' %}"></script> - <script src="{% static 'js/flag.js' %}"></script> {% endblock %} diff --git a/hypha/apply/funds/templates/funds/applicationsubmission_reviewer_detail.html b/hypha/apply/funds/templates/funds/applicationsubmission_reviewer_detail.html index 614428db939f0097608a2f3d046fac75c8018b9c..0926d50b9531a1ac00bdd944e14f22dd0b63025c 100644 --- a/hypha/apply/funds/templates/funds/applicationsubmission_reviewer_detail.html +++ b/hypha/apply/funds/templates/funds/applicationsubmission_reviewer_detail.html @@ -2,7 +2,10 @@ {% load i18n static workflow_tags review_tags determination_tags %} {% block flags %} - {% include 'flags/flags.html' with submission=object user=request.user %} + <div class="sidebar__inner"> + <h5>{% trans "Flags" %}</h5> + {% include 'flags/flags.html' with submission=object user=request.user %} + </div> {% endblock %} {% block reviews %} diff --git a/hypha/apply/funds/templates/funds/grouped_application_list.html b/hypha/apply/funds/templates/funds/grouped_application_list.html index 06f15a88a5098f367bf6d2d0d474f03c3b578496..f49c626ada8433cc519cc62c6bd5f2c3cace1713 100644 --- a/hypha/apply/funds/templates/funds/grouped_application_list.html +++ b/hypha/apply/funds/templates/funds/grouped_application_list.html @@ -25,5 +25,4 @@ <script src="{% static 'js/submission-filters.js' %}"></script> <script src="{% static 'js/tabs.js' %}"></script> <script src="{% static 'js/batch-actions.js' %}"></script> - <script src="{% static 'js/flag.js' %}"></script> {% endblock %} diff --git a/hypha/apply/funds/templates/funds/staff_assignments.html b/hypha/apply/funds/templates/funds/staff_assignments.html index 0be6503cc566a8c363b9b9400ef8160a5528bc50..f2fb4167fcbd28eda2861acac2e2b818142e4f28 100644 --- a/hypha/apply/funds/templates/funds/staff_assignments.html +++ b/hypha/apply/funds/templates/funds/staff_assignments.html @@ -21,5 +21,4 @@ {% block extra_js %} {{ filter.form.media.js }} <script src="{% static 'js/symbol-es6.min.js' %}"></script> - <script src="{% static 'js/flag.js' %}"></script> {% endblock %} diff --git a/hypha/apply/funds/templates/funds/submissions_overview.html b/hypha/apply/funds/templates/funds/submissions_overview.html index a7928172dd622337647211ac7c823b6d459b423c..65d7fe64e334d96f153f179a23caa8ab0fef0b56 100644 --- a/hypha/apply/funds/templates/funds/submissions_overview.html +++ b/hypha/apply/funds/templates/funds/submissions_overview.html @@ -29,19 +29,6 @@ <a href="{% url 'apply:submissions:list' %}">{% trans "Show all" %}</a> </div> </div> - - {% if staff_flagged.table.data %} - <div class="wrapper wrapper--bottom-space"> - <h4 class="heading heading--normal">{% trans "Staff flagged submissions" %}</h4> - {% render_table staff_flagged.table %} - {% if staff_flagged.display_more %} - <div class="all-submissions-table__more"> - <a href="{% url 'apply:submissions:staff_flagged' %}">{% trans "Show all" %}</a> - </div> - {% endif %} - </div> - {% endif %} - {% endblock %} </div> {% endblock %} diff --git a/hypha/apply/funds/templates/funds/submissions_staff_flagged.html b/hypha/apply/funds/templates/funds/submissions_staff_flagged.html deleted file mode 100644 index 00436c3c907ffb8f29b962620331df5d9f60c857..0000000000000000000000000000000000000000 --- a/hypha/apply/funds/templates/funds/submissions_staff_flagged.html +++ /dev/null @@ -1,29 +0,0 @@ -{% extends "funds/base_submissions_table.html" %} -{% load i18n static %} -{% load render_table from django_tables2 %} - -{% block title %}{% trans "Staff flagged submissions" %}{% endblock %} - -{% block content %} - - {% adminbar %} - {% slot header %} - {% trans "Staff flagged submissions" %}<span class="submissions-count"> ({{ table.rows|length }})</span> - {% endslot %} - {% slot sub_heading %}{% trans "Submissions flagged by staff" %}{% endslot %} - {% endadminbar %} - - - <div class="wrapper wrapper--large wrapper--inner-space-medium"> - {% block table %} - {% render_table table %} - {% endblock %} - </div> -{% endblock %} - -{% block extra_js %} - {{ filter.form.media.js }} - <script src="{% static 'js/all-submissions-table.js' %}"></script> - <script src="{% static 'js/symbol-es6.min.js' %}"></script> - <script src="{% static 'js/flag.js' %}"></script> -{% endblock %} diff --git a/hypha/apply/funds/templates/funds/submissions_user_flagged.html b/hypha/apply/funds/templates/funds/submissions_user_flagged.html deleted file mode 100644 index 05653fdf80420ce3d722978734fdd000d025c169..0000000000000000000000000000000000000000 --- a/hypha/apply/funds/templates/funds/submissions_user_flagged.html +++ /dev/null @@ -1,22 +0,0 @@ -{% extends "funds/base_submissions_table.html" %} -{% load i18n static %} -{% load render_table from django_tables2 %} - -{% block title %}{% trans "Your flagged submissions" %}{% endblock %} - -{% block content %} - - {% adminbar %} - {% slot header %} - {% trans "Your flagged submissions" %} <span class="submissions-count">({{ table.rows|length }})</span> - {% endslot %} - {% slot sub_heading %}{% trans "Submissions flagged by you" %}{% endslot %} - {% endadminbar %} - - - <div class="wrapper wrapper--large wrapper--inner-space-medium"> - {% block table %} - {% render_table table %} - {% endblock %} - </div> -{% endblock %} diff --git a/hypha/apply/funds/urls.py b/hypha/apply/funds/urls.py index 58a0a7cb745c257478660f50a5b7a51f2f85abe2..b5eec5780f336a481b3564c9881d1fdc65ebd871 100644 --- a/hypha/apply/funds/urls.py +++ b/hypha/apply/funds/urls.py @@ -26,8 +26,6 @@ from .views import ( SubmissionsByRound, SubmissionsByStatus, SubmissionSealedView, - SubmissionStaffFlaggedView, - SubmissionUserFlaggedView, partial_screening_card, submission_success, ) @@ -135,19 +133,6 @@ submission_urls = ( ), path("summary/", GroupingApplicationsListView.as_view(), name="summary"), path("result/", SubmissionResultView.as_view(), name="result"), - path( - "flagged/", - include( - [ - path("", SubmissionUserFlaggedView.as_view(), name="flagged"), - path( - "staff/", - SubmissionStaffFlaggedView.as_view(), - name="staff_flagged", - ), - ] - ), - ), path( "reviews/", include( diff --git a/hypha/apply/funds/views.py b/hypha/apply/funds/views.py index 204bc8261bcf674791e4a9e31440f50b2abc86c1..0c70f9b7f0b295802d149082b6422088a8143f34 100644 --- a/hypha/apply/funds/views.py +++ b/hypha/apply/funds/views.py @@ -122,11 +122,9 @@ from .tables import ( RoundsFilter, RoundsTable, StaffAssignmentsTable, - StaffFlaggedSubmissionsTable, SubmissionFilterAndSearch, SubmissionReviewerFilterAndSearch, SummarySubmissionsTable, - UserFlaggedSubmissionsTable, ) from .utils import ( get_or_create_default_screening_statuses, @@ -496,8 +494,6 @@ class SubmissionOverviewView(BaseAdminSubmissionsTable): for status, data in PHASES_MAPPING.items() } - staff_flagged = self.get_staff_flagged() - return super().get_context_data( open_rounds=open_rounds, open_query=open_query, @@ -506,27 +502,9 @@ class SubmissionOverviewView(BaseAdminSubmissionsTable): closed_query=closed_query, rounds_title=rounds_title, status_counts=grouped_statuses, - staff_flagged=staff_flagged, **kwargs, ) - def get_staff_flagged(self): - qs = super().get_queryset().flagged_staff().order_by("-submit_time") - row_attrs = dict( - {"data-flag-type": "staff"}, **SummarySubmissionsTable._meta.row_attrs - ) - - limit = 5 - return { - "table": SummarySubmissionsTable( - qs[:limit], - prefix="staff-flagged-", - attrs={"class": "all-submissions-table flagged-table"}, - row_attrs=row_attrs, - ), - "display_more": qs.count() > limit, - } - class SubmissionAdminListView(BaseAdminSubmissionsTable, DelegateableListView): template_name = "funds/submissions.html" @@ -592,37 +570,6 @@ class SubmissionListView(ViewDispatcher): reviewer_view = SubmissionReviewerListView -@method_decorator(staff_required, name="dispatch") -class SubmissionStaffFlaggedView(BaseAdminSubmissionsTable): - table_class = StaffFlaggedSubmissionsTable - template_name = "funds/submissions_staff_flagged.html" - - def get_queryset(self): - return ( - self.filterset_class._meta.model.objects.current() - .for_table(self.request.user) - .flagged_staff() - .order_by("-submit_time") - ) - - -@method_decorator(login_required, name="dispatch") -class SubmissionUserFlaggedView(UserPassesTestMixin, BaseAdminSubmissionsTable): - table_class = UserFlaggedSubmissionsTable - template_name = "funds/submissions_user_flagged.html" - - def get_queryset(self): - return ( - self.filterset_class._meta.model.objects.current() - .for_table(self.request.user) - .flagged_by(self.request.user) - .order_by("-submit_time") - ) - - def test_func(self): - return self.request.user.is_apply_staff or self.request.user.is_reviewer - - @method_decorator(login_required, name="dispatch") class ExportSubmissionsByRound(UserPassesTestMixin, BaseAdminSubmissionsTable): def export_submissions(self, round_id): diff --git a/hypha/core/navigation.py b/hypha/core/navigation.py index d951d782e8656989b591143c5b7f185b29f4c2e0..7ffb7f251e65112e30b2c3f044c080d6983a1414 100644 --- a/hypha/core/navigation.py +++ b/hypha/core/navigation.py @@ -7,70 +7,6 @@ from django.core.exceptions import PermissionDenied from django.urls import reverse_lazy from django.utils.translation import gettext_lazy as _ -DEFAULT_NAV_ITEMS = [ - { - "title": _("My Dashboard"), - "url": reverse_lazy("dashboard:dashboard"), - "permission_method": "hypha.apply.users.decorators.has_dashboard_access", - }, - { - "title": _("Submissions"), - # kind of basic url to figure out active tab - "url": reverse_lazy("apply:submissions:overview"), - "permission_method": "hypha.apply.users.decorators.is_apply_staff_or_reviewer_required", - "sub_items": [ - { - "title": _("All Submissions"), - "url": reverse_lazy("apply:submissions:list"), - "permission_method": "hypha.apply.users.decorators.is_apply_staff_or_reviewer_required", - }, - { - "title": _("Staff Assignments"), - "url": reverse_lazy("apply:submissions:staff_assignments"), - "permission_method": "hypha.apply.users.decorators.is_apply_staff", - }, - { - "title": _("Reviews"), - "url": reverse_lazy("apply:submissions:reviewer_leaderboard"), - "permission_method": "hypha.apply.users.decorators.is_apply_staff", - }, - { - "title": _("Results"), - "url": reverse_lazy("apply:submissions:result"), - "permission_method": "hypha.apply.users.decorators.is_apply_staff", - }, - { - "title": _("Staff flagged"), - "url": reverse_lazy("apply:submissions:staff_flagged"), - "permission_method": "hypha.apply.users.decorators.is_apply_staff", - }, - ], - }, - { - "title": _("Projects"), - # kind of basic url to figure out active tab - "url": reverse_lazy("apply:projects:overview"), - "permission_method": "hypha.apply.users.decorators.is_apply_staff_or_finance_or_contracting", - "sub_items": [ - { - "title": _("All Projects"), - "url": reverse_lazy("apply:projects:all"), - "permission_method": "hypha.apply.users.decorators.is_apply_staff_or_finance_or_contracting", - }, - { - "title": _("Invoices"), - "url": reverse_lazy("apply:projects:invoices"), - "permission_method": "hypha.apply.users.decorators.is_apply_staff_or_finance", - }, - { - "title": _("Reports"), - "url": reverse_lazy("apply:projects:reports:all"), - "permission_method": "hypha.apply.users.decorators.is_apply_staff_or_finance", - }, - ], - }, -] - def _check_permission(user, method: str) -> bool: """Resolve the method path and check if the user has permission. @@ -92,6 +28,71 @@ def _check_permission(user, method: str) -> bool: @functools.cache def get_primary_navigation_items(user): + DEFAULT_NAV_ITEMS = [ + { + "title": _("My Dashboard"), + "url": reverse_lazy("dashboard:dashboard"), + "permission_method": "hypha.apply.users.decorators.has_dashboard_access", + }, + { + "title": _("Submissions"), + # kind of basic url to figure out active tab + "url": reverse_lazy("apply:submissions:overview"), + "permission_method": "hypha.apply.users.decorators.is_apply_staff_or_reviewer_required", + "sub_items": [ + { + "title": _("All Submissions"), + "url": reverse_lazy("apply:submissions:list"), + "permission_method": "hypha.apply.users.decorators.is_apply_staff_or_reviewer_required", + }, + { + "title": _("Staff Assignments"), + "url": reverse_lazy("apply:submissions:staff_assignments"), + "permission_method": "hypha.apply.users.decorators.is_apply_staff", + }, + { + "title": _("Reviews"), + "url": reverse_lazy("apply:submissions:reviewer_leaderboard"), + "permission_method": "hypha.apply.users.decorators.is_apply_staff", + }, + { + "title": _("Results"), + "url": reverse_lazy("apply:submissions:result"), + "permission_method": "hypha.apply.users.decorators.is_apply_staff", + }, + { + "title": _("Staff flagged"), + "url": reverse_lazy("apply:submissions:list-alt") + + "?query=flagged:@staff", + "permission_method": "hypha.apply.users.decorators.is_apply_staff", + }, + ], + }, + { + "title": _("Projects"), + # kind of basic url to figure out active tab + "url": reverse_lazy("apply:projects:overview"), + "permission_method": "hypha.apply.users.decorators.is_apply_staff_or_finance_or_contracting", + "sub_items": [ + { + "title": _("All Projects"), + "url": reverse_lazy("apply:projects:all"), + "permission_method": "hypha.apply.users.decorators.is_apply_staff_or_finance_or_contracting", + }, + { + "title": _("Invoices"), + "url": reverse_lazy("apply:projects:invoices"), + "permission_method": "hypha.apply.users.decorators.is_apply_staff_or_finance", + }, + { + "title": _("Reports"), + "url": reverse_lazy("apply:projects:reports:all"), + "permission_method": "hypha.apply.users.decorators.is_apply_staff_or_finance", + }, + ], + }, + ] + """Get the primary navigation items based on user permissions.""" original_nav_items = copy.deepcopy( settings.APPLY_NAV_MENU_ITEMS or DEFAULT_NAV_ITEMS diff --git a/hypha/static_src/javascript/flag.js b/hypha/static_src/javascript/flag.js deleted file mode 100644 index f9a7fdf609da693e8654af4af59f73568831eee5..0000000000000000000000000000000000000000 --- a/hypha/static_src/javascript/flag.js +++ /dev/null @@ -1,41 +0,0 @@ -(function ($) { - "use strict"; - - $(".flagged-table") - .find(".all-submissions-table__parent") - .each(function () { - var $flagged_item = $(this); - var submission_id = $flagged_item.data("record-id"); - var flag_type = $flagged_item.data("flag-type"); - var $button = - '<span class="button--float"><button class="button button--flag button--unflag flagged" data-id="' + - submission_id + - '" data-type="' + - flag_type + - '">Flag</button></span>'; - $flagged_item - .find("td.comments") - .css("position", "relative") - .append($button); - }); - - $(".button--flag").on("click", function (e) { - e.preventDefault(); - - var $current = $(this); - var id = $current.data("id"); - var type = $current.data("type"); - - $.ajax({ - url: "/apply/submissions/" + id + "/" + type + "/flag/", - type: "POST", - success: function (json) { - if (json.result) { - $current.addClass("flagged"); - } else { - $current.removeClass("flagged"); - } - }, - }); - }); -})(jQuery); diff --git a/hypha/static_src/sass/components/_button.scss b/hypha/static_src/sass/components/_button.scss index 186e88a839730a2f60157f8f08f1f2fc2e1842a3..760d0b2fea3d248edec6c5a75701ab6fadf2f620 100644 --- a/hypha/static_src/sass/components/_button.scss +++ b/hypha/static_src/sass/components/_button.scss @@ -411,12 +411,6 @@ } } - &--float { - position: absolute; - inset-block-start: 2px; - inset-inline-end: 2px; - } - // Two-factor &-info, &-link {