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

Redesign profile page #706

Merged
merged 50 commits into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
552ba46
Remove everything from profile & add basic card grid layout
Splines Nov 22, 2024
ea98fa4
Add back first elements as cards
Splines Nov 22, 2024
e9897bd
Add back in voucher and user data (gdpr)
Splines Nov 22, 2024
b2d6b19
Avoid nested voucher form
Splines Nov 22, 2024
1569817
Add margin in mobile view when stacked
Splines Nov 22, 2024
d2db7c4
Pimp up profile card styling & add voucher redemption pattern
Splines Nov 22, 2024
4d6207c
Move GDPR to account & use full-width for courses
Splines Nov 22, 2024
a8b1904
Add modal for data request
Splines Nov 22, 2024
81a7640
Show toast upon data request
Splines Nov 22, 2024
4c6fad8
Add text to notification toast upon data request
Splines Nov 22, 2024
382ead9
Delete unused file (from now on unused)
Splines Nov 22, 2024
b55c32b
Improve request data modal explanation text
Splines Nov 23, 2024
33d1c63
Fix card header border radius
Splines Nov 23, 2024
0485366
Make accordion background transparent
Splines Nov 23, 2024
e8fd13d
Decaffeinate profile code
Splines Nov 23, 2024
f237078
Account for border also in voucher redemption box
Splines Nov 23, 2024
e40fab9
Add custom wrapper class to reduce checkbox margin
Splines Nov 23, 2024
6415daa
Ensure equal height columns
Splines Nov 23, 2024
9c21760
Improve unsaved changes btn & show immediately
Splines Nov 23, 2024
e574fd4
Add helpdesk to redeem voucher form
Splines Nov 23, 2024
a6df97b
Print some labels in bold
Splines Nov 23, 2024
8f7d44a
Change "unsaved changed" button to warning color
Splines Nov 23, 2024
b62c625
Add back in accordion id
Splines Nov 23, 2024
6b3211b
Add another div for the voucher redeem content
Splines Nov 23, 2024
14f7ac5
Replace "einige Daten" by "bestimmte Daten"
Splines Nov 23, 2024
1abed35
Move javascript include tag to end to avoid initialization issues
Splines Nov 23, 2024
2701f3b
Use $(document).ready() to not miss load events
Splines Nov 23, 2024
8096694
Show unsaved changes also at bottom (for small displays)
Splines Nov 23, 2024
e893865
Only add margin for big displays
Splines Nov 23, 2024
d72bb7d
Fix margins below redeem voucher card
Splines Nov 23, 2024
8093267
Remove left-over console log
Splines Nov 23, 2024
9cbbd69
Improve data request sent toast message
Splines Nov 23, 2024
30829e0
Improve redeem voucher form for small displays
Splines Nov 23, 2024
227dd16
Wrap text in unsaved changes button on small displays
Splines Nov 23, 2024
b2cb3a3
Merge branch 'dev' into redesign/profile-page
Splines Nov 23, 2024
ef7ae77
Improve wording of content tag search & add tooltip
Splines Nov 23, 2024
9b534b5
Use other pattern for voucher redemption card
Splines Nov 23, 2024
8efc817
Test changing user name (cypress)
Splines Nov 24, 2024
4024892
Test changing user tutorial submission name (cypress)
Splines Nov 24, 2024
a62f732
Remove further `custom: true` occurrences
Splines Nov 24, 2024
3b70605
Test if language is correctly switched (cypress)
Splines Nov 24, 2024
ccea0fb
Start writing module settings cypress test
Splines Nov 24, 2024
0986403
use voronoi pattern for voucher redemption card
f-buerckel Nov 25, 2024
2251df0
Merge remote-tracking branch 'origin/redesign/profile-page' into rede…
Splines Nov 26, 2024
6d6c25b
Merge branch 'dev' into redesign/profile-page
Splines Dec 1, 2024
adad4a7
Fix flaky language switch test & refactor
Splines Dec 3, 2024
9904350
Merge branch 'dev' into redesign/profile-page
Splines Dec 3, 2024
f7bcb3c
Add test for module settings (allow to subscribe to a lecture)
Splines Dec 3, 2024
2c385fb
Merge branch 'dev' into redesign/profile-page
Splines Dec 3, 2024
55ee842
Remove cypress `.only`
Splines Dec 3, 2024
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
2 changes: 2 additions & 0 deletions app/assets/images/voronoi_pattern.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
//= require masonry_grid
//= require media
//= require notifications
//= require profile
//= require questions
//= require quizzes
//= require referrals
Expand Down
37 changes: 0 additions & 37 deletions app/assets/javascripts/profile.coffee

This file was deleted.

