This repository has been archived by the owner on Jan 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
16 changed files
with
154 additions
and
53 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
33 changes: 33 additions & 0 deletions
33
services/app/lib/hexlet_basics_web/schemas/company_schema.ex
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,33 @@ | ||
defmodule HexletBasicsWeb.Schemas.CompanySchema do | ||
alias HexletBasicsWeb.Router.Helpers, as: Routes | ||
|
||
def build(conn) do | ||
%{ | ||
"@context": "https://schema.org", | ||
"@type": "Organization", | ||
url: "http://hexlet.io", | ||
name: "Hexlet", | ||
legalName: "Hexlet Ltd.", | ||
vatID: "VAT ID: FI26641607", | ||
telephone: "+44 20 3514 2938", | ||
sameAs: [ | ||
"https://www.facebook.com/Hexlet", | ||
"https://www.youtube.com/user/HexletUniversity", | ||
"https://twitter.com/HexletHQ", | ||
"https://soundcloud.com/hexlet" | ||
], | ||
address: %{ | ||
"@type": "PostalAddress", | ||
name: "Puolikkotie 8, 02230 Espoo, Finland" | ||
}, | ||
logo: %{ | ||
"@type": "ImageObject", | ||
url: Routes.static_url(conn, "/images/hexlet_logo.png") | ||
}, | ||
email: %{ | ||
"@type": "Text", | ||
"@id": "mailto:support@hexlet.io" | ||
} | ||
} | ||
end | ||
end |
24 changes: 24 additions & 0 deletions
24
services/app/lib/hexlet_basics_web/schemas/language/module/lesson_schema.ex
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,24 @@ | ||
defmodule HexletBasicsWeb.Schemas.Language.Module.LessonSchema do | ||
alias HexletBasicsWeb.Schemas.CompanySchema | ||
alias HexletBasicsWeb.Router.Helpers, as: Routes | ||
|
||
def build(conn, lesson, lesson_description, lesson_theory_html) do | ||
%{ | ||
"@context": "https://schema.org", | ||
"@type": "TechArticle", | ||
author: Gettext.gettext(HexletBasicsWeb.Gettext, "Code Basics Author"), | ||
headline: lesson_description.name, | ||
datePublished: lesson.inserted_at, | ||
dateModified: lesson.updated_at, | ||
image: Routes.static_url(conn, "/images/smm_cover.jpg"), | ||
accessMode: "textOnVisual", | ||
publisher: CompanySchema.build(conn), | ||
hasPart: %{ | ||
"@context": "https://schema.org", | ||
"@type": "WebPageElement", | ||
isAccessibleForFree: "https://schema.org/True", | ||
value: HtmlSanitizeEx.strip_tags(lesson_theory_html) | ||
} | ||
} | ||
end | ||
end |
17 changes: 17 additions & 0 deletions
17
services/app/lib/hexlet_basics_web/schemas/language/module_schema.ex
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,17 @@ | ||
defmodule HexletBasicsWeb.Schemas.Language.ModuleSchema do | ||
alias HexletBasicsWeb.Schemas.CompanySchema | ||
alias HexletBasicsWeb.Router.Helpers, as: Routes | ||
|
||
def build(conn, module, module_description, language) do | ||
%{ | ||
"@context": "https://schema.org", | ||
"@type": "Course", | ||
name: module_description.name, | ||
description: module_description.description, | ||
accessMode: "textOnVisual", | ||
isAccessibleForFree: "https://schema.org/True", | ||
url: Routes.language_module_lesson_path(conn, :index, language.slug, module.slug), | ||
provider: CompanySchema.build(conn) | ||
} | ||
end | ||
end |
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.