Skip to content

Commit 4b273b4

Browse files
committed
Show preview of colours in theme selection
1 parent 505a51c commit 4b273b4

3 files changed

Lines changed: 37 additions & 1 deletion

File tree

app/assets/stylesheets/application.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,24 @@ td.day .calendar-text {
10491049
}
10501050
}
10511051

1052+
.theme-selector {
1053+
display: flex;
1054+
gap: 10px
1055+
}
1056+
1057+
.theme-select-option {
1058+
flex-grow: 1;
1059+
label {
1060+
border: 5px solid;
1061+
padding: 10px 20px;
1062+
border-radius: 5px;
1063+
display: block;
1064+
1065+
hr {
1066+
border-width: 10px;
1067+
}
1068+
}
1069+
}
10521070
.btn-oidc-only {
10531071
font-size: 36px;
10541072
padding: 4px;

app/views/spaces/_form.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<%= f.input :description, as: :markdown_area, input_html: { rows: '10' } %>
99

10-
<%= f.input :theme, collection: TeSS::Config.themes.keys, selected: @space.theme || 'default' %>
10+
<%= render partial: 'theme_selector', locals: { form: f } %>
1111

1212
<div class="form-group">
1313
<%= render partial: 'common/image_form', locals: { form: f } %>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<div class="form-group">
2+
<label>Theme</label>
3+
<div class="theme-selector">
4+
<% TeSS::Config.themes.each do |theme, colours| %>
5+
<% id = "space_theme_#{theme}" %>
6+
<% primary = colours['primary'] %>
7+
<% secondary = colours['secondary'] %>
8+
<div class="theme-select-option">
9+
<%= label_tag(id, class: 'radio_buttons optional', style: "border-color: #{primary};") do %>
10+
<%= form.radio_button(:theme, theme, id: id) %>
11+
<%= theme.titleize %>
12+
<hr style="border-color: <%= primary %>">
13+
<hr style="border-color: <%= secondary %>">
14+
<% end %>
15+
</div>
16+
<% end %>
17+
</div>
18+
</div>

0 commit comments

Comments
 (0)