42 changes: 42 additions & 0 deletions app/assets/javascripts/profile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
$(document).ready(function () {
$("#profileForm").on("change input", function () {
$("#profileChange").removeClass("d-none");
$("#profileChangeBottom").removeClass("d-none");
});

$('input:checkbox[name^="user[lecture"]').on("change", function () {
const courseId = this.dataset.course;
const lectureId = this.dataset.lecture;
const checkedCount = $('input:checked[data-course="' + courseId + '"]').length;
const authRequiredLectureIds = $("#lectures-for-course-" + courseId).data("authorize");

if ($(this).prop("checked") && authRequiredLectureIds.includes(parseInt(lectureId))) {
$("#pass-lecture-" + lectureId).show();
}
else {
$("#pass-lecture-" + lectureId).hide();
if (checkedCount === 0) {
$('.courseSubInfo[data-course="' + courseId + '"]').removeClass("fas fa-check-circle")
.addClass("far fa-circle");
}
else {
$('.courseSubInfo[data-course="' + courseId + '"]').removeClass("far fa-circle")
.addClass("fas fa-check-circle");
}
}
});

$(".programCollapse").on("show.bs.collapse", function () {
const program = $(this).data("program");
$("#program-" + program + "-collapse").find(".coursePlaceholder").each(function () {
const course = $(this).data("course");
$(this).append($("#course-card-" + course));
$("#course-card-" + course).show();
});
});

$("#request-data-btn").on("click", function () {
const toast = $("#request-data-toast");
bootstrap.Toast.getOrCreateInstance(toast).show();
});
});
4 changes: 0 additions & 4 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,6 @@ $modal-xxl: 1600px !default;
overflow-y: scroll;
}

#profileChange {
display: none;
}

.revertCommontator {
all: unset;
}
Expand Down
53 changes: 53 additions & 0 deletions app/assets/stylesheets/profile.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
@import "bootstrap/functions";
@import "bootstrap/variables";
@import "bootstrap/mixins";

