Bug fixes and new styling for the news page

This commit is contained in:
Inga Kirschnick 2022-12-21 14:38:17 +01:00
parent c79bc1ed57
commit f5a1cf75dd
6 changed files with 59 additions and 43 deletions

View File

@ -28,7 +28,7 @@ def faq():
@login_required @login_required
def dashboard(): def dashboard():
users = [ users = [
u.to_json_serializeable(filter_by_privacy_settings=True, include_avatar_relationship=True) for u u.to_json_serializeable(filter_by_privacy_settings=True) for u
in User.query.filter(User.is_public == True, User.id != current_user.id).all() in User.query.filter(User.is_public == True, User.id != current_user.id).all()
] ]
return render_template('main/dashboard.html.j2', title='Dashboard', users=users) return render_template('main/dashboard.html.j2', title='Dashboard', users=users)

View File

@ -47,7 +47,7 @@ class PublicUserList extends RessourceList {
return { return {
'id': user.id, 'id': user.id,
'member-since': user.member_since, 'member-since': user.member_since,
'avatar': user.avatar ? `/profile/${user.id}/avatars/${user.avatar.id}` : '/static/images/user_avatar.png', 'avatar': user.avatar ? `/profile/${user.id}/avatar` : '/static/images/user_avatar.png',
'username': user.username, 'username': user.username,
'full-name': user.full_name ? user.full_name : '', 'full-name': user.full_name ? user.full_name : '',
'location': user.location ? user.location : '', 'location': user.location ? user.location : '',

View File

@ -11,16 +11,16 @@
<div class="col s12"> <div class="col s12">
<form method="POST"> <form method="POST">
{{ edit_general_settings_form.hidden_tag() }} {{ edit_profile_settings_form.hidden_tag() }}
<div class="card"> <div class="card">
<div class="card-content"> <div class="card-content">
<span class="card-title">General settings</span> <span class="card-title">General settings</span>
{{ wtf.render_field(edit_general_settings_form.username, material_icon='person') }} {{ wtf.render_field(edit_profile_settings_form.username, material_icon='person') }}
{{ wtf.render_field(edit_general_settings_form.email, material_icon='email') }} {{ wtf.render_field(edit_profile_settings_form.email, material_icon='email') }}
</div> </div>
<div class="card-action"> <div class="card-action">
<div class="right-align"> <div class="right-align">
{{ wtf.render_field(edit_general_settings_form.submit, material_icon='send') }} {{ wtf.render_field(edit_profile_settings_form.submit, material_icon='send') }}
</div> </div>
</div> </div>
</form> </form>

View File

@ -44,24 +44,29 @@
</div> </div>
<div class="col s12" id="social"> <div class="col s12" id="social">
<h3>Social</h3> <h3>Social</h3>
<div class="col s12"> <div class="card">
<div class="card"> <div class="card-content">
<div class="card-content"> <span class="card-title">Other users and groups</span>
<span class="card-title">Other users and groups</span> <p>Find other users and follow them to see their corpora and groups.</p>
<p>Find other users and follow them to see their corpora and groups.</p> <div class="public-user-list no-autoinit"></div>
<div class="public-user-list no-autoinit"></div>
</div>
</div> </div>
</div> </div>
<div class="col s12"> <div class="card">
<div class="card"> <div class="card-content">
<div class="card-content"> <span class="card-title">Public corpora</span>
<span class="card-title">Public corpora</span> <p>Find public corpora</p>
<p>Find public corpora</p>
</div>
</div> </div>
</div> </div>
</div> </div>
<div class="fixed-action-btn direction-top active" style="bottom:45px; right:24px;">
<a id="news-feature-discovery" class="waves-effect waves-light btn btn-floating"><i class="material-icons">mail</i></a>
</div>
<div class="tap-target" data-target="news-feature-discovery" style="background-color:#1A5C89">
<div class="tap-target-content">
<h5>Title</h5>
<p>A bunch of text</p>
</div>
</div>
</div> </div>
</div> </div>
{% endblock page_content %} {% endblock page_content %}

View File

@ -7,10 +7,9 @@
<div class="col s12"> <div class="col s12">
<h1 id="title">{{ title }}</h1> <h1 id="title">{{ title }}</h1>
</div> </div>
<div class="col s12"> <div class="col s12">
<div id="aggregated-news"></div> <div id="aggregated-news"></div>
<div class="card" id="april-2022-update"> <div class="card" id="april-2022-update">
<div class="card-content"> <div class="card-content">
<span class="card-title">April 2022 update</span> <span class="card-title">April 2022 update</span>
@ -199,31 +198,44 @@
function mastodonStatusToHtml(status) { function mastodonStatusToHtml(status) {
return htmlString = ` return htmlString = `
<div class="card white-text" style="background-color:#5D50E7;">
<div class="card-content">
<span class="card-title">New Actitvity on Mastodon</span>
${status.content}
</div>
</div>
`.trim();
}
function bisBlogsEntryToHtml(entry) {
return `
<div class="row"> <div class="row">
<div class="col s1">
<img src="https://blogs.uni-bielefeld.de/blog/uniintern/resource/themabilder/unilogo-square.svg" alt="Bielefeld University Blogs" class="responsive-img">
</div>
<div class="col s11"> <div class="col s11">
<div class="card" style="background-color: #14f5b4;"> <div class="card white-text" style="background-color:#5D50E7; border-radius:10px;">
<div class="card-content"> <div class="card-content">
<span class="card-title">${entry.title['#text']}</span> <span class="card-title">New Actitvity on Mastodon</span>
${entry.content['#text']} ${status.content}
</div> </div>
</div> </div>
</div> </div>
</div> <div class="col s1">
<img src="https://joinmastodon.org/logos/logo-purple.svg" alt="Mastodon" class="responsive-img hide-on-small-only" style="width:70%; margin-top:30px;">
</div>
`.trim(); `.trim();
} }
function bisBlogsEntryToHtml(entry) {
let bisBlogHTMLElement = document.createElement('div');
bisBlogHTMLElement.classList.add('row');
bisBlogHTMLElement.innerHTML = `
<div class="row">
<div class="col s1">
<img src="https://blogs.uni-bielefeld.de/blog/uniintern/resource/themabilder/unilogo-square.svg" alt="Bielefeld University Blogs" class="responsive-img hide-on-small-only" style="width:70%; margin-top:40px;">
</div>
<div class="col s11">
<div class="card" style="background-color: #A5BDCC; border-radius:10px;">
<div class="card-content">
<span class="card-title">${entry.title['#text']}</span>
${entry.content['#text']}
</div>
</div>
</div>
</div>
`.trim();
let bisBlogImages = bisBlogHTMLElement.querySelectorAll('img');
bisBlogImages.forEach((img) => {
img.classList.add('responsive-img');
});
return bisBlogHTMLElement.outerHTML;
}
let aggregatedNewsElement = document.querySelector('#aggregated-news'); let aggregatedNewsElement = document.querySelector('#aggregated-news');
aggregateNews().then((aggregatedNews) => { aggregateNews().then((aggregatedNews) => {

View File

@ -22,7 +22,7 @@
<div class="col s7"> <div class="col s7">
<div class="row"> <div class="row">
<div class="col s12"> <div class="col s12">
<h3 style="float:left">{{ user.username }}<span class="new badge green" id="public-information-badge" data-badge-caption="custom caption" style="margin-top:20px;"></span></h3> <h3 style="float:left">{{ user.username }}<span class="new badge green" id="public-information-badge" data-badge-caption="" style="margin-top:20px;"></span></h3>
</div> </div>
<div class="col 12"> <div class="col 12">
{% if user.show_last_seen %} {% if user.show_last_seen %}
@ -82,8 +82,8 @@
{% endif %} {% endif %}
<p></p> <p></p>
<br> <br>
{% if current_user.is_authenticated and current_user.id == user.id %} {% if current_user.is_authenticated and current_user.hashid == user.id %}
<a class="waves-effect waves-light btn-small" href="{{ url_for('.edit_profile', user_id=user.id) }}">Edit profile</a> <a class="waves-effect waves-light btn-small" href="{{ url_for('.edit_profile', user_id=current_user.id) }}">Edit profile</a>
{% endif %} {% endif %}
</div> </div>
</div> </div>
@ -115,8 +115,7 @@
{{ super() }} {{ super() }}
<script> <script>
let publicInformationBadge = document.querySelector('#public-information-badge'); let publicInformationBadge = document.querySelector('#public-information-badge');
if ("{{ user.id }}" == "{{ current_user.hashid }}") {
if ("{{ user }}" == "{{ current_user }}") {
if ("{{ user.is_public }}" == "True") { if ("{{ user.is_public }}" == "True") {
publicInformationBadge.dataset.badgeCaption = 'Your profile is public'; publicInformationBadge.dataset.badgeCaption = 'Your profile is public';
publicInformationBadge.classList.add('green'); publicInformationBadge.classList.add('green');