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

Changes about platform style theme - refs BT#21621 #5614

Merged
merged 16 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
8c7e926
Internal: Allow to set ColorTheme by AccessUrl - refs BT#21621
AngelFQC Jun 25, 2024
f20199d
Internal: Remove references to stylesheets setting - refs BT#21621
AngelFQC Jun 25, 2024
afbe67c
Internal: Add ThemeHelper to get the current color theme - refs BT#21621
AngelFQC Jun 25, 2024
a20653f
Admin: Allow to set color theme according the access url - refs BT#21621
AngelFQC Jun 26, 2024
ea02e1d
Internal: Remove references to platform.theme setting - refs BT#21621
AngelFQC Jun 26, 2024
84b94e3
Admin: Load color themes to be selected by current access url - refs …
AngelFQC Jun 26, 2024
34106e8
Internal: Add twig functions to get assets from the current theme - r…
AngelFQC Jun 28, 2024
8453525
Internal: Name properly variable in migration about style themes - re…
AngelFQC Jun 28, 2024
e6a69a5
Internal: Configure filesystem for themes and use it when creating th…
AngelFQC Jun 29, 2024
0ea0c4c
Internal: Load theme assets from var/themes - refs BT#21621
AngelFQC Jul 1, 2024
c31251b
Internal: Include default chamilo colors theme - refs BT#21621
AngelFQC Jul 1, 2024
783bee4
CI: Add tests for ThemeController - refs BT#21621
AngelFQC Jul 1, 2024
75a0afe
Internal: Fix to get course setting value to get visual theme - refs …
AngelFQC Jul 1, 2024
6e81d5b
Internal: Remove references to assets/css/theme path - refs BT#21621
AngelFQC Jul 1, 2024
a329033
Internal: Validate if theme asset exists - refs BT#21621
AngelFQC Jul 2, 2024
54e6796
Internal: Migration: Remove stylesheets ad theme settings + move var/…
AngelFQC Jul 5, 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
36 changes: 0 additions & 36 deletions assets/css/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,6 @@

@import "tinymce/skins/ui/oxide/skin.css";

// TAILWIND COLOR DEFINITION https://tailwindcss.com/docs/customizing-colors#using-css-variables
@layer base {
:root {
--color-primary-base: 46 117 163;
--color-primary-gradient: 36 77 103;
--color-primary-button-text: 46 117 163;
--color-primary-button-alternative-text: 255 255 255;

--color-secondary-base: 243 126 47;
--color-secondary-gradient: 224 100 16;
--color-secondary-button-text: 255 255 255;

--color-tertiary-base: 51 51 51;
--color-tertiary-gradient: 0 0 0;
--color-tertiary-button-text: 255 255 255;

--color-success-base: 119 170 12;
--color-success-gradient: 83 127 0;
--color-success-button-text: 255 255 255;

--color-info-base: 13 123 253;
--color-info-gradient: 0 84 211;
--color-info-button-text: 255 255 255;

--color-warning-base: 245 206 1;
--color-warning-gradient: 186 152 0;
--color-warning-button-text: 0 0 0;

--color-danger-base: 223 59 59;
--color-danger-gradient: 180 0 21;
--color-danger-button-text: 255 255 255;

--color-form-base: 46 117 163;
}
}

