Description:
moved data migration for config to seeds.rb, shows option description in system config page
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r269:fe3bd12dc5d0 - - 9 files changed: 127 inserted, 131 deleted

@@ -0,0 +1,124
1 +
2 + def create_configuration_key(key,
3 + value_type,
4 + default_value,
5 + description='')
6 + conf = (Configuration.find_by_key(key) ||
7 + Configuration.new(:key => key,
8 + :value_type => value_type,
9 + :value => default_value))
10 + conf.description = description
11 + conf.save
12 + end
13 +
14 + CONFIGURATIONS =
15 + [
16 + {
17 + :key => 'system.single_user_mode',
18 + :value_type => 'boolean',
19 + :value => 'false',
20 + :description => 'Only admins can log in to the system when running under single user mode.'
21 + },
22 +
23 + {
24 + :key => 'ui.front.title',
25 + :value_type => 'string',
26 + :value => 'Grader'
27 + },
28 +
29 + {
30 + :key => 'ui.front.welcome_message',
31 + :value_type => 'string',
32 + :value => 'Welcome!'
33 + },
34 +
35 + {
36 + :key => 'ui.show_score',
37 + :value_type => 'boolean',
38 + :value => 'true'
39 + },
40 +
41 + {
42 + :key => 'contest.time_limit',
43 + :value_type => 'string',
44 + :value => 'unlimited',
45 + :description => 'Time limit in format hh:mm, or "unlimited" for contests with no time limits.'
46 + },
47 +
48 + {
49 + :key => 'system.mode',
50 + :value_type => 'string',
51 + :value => 'standard',
52 + :description => 'Current modes are "standard", "contest", "indv-contest", and "analysis".'
53 + },
54 +
55 + {
56 + :key => 'contest.name',
57 + :value_type => 'string',
58 + :value => 'Grader',
59 + :description => 'This name will be shown on the user header bar.'
60 + },
61 +
62 + {
63 + :key => 'contest.multisites',
64 + :value_type => 'boolean',
65 + :value => 'false',
66 + :description => 'If the server is in contest mode and this option is true, on the log in of the admin a menu for site selections is shown.'
67 + },
68 +
69 + {
70 + :key => 'system.online_registration',
71 + :value_type => 'boolean',
72 + :value => 'false',
73 + :description => 'This option enables online registration.'
74 + },
75 +
76 + # If Configuration['system.online_registration'] is true, the
77 + # system allows online registration, and will use these
78 + # information for sending confirmation emails.
79 + {
80 + :key => 'system.online_registration.smtp',
81 + :value_type => 'string',
82 + :value => 'smtp.somehost.com'
83 + },
84 +
85 + {
86 + :key => 'system.online_registration.from',
87 + :value_type => 'string',
88 + :value => 'your.email@address'
89 + },
90 +
91 + {
92 + :key => 'system.admin_email',
93 + :value_type => 'string',
94 + :value => 'admin@admin.email'
95 + },
96 +
97 + {
98 + :key => 'system.user_setting_enabled',
99 + :value_type => 'boolean',
100 + :value => 'true',
101 + :description => 'If this option is true, users can change their settings'
102 + },
103 +
104 + # If Configuration['contest.test_request.early_timeout'] is true
105 + # the user will not be able to use test request at 30 minutes
106 + # before the contest ends.
107 + {
108 + :key => 'contest.test_request.early_timeout',
109 + :value_type => 'boolean',
110 + :value => 'false'
111 + }
112 + ]
113 +
114 + CONFIGURATIONS.each do |conf|
115 + if conf.has_key? :description
116 + desc = conf[:description]
117 + else
118 + desc = ''
119 + end
120 + create_configuration_key(conf[:key],
121 + conf[:value_type],
122 + conf[:default_value],
123 + desc)
124 + end
@@ -8,16 +8,17
8 %th Key
8 %th Key
9 %th Type
9 %th Type
10 %th Value
10 %th Value
11 -
11 + %th Description
12 - @configurations.each do |conf|
12 - @configurations.each do |conf|
13 - @configuration = conf
13 - @configuration = conf
14 - %tr
14 + %tr{:class => cycle("info-odd", "info-even")}
15 %td
15 %td
16 = in_place_editor_field :configuration, :key, {}, :rows=>1
16 = in_place_editor_field :configuration, :key, {}, :rows=>1
17 %td
17 %td
18 = in_place_editor_field :configuration, :value_type, {}, :rows=>1
18 = in_place_editor_field :configuration, :value_type, {}, :rows=>1
19 %td
19 %td
20 = in_place_editor_field :configuration, :value, {}, :rows=>1
20 = in_place_editor_field :configuration, :value, {}, :rows=>1
21 + %td= conf.description
21
22
22 - if Configuration.cache?
23 - if Configuration.cache?
23 %br/
24 %br/
@@ -6,29 +6,6
6 t.column :value, :string
6 t.column :value, :string
7 t.timestamps
7 t.timestamps
8 end
8 end
9 -
10 - Configuration.reset_column_information
11 -
12 - Configuration.create(:key => 'system.single_user_mode',
13 - :value_type => 'boolean',
14 - :value => 'false')
15 -
16 - Configuration.create(:key => 'ui.front.title',
17 - :value_type => 'string',
18 - :value => 'Grader')
19 -
20 - Configuration.create(:key => 'ui.front.welcome_message',
21 - :value_type => 'string',
22 - :value => 'Welcome!')
23 -
24 - Configuration.create(:key => 'ui.show_score',
25 - :value_type => 'boolean',
26 - :value => 'true')
27 -
28 - Configuration.create(:key => 'contest.time_limit',
29 - :value_type => 'string',
30 - :value => 'unlimited')
31 -
32 end
9 end
33
10
34 def self.down
11 def self.down
deleted file
deleted file
deleted file
deleted file
deleted file
deleted file
You need to be logged in to leave comments. Login now