.voucher-redemption-pattern {
background-image: image-url('voronoi_pattern.svg');
background-position: center;
background-size: 110%;
background-color: #FFFFFF;
height: 3em;

border-top-left-radius: calc(#{$card-inner-border-radius} - 2px);
border-top-right-radius: calc(#{$card-inner-border-radius} - 2px);
}

.profile-card {
height: 100%;
border: 2px solid #223e62;

background: linear-gradient(348deg, #f7faff 0%, #fcfdfd 60%);
box-shadow: rgba(0, 0, 0, 0.25) 0px 1px 3px;

.card-header {
background-color: #223e62;
color: white;

// account for our custom border
border-top-left-radius: calc(#{$card-inner-border-radius} - 2px);
border-top-right-radius: calc(#{$card-inner-border-radius} - 2px);
}
}

@include media-breakpoint-up(sm) {
.voucher-card {
min-width: 30em;
}
}

// needed because of https://github.com/bootstrap-ruby/bootstrap_form/issues/738
// and https://github.com/bootstrap-ruby/bootstrap_form/pull/618
.checkbox-list {
margin-bottom: 0.2em !important;
}

// Ensure equal height columns
.row.display-flex {
display: flex;
flex-wrap: wrap;
}

.row.display-flex>[class*='col-'] {
flex-grow: 1;
}
1 change: 0 additions & 1 deletion app/controllers/profile_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ def show_accordion
def request_data
MathiMailer.data_request_email(current_user).deliver_later
MathiMailer.data_provide_email(current_user).deliver_later
redirect_to edit_profile_path, notice: t("profile.data_request_sent")
end

private
Expand Down
7 changes: 5 additions & 2 deletions app/views/commontator/comments/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@

<div class="field">
<%=
form.text_area :body, rows: '7', class: 'form-control commentForm comment-field', id: new_record ?
form.text_area :body, rows: '7',
"data-cy": "comment-textarea",
class: 'form-control commentForm comment-field', id: new_record ?
comment.parent.nil? ? "commontator-thread-#{@commontator_thread.id}-new-comment-body" :
"commontator-comment-#{comment.parent.id}-reply" :
"commontator-comment-#{comment.id}-edit-body"
Expand All @@ -48,7 +50,8 @@

<div class="submit">
<%= form.submit t("commontator.comment.actions.#{new_record ? 'create' : 'update'}"),
class: 'btn btn-primary btn-sm' %>
class: 'btn btn-primary btn-sm',
"data-cy": "submit-new-comment" %>
<%=
form.submit(
t('commontator.comment.actions.cancel'), name: 'cancel',
Expand Down
3 changes: 2 additions & 1 deletion app/views/commontator/comments/_list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
%>

<% nested_comments.each do |comment, nested_children| %>
<div id="commontator-comment-<%= comment.id %>" class="comment comment-field">
<div id="commontator-comment-<%= comment.id %>" class="comment comment-field"
data-cy="comment">
<%=
render partial: 'commontator/comments/show', formats: [ :html ], locals: {
user: user, comment: comment, nested_children: nested_children
Expand Down
3 changes: 2 additions & 1 deletion app/views/commontator/threads/_reply.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
<div id="commontator-thread-<%= thread.id %>-new-comment-link" class="new-comment">
<%= link_to t('commontator.comment.actions.new'),
commontator.new_thread_comment_path(thread),
remote: true %>
remote: true,
"data-cy": "new-comment" %>
</div>
<% end %>

Expand Down
6 changes: 4 additions & 2 deletions app/views/lectures/subscribe_page.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
value: "redirect" %>
</p>
<%= f.submit t("profile.subscribe_lecture"),
class: "btn btn-primary"%>
class: "btn btn-primary",
"data-cy": "subscribe-to-lecture" %>
<% end %>
<% else %>
<%= link_to t("profile.subscribe_lecture"),
Expand All @@ -58,7 +59,8 @@
parent: "redirect" } }),
method: :patch,
remote: true,
class: "btn btn-primary" %>
class: "btn btn-primary",
"data-cy": "subscribe-to-lecture" %>
<% end %>
</p>
</div>
Expand Down
10 changes: 8 additions & 2 deletions app/views/profile/_account.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<%= link_to t('profile.change_data'),
edit_user_registration_path,
class: "btn btn-outline-secondary mb-2" %>
class: "btn btn-outline-secondary" %>

<button type="button" class="btn btn-outline-secondary" id="open-request-data"
data-bs-toggle="modal" data-bs-target="#requestDataModal">
<%= t('profile.data_request') %>
</button>

<%= link_to t('profile.delete_account'),
delete_account_path,
class: "btn btn-outline-danger mb-2",
class: "btn btn-outline-danger",
"data-cy": "delete-account-btn",
remote: true %>
9 changes: 0 additions & 9 deletions app/views/profile/_data.html.erb

This file was deleted.

21 changes: 10 additions & 11 deletions app/views/profile/_email_notifications.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
<%= f.form_group :email_notifications do %>
<%= f.check_box :email_for_announcement,
label: t('profile.email_for_announcement'),
custom: true %>
fosterfarrell9 marked this conversation as resolved.
Show resolved Hide resolved
wrapper_class: 'checkbox-list' %>
<%= f.check_box :email_for_medium,
label: t('profile.email_for_medium'),
custom: true %>
wrapper_class: 'checkbox-list' %>
<%= f.check_box :email_for_teachable,
label: t('profile.email_for_teachable'),
custom: true %>
wrapper_class: 'checkbox-list' %>
<% end %>
</div>
<div class="col-12">
Expand All @@ -25,22 +25,22 @@
<%= f.form_group :submission_emails do %>
<%= f.check_box :email_for_submission_upload,
label: t('profile.email_for_submission_upload'),
custom: true %>
wrapper_class: 'checkbox-list' %>
<%= f.check_box :email_for_submission_removal,
label: t('profile.email_for_submission_removal'),
custom: true %>
wrapper_class: 'checkbox-list' %>
<%= f.check_box :email_for_submission_join,
label: t('profile.email_for_submission_join'),
custom: true %>
wrapper_class: 'checkbox-list' %>
<%= f.check_box :email_for_submission_leave,
label: t('profile.email_for_submission_leave'),
custom: true %>
wrapper_class: 'checkbox-list' %>
<%= f.check_box :email_for_correction_upload,
label: t('profile.email_for_correction_upload'),
custom: true %>
wrapper_class: 'checkbox-list' %>
<%= f.check_box :email_for_submission_decision,
label: t('profile.email_for_submission_decision'),
custom: true %>
wrapper_class: 'checkbox-list' %>
<% end %>
</div>
<div class="col-12">
Expand All @@ -49,8 +49,7 @@
</h5>
<%= f.form_group :other_email_notifications do %>
<%= f.check_box :email_for_news,
label: t('profile.email_for_news'),
custom: true %>
label: t('profile.email_for_news') %>
<% end %>
</div>
</div>
50 changes: 50 additions & 0 deletions app/views/profile/_request_data_modal.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!-- Modal -->
<div class="modal fade" id="requestDataModal" tabindex="-1"
aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">

<div class="modal-header">
<h1 class="modal-title fs-5" id="exampleModalLabel">
<%= t('profile.my_data') %>
</h1>
<button type="button" class="btn-close"
data-bs-dismiss="modal" aria-label="Close"></button>
</div>

<div class="modal-body">
<%= t('profile.data_explanation') %>
</div>

<div class="modal-footer">
<%= link_to t('profile.data_request'),
request_data_path,
class: "btn btn-primary",
id: "request-data-btn",
type: "button",
data: { 'bs-dismiss': 'modal' },
remote: true %>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>

</div>
</div>
</div>

<!-- Notification upon successful data retrieval -->
<div aria-live="polite" aria-atomic="true"
class="position-fixed top-50 start-50 translate-middle" style="z-index: 1050;">
<div class="toast profile-card" id="request-data-toast" role="alert"
aria-live="assertive" aria-atomic="true" data-bs-autohide="false">

<div class="toast-header">
<strong class="me-auto"><%= t('profile.data_request') %></strong>
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
</div>

<div class="toast-body">
<%= t('profile.data_request_sent') %>
</div>

</div>
</div>
Loading
Loading