-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor new layout: no extra languages; responsive layout (#1186)
* added special other_language language tag; refactored courses page to be more responsive * fix tests * remove some comments
- Loading branch information
Showing
15 changed files
with
465 additions
and
166 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
backend/migrations/20230512085720_update-tags-create_other_language_tags.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { Knex } from "knex" | ||
|
||
export async function up(knex: Knex): Promise<void> { | ||
await knex.raw(` | ||
insert into tag (id, hidden) values ('other_language', false) on conflict do nothing; | ||
`) | ||
await knex.raw(` | ||
insert into tag_type (name) values ('language') on conflict do nothing; | ||
`) | ||
await knex.raw(` | ||
insert into "_TagToTagType" ("A", "B") values ('other_language', 'language') | ||
on conflict do nothing; | ||
`) | ||
await knex.raw(` | ||
insert into "_CourseToTag" ("A", "B") | ||
select c.id, 'other_language' from course c | ||
join "_CourseToTag" ctt on c.id = ctt."A" | ||
join tag on ctt."B" = tag.id | ||
join "_TagToTagType" ttt on tag.id = ttt."A" | ||
where ttt."B" = 'language' | ||
and tag.id not in ('en', 'fi', 'se') | ||
on conflict do nothing; | ||
`) | ||
await knex.raw(` | ||
insert into tag_translation (tag_id, language, name) | ||
values ('other_language', 'en_US', 'other language') | ||
on conflict do nothing; | ||
`) | ||
await knex.raw(` | ||
insert into tag_translation (tag_id, language, name) | ||
values ('other_language', 'fi_FI', 'muu kieli') | ||
on conflict do nothing; | ||
`) | ||
} | ||
|
||
export async function down(knex: Knex): Promise<void> { | ||
await knex.raw(` | ||
delete from tag_translation where tag_id = 'other_language'; | ||
`) | ||
await knex.raw(` | ||
delete from "_CourseToTag" where "B" = 'other_language'; | ||
`) | ||
await knex.raw(` | ||
delete from "_TagToTagType" where "A" = 'other_language'; | ||
`) | ||
await knex.raw(` | ||
delete from tag where id = 'other_language'; | ||
`) | ||
} |
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
Oops, something went wrong.