Skip to content

Commit 6fd918c

Browse files
committed
Updated documentation on customization
1 parent d85be42 commit 6fd918c

3 files changed

Lines changed: 19 additions & 11 deletions

File tree

app/helpers/application_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,6 @@ def unverified_notice(resource)
694694
end
695695

696696
def theme_path
697-
"themes/#{params[:theme_preview] || current_space&.theme || 'default'}"
697+
"themes/#{params[:theme_preview] || current_space&.theme || TeSS::Config.site['default_theme'] || 'default'}"
698698
end
699699
end

config/tess.example.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ default: &default
9494
logo_alt: 'Training eSupport System'
9595
logo_open_graph: ''
9696
logo_email: ''
97+
default_theme: default
9798
# Colours of the SVG icons used throughout TeSS, requires `rake assets:precompile` if changed
9899
icon_primary_color: '#047EAA' # Blue by default
99100
icon_secondary_color: '#F47D21' # Orange by default

docs/customization.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,30 @@ Secure settings such as database credentials, API keys, email settings etc. can
1818
TeSS' UI is built on [Bootstrap 3](https://getbootstrap.com/docs/3.4/). To customize the appearance of TeSS, go into
1919
the themes folder (`app/assets/stylesheets/themes`) and make a copy of the default theme file (`default.scss`).
2020
In your copy, you can tweak any of the existing variables, add overrides for any Bootstrap variables
21-
([reference](https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/bootstrap/_variables.scss)) and add
22-
new CSS/Sass styles.
21+
([reference](https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/bootstrap/_variables.scss)) and add new CSS/Sass styles (look at the other themes in that directory, and the `mixins/_modern_base.scss` mixin for reference).
2322

24-
To enable your theme, edit `app/assets/stylesheets/mixins/variables.scss` and change the line:
25-
```scss
26-
@import "../themes/default";
27-
```
28-
to point to your new theme file...
29-
```scss
30-
@import "../themes/new_theme";
23+
To use your theme as the site default, edit your `config/tess.yml` config file and change
24+
(or add if not present) the `default_theme` variable under the `site` section to reference your new theme file (sans the `.scss` extension):
25+
26+
```yml
27+
default: &default
28+
# ...
29+
site:
30+
# ...
31+
default_theme: my_theme
3132
```
3233
34+
Additionally, you will need to create a symlink for the theme's images:
35+
36+
ln -s app/assets/images/modern app/assets/images/themes/my_theme
37+
3338
Be sure to recompile assets (`bundle exec rake assets:recompile`), or rebuild your docker image,
3439
and restart the application to apply the new styles.
3540

3641
You can visit <http://localhost:3000/theme_showcase> on your local instance to see various Bootstrap elements with the
37-
current theme applied.
42+
current theme applied.
43+
44+
You can also add a query parameter `theme_preview` to the URL of any page to preview different themes, e.g. <http://localhost:3000/theme_showcase?theme_preview=blue>
3845

3946
## Text changes
4047

0 commit comments

Comments
 (0)