From f37058779ac1dfe68004ba085fe5a04b4906b59e Mon Sep 17 00:00:00 2001 From: Jiiks Date: Mon, 12 Feb 2018 02:48:44 +0200 Subject: [PATCH] Radio functional --- client/src/modules/thememanager.js | 2 +- tests/themes/Example/config.json | 50 +++++++++++++++++------------- tests/themes/Example/index.scss | 1 + tests/themes/Example/vars.scss | 3 +- 4 files changed, 33 insertions(+), 23 deletions(-) diff --git a/client/src/modules/thememanager.js b/client/src/modules/thememanager.js index b72ee6fd..4dd57f82 100644 --- a/client/src/modules/thememanager.js +++ b/client/src/modules/thememanager.js @@ -190,7 +190,7 @@ export default class ThemeManager extends ContentManager { return `$${name}: ${value * setting.multi || 1};`; } - if (type === 'dropdown') { + if (type === 'dropdown' || type === 'radio') { return `$${name}: ${setting.options.find(opt => opt.value === value).text};`; } diff --git a/tests/themes/Example/config.json b/tests/themes/Example/config.json index dc02c566..cb3b93fe 100644 --- a/tests/themes/Example/config.json +++ b/tests/themes/Example/config.json @@ -68,6 +68,35 @@ } ] }, + { + "id": "radioTest", + "type": "radio", + "value": "opt1", + "text": "Span text colour", + "hint": "Radio Test Setting Hint", + "options": [ + { + "value": "opt1", + "text": "red" + }, + { + "value": "opt2", + "text": "green" + }, + { + "value": "opt3", + "text": "blue" + }, + { + "value": "opt4", + "text": "orange" + }, + { + "value": "opt5", + "text": "white" + } + ] + }, { "id": "default-0", "type": "text", @@ -81,27 +110,6 @@ "value": true, "text": "Work properly", "hint": "Just some test settings to test the settings panel for themes" - }, - { - "id": "default-2", - "type": "radio", - "value": "opt1", - "text": "Test Radio Setting", - "hint": "Just some test settings to test the settings panel for themes", - "options": [ - { - "value": 1, - "text": "Option 1" - }, - { - "value": 2, - "text": "Option 2" - }, - { - "value": 3, - "text": "Option 3" - } - ] } ] } diff --git a/tests/themes/Example/index.scss b/tests/themes/Example/index.scss index 537073cb..0984461c 100644 --- a/tests/themes/Example/index.scss +++ b/tests/themes/Example/index.scss @@ -6,6 +6,7 @@ div { span { border: 1px solid rgba(20, 20, 20, $spanOpacity); + color: $radioTest !important; } .avatar-large { diff --git a/tests/themes/Example/vars.scss b/tests/themes/Example/vars.scss index 005ca4fe..3adadbbf 100644 --- a/tests/themes/Example/vars.scss +++ b/tests/themes/Example/vars.scss @@ -1,4 +1,5 @@ $divBg: green !default; $spanOpacity: 0.5 !default; $avatar: "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Cow_female_black_white.jpg/220px-Cow_female_black_white.jpg" !default; -$avatarRadius: 8px !default; \ No newline at end of file +$avatarRadius: 8px !default; +$radioTest: red !default; \ No newline at end of file