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 23 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
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).on("turbolinks:load", function () {
$("#profileForm").on("change input", function () {
$("#profileChange").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 () {
console.log("pressed");
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
57 changes: 57 additions & 0 deletions app/assets/stylesheets/profile.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
@import "bootstrap/functions";
@import "bootstrap/variables";

.voucher-redemption-pattern {
background:
radial-gradient(50% 50% at 100% 0, #FFFFFF 0% 5%, #223E62 6% 15%, #FFFFFF 16% 25%, #223E62 26% 35%, #FFFFFF 36% 45%,
#223E62 46% 55%, #FFFFFF 56% 65%, #223E62 66% 75%, #FFFFFF 76% 85%, #223E62 86% 95%,
#0000 96%),
radial-gradient(50% 50% at 0 100%, #FFFFFF 0% 5%, #223E62 6% 15%, #FFFFFF 16% 25%, #223E62 26% 35%, #FFFFFF 36% 45%,
#223E62 46% 55%, #FFFFFF 56% 65%, #223E62 66% 75%, #FFFFFF 76% 85%, #223E62 86% 95%,
#0000 96%),
radial-gradient(50% 50%, #FFFFFF 0% 5%, #223E62 6% 15%, #FFFFFF 16% 25%, #223E62 26% 35%, #FFFFFF 36% 45%,
#223E62 46% 55%, #FFFFFF 56% 65%, #223E62 66% 75%, #FFFFFF 76% 85%, #223E62 86% 95%,
#0000 96%),
radial-gradient(50% 50%, #FFFFFF 0% 5%, #223E62 6% 15%, #FFFFFF 16% 25%, #223E62 26% 35%, #FFFFFF 36% 45%,
#223E62 46% 55%, #FFFFFF 56% 65%, #223E62 66% 75%, #FFFFFF 76% 85%, #223E62 86% 95%,
#0000 96%) 39px 39px;
background-size: 78px 78px;
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);
}
}

// 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
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>
2 changes: 1 addition & 1 deletion app/views/profile/_subscription_type.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="row">
<div class="col-12">
<%= f.form_group :locale,
label: { text: t('profile.locale') } do %>
label: { text: t('profile.locale'), class: 'fw-bold' } do %>
<% I18n.available_locales.each do |locale| %>
<%= f.radio_button :locale,
locale.to_s,
Expand Down
4 changes: 2 additions & 2 deletions app/views/profile/_subscriptions.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
<% Program.includes(divisions: [courses: [lectures: [:term, :teacher]]])
.select { |p| p.courses.any? }.natural_sort_by(&:name_with_subject)
.each do |p| %>
<div class="accordion-item">
<button class="accordion-button collapsed"
<div class="accordion-item bg-transparent">
<button class="accordion-button collapsed bg-transparent"
type="button"
data-bs-toggle="collapse"
data-bs-target="#program-<%= p.id %>-collapse">
Expand Down
Loading