Skip to content

Commit 9206718

Browse files
committed
feat: Improve editor for disabled_fields configuration
1 parent a989d02 commit 9206718

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

app/views/manage/configs/edit.html.haml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
text_field_vars = %w()
33
markdown_field_vars = %w(bus_captain_notes thanks_for_rsvp_message thanks_for_applying_message disclaimer_message)
44
css_field_vars = %w(custom_css)
5+
form_field_vars = %w(disabled_fields)
56

67
= render "layouts/manage/page_title", title: "Edit Configuration", subtitle: @config.var do
78
= link_to 'Cancel', manage_configs_path, class: 'btn btn-sm btn-outline-secondary'
@@ -20,6 +21,8 @@
2021
= f.input @config.var.to_sym, as: :text, input_html: { value: @config.value, 'data-simple-mde' => '1' }
2122
- elsif text_field_vars.include? @config.var
2223
= f.input @config.var.to_sym, as: :text, input_html: { value: @config.value }
24+
- elsif form_field_vars.include? @config.var
25+
= f.input @config.var.to_sym, as: :check_boxes, :collection => ['why_attend']
2326
- else
2427
= f.input @config.var.to_sym, input_html: { value: @config.value }
2528

app/views/manage/configs/index.html.haml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,15 @@
2020
= link_to enter_theming_editor_manage_configs_path do
2121
%span.fa.fa-paint-brush.icon-space-r-half
2222
Interactive editor
23-
- if value == ''
23+
- if key == 'disabled_fields'
24+
- cleaned_value = value
25+
- cleaned_value = cleaned_value.join(' ') if cleaned_value.is_a?(Array)
26+
- if cleaned_value.blank?
27+
%p.mb-0
28+
%span.badge.badge-secondary Not set
29+
- else
30+
%pre.mb-0= cleaned_value
31+
- elsif value == ''
2432
%p.mb-0
2533
%span.badge.badge-secondary Not set
2634
- else

config/locales/en.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ en:
7070
email_from: '"From" email address for all emails sent through the website (e.g. BrickHack <[email protected]>)'
7171
default_page_title: Default <title> for all pages (e.g. HackFoo - Jan 1-2, 2017)
7272

73-
disabled_fields: Optional comma-separated list of fields (e.g. why_attend)
73+
disabled_fields: Optional list of fields to turn off (e.g. why_attend)
7474
disclaimer_message: Optional message that appears before signing up & applying. Supports markdown.
7575
thanks_for_applying_message: Optional message that appears after completing an application. Supports markdown.
7676
thanks_for_rsvp_message: Optional message that appears after RSVP'ing as attending. Supports markdown.

0 commit comments

Comments
 (0)