-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow customizing course checkbox privacy policy texts, make wide tab…
…les responsive inside exercises, and misc fixes (#1357) * Support tables with a lot of columns inside exercise blocks * Allow customizing custom privacy policy checkbox texts on the course settings dialog * Add error handling to marketing consent form and update privacy policy checkbox table schema * Update Ukrainian translations
- Loading branch information
Showing
16 changed files
with
340 additions
and
108 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
services/cms/src/utils/Gutenberg/editBlockThemeJsonSettings.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...adless-lms/migrations/20241212140953_course_custom_privacy_policy_checkbox_texts.down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DROP TABLE course_custom_privacy_policy_checkbox_texts; |
23 changes: 23 additions & 0 deletions
23
...headless-lms/migrations/20241212140953_course_custom_privacy_policy_checkbox_texts.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
CREATE TABLE course_custom_privacy_policy_checkbox_texts ( | ||
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY, | ||
course_id UUID NOT NULL REFERENCES courses(id), | ||
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), | ||
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), | ||
deleted_at TIMESTAMP WITH TIME ZONE, | ||
text_html TEXT NOT NULL, | ||
text_slug TEXT NOT NULL, | ||
UNIQUE NULLS NOT DISTINCT (course_id, text_slug, deleted_at) | ||
); | ||
CREATE TRIGGER set_timestamp BEFORE | ||
UPDATE ON course_custom_privacy_policy_checkbox_texts FOR EACH ROW EXECUTE PROCEDURE trigger_set_timestamp(); | ||
COMMENT ON TABLE course_custom_privacy_policy_checkbox_texts IS 'Used to set the privacy policy checkbox texts in the course settings dialog when a course has a different privacy policy than all the other courses. (e.g., the Elements of AI course)'; | ||
COMMENT ON COLUMN course_custom_privacy_policy_checkbox_texts.id IS 'A unique, stable identifier for the record.'; | ||
COMMENT ON COLUMN course_custom_privacy_policy_checkbox_texts.created_at IS 'Timestamp when the record was created.'; | ||
COMMENT ON COLUMN course_custom_privacy_policy_checkbox_texts.updated_at IS 'Timestamp when the record was last updated. The field is updated automatically by the set_timestamp trigger.'; | ||
COMMENT ON COLUMN course_custom_privacy_policy_checkbox_texts.deleted_at IS 'Timestamp when the record was deleted. If null, the record is not deleted.'; | ||
COMMENT ON COLUMN course_custom_privacy_policy_checkbox_texts.text_html IS 'The HTML content of the text.'; | ||
COMMENT ON COLUMN course_custom_privacy_policy_checkbox_texts.text_slug IS 'An identifier for the text, used to reference it in the course settings dialog.'; | ||
COMMENT ON COLUMN course_custom_privacy_policy_checkbox_texts.course_id IS 'The course in which the text is shown.'; | ||
|
||
CREATE INDEX course_custom_privacy_policy_checkbox_texts_course_id_idx ON course_custom_privacy_policy_checkbox_texts (course_id) | ||
WHERE deleted_at IS NULL; |
48 changes: 48 additions & 0 deletions
48
.../models/.sqlx/query-953607b07ff76b32b28eb3fb706a5770aa7fa66cc978781a8fc8235ff277eb08.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
services/headless-lms/models/src/course_custom_privacy_policy_checkbox_texts.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use crate::prelude::*; | ||
|
||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)] | ||
#[cfg_attr(feature = "ts_rs", derive(TS))] | ||
pub struct CourseCustomPrivacyPolicyCheckboxText { | ||
pub id: Uuid, | ||
pub course_id: Uuid, | ||
pub created_at: DateTime<Utc>, | ||
pub updated_at: DateTime<Utc>, | ||
pub deleted_at: Option<DateTime<Utc>>, | ||
pub text_html: String, | ||
pub text_slug: String, | ||
} | ||
|
||
pub async fn get_all_by_course_id( | ||
conn: &mut PgConnection, | ||
course_id: Uuid, | ||
) -> ModelResult<Vec<CourseCustomPrivacyPolicyCheckboxText>> { | ||
let texts = sqlx::query_as!( | ||
CourseCustomPrivacyPolicyCheckboxText, | ||
r#" | ||
SELECT * | ||
FROM course_custom_privacy_policy_checkbox_texts | ||
WHERE course_id = $1 | ||
AND deleted_at IS NULL; | ||
"#, | ||
course_id, | ||
) | ||
.fetch_all(conn) | ||
.await?; | ||
Ok(texts) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.