diff --git a/app/assets/javascripts/admin/components/site-settings/group-list.js.es6 b/app/assets/javascripts/admin/components/site-settings/group-list.js.es6
new file mode 100644
index 00000000000..c67f41f8d0c
--- /dev/null
+++ b/app/assets/javascripts/admin/components/site-settings/group-list.js.es6
@@ -0,0 +1,8 @@
+import computed from "ember-addons/ember-computed-decorators";
+
+export default Ember.Component.extend({
+ @computed()
+ groupChoices() {
+ return this.site.get('groups').map(g => g.name);
+ }
+});
diff --git a/app/assets/javascripts/admin/mixins/setting-component.js.es6 b/app/assets/javascripts/admin/mixins/setting-component.js.es6
index 444fe6aa76b..c3f4f19e3d3 100644
--- a/app/assets/javascripts/admin/mixins/setting-component.js.es6
+++ b/app/assets/javascripts/admin/mixins/setting-component.js.es6
@@ -13,7 +13,8 @@ const CUSTOM_TYPES = [
"uploaded_image_list",
"compact_list",
"secret_list",
- "upload"
+ "upload",
+ "group_list"
];
export default Ember.Mixin.create({
diff --git a/app/assets/javascripts/admin/templates/components/site-settings/group-list.hbs b/app/assets/javascripts/admin/templates/components/site-settings/group-list.hbs
new file mode 100644
index 00000000000..adb6ec50982
--- /dev/null
+++ b/app/assets/javascripts/admin/templates/components/site-settings/group-list.hbs
@@ -0,0 +1,3 @@
+{{list-setting settingValue=value choices=groupChoices settingName=setting.setting}}
+{{setting-validation-message message=validationMessage}}
+
{{{unbound setting.description}}}
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 6d217d85c46..336179ecb24 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -4106,6 +4106,7 @@ en:
clear_filter: "Clear"
add_url: "add URL"
add_host: "add host"
+ add_group: "add group"
uploaded_image_list:
label: "Edit list"
empty: "There are no pictures yet. Please upload one."
diff --git a/lib/site_settings/type_supervisor.rb b/lib/site_settings/type_supervisor.rb
index 2137561b88b..da210d82109 100644
--- a/lib/site_settings/type_supervisor.rb
+++ b/lib/site_settings/type_supervisor.rb
@@ -33,6 +33,7 @@ class SiteSettings::TypeSupervisor
uploaded_image_list: 17,
upload: 18,
group: 19,
+ group_list: 20,
)
end
diff --git a/spec/components/site_settings/type_supervisor_spec.rb b/spec/components/site_settings/type_supervisor_spec.rb
index f795d824434..2fae2ff5818 100644
--- a/spec/components/site_settings/type_supervisor_spec.rb
+++ b/spec/components/site_settings/type_supervisor_spec.rb
@@ -72,10 +72,15 @@ describe SiteSettings::TypeSupervisor do
it "'uploaded_image_list' should be at 17th position" do
expect(SiteSettings::TypeSupervisor.types[:uploaded_image_list]).to eq(17)
end
-
it "'upload' should be at the right position" do
expect(SiteSettings::TypeSupervisor.types[:upload]).to eq(18)
end
+ it "'group' should be at the right position" do
+ expect(SiteSettings::TypeSupervisor.types[:group]).to eq(19)
+ end
+ it "'group_list' should be at the right position" do
+ expect(SiteSettings::TypeSupervisor.types[:group_list]).to eq(20)
+ end
end
end
diff --git a/test/javascripts/admin/components/group-list-setting-test.js.es6 b/test/javascripts/admin/components/group-list-setting-test.js.es6
new file mode 100644
index 00000000000..d64bd9d7d11
--- /dev/null
+++ b/test/javascripts/admin/components/group-list-setting-test.js.es6
@@ -0,0 +1,57 @@
+import componentTest from "helpers/component-test";
+
+moduleForComponent("group-list", { integration: true });
+
+componentTest("default", {
+ template: "{{site-setting setting=setting}}",
+
+ beforeEach() {
+ this.site.groups = [
+ {
+ id: 1,
+ name: "Donuts"
+ },
+ {
+ id: 2,
+ name: "Cheese cake"
+ }
+ ];
+
+ this.set(
+ "setting",
+ Ember.Object.create({
+ allowsNone: undefined,
+ category: "foo",
+ default: "",
+ description: "Choose groups",
+ overridden: false,
+ placeholder: null,
+ preview: null,
+ secret: false,
+ setting: "foo_bar",
+ type: "group_list",
+ validValues: undefined,
+ value: "Donuts"
+ })
+ );
+ },
+
+ async test(assert) {
+ const subject = selectKit(".list-setting");
+
+ assert.equal(
+ subject.header().value(),
+ "Donuts",
+ "it selects the setting's value"
+ );
+
+ await subject.expand();
+ await subject.selectRowByValue("Cheese cake");
+
+ assert.equal(
+ subject.header().value(),
+ "Donuts,Cheese cake",
+ "it allows to select a setting from the list of choices"
+ );
+ }
+});