@layer utilities {
.border-gray-300 {
--tw-border-opacity: 1;
Expand Down
Empty file.
Binary file removed assets/css/themes/chamilo/fonts/OpenSans-Bold.woff
Binary file not shown.
Binary file removed assets/css/themes/chamilo/fonts/OpenSans-Bold.woff2
Binary file not shown.
Binary file removed assets/css/themes/chamilo/fonts/OpenSans-Light.woff
Binary file not shown.
Binary file removed assets/css/themes/chamilo/fonts/OpenSans-Light.woff2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed assets/css/themes/chamilo/fonts/OpenSans.woff
Binary file not shown.
Binary file removed assets/css/themes/chamilo/fonts/OpenSans.woff2
Binary file not shown.
Empty file.
4 changes: 2 additions & 2 deletions assets/vue/AppInstaller.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
href="index.php"
>
<img
:src="'/themes/chamilo/images/header-logo.svg'"
alt="Chamilo"
src="/build/css/themes/chamilo/images/header-logo.png"
>
/>
</a>
<ol>
<li
Expand Down
5 changes: 3 additions & 2 deletions assets/vue/components/layout/PlatformLogo.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<script setup>
import headerLogoPath from "../../../../assets/css/themes/chamilo/images/header-logo.svg"
import { usePlatformConfig } from "../../store/platformConfig"
import { useVisualTheme } from "../../composables/theme"

const platformConfigStore = usePlatformConfig()
const { getThemeAssetUrl } = useVisualTheme()

const siteName = platformConfigStore.getSetting("platform.site_name")
</script>

<template>
<img
:alt="siteName"
:src="headerLogoPath"
:title="siteName"
:src="getThemeAssetUrl('images/header-logo.png')"
/>
</template>
50 changes: 50 additions & 0 deletions assets/vue/components/platform/ColorThemeSelector.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<script setup>
import BaseSelect from "../basecomponents/BaseSelect.vue"
import { ref } from "vue"
import themeService from "../../services/colorThemeService"
import { useI18n } from "vue-i18n"
import { useNotification } from "../../composables/notification"

const modelValue = defineModel({
required: true,
type: Object,
})

const { t } = useI18n()
const { showErrorNotification } = useNotification()

const serverThemes = ref([])
const isServerThemesLoading = ref(true)

const loadThemes = async () => {
try {
const { items } = await themeService.findAllByCurrentUrl()

serverThemes.value = items.map((accessUrlRelColorTheme) => accessUrlRelColorTheme.colorTheme)

modelValue.value = items.find((accessUrlRelColorTheme) => accessUrlRelColorTheme.active)?.colorTheme["@id"]
} catch (e) {
showErrorNotification(t("We could not retrieve the themes"))
} finally {
isServerThemesLoading.value = false
}
}

defineExpose({
loadThemes,
})

loadThemes()
</script>

<template>
<BaseSelect
v-model="modelValue"
:is-loading="isServerThemesLoading"
:label="t('Color theme selected')"
:options="serverThemes"
allow-clear
option-label="title"
option-value="@id"
/>
</template>
16 changes: 16 additions & 0 deletions assets/vue/composables/theme.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { onMounted, ref, watch } from "vue"
import Color from "colorjs.io"
import { usePlatformConfig } from "../store/platformConfig"

export const useTheme = () => {
let colors = {}
Expand Down Expand Up @@ -71,3 +72,18 @@ export const useTheme = () => {
setColors,
}
}

export function useVisualTheme() {
const platformConfigStore = usePlatformConfig()

const themeName = platformConfigStore.visualTheme

function getThemeAssetUrl(path) {
return `/themes/${platformConfigStore.visualTheme}/${path}`
}

return {
themeName,
getThemeAssetUrl,
}
}
21 changes: 15 additions & 6 deletions assets/vue/services/colorThemeService.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ const url = "/api/color_themes"
/**
* Gets the color themes
*
* @returns {Promise<Array>}
* @returns {Promise<{totalItems, items}>}
*/
async function getThemes() {
const { items } = await baseService.getCollection(url)

return items
async function findAllByCurrentUrl() {
return await baseService.getCollection("/api/access_url_rel_color_themes")
}

/**
Expand All @@ -35,7 +33,18 @@ async function updateTheme({ iri = null, title, colors }) {
})
}

/**
* @param {string} iri
* @returns {Promise<Object>}
*/
async function changePlatformColorTheme(iri) {
return baseService.post("/api/access_url_rel_color_themes", {
colorTheme: iri,
})
}

export default {
getThemes,
updateTheme,
findAllByCurrentUrl,
changePlatformColorTheme,
}
4 changes: 4 additions & 0 deletions assets/vue/store/platformConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ export const usePlatformConfig = defineStore("platformConfig", () => {
const settings = ref([])
const studentView = ref("teacherview")
const plugins = ref([])
const visualTheme = ref("chamilo")

async function findSettingsRequest() {
isLoading.value = true

try {
const { data } = await axios.get("/platform-config/list")

visualTheme.value = data.visual_theme

settings.value = data.settings

studentView.value = data.studentview
Expand Down Expand Up @@ -44,5 +47,6 @@ export const usePlatformConfig = defineStore("platformConfig", () => {
initialize,
getSetting,
isStudentViewActive,
visualTheme,
}
})
Loading
Loading