diff --git a/funnel/assets/js/profile_followers.js b/funnel/assets/js/profile_followers.js new file mode 100644 index 000000000..a10110d9b --- /dev/null +++ b/funnel/assets/js/profile_followers.js @@ -0,0 +1,16 @@ +import TableSearch from './utils/tablesearch'; + +$(() => { + window.Hasgeek.profileFollowersInit = (search) => { + if (search) { + const tableSearch = new TableSearch(search.tableId); + const inputId = `#${search.inputId}`; + const tableRow = `#${search.tableId} tbody tr`; + $(inputId).keyup(function doTableSearch() { + $(tableRow).addClass('mui--hide'); + const hits = tableSearch.searchRows($(this).val()); + $(hits.join(',')).removeClass('mui--hide'); + }); + } + }; +}); diff --git a/funnel/templates/follow_share_details_modal.html.jinja2 b/funnel/templates/follow_share_details_modal.html.jinja2 new file mode 100644 index 000000000..4ed0fcb61 --- /dev/null +++ b/funnel/templates/follow_share_details_modal.html.jinja2 @@ -0,0 +1,84 @@ +{% from "macros.html.jinja2" import faicon, csrf_tag %} + + + + + + diff --git a/funnel/templates/profile_followers.html.jinja2 b/funnel/templates/profile_followers.html.jinja2 new file mode 100644 index 000000000..fb6002d08 --- /dev/null +++ b/funnel/templates/profile_followers.html.jinja2 @@ -0,0 +1,100 @@ +{% extends "profile_layout.html.jinja2" %} +{%- from "macros.html.jinja2" import faicon, useravatar %} + +{%- block pageheaders %} + + + + + +{%- endblock pageheaders %} + +{% block bodyattrs %}class="bg-primary mobile-header"{% endblock bodyattrs %} + +{% block contenthead %} +{% endblock contenthead %} + +{% block baseheadline %} + {{ profile_header(profile, class="mui--hidden-xs mui--hidden-sm", current_page="followers", title=_("Followers")) }} +{% endblock baseheadline %} + +{% block basecontent %} +
+
+
+
+
+ {% trans %}Follow{% endtrans %} + + + + {%- for membership in followers %} + {%- if membership %} + + + + + + {%- endif %} + {%- endfor %} +
{{ membership.member.fullname }}{{ membership.member.username }} +
+
+ {{ useravatar(membership.member, add_profile_link=true, size='big') }} +
+

{{ membership.member.fullname }}{% if membership.member.features.is_private() %}{{ faicon(icon='lock-alt', icon_size='caption', baseline=false, css_class="margin-left") }}{%- endif %}

+

@{{ membership.member.username }}

+
+
+
+
+
+
+
+
+
+
+
+ +{% endblock basecontent %} + +{% block innerscripts %} + + +{% endblock innerscripts %} diff --git a/funnel/templates/profile_layout.html.jinja2 b/funnel/templates/profile_layout.html.jinja2 index 01c2e51cf..69de7049b 100644 --- a/funnel/templates/profile_layout.html.jinja2 +++ b/funnel/templates/profile_layout.html.jinja2 @@ -426,6 +426,7 @@ {% if profile.is_organization_profile %} {% trans %}Home{% endtrans %} {% trans %}Admins{% endtrans %} {{ faicon(icon='chevron-right', icon_size='subhead') }} + {% trans %}Followers{% endtrans %} {{ faicon(icon='chevron-right', icon_size='subhead') }} {% elif not profile.features.is_private() %} {% trans %}Sessions{% endtrans %} {% trans %}Projects{% endtrans %}{{ faicon(icon='chevron-right', icon_size='subhead') }} diff --git a/funnel/views/profile.py b/funnel/views/profile.py index c16173794..f815f91cd 100644 --- a/funnel/views/profile.py +++ b/funnel/views/profile.py @@ -6,6 +6,7 @@ from baseframe import _ from baseframe.filters import date_filter +from baseframe import forms from baseframe.forms import render_form from coaster.auth import current_auth from coaster.views import ( @@ -277,6 +278,19 @@ def user_proposals(self) -> ReturnRenderWith: ], } + + @route('followers') + @render_with('profile_followers.html.jinja2', json=True) + def followers(self) -> ReturnRenderWith: + # Tobechanged: Return followers + return { + 'profile': self.obj.current_access(datasets=('primary', 'related')), + 'followers': [ + membership.current_access(datasets=('without_parent', 'related')) + for membership in self.obj.active_admin_memberships + ], + } + @route('past.projects') @requestargs(('page', int), ('per_page', int)) @render_with('past_projects_section.html.jinja2') @@ -468,4 +482,16 @@ def transition(self) -> ReturnView: return render_redirect(get_next_url(referrer=True)) + @route('follow', methods=['GET']) + @render_with('follow_share_details_modal.html.jinja2') + @requires_login + def follow(self) -> ReturnRenderWith: + """Edit project banner.""" + form = forms.Form() + return { + 'profile': self.obj, + 'form': form, + } + + ProfileView.init_app(app) diff --git a/webpack.config.js b/webpack.config.js index 5403a756e..22465ae6c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -55,6 +55,7 @@ module.exports = { labels_form: path.resolve(__dirname, 'funnel/assets/js/labels_form.js'), cfp_form: path.resolve(__dirname, 'funnel/assets/js/cfp_form.js'), rsvp_form_modal: path.resolve(__dirname, 'funnel/assets/js/rsvp_form_modal.js'), + profile_followers: path.resolve(__dirname, 'funnel/assets/js/profile_followers.js'), app_css: path.resolve(__dirname, 'funnel/assets/sass/app.scss'), form_css: path.resolve(__dirname, 'funnel/assets/sass/form.scss'), index_css: path.resolve(__dirname, 'funnel/assets/sass/pages/index.scss'),